32 lines
1.5 KiB
Lua
32 lines
1.5 KiB
Lua
-- Named CLR API reflection only; no raw process memory access.
|
|||
|
|
do
|
||
|
|
local s=_G.__gacPeakMarshaledOffsets1 or {index=0};_G.__gacPeakMarshaledOffsets1=s
|
||
|
|
if not s.done then
|
||
|
|
local function log(v)CS.UnityEngine.Debug.Log('[GAC_PEAK_MARSHAL_OFFSET] '..tostring(v))end
|
||
|
|
local ok,err=pcall(function()
|
||
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
||
|
|
local zero=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),0)
|
||
|
|
if not s.ms then
|
||
|
|
local ty=typeof(CS.System.Object).Assembly:GetType('System.Runtime.InteropServices.Marshal')
|
||
|
|
s.ms=ty:GetMethods(flags)
|
||
|
|
end
|
||
|
|
for i=s.index,math.min(s.index+15,s.ms.Length-1)do
|
||
|
|
local m=s.ms[i]
|
||
|
|
if m.Name=='OffsetOf' and not m.IsGenericMethod then
|
||
|
|
local ps=m:GetParameters()
|
||
|
|
if ps.Length==2 and tostring(ps[0].ParameterType.FullName)=='System.Type' then
|
||
|
|
for _,name in ipairs({'totalBattleRounds','challengeTurnCount','challengeTurnLeft','totalBattleTurns'})do
|
||
|
|
local args=CS.System.Array.CreateInstance(typeof(CS.System.Object),2)
|
||
|
|
args[0]=typeof(CS.RPG.GameCore.PVEGameStatistics);args[1]=name
|
||
|
|
local good,v=pcall(function()return m:Invoke(nil,zero,nil,args,nil):ToInt64()end)
|
||
|
|
log(name..' '..tostring(good)..' '..tostring(v))
|
||
|
|
end
|
||
|
|
s.done=true;return
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
s.index=s.index+16;if s.index>=s.ms.Length then s.done=true;log('NO_API')end
|
||
|
|
end)
|
||
|
|
if not ok then s.done=true;log('ERROR '..tostring(err))end
|
||
|
|
end
|
||
|
|
end
|