Skip to content

Commit

Permalink
add continue prompt in inject_ucode.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
glankk committed Oct 31, 2018
1 parent 42b3b2c commit c906c29
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions patch/lua/inject_ucode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,23 @@ local data_loc =
}

local arg = {...}
local opt_y = false
if arg[1] == "-y" then
opt_y = true
table.remove(arg, 1)
end

function quit(code)
if not opt_y then
print("press enter to continue")
io.read()
end
os.exit(code)
end

if #arg < 2 then
print("usage: `inject_ucode <dst-file> <src-file>`")
return
quit(1)
end
local dst = gru.n64rom_load(arg[1])
local src = gru.n64rom_load(arg[2])
Expand All @@ -52,7 +66,7 @@ if text_insert then
print(string.format("found text insertion point at 0x%08X in `%s`", text_insert, arg[1]))
else
print("unable find text insertion point")
return 1
quit(1)
end

-- find data insertion point
Expand All @@ -63,7 +77,7 @@ if data_insert then
print(string.format("found data insertion point at 0x%08X in `%s`", data_insert, arg[1]))
else
print("unable find data insertion point")
return 1
quit(1)
end

-- include destination locations as search locations in source
Expand Down Expand Up @@ -92,7 +106,7 @@ for i = 1,#text_loc do
end
if not text then
print("unable find text chunk")
return 1
quit(1)
end

-- find data
Expand All @@ -112,7 +126,7 @@ for i = 1,#data_loc do
end
if not data then
print("unable find data chunk")
return 1
quit(1)
end

-- insert microcode
Expand All @@ -125,3 +139,4 @@ print("saving rom to `" .. arg[1] .. "`")
dst:save(arg[1])

print("done")
quit(0)

0 comments on commit c906c29

Please sign in to comment.