Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- aobscanmodule(aobGetScripts,$process,48 89 54 24 10 55 53 56 57 41 54 41 55 41 56 41 57 48 81)
- alloc(newmem,$1000,aobGetScripts)
- label(code)
- label(return)
- label(pViewport)
- registersymbol(pViewport)
- label(bThread)
- registersymbol(bThread)
- newmem:
- code:
- push rax
- cmp qword ptr[pViewport],0
- jne short @f
- mov rax,[r8+8] // get the owner node from any random script
- mov rax,[rax+138] // get the viewport
- mov [pViewport],rax
- @@:
- pop rax
- mov [rsp+10],rdx
- jmp return
- pViewport:
- dq 0
- // to call with lua:
- alloc(GetClassName,$1000,$process)
- registersymbol(GetClassName)
- GetClassName:
- push rbx
- sub rsp,40
- mov rax,[rcx]
- call qword ptr[rax+30] // object::_get_class_namev
- add rsp,40
- pop rbx
- ret
- CONST_VIEWPORT = 0x108
- CONST_NAMESTRING = 0x120
- CONST_SCRIPTINSTANCE = 0x58
- CONST_SCRIPT = 0x250
- function FindNode(vp,str)
- local Childs = readPointer(vp+CONST_VIEWPORT)
- if Childs == 0 then return 0 end
- local Size = readInteger(Childs-4)
- for i=0,(Size-1) do
- local Node = readPointer(Childs+i*8)
- local NameString = readPointer(Node+CONST_NAMESTRING)
- NameString = readPointer(NameString+0x10)
- local szName = readString(NameString,99,true)
- if szName == str then return Node end
- local ret = FindNode(Node,str)
- if ret > 0 then return ret end
- end
- return 0
- end
- function FindNodeWithScriptInstance(vp,str)
- local Childs = readPointer(vp+CONST_VIEWPORT)
- if Childs == 0 then return 0 end
- local Size = readInteger(Childs-4)
- if Size == 0 or Size == nil then return 0 end
- for i=0,(Size-1) do
- local Node = readPointer(Childs+i*8)
- if Node == 0 then return 0 end
- local NameString = readPointer(Node+CONST_NAMESTRING)
- if NameString == 0 or NameString == nil then return 0 end
- NameString = readPointer(NameString+0x10)
- local szName = readString(NameString,99,true)
- if szName == str and readQword(Node+CONST_SCRIPTINSTANCE) > 0 then return Node end
- local ret = FindNodeWithScriptInstance(Node,str)
- if ret > 0 and readQword(ret+CONST_SCRIPTINSTANCE) > 0 then return ret end
- end
- return 0
- end
- function DebugDumpNodes(vp,bscript)
- local Childs = readPointer(vp+CONST_VIEWPORT)
- if Childs == 0 then return 0 end
- local Size = readInteger(Childs-4)
- for i=0,(Size-1) do
- local Node = readPointer(Childs+i*8)
- local NameString = readPointer(Node+CONST_NAMESTRING)
- NameString = readPointer(NameString+0x10)
- local szName = readString(NameString,99,true)
- if not bscript then
- print(string.format("%s : %X",szName,Node))
- else
- if (readQword(Node+CONST_SCRIPTINSTANCE) > 0 ) then print(string.format("%s : %X",szName,Node)) end
- end
- DebugDumpNodes(Node,bscript)
- end
- return 0
- end
- /*
- Script Variables Types:
- 0 = null
- 1 = bool
- 2 = int
- 3 = float
- 4 = string
- 5 = vec2
- 6 = vec2i
- 18 = node path(pointer)
- todo : add more support
- e.g 3D types and arrays ...
- */
- // add transform const for sprite and kinematics
- {$lua}
- if syntaxcheck then return end
- function ReadName(member,index)
- if index == readInteger(member+0x38) then
- local NameString = readPointer(member+0x30)
- NameString = readPointer(NameString+0x10)
- local str = readString(NameString,99,true)
- return str
- end
- local NextMap = readPointer(member+0x20)
- if NextMap == 0 then return "null" end
- local retstr = ReadName(NextMap,index)
- return retstr
- end
- function GetCEType(gType)
- if (gType == 1) then return 0 end --bool
- if (gType == 3) then return 5 end --a float is a double in godot
- if (gType == 5) then return 4 end --vector2 is a x,y float in godot
- if (gType == 4) then return 7 end --(unicode)string
- if (gType == 18) then return 3 end --node pointer
- return 2 --integer
- end
- [ENABLE]
- addList = getAddressList()
- local StringSearch = "Player"
- local vp = getAddress("pViewport")
- vp = readPointer(vp)
- if vp == 0 then print("no viewport") error("") end
- local Node = FindNodeWithScriptInstance(vp,StringSearch)
- if Node == 0 then print("node not found") error("") end
- local ScriptInstance = readPointer(Node+CONST_SCRIPTINSTANCE)
- local Variants = readPointer(ScriptInstance+0x20)
- local Vars = readInteger(Variants-0x4)
- local Script = readPointer(ScriptInstance+0x10)
- local ScriptNamePtr = readPointer(Script+CONST_SCRIPT)
- local szScriptName = readString(ScriptNamePtr+0xC,99,true)
- --if szScriptName == nil then szScriptName = "nil" end
- --Node = owner of the scriptinstance
- --OOP : Object -> Node -> (Canvas/Node2D/Node3D) -> xxx(e.g Label1)
- local Node = readPointer(ScriptInstance+0x8)
- local NodeName = readPointer(Node+CONST_NAMESTRING) -- NameString
- local NodeNamePtr = readPointer(NodeName +0x10)
- local szNodeName = readString(NodeNamePtr,99,true)
- --a Node is like a GameObject(Unity) or Actor(Unreal)
- --the node name is the name that is used from the dev to name the object
- --in the editor
- if string.match(szNodeName,StringSearch) then
- --local Infos = string.format("%s(%s)",szNodeName,szScriptName)
- local GenRec = addList.createMemoryRecord()
- GenRec.setDescription("Generated:")
- GenRec.setAddress(0)
- GenRec.setType(8)
- GenRec.DontSave=true
- local OwnerRec = addList.createMemoryRecord()
- OwnerRec.setDescription(szNodeName)
- OwnerRec.setAddress(0)
- OwnerRec.setType(8)
- OwnerRec.DontSave=true
- OwnerRec.appendToEntry(GenRec)
- -- currently only transform support for sprites and KinematicBody2D
- -- todo:
- -- add transform support for StaticBody2D and KinematicBody2D
- -- +3D types
- local Class = executeCodeEx(0, nil,getAddress("GetClassName"),Node)
- --local Class = 0
- if (Class > 0) then
- Class = readPointer(Class)
- Class = readPointer(Class+0x10)
- local ClassName = readString(Class,99,true)
- if (ClassName == "Sprite") then
- local newRec = addList.createMemoryRecord()
- newRec.setDescription("Transform Position X")
- newRec.setAddress(Node+0x288)
- newRec.setType(4)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- local newRec = addList.createMemoryRecord()
- newRec.setDescription("Transform Position Y")
- newRec.setAddress(Node+0x288+0x4)
- newRec.setType(4)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- local newRec = addList.createMemoryRecord()
- newRec.setDescription("Transform Rotation")
- newRec.setAddress(Node+0x288+0x8)
- newRec.setType(4)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- local newRec = addList.createMemoryRecord()
- newRec.setDescription("Transform Scale X")
- newRec.setAddress(Node+0x288+0xC)
- newRec.setType(4)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- local newRec = addList.createMemoryRecord()
- newRec.SetDescription("Transform Scale Y")
- newRec.setAddress(Node+0x288+0x10)
- newRec.setType(4)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- end
- if (ClassName == "KinematicBody2D") then
- local newRec = addList.createMemoryRecord()
- newRec.setDescription("Transform Position X")
- newRec.setAddress(Node+0x270)
- newRec.setType(4)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- local newRec = addList.createMemoryRecord()
- newRec.setDescription("Transform Position Y")
- newRec.setAddress(Node+0x270+0x4)
- newRec.setType(4)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- end
- end
- if (Vars > 1000) then Vars = 0 end --some animation stuff is HUGE skip that!
- for n=0,(Vars-1) do
- local membermap = readPointer(Script+0x1C0)
- local endmap = readPointer(Script+0x1C8)
- local VarName = "null"
- membermap = readPointer(membermap+0x10)
- if (readPointer(membermap+0x10) == endmap) then
- VarName = ReadName(membermap,n)
- else
- while (VarName == "null") do
- membermap = readPointer(membermap+0x10)
- VarName = ReadName(membermap,n)
- end
- end
- local Type = readInteger(Variants)
- local CEType = GetCEType(Type)
- local Ptr = Variants+0x8
- if (Type == 4 ) then -- if string
- Ptr=readPointer(Ptr) --read ptr to wchars
- end
- if (Type == 5) then -- if vector2
- --X
- local VecInfo = string.format("[Vec2.x] %s (%s)",VarName,szScriptName)
- local newRec = addList.createMemoryRecord()
- newRec.setDescription(VecInfo)
- newRec.setAddress(Ptr)
- newRec.setType(CEType)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- --Y
- local VecInfo = string.format("[Vec2.y] %s (%s)",VarName,szScriptName)
- local newRec = addList.createMemoryRecord()
- newRec.setDescription(VecInfo)
- newRec.setAddress(Ptr+0x4)
- newRec.setType(CEType)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- else
- local newRec = addList.createMemoryRecord()
- local RecString = string.format("[%x] %s : %s",n,VarName,szScriptName)
- newRec.setDescription(RecString)
- newRec.setAddress(Ptr)
- newRec.setType(CEType)
- newRec.DontSave=true
- newRec.appendToEntry(OwnerRec)
- end
- Variants=Variants+0x18
- end
- end
- [DISABLE]
- local Generated = addList.getMemoryRecordByDescription("Generated:")
- if Generated ~= nil then
- while Generated.Count > 0 do
- Generated.Child[0]:Delete()
- end
- Generated:Delete()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement