Files
GaCy-GO/tools/cw_book_entry_capture.lua
T
2026-10-28 18:54:43 +07:00

40 lines
2.0 KiB
Lua

-- Read only already loaded, exact Handbook/CW Go callbacks. One function per
-- heartbeat, bounded 32 KiB bytecode; never calls a callback or sends a packet.
do local function capture()
local s=_G.__gacCwBookEntryCapture2 or {index=1};_G.__gacCwBookEntryCapture2=s
local targets={
{'Ui.DailyMission.Rogue.GridFight.HandbookRogueGridFightTabItem','_on_click_go'},
{'Ui.DailyMission.Rogue.HandbookRogueGotoBtnBehaviour','on_btn_go'},
{'Logic.Goto.GotoCommand.GotoGridFightEntrancePageCommand','execute'},
{'Ui.DailyMission.Rogue.GridFight.HandbookRogueGridFightTabItem','_setup_view'},
}
if s.index>#targets then return end
local target=targets[s.index];s.index=s.index+1
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_BOOK_ENTRY] '..tostring(v))end
local phase='module'
local ok,err=pcall(function()
local class=package.loaded[target[1]]
if type(class)~='table'then log('MISSING_MODULE '..target[1]);return end
phase='function';local fn=class[target[2]]
if type(fn)~='function'then
log('MISSING_FUNCTION '..target[1]..'.'..target[2])
local count=0;for k,v in pairs(class)do if type(v)=='function'then log('METHOD '..tostring(k));count=count+1;if count>=32 then break end end end
return
end
phase='upvalues'
if type(debug.getupvalue)=='function'then
for i=1,16 do local name,value=debug.getupvalue(fn,i);if not name then break end
log('UPVALUE '..target[2]..' '..name..' '..type(value)..' '..tostring(value))
end
end
phase='dump';log('DUMP_CAPABILITY '..type(string.dump)..' '..type(debug.getupvalue))
if type(string.dump)~='function'then return end
local raw=string.dump(fn)
if #raw>32768 then error('Named callback exceeds bytecode bound')end
local bytes=CS.System.Array.CreateInstance(typeof(CS.System.Byte),#raw)
for i=1,#raw do bytes[i-1]=raw:byte(i)end
log('BYTECODE '..target[1]..'.'..target[2]..' '..CS.System.Convert.ToBase64String(bytes))
end)
if not ok then log('ERROR '..phase..' '..tostring(err))end
end;capture()end