Advertisement
tcyknhrabirwjyljhp

Untitled

Mar 29th, 2022
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.50 KB | None | 0 0
  1. aobscanmodule(aobGetScripts,$process,48 89 54 24 10 55 53 56 57 41 54 41 55 41 56 41 57 48 81)
  2. alloc(newmem,$1000,aobGetScripts)
  3.  
  4. label(code)
  5. label(return)
  6. label(pViewport)
  7. registersymbol(pViewport)
  8. label(bThread)
  9. registersymbol(bThread)
  10.  
  11. newmem:
  12.  
  13. code:
  14. push rax
  15. cmp qword ptr[pViewport],0
  16. jne short @f
  17. mov rax,[r8+8] // get the owner node from any random script
  18. mov rax,[rax+138] // get the viewport
  19. mov [pViewport],rax
  20. @@:
  21. pop rax
  22. mov [rsp+10],rdx
  23. jmp return
  24. pViewport:
  25. dq 0
  26.  
  27. // to call with lua:
  28. alloc(GetClassName,$1000,$process)
  29. registersymbol(GetClassName)
  30.  
  31. GetClassName:
  32. push rbx
  33. sub rsp,40
  34. mov rax,[rcx]
  35. call qword ptr[rax+30] // object::_get_class_namev
  36. add rsp,40
  37. pop rbx
  38. ret
  39.  
  40.  
  41. CONST_VIEWPORT = 0x108
  42. CONST_NAMESTRING = 0x120
  43. CONST_SCRIPTINSTANCE = 0x58
  44. CONST_SCRIPT = 0x250
  45.  
  46. function FindNode(vp,str)
  47. local Childs = readPointer(vp+CONST_VIEWPORT)
  48. if Childs == 0 then return 0 end
  49. local Size = readInteger(Childs-4)
  50.  
  51. for i=0,(Size-1) do
  52. local Node = readPointer(Childs+i*8)
  53. local NameString = readPointer(Node+CONST_NAMESTRING)
  54. NameString = readPointer(NameString+0x10)
  55. local szName = readString(NameString,99,true)
  56. if szName == str then return Node end
  57. local ret = FindNode(Node,str)
  58. if ret > 0 then return ret end
  59. end
  60.  
  61. return 0
  62. end
  63.  
  64. function FindNodeWithScriptInstance(vp,str)
  65. local Childs = readPointer(vp+CONST_VIEWPORT)
  66. if Childs == 0 then return 0 end
  67. local Size = readInteger(Childs-4)
  68. if Size == 0 or Size == nil then return 0 end
  69.  
  70. for i=0,(Size-1) do
  71. local Node = readPointer(Childs+i*8)
  72. if Node == 0 then return 0 end
  73. local NameString = readPointer(Node+CONST_NAMESTRING)
  74. if NameString == 0 or NameString == nil then return 0 end
  75. NameString = readPointer(NameString+0x10)
  76. local szName = readString(NameString,99,true)
  77. if szName == str and readQword(Node+CONST_SCRIPTINSTANCE) > 0 then return Node end
  78. local ret = FindNodeWithScriptInstance(Node,str)
  79. if ret > 0 and readQword(ret+CONST_SCRIPTINSTANCE) > 0 then return ret end
  80. end
  81.  
  82. return 0
  83. end
  84.  
  85. function DebugDumpNodes(vp,bscript)
  86. local Childs = readPointer(vp+CONST_VIEWPORT)
  87. if Childs == 0 then return 0 end
  88. local Size = readInteger(Childs-4)
  89.  
  90. for i=0,(Size-1) do
  91. local Node = readPointer(Childs+i*8)
  92. local NameString = readPointer(Node+CONST_NAMESTRING)
  93. NameString = readPointer(NameString+0x10)
  94. local szName = readString(NameString,99,true)
  95. if not bscript then
  96. print(string.format("%s : %X",szName,Node))
  97. else
  98. if (readQword(Node+CONST_SCRIPTINSTANCE) > 0 ) then print(string.format("%s : %X",szName,Node)) end
  99. end
  100. DebugDumpNodes(Node,bscript)
  101. end
  102.  
  103. return 0
  104. end
  105.  
  106. /*
  107. Script Variables Types:
  108.  
  109. 0 = null
  110. 1 = bool
  111. 2 = int
  112. 3 = float
  113. 4 = string
  114. 5 = vec2
  115. 6 = vec2i
  116. 18 = node path(pointer)
  117.  
  118. todo : add more support
  119. e.g 3D types and arrays ...
  120. */
  121.  
  122. // add transform const for sprite and kinematics
  123.  
  124. {$lua}
  125. if syntaxcheck then return end
  126.  
  127. function ReadName(member,index)
  128. if index == readInteger(member+0x38) then
  129. local NameString = readPointer(member+0x30)
  130. NameString = readPointer(NameString+0x10)
  131. local str = readString(NameString,99,true)
  132. return str
  133. end
  134. local NextMap = readPointer(member+0x20)
  135. if NextMap == 0 then return "null" end
  136. local retstr = ReadName(NextMap,index)
  137. return retstr
  138. end
  139.  
  140. function GetCEType(gType)
  141. if (gType == 1) then return 0 end --bool
  142. if (gType == 3) then return 5 end --a float is a double in godot
  143. if (gType == 5) then return 4 end --vector2 is a x,y float in godot
  144. if (gType == 4) then return 7 end --(unicode)string
  145. if (gType == 18) then return 3 end --node pointer
  146. return 2 --integer
  147. end
  148.  
  149. [ENABLE]
  150. addList = getAddressList()
  151. local StringSearch = "Player"
  152. local vp = getAddress("pViewport")
  153. vp = readPointer(vp)
  154.  
  155. if vp == 0 then print("no viewport") error("") end
  156.  
  157. local Node = FindNodeWithScriptInstance(vp,StringSearch)
  158. if Node == 0 then print("node not found") error("") end
  159. local ScriptInstance = readPointer(Node+CONST_SCRIPTINSTANCE)
  160.  
  161. local Variants = readPointer(ScriptInstance+0x20)
  162.  
  163. local Vars = readInteger(Variants-0x4)
  164.  
  165. local Script = readPointer(ScriptInstance+0x10)
  166. local ScriptNamePtr = readPointer(Script+CONST_SCRIPT)
  167. local szScriptName = readString(ScriptNamePtr+0xC,99,true)
  168.  
  169. --if szScriptName == nil then szScriptName = "nil" end
  170.  
  171. --Node = owner of the scriptinstance
  172. --OOP : Object -> Node -> (Canvas/Node2D/Node3D) -> xxx(e.g Label1)
  173.  
  174. local Node = readPointer(ScriptInstance+0x8)
  175. local NodeName = readPointer(Node+CONST_NAMESTRING) -- NameString
  176. local NodeNamePtr = readPointer(NodeName +0x10)
  177. local szNodeName = readString(NodeNamePtr,99,true)
  178.  
  179. --a Node is like a GameObject(Unity) or Actor(Unreal)
  180. --the node name is the name that is used from the dev to name the object
  181. --in the editor
  182.  
  183. if string.match(szNodeName,StringSearch) then
  184.  
  185. --local Infos = string.format("%s(%s)",szNodeName,szScriptName)
  186.  
  187. local GenRec = addList.createMemoryRecord()
  188. GenRec.setDescription("Generated:")
  189. GenRec.setAddress(0)
  190. GenRec.setType(8)
  191. GenRec.DontSave=true
  192.  
  193. local OwnerRec = addList.createMemoryRecord()
  194. OwnerRec.setDescription(szNodeName)
  195. OwnerRec.setAddress(0)
  196. OwnerRec.setType(8)
  197. OwnerRec.DontSave=true
  198. OwnerRec.appendToEntry(GenRec)
  199.  
  200. -- currently only transform support for sprites and KinematicBody2D
  201. -- todo:
  202. -- add transform support for StaticBody2D and KinematicBody2D
  203. -- +3D types
  204.  
  205. local Class = executeCodeEx(0, nil,getAddress("GetClassName"),Node)
  206. --local Class = 0
  207. if (Class > 0) then
  208. Class = readPointer(Class)
  209. Class = readPointer(Class+0x10)
  210. local ClassName = readString(Class,99,true)
  211. if (ClassName == "Sprite") then
  212. local newRec = addList.createMemoryRecord()
  213. newRec.setDescription("Transform Position X")
  214. newRec.setAddress(Node+0x288)
  215. newRec.setType(4)
  216. newRec.DontSave=true
  217. newRec.appendToEntry(OwnerRec)
  218.  
  219. local newRec = addList.createMemoryRecord()
  220. newRec.setDescription("Transform Position Y")
  221. newRec.setAddress(Node+0x288+0x4)
  222. newRec.setType(4)
  223. newRec.DontSave=true
  224. newRec.appendToEntry(OwnerRec)
  225.  
  226. local newRec = addList.createMemoryRecord()
  227. newRec.setDescription("Transform Rotation")
  228. newRec.setAddress(Node+0x288+0x8)
  229. newRec.setType(4)
  230. newRec.DontSave=true
  231. newRec.appendToEntry(OwnerRec)
  232.  
  233. local newRec = addList.createMemoryRecord()
  234. newRec.setDescription("Transform Scale X")
  235. newRec.setAddress(Node+0x288+0xC)
  236. newRec.setType(4)
  237. newRec.DontSave=true
  238. newRec.appendToEntry(OwnerRec)
  239.  
  240. local newRec = addList.createMemoryRecord()
  241. newRec.SetDescription("Transform Scale Y")
  242. newRec.setAddress(Node+0x288+0x10)
  243. newRec.setType(4)
  244. newRec.DontSave=true
  245. newRec.appendToEntry(OwnerRec)
  246. end
  247. if (ClassName == "KinematicBody2D") then
  248. local newRec = addList.createMemoryRecord()
  249. newRec.setDescription("Transform Position X")
  250. newRec.setAddress(Node+0x270)
  251. newRec.setType(4)
  252. newRec.DontSave=true
  253. newRec.appendToEntry(OwnerRec)
  254.  
  255. local newRec = addList.createMemoryRecord()
  256. newRec.setDescription("Transform Position Y")
  257. newRec.setAddress(Node+0x270+0x4)
  258. newRec.setType(4)
  259. newRec.DontSave=true
  260. newRec.appendToEntry(OwnerRec)
  261. end
  262. end
  263.  
  264. if (Vars > 1000) then Vars = 0 end --some animation stuff is HUGE skip that!
  265.  
  266. for n=0,(Vars-1) do
  267.  
  268. local membermap = readPointer(Script+0x1C0)
  269. local endmap = readPointer(Script+0x1C8)
  270. local VarName = "null"
  271.  
  272. membermap = readPointer(membermap+0x10)
  273. if (readPointer(membermap+0x10) == endmap) then
  274. VarName = ReadName(membermap,n)
  275. else
  276. while (VarName == "null") do
  277. membermap = readPointer(membermap+0x10)
  278. VarName = ReadName(membermap,n)
  279. end
  280. end
  281.  
  282. local Type = readInteger(Variants)
  283. local CEType = GetCEType(Type)
  284.  
  285. local Ptr = Variants+0x8
  286.  
  287. if (Type == 4 ) then -- if string
  288. Ptr=readPointer(Ptr) --read ptr to wchars
  289. end
  290.  
  291. if (Type == 5) then -- if vector2
  292. --X
  293. local VecInfo = string.format("[Vec2.x] %s (%s)",VarName,szScriptName)
  294. local newRec = addList.createMemoryRecord()
  295. newRec.setDescription(VecInfo)
  296. newRec.setAddress(Ptr)
  297. newRec.setType(CEType)
  298. newRec.DontSave=true
  299. newRec.appendToEntry(OwnerRec)
  300. --Y
  301. local VecInfo = string.format("[Vec2.y] %s (%s)",VarName,szScriptName)
  302. local newRec = addList.createMemoryRecord()
  303. newRec.setDescription(VecInfo)
  304. newRec.setAddress(Ptr+0x4)
  305. newRec.setType(CEType)
  306. newRec.DontSave=true
  307. newRec.appendToEntry(OwnerRec)
  308. else
  309. local newRec = addList.createMemoryRecord()
  310. local RecString = string.format("[%x] %s : %s",n,VarName,szScriptName)
  311. newRec.setDescription(RecString)
  312. newRec.setAddress(Ptr)
  313. newRec.setType(CEType)
  314. newRec.DontSave=true
  315. newRec.appendToEntry(OwnerRec)
  316. end
  317.  
  318. Variants=Variants+0x18
  319.  
  320. end
  321. end
  322.  
  323.  
  324.  
  325. [DISABLE]
  326. local Generated = addList.getMemoryRecordByDescription("Generated:")
  327.  
  328. if Generated ~= nil then
  329. while Generated.Count > 0 do
  330. Generated.Child[0]:Delete()
  331. end
  332. Generated:Delete()
  333. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement