39 lines
1.6 KiB
Lua
39 lines
1.6 KiB
Lua
-- Export bytecode of named, already-loaded Lua UI methods. No function calls.
|
|
do
|
|
local targets={
|
|
{'Ui.GridFight.Entrance.S2.GridFightS2EntrancePage','_on_load'},
|
|
{'Ui.GridFight.Entrance.S2.GridFightS2EntrancePage','_setup_view'},
|
|
{'Ui.GridFight.Entrance.S2.GridFightS2EntrancePage','_try_show_tutorial'},
|
|
{'Ui.GridFight.Entrance.S2.GridFightS2EntrancePage','_start_action'},
|
|
}
|
|
_G.__gacCwEntryLuaExport1=_G.__gacCwEntryLuaExport1 or {index=1}
|
|
local state=_G.__gacCwEntryLuaExport1
|
|
if state.index<=#targets then
|
|
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_ENTRY_LUA] '..tostring(v))end
|
|
local target=targets[state.index]
|
|
local ok,err=pcall(function()
|
|
if not state.bytes then
|
|
local class=package.loaded[target[1]]
|
|
local fn=class and class[target[2]]
|
|
if type(fn)~='function' then error('Named UI method is not loaded')end
|
|
local data=string.dump(fn)
|
|
if #data>131072 then error('Bytecode exceeds export bound')end
|
|
state.bytes=data;state.offset=1
|
|
log('BEGIN '..target[1]..'.'..target[2]..' bytes='..#data)
|
|
for i=1,16 do
|
|
local name,value=debug.getupvalue(fn,i)
|
|
if not name then break end
|
|
log('UPVALUE '..name..' '..type(value))
|
|
end
|
|
end
|
|
local piece=state.bytes:sub(state.offset,state.offset+1023)
|
|
local hex={}
|
|
for i=1,#piece do hex[i]=string.format('%02x',piece:byte(i))end
|
|
log('HEX '..table.concat(hex))
|
|
state.offset=state.offset+#piece
|
|
if state.offset>#state.bytes then log('END');state.bytes=nil;state.index=state.index+1 end
|
|
end)
|
|
if not ok then log('ERROR '..tostring(err));state.bytes=nil;state.index=state.index+1 end
|
|
end
|
|
end
|