AbhiModszYT

Hool mod

Jan 9th, 2025
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.19 KB | Gaming | 0 0
  1. local LibNameUnityOnly ="libil2cpp.so"
  2. local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
  3. local loadingPlaceholder = {[{}] = true}
  4. local register
  5. local modules = {}
  6. local require
  7. local loaded = {}
  8. register = function(name, body)
  9. if not modules[name] then
  10. modules[name] = body
  11. end
  12. end
  13. require = function(name)
  14. local loadedModule = loaded[name]
  15. if loadedModule then
  16. if loadedModule == loadingPlaceholder then
  17. return nil
  18. end
  19. else
  20. if not modules[name] then
  21. if not superRequire then
  22. local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
  23. error('Tried to require ' .. identifier .. ', but no such module has been registered')
  24. else
  25. return superRequire(name)
  26. end
  27. end
  28. loaded[name] = loadingPlaceholder
  29. loadedModule = modules[name](require, loaded, register, modules)
  30. loaded[name] = loadedModule
  31. end
  32. return loadedModule
  33. end
  34. return require, loaded, register, modules
  35. end)(require)
  36. __bundle_register("GGIl2cpp", function(require, _LOADED, __bundle_register, __bundle_modules)
  37. require("utils.il2cppconst")
  38. require("il2cpp")
  39. return Il2cpp
  40. end)
  41. __bundle_register("il2cpp", function(require, _LOADED, __bundle_register, __bundle_modules)
  42. local Il2cppMemory = require("utils.il2cppmemory")
  43. local VersionEngine = require("utils.version")
  44. local AndroidInfo = require("utils.androidinfo")
  45. local Searcher = require("utils.universalsearcher")
  46. local PatchApi = require("utils.patchapi")
  47. local Il2cppBase = {
  48. il2cppStart = 0,
  49. il2cppEnd = 0,
  50. globalMetadataStart = 0,
  51. globalMetadataEnd = 0,
  52. globalMetadataHeader = 0,
  53. MainType = AndroidInfo.platform and gg.TYPE_QWORD or gg.TYPE_DWORD,
  54. pointSize = AndroidInfo.platform and 8 or 4,
  55. Il2CppTypeDefinitionApi = {},
  56. MetadataRegistrationApi = require("il2cppstruct.metadataRegistration"),
  57. TypeApi = require("il2cppstruct.type"),
  58. MethodsApi = require("il2cppstruct.method"),
  59. GlobalMetadataApi = require("il2cppstruct.globalmetadata"),
  60. FieldApi = require("il2cppstruct.field"),
  61. ClassApi = require("il2cppstruct.class"),
  62. ObjectApi = require("il2cppstruct.object"),
  63. ClassInfoApi = require("il2cppstruct.api.classinfo"),
  64. FieldInfoApi = require("il2cppstruct.api.fieldinfo"),
  65. String = require("il2cppstruct.il2cppstring"),
  66. MemoryManager = require("utils.malloc"),
  67. PatchesAddress = function(add, Bytescodes)
  68. local patchCode = {}
  69. for code in string.gmatch(Bytescodes, '.') do
  70. patchCode[#patchCode + 1] = {
  71. address = add + #patchCode,
  72. value = string.byte(code),
  73. flags = gg.TYPE_BYTE
  74. }
  75. end
  76. local patch = PatchApi:Create(patchCode)
  77. patch:Patch()
  78. return patch
  79. end,
  80. FindMethods = function(searchParams)
  81. Il2cppMemory:SaveResults()
  82. for i = 1, #searchParams do
  83. searchParams[i] = Il2cpp.MethodsApi:Find(searchParams[i])
  84. end
  85. Il2cppMemory:ClearSavedResults()
  86. return searchParams
  87. end,
  88. FindClass = function(searchParams)
  89. Il2cppMemory:SaveResults()
  90. for i = 1, #searchParams do
  91. searchParams[i] = Il2cpp.ClassApi:Find(searchParams[i])
  92. end
  93. Il2cppMemory:ClearSavedResults()
  94. return searchParams
  95. end,
  96. FindObject = function(searchParams)
  97. Il2cppMemory:SaveResults()
  98. for i = 1, #searchParams do
  99. searchParams[i] = Il2cpp.ObjectApi:Find(Il2cpp.ClassApi:Find({Class = searchParams[i]}))
  100. end
  101. Il2cppMemory:ClearSavedResults()
  102. return searchParams
  103. end,
  104. FindFields = function(searchParams)
  105. Il2cppMemory:SaveResults()
  106. for i = 1, #searchParams do
  107. local searchParam = searchParams[i]
  108. local searchResult = Il2cppMemory:GetInformationOfField(searchParam)
  109. if not searchResult then
  110. searchResult = Il2cpp.FieldApi:Find(searchParam)
  111. Il2cppMemory:SetInformationOfField(searchParam, searchResult)
  112. end
  113. searchParams[i] = searchResult
  114. end
  115. Il2cppMemory:ClearSavedResults()
  116. return searchParams
  117. end,
  118. Utf8ToString = function(Address, length)
  119. local chars, char = {}, {
  120. address = Address,
  121. flags = gg.TYPE_BYTE
  122. }
  123. if not length then
  124. repeat
  125. _char = string.char(gg.getValues({char})[1].value & 0xFF)
  126. chars[#chars + 1] = _char
  127. char.address = char.address + 0x1
  128. until string.find(_char, "[%z%s]")
  129. return table.concat(chars, "", 1, #chars - 1)
  130. else
  131. for i = 1, length do
  132. local _char = gg.getValues({char})[1].value
  133. chars[i] = string.char(_char & 0xFF)
  134. char.address = char.address + 0x1
  135. end
  136. return table.concat(chars)
  137. end
  138. end,
  139. ChangeBytesOrder = function(bytes)
  140. local newBytes, index, lenBytes = {}, 0, #bytes / 2
  141. for byte in string.gmatch(bytes, "..") do
  142. newBytes[lenBytes - index] = byte
  143. index = index + 1
  144. end
  145. return table.concat(newBytes)
  146. end,
  147. FixValue = function(val)
  148. return AndroidInfo.platform and val & 0x00FFFFFFFFFFFFFF or val & 0xFFFFFFFF
  149. end,
  150. GetValidAddress = function(Address)
  151. local lastByte = Address & 0x000000000000000F
  152. local delta = 0
  153. local checkTable = {[12] = true, [4] = true, [8] = true, [0] = true}
  154. while not checkTable[lastByte - delta] do
  155. delta = delta + 1
  156. end
  157. return Address - delta
  158. end,
  159. SearchPointer = function(self, address)
  160. address = self.ChangeBytesOrder(type(address) == 'number' and string.format('%X', address) or address)
  161. gg.searchNumber('h ' .. address)
  162. gg.refineNumber('h ' .. address:sub(1, 6))
  163. gg.refineNumber('h ' .. address:sub(1, 2))
  164. local FindsResult = gg.getResults(gg.getResultsCount())
  165. gg.clearResults()
  166. return FindsResult
  167. end,
  168. }
  169. Il2cpp = setmetatable({}, {
  170. __call = function(self, config)
  171. config = config or {}
  172. getmetatable(self).__index = Il2cppBase
  173. if config.libilcpp then
  174. self.il2cppStart, self.il2cppEnd = config.libilcpp.start, config.libilcpp['end']
  175. else
  176. self.il2cppStart, self.il2cppEnd = Searcher.FindIl2cpp()
  177. end
  178. if config.globalMetadata then
  179. self.globalMetadataStart, self.globalMetadataEnd = config.globalMetadata.start, config.globalMetadata['end']
  180. else
  181. self.globalMetadataStart, self.globalMetadataEnd = Searcher:FindGlobalMetaData()
  182. end
  183. if config.globalMetadataHeader then
  184. self.globalMetadataHeader = config.globalMetadataHeader
  185. else
  186. self.globalMetadataHeader = self.globalMetadataStart
  187. end
  188. self.MetadataRegistrationApi.metadataRegistration = config.metadataRegistration
  189. VersionEngine:ChooseVersion(config.il2cppVersion, self.globalMetadataHeader)
  190. Il2cppMemory:ClearMemorize()
  191. end,
  192. __index = function(self, key)
  193. assert(key == "PatchesAddress", "You didn't call 'Il2cpp'")
  194. return Il2cppBase[key]
  195. end
  196. })
  197. return Il2cpp
  198. end)
  199. __bundle_register("utils.malloc", function(require, _LOADED, __bundle_register, __bundle_modules)
  200. local MemoryManager = {
  201. availableMemory = 0,
  202. lastAddress = 0,
  203. NewAlloc = function(self)
  204. self.lastAddress = gg.allocatePage(gg.PROT_READ | gg.PROT_WRITE)
  205. self.availableMemory = 4096
  206. end,
  207. }
  208. local M = {
  209. MAlloc = function(size)
  210. local manager = MemoryManager
  211. if size > manager.availableMemory then
  212. manager:NewAlloc()
  213. end
  214. local address = manager.lastAddress
  215. manager.availableMemory = manager.availableMemory - size
  216. manager.lastAddress = manager.lastAddress + size
  217. return address
  218. end,
  219. }
  220. return M
  221. end)
  222. __bundle_register("il2cppstruct.il2cppstring", function(require, _LOADED, __bundle_register, __bundle_modules)
  223. local StringApi = {
  224. EditString = function(self, newStr)
  225. local _stringLength = gg.getValues{{address = self.address + self.Fields._stringLength, flags = gg.TYPE_DWORD}}[1].value
  226. _stringLength = _stringLength * 2
  227. local bytes = gg.bytes(newStr, "UTF-16LE")
  228. if _stringLength == #bytes then
  229. local strStart = self.address + self.Fields._firstChar
  230. for i, v in ipairs(bytes) do
  231. bytes[i] = {
  232. address = strStart + (i - 1),
  233. flags = gg.TYPE_BYTE,
  234. value = v
  235. }
  236. end
  237. gg.setValues(bytes)
  238. elseif _stringLength > #bytes then
  239. local strStart = self.address + self.Fields._firstChar
  240. local _bytes = {}
  241. for i = 1, _stringLength do
  242. _bytes[#_bytes + 1] = {
  243. address = strStart + (i - 1),
  244. flags = gg.TYPE_BYTE,
  245. value = bytes[i] or 0
  246. }
  247. end
  248. gg.setValues(_bytes)
  249. elseif _stringLength < #bytes then
  250. self.address = Il2cpp.MemoryManager.MAlloc(self.Fields._firstChar + #bytes + 8)
  251. local length = #bytes % 2 == 1 and #bytes + 1 or #bytes
  252. local _bytes = {
  253. { address = self.address,
  254. flags = Il2cpp.MainType,
  255. value = self.ClassAddress
  256. },
  257. { address = self.address + self.Fields._stringLength,
  258. flags = gg.TYPE_DWORD,
  259. value = length / 2
  260. }
  261. }
  262. local strStart = self.address + self.Fields._firstChar
  263. for i = 1, length do
  264. _bytes[#_bytes + 1] = {
  265. address = strStart + (i - 1),
  266. flags = gg.TYPE_BYTE,
  267. value = bytes[i] or 0
  268. }
  269. end
  270. _bytes[#_bytes + 1] = {
  271. address = self.pointToStr,
  272. flags = Il2cpp.MainType,
  273. value = self.address
  274. }
  275. gg.setValues(_bytes)
  276. end
  277. end,
  278. ReadString = function(self)
  279. local _stringLength = gg.getValues{{address = self.address + self.Fields._stringLength, flags = gg.TYPE_DWORD}}[1].value
  280. local bytes = {}
  281. if _stringLength > 0 and _stringLength < 200 then
  282. local strStart = self.address + self.Fields._firstChar
  283. for i = 0, _stringLength do
  284. bytes[#bytes + 1] = {
  285. address = strStart + (i << 1),
  286. flags = gg.TYPE_WORD
  287. }
  288. end
  289. bytes = gg.getValues(bytes)
  290. local code = {[[return "]]}
  291. for i, v in ipairs(bytes) do
  292. code[#code + 1] = string.format([[\u{%x}]], v.value & 0xFFFF)
  293. end
  294. code[#code + 1] = '"'
  295. local read, err = load(table.concat(code))
  296. if read then
  297. return read()
  298. end
  299. end
  300. return ""
  301. end
  302. }
  303. local String = {
  304. From = function(address)
  305. local pointToStr = gg.getValues({{address = Il2cpp.FixValue(address), flags = Il2cpp.MainType}})[1]
  306. local str = setmetatable(
  307. {
  308. address = Il2cpp.FixValue(pointToStr.value),
  309. Fields = {},
  310. pointToStr = Il2cpp.FixValue(address)
  311. }, {__index = StringApi})
  312. local pointClassAddress = gg.getValues({{address = str.address, flags = Il2cpp.MainType}})[1].value
  313. local stringInfo = Il2cpp.FindClass({{Class = Il2cpp.FixValue(pointClassAddress), FieldsDump = true}})[1]
  314. for i, v in ipairs(stringInfo) do
  315. if v.ClassNameSpace == "System" then
  316. str.ClassAddress = tonumber(v.ClassAddress, 16)
  317. for indexField, FieldInfo in ipairs(v.Fields) do
  318. str.Fields[FieldInfo.FieldName] = tonumber(FieldInfo.Offset, 16)
  319. end
  320. return str
  321. end
  322. end
  323. return nil
  324. end,
  325. }
  326. return String
  327. end)
  328. __bundle_register("il2cppstruct.api.fieldinfo", function(require, _LOADED, __bundle_register, __bundle_modules)
  329. local Il2cppMemory = require("utils.il2cppmemory")
  330. local FieldInfoApi = {
  331. GetConstValue = function(self)
  332. if self.IsConst then
  333. local fieldIndex = getmetatable(self).fieldIndex
  334. local defaultValue = Il2cppMemory:GetDefaultValue(fieldIndex)
  335. if not defaultValue then
  336. defaultValue = Il2cpp.GlobalMetadataApi:GetDefaultFieldValue(fieldIndex)
  337. Il2cppMemory:SetDefaultValue(fieldIndex, defaultValue)
  338. elseif defaultValue == "nil" then
  339. return nil
  340. end
  341. return defaultValue
  342. end
  343. return nil
  344. end
  345. }
  346. return FieldInfoApi
  347. end)
  348. __bundle_register("utils.il2cppmemory", function(require, _LOADED, __bundle_register, __bundle_modules)
  349. local Il2cppMemory = {
  350. Methods = {},
  351. Classes = {},
  352. Fields = {},
  353. DefaultValues = {},
  354. Results = {},
  355. Types = {},
  356. GetInformationOfType = function(self, index)
  357. return self.Types[index]
  358. end,
  359. SetInformationOfType = function(self, index, typeName)
  360. self.Types[index] = typeName
  361. end,
  362. SaveResults = function(self)
  363. if gg.getResultsCount() > 0 then
  364. self.Results = gg.getResults(gg.getResultsCount())
  365. end
  366. end,
  367. ClearSavedResults = function(self)
  368. self.Results = {}
  369. end,
  370. GetDefaultValue = function(self, fieldIndex)
  371. return self.DefaultValues[fieldIndex]
  372. end,
  373. SetDefaultValue = function(self, fieldIndex, defaultValue)
  374. self.DefaultValues[fieldIndex] = defaultValue or "nil"
  375. end,
  376. GetInformationOfField = function(self, searchParam)
  377. return self.Fields[searchParam]
  378. end,
  379. SetInformationOfField = function(self, searchParam, searchResult)
  380. if not searchResult.Error then
  381. self.Fields[searchParam] = searchResult
  382. end
  383. end,
  384. GetInformaionOfMethod = function(self, searchParam)
  385. return self.Methods[searchParam]
  386. end,
  387. SetInformaionOfMethod = function(self, searchParam, searchResult)
  388. if not searchResult.Error then
  389. self.Methods[searchParam] = searchResult
  390. end
  391. end,
  392. GetInformationOfClass = function(self, searchParam)
  393. return self.Classes[searchParam]
  394. end,
  395. SetInformationOfClass = function(self, searchParam, searchResult)
  396. self.Classes[searchParam] = searchResult
  397. end,
  398. ClearMemorize = function(self)
  399. self.Methods = {}
  400. self.Classes = {}
  401. self.Fields = {}
  402. self.DefaultValues = {}
  403. self.Results = {}
  404. self.Types = {}
  405. end
  406. }
  407. return Il2cppMemory
  408. end)
  409. __bundle_register("il2cppstruct.api.classinfo", function(require, _LOADED, __bundle_register, __bundle_modules)
  410. local ClassInfoApi = {
  411. GetFieldWithName = function(self, name)
  412. local FieldsInfo = self.Fields
  413. if FieldsInfo then
  414. for fieldIndex = 1, #FieldsInfo do
  415. if FieldsInfo[fieldIndex].FieldName == name then
  416. return FieldsInfo[fieldIndex]
  417. end
  418. end
  419. else
  420. local ClassAddress = tonumber(self.ClassAddress, 16)
  421. local _ClassInfo = gg.getValues({
  422. { address = ClassAddress + Il2cpp.ClassApi.FieldsLink,
  423. flags = Il2cpp.MainType
  424. },
  425. { address = ClassAddress + Il2cpp.ClassApi.CountFields,
  426. flags = gg.TYPE_WORD
  427. }
  428. })
  429. self.Fields = Il2cpp.ClassApi:GetClassFields(Il2cpp.FixValue(_ClassInfo[1].value), _ClassInfo[2].value, {
  430. ClassName = self.ClassName,
  431. IsEnum = self.IsEnum,
  432. TypeMetadataHandle = self.TypeMetadataHandle
  433. })
  434. return self:GetFieldWithName(name)
  435. end
  436. return nil
  437. end,
  438. GetMethodsWithName = function(self, name)
  439. local MethodsInfo, MethodsInfoResult = self.Methods, {}
  440. if MethodsInfo then
  441. for methodIndex = 1, #MethodsInfo do
  442. if MethodsInfo[methodIndex].MethodName == name then
  443. MethodsInfoResult[#MethodsInfoResult + 1] = MethodsInfo[methodIndex]
  444. end
  445. end
  446. return MethodsInfoResult
  447. else
  448. local ClassAddress = tonumber(self.ClassAddress, 16)
  449. local _ClassInfo = gg.getValues({
  450. { address = ClassAddress + Il2cpp.ClassApi.MethodsLink,
  451. flags = Il2cpp.MainType
  452. },
  453. { address = ClassAddress + Il2cpp.ClassApi.CountMethods,
  454. flags = gg.TYPE_WORD
  455. }
  456. })
  457. self.Methods = Il2cpp.ClassApi:GetClassMethods(Il2cpp.FixValue(_ClassInfo[1].value), _ClassInfo[2].value,
  458. self.ClassName)
  459. return self:GetMethodsWithName(name)
  460. end
  461. end,
  462. GetFieldWithOffset = function(self, fieldOffset)
  463. if not self.Fields then
  464. local ClassAddress = tonumber(self.ClassAddress, 16)
  465. local _ClassInfo = gg.getValues({
  466. { address = ClassAddress + Il2cpp.ClassApi.FieldsLink,
  467. flags = Il2cpp.MainType
  468. },
  469. { address = ClassAddress + Il2cpp.ClassApi.CountFields,
  470. flags = gg.TYPE_WORD
  471. }
  472. })
  473. self.Fields = Il2cpp.ClassApi:GetClassFields(Il2cpp.FixValue(_ClassInfo[1].value), _ClassInfo[2].value, {
  474. ClassName = self.ClassName,
  475. IsEnum = self.IsEnum,
  476. TypeMetadataHandle = self.TypeMetadataHandle
  477. })
  478. end
  479. if #self.Fields > 0 then
  480. local klass = self
  481. while klass ~= nil do
  482. if klass.Fields and klass.InstanceSize >= fieldOffset then
  483. local lastField
  484. for indexField, field in ipairs(klass.Fields) do
  485. if not (field.IsStatic or field.IsConst) then
  486. local offset = tonumber(field.Offset, 16)
  487. if offset > 0 then
  488. local maybeStruct = fieldOffset < offset
  489. if indexField == 1 and maybeStruct then
  490. break
  491. elseif offset == fieldOffset or indexField == #klass.Fields then
  492. return field
  493. elseif maybeStruct then
  494. return lastField
  495. else
  496. lastField = field
  497. end
  498. end
  499. end
  500. end
  501. end
  502. klass = klass.Parent ~= nil
  503. and Il2cpp.FindClass({
  504. {
  505. Class = tonumber(klass.Parent.ClassAddress, 16),
  506. FieldsDump = true
  507. }
  508. })[1][1]
  509. or nil
  510. end
  511. end
  512. return nil
  513. end
  514. }
  515. return ClassInfoApi
  516. end)
  517. __bundle_register("il2cppstruct.object", function(require, _LOADED, __bundle_register, __bundle_modules)
  518. local AndroidInfo = require("utils.androidinfo")
  519. local ObjectApi = {
  520. FilterObjects = function(self, Objects)
  521. local FilterObjects = {}
  522. for k, v in ipairs(gg.getValuesRange(Objects)) do
  523. if v == 'A' then
  524. FilterObjects[#FilterObjects + 1] = Objects[k]
  525. end
  526. end
  527. Objects = FilterObjects
  528. gg.loadResults(Objects)
  529. gg.searchPointer(0)
  530. if gg.getResultsCount() <= 0 and AndroidInfo.platform and AndroidInfo.sdk >= 30 then
  531. local FixRefToObjects = {}
  532. for k, v in ipairs(Objects) do
  533. gg.searchNumber(tostring(v.address | 0xB400000000000000), gg.TYPE_QWORD)
  534. local RefToObject = gg.getResults(gg.getResultsCount())
  535. table.move(RefToObject, 1, #RefToObject, #FixRefToObjects + 1, FixRefToObjects)
  536. gg.clearResults()
  537. end
  538. gg.loadResults(FixRefToObjects)
  539. end
  540. local RefToObjects, FilterObjects = gg.getResults(gg.getResultsCount()), {}
  541. gg.clearResults()
  542. for k, v in ipairs(gg.getValuesRange(RefToObjects)) do
  543. if v == 'A' then
  544. FilterObjects[#FilterObjects + 1] = {
  545. address = Il2cpp.FixValue(RefToObjects[k].value),
  546. flags = RefToObjects[k].flags
  547. }
  548. end
  549. end
  550. gg.loadResults(FilterObjects)
  551. local _FilterObjects = gg.getResults(gg.getResultsCount())
  552. gg.clearResults()
  553. return _FilterObjects
  554. end,
  555. FindObjects = function(self, ClassAddress)
  556. gg.clearResults()
  557. gg.setRanges(0)
  558. gg.setRanges(gg.REGION_C_HEAP | gg.REGION_C_HEAP | gg.REGION_ANONYMOUS | gg.REGION_C_BSS | gg.REGION_C_DATA |
  559. gg.REGION_C_ALLOC)
  560. gg.loadResults({{
  561. address = tonumber(ClassAddress, 16),
  562. flags = Il2cpp.MainType
  563. }})
  564. gg.searchPointer(0)
  565. if gg.getResultsCount() <= 0 and AndroidInfo.platform and AndroidInfo.sdk >= 30 then
  566. gg.searchNumber(tostring(tonumber(ClassAddress, 16) | 0xB400000000000000), gg.TYPE_QWORD)
  567. end
  568. local FindsResult = gg.getResults(gg.getResultsCount())
  569. gg.clearResults()
  570. return self:FilterObjects(FindsResult)
  571. end,
  572. Find = function(self, ClassesInfo)
  573. local Objects = {}
  574. for j = 1, #ClassesInfo do
  575. local FindResult = self:FindObjects(ClassesInfo[j].ClassAddress)
  576. table.move(FindResult, 1, #FindResult, #Objects + 1, Objects)
  577. end
  578. return Objects
  579. end,
  580. FindHead = function(Address)
  581. local validAddress = Il2cpp.GetValidAddress(Address)
  582. local mayBeHead = {}
  583. for i = 1, 1000 do
  584. mayBeHead[i] = {
  585. address = validAddress - (4 * (i - 1)),
  586. flags = Il2cpp.MainType
  587. }
  588. end
  589. mayBeHead = gg.getValues(mayBeHead)
  590. for i = 1, #mayBeHead do
  591. local mayBeClass = Il2cpp.FixValue(mayBeHead[i].value)
  592. if Il2cpp.ClassApi.IsClassInfo(mayBeClass) then
  593. return mayBeHead[i]
  594. end
  595. end
  596. return {value = 0, address = 0}
  597. end,
  598. }
  599. return ObjectApi
  600. end)
  601. __bundle_register("utils.androidinfo", function(require, _LOADED, __bundle_register, __bundle_modules)
  602. local AndroidInfo = {
  603. platform = gg.getTargetInfo().x64,
  604. sdk = gg.getTargetInfo().targetSdkVersion
  605. }
  606. return AndroidInfo
  607. end)
  608. __bundle_register("il2cppstruct.class", function(require, _LOADED, __bundle_register, __bundle_modules)
  609. local Protect = require("utils.protect")
  610. local StringUtils = require("utils.stringutils")
  611. local Il2cppMemory = require("utils.il2cppmemory")
  612. local ClassApi = {
  613. GetClassName = function(self, ClassAddress)
  614. return Il2cpp.Utf8ToString(Il2cpp.FixValue(gg.getValues({{
  615. address = Il2cpp.FixValue(ClassAddress) + self.NameOffset,
  616. flags = Il2cpp.MainType
  617. }})[1].value))
  618. end,
  619. GetClassMethods = function(self, MethodsLink, Count, ClassName)
  620. local MethodsInfo, _MethodsInfo = {}, {}
  621. for i = 0, Count - 1 do
  622. _MethodsInfo[#_MethodsInfo + 1] = {
  623. address = MethodsLink + (i << self.MethodsStep),
  624. flags = Il2cpp.MainType
  625. }
  626. end
  627. _MethodsInfo = gg.getValues(_MethodsInfo)
  628. for i = 1, #_MethodsInfo do
  629. local MethodInfo
  630. MethodInfo, _MethodsInfo[i] = Il2cpp.MethodsApi:UnpackMethodInfo({
  631. MethodInfoAddress = Il2cpp.FixValue(_MethodsInfo[i].value),
  632. ClassName = ClassName
  633. })
  634. table.move(MethodInfo, 1, #MethodInfo, #MethodsInfo + 1, MethodsInfo)
  635. end
  636. MethodsInfo = gg.getValues(MethodsInfo)
  637. Il2cpp.MethodsApi:DecodeMethodsInfo(_MethodsInfo, MethodsInfo)
  638. return _MethodsInfo
  639. end,
  640. GetClassFields = function(self, FieldsLink, Count, ClassCharacteristic)
  641. local FieldsInfo, _FieldsInfo = {}, {}
  642. for i = 0, Count - 1 do
  643. _FieldsInfo[#_FieldsInfo + 1] = {
  644. address = FieldsLink + (i * self.FieldsStep),
  645. flags = Il2cpp.MainType
  646. }
  647. end
  648. _FieldsInfo = gg.getValues(_FieldsInfo)
  649. for i = 1, #_FieldsInfo do
  650. local FieldInfo
  651. FieldInfo = Il2cpp.FieldApi:UnpackFieldInfo(Il2cpp.FixValue(_FieldsInfo[i].address))
  652. table.move(FieldInfo, 1, #FieldInfo, #FieldsInfo + 1, FieldsInfo)
  653. end
  654. FieldsInfo = gg.getValues(FieldsInfo)
  655. _FieldsInfo = Il2cpp.FieldApi:DecodeFieldsInfo(FieldsInfo, ClassCharacteristic)
  656. return _FieldsInfo
  657. end,
  658. UnpackClassInfo = function(self, ClassInfo, Config)
  659. local _ClassInfo = gg.getValues({
  660. { address = ClassInfo.ClassInfoAddress + self.NameOffset,
  661. flags = Il2cpp.MainType
  662. },
  663. { address = ClassInfo.ClassInfoAddress + self.CountMethods,
  664. flags = gg.TYPE_WORD
  665. },
  666. { address = ClassInfo.ClassInfoAddress + self.CountFields,
  667. flags = gg.TYPE_WORD
  668. },
  669. { address = ClassInfo.ClassInfoAddress + self.MethodsLink,
  670. flags = Il2cpp.MainType
  671. },
  672. { address = ClassInfo.ClassInfoAddress + self.FieldsLink,
  673. flags = Il2cpp.MainType
  674. },
  675. { address = ClassInfo.ClassInfoAddress + self.ParentOffset,
  676. flags = Il2cpp.MainType
  677. },
  678. { address = ClassInfo.ClassInfoAddress + self.NameSpa
Advertisement
Add Comment
Please, Sign In to add comment