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

30 lines
1.4 KiB
Lua

-- Read only metadata for the exact failing phase and its GlobalVars services.
-- Bounded per heartbeat; no native calls, initialization or phase flag changes.
do
local function capture()
local s=_G.__gacAdventureGlobals1 or {index=0,stage='phase'}
_G.__gacAdventureGlobals1=s
if s.done then return end
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
local log=function(v)CS.UnityEngine.Debug.Log('[GAC_ADVENTURE_GLOBALS] '..tostring(v))end
if not s.fields then
s.t=s.stage=='phase' and typeof(CS.RPG.Client.AdventurePhase) or typeof(CS.RPG.Client.GlobalVars)
s.fields=s.t:GetFields(flags)
end
for n=1,12 do
if s.index>=s.fields.Length then
if s.stage=='phase' then s.stage='globals';s.index=0;s.fields=nil;return end
s.done=true;log('END');return
end
local f=s.fields[s.index];s.index=s.index+1
if (s.stage=='globals' and f.IsStatic) or
(s.stage=='phase' and (f.Name=='<ADPInitParams>k__BackingField' or f.Name=='<InputController>k__BackingField' or f.Name=='_ReactionSys')) then
local value=f.IsStatic and f:GetValue(nil) or nil
log(s.stage..' FIELD '..f.Name..' TYPE '..f.FieldType.FullName..' HANDLE '..tostring(f.FieldHandle.Value)..' NULL '..tostring(value==nil))
end
end
end
local ok,e=pcall(capture)
if not ok then _G.__gacAdventureGlobals1={done=true};CS.UnityEngine.Debug.Log('[GAC_ADVENTURE_GLOBALS] ERROR '..tostring(e))end
end