52 lines
2.3 KiB
Lua
52 lines
2.3 KiB
Lua
-- Encode isolated protobuf objects to map obfuscated backing fields to tags.
|
|
-- No objects are synced into a game module or sent as network responses.
|
|
do
|
|
local names={'GridFightStartGamePlayCsReq'}
|
|
_G.__gacCwStartWire1=_G.__gacCwStartWire1 or {index=1,field=0}
|
|
local state=_G.__gacCwStartWire1
|
|
if state.index<=#names then
|
|
local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_START_WIRE] '..tostring(v))end
|
|
local ok,err=pcall(function()
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
|
local t=typeof(CS[names[state.index]])
|
|
local fields=t:GetFields(flags)
|
|
local count=0
|
|
for i=state.field,fields.Length-1 do
|
|
state.field=i+1
|
|
local f=fields[i]
|
|
if not f.IsStatic and f.FieldType==typeof(CS.System.UInt32) then
|
|
local obj=CS.System.Activator.CreateInstance(t)
|
|
local typed=CS.System.Array.CreateInstance(typeof(CS.System.UInt32),1);typed[0]=1
|
|
local boxed=CS.System.Array.CreateInstance(typeof(CS.System.Object),2);boxed[0]=obj
|
|
CS.System.Array.Copy(typed,0,boxed,1,1)
|
|
local setters=f:GetType():GetMethods(flags)
|
|
local setter=nil
|
|
for j=0,setters.Length-1 do
|
|
if setters[j].Name=='SetValue' and setters[j]:GetParameters().Length==2 then setter=setters[j];break end
|
|
end
|
|
if not setter then error('FieldInfo.SetValue overload missing')end
|
|
local invoke=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),0)
|
|
setter:Invoke(f,invoke,nil,boxed,nil)
|
|
local bytes=CS.Google.Protobuf.MessageExtensions.ToByteArray(obj)
|
|
log('FIELD '..names[state.index]..' '..f.Name..' '..CS.System.BitConverter.ToString(bytes))
|
|
local properties=t:GetProperties(flags)
|
|
local empty=CS.System.Array.CreateInstance(typeof(CS.System.Object),0)
|
|
for j=0,properties.Length-1 do
|
|
local p=properties[j]
|
|
if p.PropertyType==typeof(CS.System.UInt32) then
|
|
local getter=p:GetGetMethod(true)
|
|
if getter and not getter.IsStatic and getter:Invoke(obj,invoke,nil,empty,nil)==1 then
|
|
log('GETTER '..names[state.index]..' '..f.Name..' '..p.Name..' '..getter.MetadataToken)
|
|
end
|
|
end
|
|
end
|
|
count=count+1;if count>=2 then return end
|
|
end
|
|
end
|
|
log('END '..names[state.index]);state.index=state.index+1;state.field=0
|
|
end)
|
|
if not ok then log('ERROR '..tostring(err));state.index=state.index+1;state.field=0 end
|
|
end
|
|
end
|
|
|