├── .gitignore ├── index.ts ├── main.js ├── hook.js ├── tsconfig.json ├── README.md ├── package.json ├── mod.js ├── menu.js └── dist └── build.js /.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | node_modules/* -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | import 'frida-il2cpp-bridge'; 2 | import {start} from "./main"; 3 | 4 | setImmediate(() => { 5 | start(); 6 | }) -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | import { Mod } from './mod' 2 | import { hook } from './hook' 3 | import { getMenu } from './menu' 4 | 5 | export const start = () => { 6 | Mod.var.test = '666'; 7 | Mod.Init('FlxMod',getMenu,hook,'1.0.0','24062700'); 8 | } -------------------------------------------------------------------------------- /hook.js: -------------------------------------------------------------------------------- 1 | import 'frida-il2cpp-bridge' 2 | 3 | export const hook = (Mod) => { 4 | console.log('start hook'); 5 | Il2Cpp.perform(() => { 6 | console.log(Mod.var.test,1); 7 | console.log(Il2Cpp.unityVersion); 8 | }); 9 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "lib": [ 5 | "es2020" 6 | ], 7 | "experimentalDecorators": true, 8 | "module": "commonjs", 9 | "allowJs": true, 10 | "noEmit": true, 11 | "esModuleInterop": true, 12 | "strict": true 13 | } 14 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FlxMod-template2 2 | JsHook Il2cpp游戏Mod空模板 3 | [frida-il2cpp-bridge V0.7.13 Wiki](https://github.com/vfsfitvnm/frida-il2cpp-bridge/wiki/Snippets/24e6c11527c0943af7cae0d91eeae585fa649a9c) 本项目没有使用ts,hook方法的写法参考Wiki,然后不写类型即可。 4 | 5 | ## Usage 6 | 7 | 1. `npm install` 8 | 9 | 2. `npm run dev` or `npm run build` 10 | 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flxmod-template2", 3 | "main": "index.ts", 4 | "version": "1.0.0", 5 | "private": true, 6 | "scripts": { 7 | "build": "frida-compile -S -o dist/build.js -c index.ts", 8 | "dev": "frida-compile -o dist/test.js -w index.ts", 9 | "frida": "adb forward tcp:28042 tcp:28042 && adb forward tcp:28043 tcp:28043 && frida -H 127.0.0.1:28042 -F -l dist/test.js" 10 | }, 11 | "devDependencies": { 12 | "@types/frida-gum": "^17.2.0", 13 | "@types/node": "^16.11.12", 14 | "frida-compile": "^10.2.5", 15 | "frida-il2cpp-bridge": "^0.7.13" 16 | }, 17 | "dependencies": {} 18 | } -------------------------------------------------------------------------------- /mod.js: -------------------------------------------------------------------------------- 1 | export const Mod = { 2 | name: '', 3 | version: '', 4 | build: '', 5 | menu: [], 6 | callbacks: {}, 7 | var: {}, 8 | Init: (name, getMenu, hook, version = '', build = '') => { 9 | Mod.name = name; 10 | Mod.getMenu = getMenu; 11 | Mod.version = version; 12 | Mod.build = build; 13 | Mod.startHook = hook; 14 | 15 | Mod.createMenu(); 16 | Mod.startHook(Mod); 17 | }, 18 | getVar: (name) => { 19 | if (Mod.var[name]) { 20 | return Mod.var[name]; 21 | } 22 | return undefined; 23 | }, 24 | setVar: (name, value) => { 25 | if (Mod.var[name]) { 26 | Mod.var[name] = value; 27 | return true; 28 | } 29 | return false; 30 | }, 31 | callbackBuild: () => { 32 | let callbackindex = 1; 33 | const menu = Mod.getMenu(Mod); 34 | menu.forEach(e => { 35 | if (e.type == 'tab') { 36 | e.item.forEach(e2 => { 37 | let tabitemindex = 1; 38 | e2.item.forEach(e3 => { 39 | if (e3?.callback) { 40 | let key = '1_'; 41 | key += callbackindex+'_'+tabitemindex; 42 | Mod.callbacks[key] = e3.callback; 43 | } 44 | tabitemindex++; 45 | }) 46 | callbackindex++; 47 | }); 48 | } else { 49 | if (e?.callback) { 50 | let key = callbackindex; 51 | Mod.callbacks[key] = e.callback; 52 | } 53 | callbackindex++; 54 | } 55 | }); 56 | }, 57 | callbackHandle: (val) => { 58 | console.log(JSON.stringify(val)) 59 | if (Mod.callbacks[val.id]) Mod.callbacks[val.id](val) 60 | }, 61 | createMenu: () => { 62 | if (typeof modmenu != 'undefined') { 63 | Mod.callbackBuild() 64 | Mod.menuInstance = modmenu.create(Mod.name, Mod.getMenu(Mod), { 65 | onchange: Mod.callbackHandle 66 | }); 67 | Mod.menuInstance.state(); 68 | } 69 | }, 70 | startHook: undefined, 71 | menuInstance: undefined 72 | } -------------------------------------------------------------------------------- /menu.js: -------------------------------------------------------------------------------- 1 | import { Mod } from './mod' 2 | import 'frida-il2cpp-bridge' 3 | 4 | export const getMenu = (m) => { 5 | return [ 6 | { 7 | 'type': 'tab', 8 | 'item': [ 9 | { 10 | 'title': 'tab1', 11 | 'item': [ 12 | { 13 | 'type': 'button', 14 | 'title': 'Test1', 15 | 'callback': (res) => { 16 | console.log('ok1'); 17 | } 18 | }, 19 | { 20 | 'type': 'button', 21 | 'title': 'Test2', 22 | 'callback': (res) => { 23 | console.log('ok2'); 24 | } 25 | }, 26 | { 27 | 'type': 'button', 28 | 'title': 'Test3', 29 | 'callback': (res) => { 30 | console.log('ok3'); 31 | } 32 | }, 33 | { 34 | 'type': 'input', 35 | 'title': 'Input Test', 36 | 'val': Mod.var.test.toString(), 37 | 'callback': (res) => { 38 | console.log(res.val); 39 | Mod.var.test = res.val; 40 | console.log('Mod.var.test: '+Mod.var.test); 41 | } 42 | } 43 | ] 44 | }, 45 | { 46 | 'title': '关于', 47 | 'item': [ 48 | { 49 | 'type': 'text', 50 | 'val': 'Mod: ' + Mod.name 51 | }, 52 | { 53 | 'type': 'text', 54 | 'val': 'Version: ' + Mod.version 55 | }, 56 | { 57 | 'type': 'text', 58 | 'val': 'Build: ' + Mod.build 59 | }, 60 | { 61 | 'type': 'text', 62 | 'val': 'CoreVersionCode: ' + runtime.coreVersionCode 63 | }, 64 | { 65 | 'type': 'button', 66 | 'title': 'Dump', 67 | 'callback': (val) => { 68 | Il2Cpp.perform(() => { 69 | console.log(Il2Cpp.unityVersion); 70 | console.log('DumpStart'); 71 | Il2Cpp.dump(); 72 | console.log('DumpComplete'); 73 | }); 74 | } 75 | } 76 | ] 77 | } 78 | ], 79 | 'default': 1 80 | } 81 | ] 82 | } -------------------------------------------------------------------------------- /dist/build.js: -------------------------------------------------------------------------------- 1 | (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i { 9 | console.log("start hook"), Il2Cpp.perform((() => { 10 | console.log(o.var.test, 1), console.log(Il2Cpp.unityVersion); 11 | })); 12 | }; 13 | 14 | exports.hook = o; 15 | 16 | },{"frida-il2cpp-bridge":34}],2:[function(require,module,exports){ 17 | (function (setImmediate){(function (){ 18 | "use strict"; 19 | 20 | Object.defineProperty(exports, "__esModule", { 21 | value: !0 22 | }), require("frida-il2cpp-bridge"); 23 | 24 | const e = require("./main"); 25 | 26 | setImmediate((() => { 27 | (0, e.start)(); 28 | })); 29 | 30 | }).call(this)}).call(this,require("timers").setImmediate) 31 | },{"./main":3,"frida-il2cpp-bridge":34,"timers":40}],3:[function(require,module,exports){ 32 | "use strict"; 33 | 34 | Object.defineProperty(exports, "__esModule", { 35 | value: !0 36 | }), exports.start = void 0; 37 | 38 | const e = require("./mod"), t = require("./hook"), o = require("./menu"), r = () => { 39 | e.Mod.var.test = "666", e.Mod.Init("FlxMod", o.getMenu, t.hook, "1.0.0", "24062700"); 40 | }; 41 | 42 | exports.start = r; 43 | 44 | },{"./hook":1,"./menu":4,"./mod":5}],4:[function(require,module,exports){ 45 | "use strict"; 46 | 47 | Object.defineProperty(exports, "__esModule", { 48 | value: !0 49 | }), exports.getMenu = void 0; 50 | 51 | const t = require("./mod"); 52 | 53 | require("frida-il2cpp-bridge"); 54 | 55 | const e = e => [ { 56 | type: "tab", 57 | item: [ { 58 | title: "tab1", 59 | item: [ { 60 | type: "button", 61 | title: "Test1", 62 | callback: t => { 63 | console.log("ok1"); 64 | } 65 | }, { 66 | type: "button", 67 | title: "Test2", 68 | callback: t => { 69 | console.log("ok2"); 70 | } 71 | }, { 72 | type: "button", 73 | title: "Test3", 74 | callback: t => { 75 | console.log("ok3"); 76 | } 77 | }, { 78 | type: "input", 79 | title: "Input Test", 80 | val: t.Mod.var.test.toString(), 81 | callback: e => { 82 | console.log(e.val), t.Mod.var.test = e.val, console.log("Mod.var.test: " + t.Mod.var.test); 83 | } 84 | } ] 85 | }, { 86 | title: "关于", 87 | item: [ { 88 | type: "text", 89 | val: "Mod: " + t.Mod.name 90 | }, { 91 | type: "text", 92 | val: "Version: " + t.Mod.version 93 | }, { 94 | type: "text", 95 | val: "Build: " + t.Mod.build 96 | }, { 97 | type: "text", 98 | val: "CoreVersionCode: " + runtime.coreVersionCode 99 | }, { 100 | type: "button", 101 | title: "Dump", 102 | callback: t => { 103 | Il2Cpp.perform((() => { 104 | console.log(Il2Cpp.unityVersion), console.log("DumpStart"), Il2Cpp.dump(), console.log("DumpComplete"); 105 | })); 106 | } 107 | } ] 108 | } ], 109 | default: 1 110 | } ]; 111 | 112 | exports.getMenu = e; 113 | 114 | },{"./mod":5,"frida-il2cpp-bridge":34}],5:[function(require,module,exports){ 115 | "use strict"; 116 | 117 | Object.defineProperty(exports, "__esModule", { 118 | value: !0 119 | }), exports.Mod = void 0, exports.Mod = { 120 | name: "", 121 | version: "", 122 | build: "", 123 | menu: [], 124 | callbacks: {}, 125 | var: {}, 126 | Init: (e, o, t, a = "", r = "") => { 127 | exports.Mod.name = e, exports.Mod.getMenu = o, exports.Mod.version = a, exports.Mod.build = r, 128 | exports.Mod.startHook = t, exports.Mod.createMenu(), exports.Mod.startHook(exports.Mod); 129 | }, 130 | getVar: e => { 131 | if (exports.Mod.var[e]) return exports.Mod.var[e]; 132 | }, 133 | setVar: (e, o) => !!exports.Mod.var[e] && (exports.Mod.var[e] = o, !0), 134 | callbackBuild: () => { 135 | let e = 1; 136 | exports.Mod.getMenu(exports.Mod).forEach((o => { 137 | if ("tab" == o.type) o.item.forEach((o => { 138 | let t = 1; 139 | o.item.forEach((o => { 140 | if (o?.callback) { 141 | let a = e; 142 | for (let e = 0; e < t; e++) a += "_" + (e + 2); 143 | exports.Mod.callbacks[a] = o.callback; 144 | } 145 | t++; 146 | })), e++; 147 | })); else { 148 | if (o?.callback) { 149 | let t = ""; 150 | if (1 != e) for (let o = 0; o < e; o++) t += 0 == o ? o + 1 : "_" + (o + 1); else t = 1; 151 | exports.Mod.callbacks[t] = o.callback; 152 | } 153 | e++; 154 | } 155 | })); 156 | }, 157 | callbackHandle: e => { 158 | console.log(JSON.stringify(e)), exports.Mod.callbacks[e.id] && exports.Mod.callbacks[e.id](e); 159 | }, 160 | createMenu: () => { 161 | "undefined" != typeof modmenu && (exports.Mod.callbackBuild(), exports.Mod.menuInstance = modmenu.create(exports.Mod.name, exports.Mod.getMenu(exports.Mod), { 162 | onchange: exports.Mod.callbackHandle 163 | }), exports.Mod.menuInstance.state()); 164 | }, 165 | startHook: void 0, 166 | menuInstance: void 0 167 | }; 168 | 169 | },{}],6:[function(require,module,exports){ 170 | "use strict"; 171 | 172 | function e(e, r, t) { 173 | var o = t.get; 174 | if (!o) throw new TypeError("Getter property descriptor expected"); 175 | t.get = function() { 176 | var e = o.call(this); 177 | return Object.defineProperty(this, r, { 178 | configurable: t.configurable, 179 | enumerable: t.enumerable, 180 | writable: !1, 181 | value: e 182 | }), e; 183 | }; 184 | } 185 | 186 | Object.defineProperty(exports, "__esModule", { 187 | value: !0 188 | }), exports.cache = e; 189 | 190 | },{}],7:[function(require,module,exports){ 191 | "use strict"; 192 | 193 | exports.__esModule = !0, exports.distance = exports.closest = void 0; 194 | 195 | var r = new Uint32Array(65536), t = function(t, e) { 196 | for (var o = t.length, a = e.length, n = 1 << o - 1, h = -1, c = 0, f = o, l = o; l--; ) r[t.charCodeAt(l)] |= 1 << l; 197 | for (l = 0; l < a; l++) { 198 | var v = r[e.charCodeAt(l)], i = v | c; 199 | (c |= ~((v |= (v & h) + h ^ h) | h)) & n && f++, (h &= v) & n && f--, h = h << 1 | ~(i | (c = c << 1 | 1)), 200 | c &= i; 201 | } 202 | for (l = o; l--; ) r[t.charCodeAt(l)] = 0; 203 | return f; 204 | }, e = function(t, e) { 205 | for (var o = e.length, a = t.length, n = [], h = [], c = Math.ceil(o / 32), f = Math.ceil(a / 32), l = 0; l < c; l++) h[l] = -1, 206 | n[l] = 0; 207 | for (var v = 0; v < f - 1; v++) { 208 | for (var i = 0, s = -1, d = 32 * v, g = Math.min(32, a) + d, u = d; u < g; u++) r[t.charCodeAt(u)] |= 1 << u; 209 | for (l = 0; l < o; l++) { 210 | var A = r[e.charCodeAt(l)], C = h[l / 32 | 0] >>> l & 1, p = A | i, x = s & (b = ((A | (U = n[l / 32 | 0] >>> l & 1)) & s) + s ^ s | A | U); 211 | (j = i | ~(b | s)) >>> 31 ^ C && (h[l / 32 | 0] ^= 1 << l), x >>> 31 ^ U && (n[l / 32 | 0] ^= 1 << l), 212 | s = (x = x << 1 | U) | ~(p | (j = j << 1 | C)), i = j & p; 213 | } 214 | for (u = d; u < g; u++) r[t.charCodeAt(u)] = 0; 215 | } 216 | var M = 0, m = -1, _ = 32 * v, w = Math.min(32, a - _) + _; 217 | for (u = _; u < w; u++) r[t.charCodeAt(u)] |= 1 << u; 218 | var y = a; 219 | for (l = 0; l < o; l++) { 220 | var U, b, j; 221 | A = r[e.charCodeAt(l)], C = h[l / 32 | 0] >>> l & 1, p = A | M; 222 | y += (j = M | ~((b = ((A | (U = n[l / 32 | 0] >>> l & 1)) & m) + m ^ m | A | U) | m)) >>> a - 1 & 1, 223 | y -= (x = m & b) >>> a - 1 & 1, j >>> 31 ^ C && (h[l / 32 | 0] ^= 1 << l), x >>> 31 ^ U && (n[l / 32 | 0] ^= 1 << l), 224 | m = (x = x << 1 | U) | ~(p | (j = j << 1 | C)), M = j & p; 225 | } 226 | for (u = _; u < w; u++) r[t.charCodeAt(u)] = 0; 227 | return y; 228 | }, o = function(r, o) { 229 | if (r.length < o.length) { 230 | var a = o; 231 | o = r, r = a; 232 | } 233 | return 0 === o.length ? r.length : r.length <= 32 ? t(r, o) : e(r, o); 234 | }; 235 | 236 | exports.distance = o; 237 | 238 | var a = function(r, t) { 239 | for (var e = 1 / 0, a = 0, n = 0; n < t.length; n++) { 240 | var h = o(r, t[n]); 241 | h < e && (e = h, a = n); 242 | } 243 | return t[a]; 244 | }; 245 | 246 | exports.closest = a; 247 | 248 | },{}],8:[function(require,module,exports){ 249 | "use strict"; 250 | 251 | var t = this && this.__decorate || function(t, e, n, i) { 252 | var r, _ = arguments.length, s = _ < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, n) : i; 253 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(t, e, n, i); else for (var a = t.length - 1; a >= 0; a--) (r = t[a]) && (s = (_ < 3 ? r(s) : _ > 3 ? r(e, n, s) : r(e, n)) || s); 254 | return _ > 3 && s && Object.defineProperty(e, n, s), s; 255 | }, e = this && this.__importDefault || function(t) { 256 | return t && t.__esModule ? t : { 257 | default: t 258 | }; 259 | }; 260 | 261 | Object.defineProperty(exports, "__esModule", { 262 | value: !0 263 | }); 264 | 265 | const n = require("decorator-cache-getter"), i = e(require("versioning")), r = require("../utils/console"); 266 | 267 | class _ { 268 | constructor() {} 269 | static get _alloc() { 270 | return this.r("il2cpp_alloc", "pointer", [ "size_t" ]); 271 | } 272 | static get _arrayGetElements() { 273 | return this.r("il2cpp_array_get_elements", "pointer", [ "pointer" ]); 274 | } 275 | static get _arrayGetLength() { 276 | return this.r("il2cpp_array_length", "uint32", [ "pointer" ]); 277 | } 278 | static get _arrayNew() { 279 | return this.r("il2cpp_array_new", "pointer", [ "pointer", "uint32" ]); 280 | } 281 | static get _assemblyGetImage() { 282 | return this.r("il2cpp_assembly_get_image", "pointer", [ "pointer" ]); 283 | } 284 | static get _classForEach() { 285 | return this.r("il2cpp_class_for_each", "void", [ "pointer", "pointer" ]); 286 | } 287 | static get _classFromName() { 288 | return this.r("il2cpp_class_from_name", "pointer", [ "pointer", "pointer", "pointer" ]); 289 | } 290 | static get _classFromSystemType() { 291 | return this.r("il2cpp_class_from_system_type", "pointer", [ "pointer" ]); 292 | } 293 | static get _classFromType() { 294 | return this.r("il2cpp_class_from_type", "pointer", [ "pointer" ]); 295 | } 296 | static get _classGetActualInstanceSize() { 297 | return this.r("il2cpp_class_get_actual_instance_size", "int32", [ "pointer" ]); 298 | } 299 | static get _classGetArrayClass() { 300 | return this.r("il2cpp_array_class_get", "pointer", [ "pointer", "uint32" ]); 301 | } 302 | static get _classGetArrayElementSize() { 303 | return this.r("il2cpp_class_array_element_size", "int", [ "pointer" ]); 304 | } 305 | static get _classGetAssemblyName() { 306 | return this.r("il2cpp_class_get_assemblyname", "pointer", [ "pointer" ]); 307 | } 308 | static get _classGetBaseType() { 309 | return this.r("il2cpp_class_enum_basetype", "pointer", [ "pointer" ]); 310 | } 311 | static get _classGetDeclaringType() { 312 | return this.r("il2cpp_class_get_declaring_type", "pointer", [ "pointer" ]); 313 | } 314 | static get _classGetElementClass() { 315 | return this.r("il2cpp_class_get_element_class", "pointer", [ "pointer" ]); 316 | } 317 | static get _classGetFieldFromName() { 318 | return this.r("il2cpp_class_get_field_from_name", "pointer", [ "pointer", "pointer" ]); 319 | } 320 | static get _classGetFields() { 321 | return this.r("il2cpp_class_get_fields", "pointer", [ "pointer", "pointer" ]); 322 | } 323 | static get _classGetFlags() { 324 | return this.r("il2cpp_class_get_flags", "int", [ "pointer" ]); 325 | } 326 | static get _classGetImage() { 327 | return this.r("il2cpp_class_get_image", "pointer", [ "pointer" ]); 328 | } 329 | static get _classGetInstanceSize() { 330 | return this.r("il2cpp_class_instance_size", "int32", [ "pointer" ]); 331 | } 332 | static get _classGetInterfaces() { 333 | return this.r("il2cpp_class_get_interfaces", "pointer", [ "pointer", "pointer" ]); 334 | } 335 | static get _classGetMethodFromName() { 336 | return this.r("il2cpp_class_get_method_from_name", "pointer", [ "pointer", "pointer", "int" ]); 337 | } 338 | static get _classGetMethods() { 339 | return this.r("il2cpp_class_get_methods", "pointer", [ "pointer", "pointer" ]); 340 | } 341 | static get _classGetName() { 342 | return this.r("il2cpp_class_get_name", "pointer", [ "pointer" ]); 343 | } 344 | static get _classGetNamespace() { 345 | return this.r("il2cpp_class_get_namespace", "pointer", [ "pointer" ]); 346 | } 347 | static get _classGetNestedClasses() { 348 | return this.r("il2cpp_class_get_nested_types", "pointer", [ "pointer", "pointer" ]); 349 | } 350 | static get _classGetParent() { 351 | return this.r("il2cpp_class_get_parent", "pointer", [ "pointer" ]); 352 | } 353 | static get _classGetRank() { 354 | return this.r("il2cpp_class_get_rank", "int", [ "pointer" ]); 355 | } 356 | static get _classGetStaticFieldData() { 357 | return this.r("il2cpp_class_get_static_field_data", "pointer", [ "pointer" ]); 358 | } 359 | static get _classGetValueSize() { 360 | return this.r("il2cpp_class_value_size", "int32", [ "pointer", "pointer" ]); 361 | } 362 | static get _classGetType() { 363 | return this.r("il2cpp_class_get_type", "pointer", [ "pointer" ]); 364 | } 365 | static get _classHasReferences() { 366 | return this.r("il2cpp_class_has_references", "bool", [ "pointer" ]); 367 | } 368 | static get _classInit() { 369 | return this.r("il2cpp_runtime_class_init", "void", [ "pointer" ]); 370 | } 371 | static get _classIsAbstract() { 372 | return this.r("il2cpp_class_is_abstract", "bool", [ "pointer" ]); 373 | } 374 | static get _classIsAssignableFrom() { 375 | return this.r("il2cpp_class_is_assignable_from", "bool", [ "pointer", "pointer" ]); 376 | } 377 | static get _classIsBlittable() { 378 | return this.r("il2cpp_class_is_blittable", "bool", [ "pointer" ]); 379 | } 380 | static get _classIsEnum() { 381 | return this.r("il2cpp_class_is_enum", "bool", [ "pointer" ]); 382 | } 383 | static get _classIsGeneric() { 384 | return this.r("il2cpp_class_is_generic", "bool", [ "pointer" ]); 385 | } 386 | static get _classIsInflated() { 387 | return this.r("il2cpp_class_is_inflated", "bool", [ "pointer" ]); 388 | } 389 | static get _classIsInterface() { 390 | return this.r("il2cpp_class_is_interface", "bool", [ "pointer" ]); 391 | } 392 | static get _classIsSubclassOf() { 393 | return this.r("il2cpp_class_is_subclass_of", "bool", [ "pointer", "pointer", "bool" ]); 394 | } 395 | static get _classIsValueType() { 396 | return this.r("il2cpp_class_is_valuetype", "bool", [ "pointer" ]); 397 | } 398 | static get _domainAssemblyOpen() { 399 | return this.r("il2cpp_domain_assembly_open", "pointer", [ "pointer", "pointer" ]); 400 | } 401 | static get _domainGet() { 402 | return this.r("il2cpp_domain_get", "pointer", []); 403 | } 404 | static get _domainGetAssemblies() { 405 | return this.r("il2cpp_domain_get_assemblies", "pointer", [ "pointer", "pointer" ]); 406 | } 407 | static get _fieldGetModifier() { 408 | return this.r("il2cpp_field_get_modifier", "pointer", [ "pointer" ]); 409 | } 410 | static get _fieldGetClass() { 411 | return this.r("il2cpp_field_get_parent", "pointer", [ "pointer" ]); 412 | } 413 | static get _fieldGetFlags() { 414 | return this.r("il2cpp_field_get_flags", "int", [ "pointer" ]); 415 | } 416 | static get _fieldGetName() { 417 | return this.r("il2cpp_field_get_name", "pointer", [ "pointer" ]); 418 | } 419 | static get _fieldGetOffset() { 420 | return this.r("il2cpp_field_get_offset", "int32", [ "pointer" ]); 421 | } 422 | static get _fieldGetStaticValue() { 423 | return this.r("il2cpp_field_static_get_value", "void", [ "pointer", "pointer" ]); 424 | } 425 | static get _fieldGetType() { 426 | return this.r("il2cpp_field_get_type", "pointer", [ "pointer" ]); 427 | } 428 | static get _fieldIsLiteral() { 429 | return this.r("il2cpp_field_is_literal", "bool", [ "pointer" ]); 430 | } 431 | static get _fieldIsStatic() { 432 | return this.r("il2cpp_field_is_static", "bool", [ "pointer" ]); 433 | } 434 | static get _fieldIsThreadStatic() { 435 | return this.r("il2cpp_field_is_thread_static", "bool", [ "pointer" ]); 436 | } 437 | static get _fieldSetStaticValue() { 438 | return this.r("il2cpp_field_static_set_value", "void", [ "pointer", "pointer" ]); 439 | } 440 | static get _free() { 441 | return this.r("il2cpp_free", "void", [ "pointer" ]); 442 | } 443 | static get _gcCollect() { 444 | return this.r("il2cpp_gc_collect", "void", [ "int" ]); 445 | } 446 | static get _gcCollectALittle() { 447 | return this.r("il2cpp_gc_collect_a_little", "void", []); 448 | } 449 | static get _gcDisable() { 450 | return this.r("il2cpp_gc_disable", "void", []); 451 | } 452 | static get _gcEnable() { 453 | return this.r("il2cpp_gc_enable", "void", []); 454 | } 455 | static get _gcGetHeapSize() { 456 | return this.r("il2cpp_gc_get_heap_size", "int64", []); 457 | } 458 | static get _gcGetMaxTimeSlice() { 459 | return this.r("il2cpp_gc_get_max_time_slice_ns", "int64", []); 460 | } 461 | static get _gcGetUsedSize() { 462 | return this.r("il2cpp_gc_get_used_size", "int64", []); 463 | } 464 | static get _gcHandleGetTarget() { 465 | return this.r("il2cpp_gchandle_get_target", "pointer", [ "uint32" ]); 466 | } 467 | static get _gcHandleFree() { 468 | return this.r("il2cpp_gchandle_free", "void", [ "uint32" ]); 469 | } 470 | static get _gcHandleNew() { 471 | return this.r("il2cpp_gchandle_new", "uint32", [ "pointer", "bool" ]); 472 | } 473 | static get _gcHandleNewWeakRef() { 474 | return this.r("il2cpp_gchandle_new_weakref", "uint32", [ "pointer", "bool" ]); 475 | } 476 | static get _gcIsDisabled() { 477 | return this.r("il2cpp_gc_is_disabled", "bool", []); 478 | } 479 | static get _gcIsIncremental() { 480 | return this.r("il2cpp_gc_is_incremental", "bool", []); 481 | } 482 | static get _gcSetMaxTimeSlice() { 483 | return this.r("il2cpp_gc_set_max_time_slice_ns", "void", [ "int64" ]); 484 | } 485 | static get _gcStartIncrementalCollection() { 486 | return this.r("il2cpp_gc_start_incremental_collection", "void", []); 487 | } 488 | static get _gcStartWorld() { 489 | return this.r("il2cpp_start_gc_world", "void", []); 490 | } 491 | static get _gcStopWorld() { 492 | return this.r("il2cpp_stop_gc_world", "void", []); 493 | } 494 | static get _getCorlib() { 495 | return this.r("il2cpp_get_corlib", "pointer", []); 496 | } 497 | static get _imageGetAssembly() { 498 | return this.r("il2cpp_image_get_assembly", "pointer", [ "pointer" ]); 499 | } 500 | static get _imageGetClass() { 501 | return this.r("il2cpp_image_get_class", "pointer", [ "pointer", "uint" ]); 502 | } 503 | static get _imageGetClassCount() { 504 | return this.r("il2cpp_image_get_class_count", "uint32", [ "pointer" ]); 505 | } 506 | static get _imageGetName() { 507 | return this.r("il2cpp_image_get_name", "pointer", [ "pointer" ]); 508 | } 509 | static get _init() { 510 | return this.r("il2cpp_init", "void", []); 511 | } 512 | static get _livenessAllocateStruct() { 513 | return this.r("il2cpp_unity_liveness_allocate_struct", "pointer", [ "pointer", "int", "pointer", "pointer", "pointer" ]); 514 | } 515 | static get _livenessCalculationBegin() { 516 | return this.r("il2cpp_unity_liveness_calculation_begin", "pointer", [ "pointer", "int", "pointer", "pointer", "pointer", "pointer" ]); 517 | } 518 | static get _livenessCalculationEnd() { 519 | return this.r("il2cpp_unity_liveness_calculation_end", "void", [ "pointer" ]); 520 | } 521 | static get _livenessCalculationFromStatics() { 522 | return this.r("il2cpp_unity_liveness_calculation_from_statics", "void", [ "pointer" ]); 523 | } 524 | static get _livenessFinalize() { 525 | return this.r("il2cpp_unity_liveness_finalize", "void", [ "pointer" ]); 526 | } 527 | static get _livenessFreeStruct() { 528 | return this.r("il2cpp_unity_liveness_free_struct", "void", [ "pointer" ]); 529 | } 530 | static get _memorySnapshotCapture() { 531 | return this.r("il2cpp_capture_memory_snapshot", "pointer", []); 532 | } 533 | static get _memorySnapshotFree() { 534 | return this.r("il2cpp_free_captured_memory_snapshot", "void", [ "pointer" ]); 535 | } 536 | static get _memorySnapshotGetClasses() { 537 | return this.r("il2cpp_memory_snapshot_get_classes", "pointer", [ "pointer", "pointer" ]); 538 | } 539 | static get _memorySnapshotGetGCHandles() { 540 | return this.r("il2cpp_memory_snapshot_get_gc_handles", [ "uint32", "pointer" ], [ "pointer" ]); 541 | } 542 | static get _memorySnapshotGetRuntimeInformation() { 543 | return this.r("il2cpp_memory_snapshot_get_information", [ "uint32", "uint32", "uint32", "uint32", "uint32", "uint32" ], [ "pointer" ]); 544 | } 545 | static get _methodGetModifier() { 546 | return this.r("il2cpp_method_get_modifier", "pointer", [ "pointer" ]); 547 | } 548 | static get _methodGetClass() { 549 | return this.r("il2cpp_method_get_class", "pointer", [ "pointer" ]); 550 | } 551 | static get _methodGetFlags() { 552 | return this.r("il2cpp_method_get_flags", "uint32", [ "pointer", "pointer" ]); 553 | } 554 | static get _methodGetFromReflection() { 555 | return this.r("il2cpp_method_get_from_reflection", "pointer", [ "pointer" ]); 556 | } 557 | static get _methodGetName() { 558 | return this.r("il2cpp_method_get_name", "pointer", [ "pointer" ]); 559 | } 560 | static get _methodGetObject() { 561 | return this.r("il2cpp_method_get_object", "pointer", [ "pointer", "pointer" ]); 562 | } 563 | static get _methodGetParameterCount() { 564 | return this.r("il2cpp_method_get_param_count", "uint8", [ "pointer" ]); 565 | } 566 | static get _methodGetParameterName() { 567 | return this.r("il2cpp_method_get_param_name", "pointer", [ "pointer", "uint32" ]); 568 | } 569 | static get _methodGetParameters() { 570 | return this.r("il2cpp_method_get_parameters", "pointer", [ "pointer", "pointer" ]); 571 | } 572 | static get _methodGetParameterType() { 573 | return this.r("il2cpp_method_get_param", "pointer", [ "pointer", "uint32" ]); 574 | } 575 | static get _methodGetPointer() { 576 | return this.r("il2cpp_method_get_pointer", "pointer", [ "pointer" ]); 577 | } 578 | static get _methodGetReturnType() { 579 | return this.r("il2cpp_method_get_return_type", "pointer", [ "pointer" ]); 580 | } 581 | static get _methodIsExternal() { 582 | return this.r("il2cpp_method_is_external", "bool", [ "pointer" ]); 583 | } 584 | static get _methodIsGeneric() { 585 | return this.r("il2cpp_method_is_generic", "bool", [ "pointer" ]); 586 | } 587 | static get _methodIsInflated() { 588 | return this.r("il2cpp_method_is_inflated", "bool", [ "pointer" ]); 589 | } 590 | static get _methodIsInstance() { 591 | return this.r("il2cpp_method_is_instance", "bool", [ "pointer" ]); 592 | } 593 | static get _methodIsSynchronized() { 594 | return this.r("il2cpp_method_is_synchronized", "bool", [ "pointer" ]); 595 | } 596 | static get _monitorEnter() { 597 | return this.r("il2cpp_monitor_enter", "void", [ "pointer" ]); 598 | } 599 | static get _monitorExit() { 600 | return this.r("il2cpp_monitor_exit", "void", [ "pointer" ]); 601 | } 602 | static get _monitorPulse() { 603 | return this.r("il2cpp_monitor_pulse", "void", [ "pointer" ]); 604 | } 605 | static get _monitorPulseAll() { 606 | return this.r("il2cpp_monitor_pulse_all", "void", [ "pointer" ]); 607 | } 608 | static get _monitorTryEnter() { 609 | return this.r("il2cpp_monitor_try_enter", "bool", [ "pointer", "uint32" ]); 610 | } 611 | static get _monitorTryWait() { 612 | return this.r("il2cpp_monitor_try_wait", "bool", [ "pointer", "uint32" ]); 613 | } 614 | static get _monitorWait() { 615 | return this.r("il2cpp_monitor_wait", "void", [ "pointer" ]); 616 | } 617 | static get _objectGetClass() { 618 | return this.r("il2cpp_object_get_class", "pointer", [ "pointer" ]); 619 | } 620 | static get _objectGetVirtualMethod() { 621 | return this.r("il2cpp_object_get_virtual_method", "pointer", [ "pointer", "pointer" ]); 622 | } 623 | static get _objectInit() { 624 | return this.r("il2cpp_runtime_object_init_exception", "void", [ "pointer", "pointer" ]); 625 | } 626 | static get _objectNew() { 627 | return this.r("il2cpp_object_new", "pointer", [ "pointer" ]); 628 | } 629 | static get _objectGetSize() { 630 | return this.r("il2cpp_object_get_size", "uint32", [ "pointer" ]); 631 | } 632 | static get _objectUnbox() { 633 | return this.r("il2cpp_object_unbox", "pointer", [ "pointer" ]); 634 | } 635 | static get _resolveInternalCall() { 636 | return this.r("il2cpp_resolve_icall", "pointer", [ "pointer" ]); 637 | } 638 | static get _stringChars() { 639 | return this.r("il2cpp_string_chars", "pointer", [ "pointer" ]); 640 | } 641 | static get _stringLength() { 642 | return this.r("il2cpp_string_length", "int32", [ "pointer" ]); 643 | } 644 | static get _stringNew() { 645 | return this.r("il2cpp_string_new", "pointer", [ "pointer" ]); 646 | } 647 | static get _stringSetLength() { 648 | return this.r("il2cpp_string_set_length", "void", [ "pointer", "int32" ]); 649 | } 650 | static get _valueBox() { 651 | return this.r("il2cpp_value_box", "pointer", [ "pointer", "pointer" ]); 652 | } 653 | static get _threadAttach() { 654 | return this.r("il2cpp_thread_attach", "pointer", [ "pointer" ]); 655 | } 656 | static get _threadCurrent() { 657 | return this.r("il2cpp_thread_current", "pointer", []); 658 | } 659 | static get _threadGetAllAttachedThreads() { 660 | return this.r("il2cpp_thread_get_all_attached_threads", "pointer", [ "pointer" ]); 661 | } 662 | static get _threadIsVm() { 663 | return this.r("il2cpp_is_vm_thread", "bool", [ "pointer" ]); 664 | } 665 | static get _threadDetach() { 666 | return this.r("il2cpp_thread_detach", "void", [ "pointer" ]); 667 | } 668 | static get _typeGetName() { 669 | return this.r("il2cpp_type_get_name", "pointer", [ "pointer" ]); 670 | } 671 | static get _typeGetObject() { 672 | return this.r("il2cpp_type_get_object", "pointer", [ "pointer" ]); 673 | } 674 | static get _typeGetTypeEnum() { 675 | return this.r("il2cpp_type_get_type", "int", [ "pointer" ]); 676 | } 677 | static get _typeIsByReference() { 678 | return this.r("il2cpp_type_is_byref", "bool", [ "pointer" ]); 679 | } 680 | static get _typeIsPrimitive() { 681 | return this.r("il2cpp_type_is_primitive", "bool", [ "pointer" ]); 682 | } 683 | static get cModule() { 684 | (i.default.lt(Il2Cpp.unityVersion, "5.3.0") || i.default.gte(Il2Cpp.unityVersion, "2022.2.0")) && (0, 685 | r.warn)(`current Unity version ${Il2Cpp.unityVersion} is not supported, expect breakage`); 686 | const t = new CModule("#include \n\n#define OFFSET_OF(name, type) int16_t name (char * p, type e) { for (int16_t i = 0; i < 512; i++) if (* ((type *) p + i) == e) return i; return -1; }\n\nOFFSET_OF (offset_of_int32, int32_t)\nOFFSET_OF (offset_of_pointer, void *)\n "), e = new NativeFunction(t.offset_of_int32, "int16", [ "pointer", "int32" ]), n = new NativeFunction(t.offset_of_pointer, "int16", [ "pointer", "pointer" ]), _ = Il2Cpp.Image.corlib.class("System.String"), s = Il2Cpp.Image.corlib.class("System.DateTime"), a = Il2Cpp.Image.corlib.class("System.Reflection.Module"); 687 | s.initialize(), a.initialize(); 688 | const l = (s.tryField("daysmonth") ?? s.tryField("DaysToMonth365") ?? s.field("s_daysToMonth365")).value, c = a.field("FilterTypeName").value, p = c.field("method_ptr").value, o = c.field("method").value, u = `#include \n#include \n\n\ntypedef struct _Il2CppObject Il2CppObject;\ntypedef enum _Il2CppTypeEnum Il2CppTypeEnum;\ntypedef struct _Il2CppReflectionMethod Il2CppReflectionMethod;\ntypedef struct _Il2CppManagedMemorySnapshot Il2CppManagedMemorySnapshot;\ntypedef struct _Il2CppMetadataType Il2CppMetadataType;\n\n\nstruct _Il2CppObject\n{\n void * class;\n void * monitor;\n};\n\nenum _Il2CppTypeEnum\n{\n IL2CPP_TYPE_END = 0x00,\n IL2CPP_TYPE_VOID = 0x01,\n IL2CPP_TYPE_BOOLEAN = 0x02,\n IL2CPP_TYPE_CHAR = 0x03,\n IL2CPP_TYPE_I1 = 0x04,\n IL2CPP_TYPE_U1 = 0x05,\n IL2CPP_TYPE_I2 = 0x06,\n IL2CPP_TYPE_U2 = 0x07,\n IL2CPP_TYPE_I4 = 0x08,\n IL2CPP_TYPE_U4 = 0x09,\n IL2CPP_TYPE_I8 = 0x0a,\n IL2CPP_TYPE_U8 = 0x0b,\n IL2CPP_TYPE_R4 = 0x0c,\n IL2CPP_TYPE_R8 = 0x0d,\n IL2CPP_TYPE_STRING = 0x0e,\n IL2CPP_TYPE_PTR = 0x0f,\n IL2CPP_TYPE_BYREF = 0x10,\n IL2CPP_TYPE_VALUETYPE = 0x11,\n IL2CPP_TYPE_CLASS = 0x12,\n IL2CPP_TYPE_VAR = 0x13,\n IL2CPP_TYPE_ARRAY = 0x14,\n IL2CPP_TYPE_GENERICINST = 0x15,\n IL2CPP_TYPE_TYPEDBYREF = 0x16,\n IL2CPP_TYPE_I = 0x18,\n IL2CPP_TYPE_U = 0x19,\n IL2CPP_TYPE_FNPTR = 0x1b,\n IL2CPP_TYPE_OBJECT = 0x1c,\n IL2CPP_TYPE_SZARRAY = 0x1d,\n IL2CPP_TYPE_MVAR = 0x1e,\n IL2CPP_TYPE_CMOD_REQD = 0x1f,\n IL2CPP_TYPE_CMOD_OPT = 0x20,\n IL2CPP_TYPE_INTERNAL = 0x21,\n IL2CPP_TYPE_MODIFIER = 0x40,\n IL2CPP_TYPE_SENTINEL = 0x41,\n IL2CPP_TYPE_PINNED = 0x45,\n IL2CPP_TYPE_ENUM = 0x55\n};\n\nstruct _Il2CppReflectionMethod\n{\n Il2CppObject object;\n void * method;\n void * name;\n void * reftype;\n};\n\nstruct _Il2CppManagedMemorySnapshot\n{\n struct Il2CppManagedHeap\n {\n uint32_t section_count;\n void * sections;\n } heap;\n struct Il2CppStacks\n {\n uint32_t stack_count;\n void * stacks;\n } stacks;\n struct Il2CppMetadataSnapshot\n {\n uint32_t type_count;\n Il2CppMetadataType * types;\n } metadata_snapshot;\n struct Il2CppGCHandles\n {\n uint32_t tracked_object_count;\n Il2CppObject ** pointers_to_objects;\n } gc_handles;\n struct Il2CppRuntimeInformation\n {\n uint32_t pointer_size;\n uint32_t object_header_size;\n uint32_t array_header_size;\n uint32_t array_bounds_offset_in_header;\n uint32_t array_size_offset_in_header;\n uint32_t allocation_granularity;\n } runtime_information;\n void * additional_user_information;\n};\n\nstruct _Il2CppMetadataType\n{\n uint32_t flags;\n void * fields;\n uint32_t field_count;\n uint32_t statics_size;\n uint8_t * statics;\n uint32_t base_or_element_type_index;\n char * name;\n const char * assembly_name;\n uint64_t type_info_address;\n uint32_t size;\n};\n\n\n#define THREAD_STATIC_FIELD_OFFSET -1;\n\n#define FIELD_ATTRIBUTE_FIELD_ACCESS_MASK 0x0007\n#define FIELD_ATTRIBUTE_COMPILER_CONTROLLED 0x0000\n#define FIELD_ATTRIBUTE_PRIVATE 0x0001\n#define FIELD_ATTRIBUTE_FAM_AND_ASSEM 0x0002\n#define FIELD_ATTRIBUTE_ASSEMBLY 0x0003\n#define FIELD_ATTRIBUTE_FAMILY 0x0004\n#define FIELD_ATTRIBUTE_FAM_OR_ASSEM 0x0005\n#define FIELD_ATTRIBUTE_PUBLIC 0x0006\n\n#define FIELD_ATTRIBUTE_STATIC 0x0010\n#define FIELD_ATTRIBUTE_LITERAL 0x0040\n\n#define METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK 0x0007\n#define METHOD_ATTRIBUTE_COMPILER_CONTROLLED 0x0000\n#define METHOD_ATTRIBUTE_PRIVATE 0x0001\n#define METHOD_ATTRIBUTE_FAM_AND_ASSEM 0x0002\n#define METHOD_ATTRIBUTE_ASSEMBLY 0x0003\n#define METHOD_ATTRIBUTE_FAMILY 0x0004\n#define METHOD_ATTRIBUTE_FAM_OR_ASSEM 0x0005\n#define METHOD_ATTRIBUTE_PUBLIC 0x0006\n\n#define METHOD_ATTRIBUTE_STATIC 0x0010\n#define METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL 0x1000\n#define METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED 0x0020\n\n\nstatic const char * (*il2cpp_class_get_name) (void *) = (void *) ${this._classGetName};\nstatic int (*il2cpp_field_get_flags) (void *) = (void *) ${this._fieldGetFlags};\nstatic size_t (*il2cpp_field_get_offset) (void *) = (void *) ${this._fieldGetOffset};\nstatic uint32_t (*il2cpp_method_get_flags) (void *, uint32_t *) = (void *) ${this._methodGetFlags};\nstatic char * (*il2cpp_type_get_name) (void *) = (void *) ${this._typeGetName};\nstatic Il2CppTypeEnum (*il2cpp_type_get_type_enum) (void *) = (void *) ${this._typeGetTypeEnum};\nstatic void (*il2cpp_free) (void * pointer) = (void *) ${this._free};\n\n\nvoid\nil2cpp_string_set_length (int32_t * string,\n int32_t length)\n{\n *(string + ${e(Il2Cpp.String.from("vfsfitvnm"), 9)}) = length;\n}\n\nvoid *\nil2cpp_array_get_elements (int32_t * array)\n{ \n return array + ${e(l, 31) - 1};\n}\n\nuint8_t\nil2cpp_type_is_byref (void * type)\n{ \n char * name;\n char last_char;\n\n name = il2cpp_type_get_name (type);\n last_char = name[strlen (name) - 1];\n\n il2cpp_free (name);\n return last_char == '&';\n}\n\nuint8_t\nil2cpp_type_is_primitive (void * type)\n{\n Il2CppTypeEnum type_enum;\n\n type_enum = il2cpp_type_get_type_enum (type);\n\n return ((type_enum >= IL2CPP_TYPE_BOOLEAN && \n type_enum <= IL2CPP_TYPE_R8) || \n type_enum == IL2CPP_TYPE_I || \n type_enum == IL2CPP_TYPE_U\n );\n}\n\nint32_t\nil2cpp_class_get_actual_instance_size (int32_t * class)\n{\n return *(class + ${e(_, _.instanceSize - 2)});\n}\n\nuint8_t\nil2cpp_class_get_rank (void * class)\n{\n uint8_t rank;\n const char * name;\n \n rank = 0;\n name = il2cpp_class_get_name (class);\n\n for (uint16_t i = strlen (name) - 1; i > 0; i--)\n {\n char c = name[i];\n\n if (c == ']') rank++;\n else if (c == '[' || rank == 0) break;\n else if (c == ',') rank++;\n else break;\n }\n\n return rank;\n}\n\nconst char *\nil2cpp_field_get_modifier (void * field)\n{ \n int flags;\n\n flags = il2cpp_field_get_flags (field);\n\n switch (flags & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) {\n case FIELD_ATTRIBUTE_PRIVATE:\n return "private";\n case FIELD_ATTRIBUTE_FAM_AND_ASSEM:\n return "private protected";\n case FIELD_ATTRIBUTE_ASSEMBLY:\n return "internal";\n case FIELD_ATTRIBUTE_FAMILY:\n return "protected";\n case FIELD_ATTRIBUTE_FAM_OR_ASSEM:\n return "protected internal";\n case FIELD_ATTRIBUTE_PUBLIC:\n return "public";\n }\n\n return "";\n}\n\nuint8_t\nil2cpp_field_is_literal (void * field)\n{\n return (il2cpp_field_get_flags (field) & FIELD_ATTRIBUTE_LITERAL) != 0;\n}\n\nuint8_t\nil2cpp_field_is_static (void * field)\n{\n return (il2cpp_field_get_flags (field) & FIELD_ATTRIBUTE_STATIC) != 0;\n}\n\nuint8_t\nil2cpp_field_is_thread_static (void * field)\n{\n return il2cpp_field_get_offset (field) == THREAD_STATIC_FIELD_OFFSET;\n}\n\nconst char *\nil2cpp_method_get_modifier (void * method)\n{\n uint32_t flags;\n\n flags = il2cpp_method_get_flags (method, NULL);\n\n switch (flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) {\n case METHOD_ATTRIBUTE_PRIVATE:\n return "private";\n case METHOD_ATTRIBUTE_FAM_AND_ASSEM:\n return "private protected";\n case METHOD_ATTRIBUTE_ASSEMBLY:\n return "internal";\n case METHOD_ATTRIBUTE_FAMILY:\n return "protected";\n case METHOD_ATTRIBUTE_FAM_OR_ASSEM:\n return "protected internal";\n case METHOD_ATTRIBUTE_PUBLIC:\n return "public";\n }\n\n return "";\n}\n\nvoid *\nil2cpp_method_get_from_reflection (const Il2CppReflectionMethod * method)\n{\n return method->method;\n}\n\nvoid *\nil2cpp_method_get_pointer (void ** method)\n{\n return * (method + ${n(o, p)});\n}\n\nuint8_t\nil2cpp_method_is_external (void * method)\n{\n uint32_t implementation_flags;\n\n il2cpp_method_get_flags (method, &implementation_flags);\n\n return (implementation_flags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) != 0;\n}\n\nuint8_t\nil2cpp_method_is_synchronized (void * method)\n{\n uint32_t implementation_flags;\n\n il2cpp_method_get_flags (method, &implementation_flags);\n\n return (implementation_flags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) != 0;\n}\n\nuintptr_t\nil2cpp_memory_snapshot_get_classes (const Il2CppManagedMemorySnapshot * snapshot,\n Il2CppMetadataType ** iter)\n{\n const int zero;\n const void * null;\n\n if (iter != NULL && snapshot->metadata_snapshot.type_count > zero)\n {\n if (*iter == null)\n {\n *iter = snapshot->metadata_snapshot.types;\n return (uintptr_t) (*iter)->type_info_address;\n }\n else\n {\n Il2CppMetadataType * metadata_type = *iter + 1;\n\n if (metadata_type < snapshot->metadata_snapshot.types + snapshot->metadata_snapshot.type_count)\n {\n *iter = metadata_type;\n return (uintptr_t) (*iter)->type_info_address;\n }\n }\n }\n return 0;\n}\n\nstruct Il2CppGCHandles\nil2cpp_memory_snapshot_get_gc_handles (const Il2CppManagedMemorySnapshot * snapshot)\n{\n return snapshot->gc_handles;\n}\n\nstruct Il2CppRuntimeInformation\nil2cpp_memory_snapshot_get_information (const Il2CppManagedMemorySnapshot * snapshot)\n{\n return snapshot->runtime_information;\n}\n `; 689 | return t.dispose(), new CModule(u); 690 | } 691 | static r(t, e, n) { 692 | const i = Il2Cpp.module.findExportByName(t) ?? this.cModule[t]; 693 | return null == i && (0, r.raise)(`cannot resolve export ${t}`), new NativeFunction(i, e, n); 694 | } 695 | } 696 | 697 | t([ n.cache ], _, "_alloc", null), t([ n.cache ], _, "_arrayGetElements", null), 698 | t([ n.cache ], _, "_arrayGetLength", null), t([ n.cache ], _, "_arrayNew", null), 699 | t([ n.cache ], _, "_assemblyGetImage", null), t([ n.cache ], _, "_classForEach", null), 700 | t([ n.cache ], _, "_classFromName", null), t([ n.cache ], _, "_classFromSystemType", null), 701 | t([ n.cache ], _, "_classFromType", null), t([ n.cache ], _, "_classGetActualInstanceSize", null), 702 | t([ n.cache ], _, "_classGetArrayClass", null), t([ n.cache ], _, "_classGetArrayElementSize", null), 703 | t([ n.cache ], _, "_classGetAssemblyName", null), t([ n.cache ], _, "_classGetBaseType", null), 704 | t([ n.cache ], _, "_classGetDeclaringType", null), t([ n.cache ], _, "_classGetElementClass", null), 705 | t([ n.cache ], _, "_classGetFieldFromName", null), t([ n.cache ], _, "_classGetFields", null), 706 | t([ n.cache ], _, "_classGetFlags", null), t([ n.cache ], _, "_classGetImage", null), 707 | t([ n.cache ], _, "_classGetInstanceSize", null), t([ n.cache ], _, "_classGetInterfaces", null), 708 | t([ n.cache ], _, "_classGetMethodFromName", null), t([ n.cache ], _, "_classGetMethods", null), 709 | t([ n.cache ], _, "_classGetName", null), t([ n.cache ], _, "_classGetNamespace", null), 710 | t([ n.cache ], _, "_classGetNestedClasses", null), t([ n.cache ], _, "_classGetParent", null), 711 | t([ n.cache ], _, "_classGetRank", null), t([ n.cache ], _, "_classGetStaticFieldData", null), 712 | t([ n.cache ], _, "_classGetValueSize", null), t([ n.cache ], _, "_classGetType", null), 713 | t([ n.cache ], _, "_classHasReferences", null), t([ n.cache ], _, "_classInit", null), 714 | t([ n.cache ], _, "_classIsAbstract", null), t([ n.cache ], _, "_classIsAssignableFrom", null), 715 | t([ n.cache ], _, "_classIsBlittable", null), t([ n.cache ], _, "_classIsEnum", null), 716 | t([ n.cache ], _, "_classIsGeneric", null), t([ n.cache ], _, "_classIsInflated", null), 717 | t([ n.cache ], _, "_classIsInterface", null), t([ n.cache ], _, "_classIsSubclassOf", null), 718 | t([ n.cache ], _, "_classIsValueType", null), t([ n.cache ], _, "_domainAssemblyOpen", null), 719 | t([ n.cache ], _, "_domainGet", null), t([ n.cache ], _, "_domainGetAssemblies", null), 720 | t([ n.cache ], _, "_fieldGetModifier", null), t([ n.cache ], _, "_fieldGetClass", null), 721 | t([ n.cache ], _, "_fieldGetFlags", null), t([ n.cache ], _, "_fieldGetName", null), 722 | t([ n.cache ], _, "_fieldGetOffset", null), t([ n.cache ], _, "_fieldGetStaticValue", null), 723 | t([ n.cache ], _, "_fieldGetType", null), t([ n.cache ], _, "_fieldIsLiteral", null), 724 | t([ n.cache ], _, "_fieldIsStatic", null), t([ n.cache ], _, "_fieldIsThreadStatic", null), 725 | t([ n.cache ], _, "_fieldSetStaticValue", null), t([ n.cache ], _, "_free", null), 726 | t([ n.cache ], _, "_gcCollect", null), t([ n.cache ], _, "_gcCollectALittle", null), 727 | t([ n.cache ], _, "_gcDisable", null), t([ n.cache ], _, "_gcEnable", null), t([ n.cache ], _, "_gcGetHeapSize", null), 728 | t([ n.cache ], _, "_gcGetMaxTimeSlice", null), t([ n.cache ], _, "_gcGetUsedSize", null), 729 | t([ n.cache ], _, "_gcHandleGetTarget", null), t([ n.cache ], _, "_gcHandleFree", null), 730 | t([ n.cache ], _, "_gcHandleNew", null), t([ n.cache ], _, "_gcHandleNewWeakRef", null), 731 | t([ n.cache ], _, "_gcIsDisabled", null), t([ n.cache ], _, "_gcIsIncremental", null), 732 | t([ n.cache ], _, "_gcSetMaxTimeSlice", null), t([ n.cache ], _, "_gcStartIncrementalCollection", null), 733 | t([ n.cache ], _, "_gcStartWorld", null), t([ n.cache ], _, "_gcStopWorld", null), 734 | t([ n.cache ], _, "_getCorlib", null), t([ n.cache ], _, "_imageGetAssembly", null), 735 | t([ n.cache ], _, "_imageGetClass", null), t([ n.cache ], _, "_imageGetClassCount", null), 736 | t([ n.cache ], _, "_imageGetName", null), t([ n.cache ], _, "_init", null), t([ n.cache ], _, "_livenessAllocateStruct", null), 737 | t([ n.cache ], _, "_livenessCalculationBegin", null), t([ n.cache ], _, "_livenessCalculationEnd", null), 738 | t([ n.cache ], _, "_livenessCalculationFromStatics", null), t([ n.cache ], _, "_livenessFinalize", null), 739 | t([ n.cache ], _, "_livenessFreeStruct", null), t([ n.cache ], _, "_memorySnapshotCapture", null), 740 | t([ n.cache ], _, "_memorySnapshotFree", null), t([ n.cache ], _, "_memorySnapshotGetClasses", null), 741 | t([ n.cache ], _, "_memorySnapshotGetGCHandles", null), t([ n.cache ], _, "_memorySnapshotGetRuntimeInformation", null), 742 | t([ n.cache ], _, "_methodGetModifier", null), t([ n.cache ], _, "_methodGetClass", null), 743 | t([ n.cache ], _, "_methodGetFlags", null), t([ n.cache ], _, "_methodGetFromReflection", null), 744 | t([ n.cache ], _, "_methodGetName", null), t([ n.cache ], _, "_methodGetObject", null), 745 | t([ n.cache ], _, "_methodGetParameterCount", null), t([ n.cache ], _, "_methodGetParameterName", null), 746 | t([ n.cache ], _, "_methodGetParameters", null), t([ n.cache ], _, "_methodGetParameterType", null), 747 | t([ n.cache ], _, "_methodGetPointer", null), t([ n.cache ], _, "_methodGetReturnType", null), 748 | t([ n.cache ], _, "_methodIsExternal", null), t([ n.cache ], _, "_methodIsGeneric", null), 749 | t([ n.cache ], _, "_methodIsInflated", null), t([ n.cache ], _, "_methodIsInstance", null), 750 | t([ n.cache ], _, "_methodIsSynchronized", null), t([ n.cache ], _, "_monitorEnter", null), 751 | t([ n.cache ], _, "_monitorExit", null), t([ n.cache ], _, "_monitorPulse", null), 752 | t([ n.cache ], _, "_monitorPulseAll", null), t([ n.cache ], _, "_monitorTryEnter", null), 753 | t([ n.cache ], _, "_monitorTryWait", null), t([ n.cache ], _, "_monitorWait", null), 754 | t([ n.cache ], _, "_objectGetClass", null), t([ n.cache ], _, "_objectGetVirtualMethod", null), 755 | t([ n.cache ], _, "_objectInit", null), t([ n.cache ], _, "_objectNew", null), t([ n.cache ], _, "_objectGetSize", null), 756 | t([ n.cache ], _, "_objectUnbox", null), t([ n.cache ], _, "_resolveInternalCall", null), 757 | t([ n.cache ], _, "_stringChars", null), t([ n.cache ], _, "_stringLength", null), 758 | t([ n.cache ], _, "_stringNew", null), t([ n.cache ], _, "_stringSetLength", null), 759 | t([ n.cache ], _, "_valueBox", null), t([ n.cache ], _, "_threadAttach", null), 760 | t([ n.cache ], _, "_threadCurrent", null), t([ n.cache ], _, "_threadGetAllAttachedThreads", null), 761 | t([ n.cache ], _, "_threadIsVm", null), t([ n.cache ], _, "_threadDetach", null), 762 | t([ n.cache ], _, "_typeGetName", null), t([ n.cache ], _, "_typeGetObject", null), 763 | t([ n.cache ], _, "_typeGetTypeEnum", null), t([ n.cache ], _, "_typeIsByReference", null), 764 | t([ n.cache ], _, "_typeIsPrimitive", null), t([ n.cache ], _, "cModule", null), 765 | Il2Cpp.Api = _; 766 | 767 | },{"../utils/console":35,"decorator-cache-getter":6,"versioning":41}],9:[function(require,module,exports){ 768 | (function (setImmediate){(function (){ 769 | "use strict"; 770 | 771 | var e = this && this.__decorate || function(e, t, n, i) { 772 | var r, a = arguments.length, l = a < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, n) : i; 773 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) l = Reflect.decorate(e, t, n, i); else for (var o = e.length - 1; o >= 0; o--) (r = e[o]) && (l = (a < 3 ? r(l) : a > 3 ? r(t, n, l) : r(t, n)) || l); 774 | return a > 3 && l && Object.defineProperty(t, n, l), l; 775 | }, t = this && this.__importDefault || function(e) { 776 | return e && e.__esModule ? e : { 777 | default: e 778 | }; 779 | }; 780 | 781 | Object.defineProperty(exports, "__esModule", { 782 | value: !0 783 | }); 784 | 785 | const n = require("decorator-cache-getter"), i = t(require("versioning")), r = require("../utils/console"), a = require("../utils/native-wait"); 786 | 787 | class l { 788 | constructor() {} 789 | static get moduleName() { 790 | switch (Process.platform) { 791 | case "linux": 792 | try { 793 | Java.androidVersion; 794 | return "libil2cpp.so"; 795 | } catch (e) { 796 | return "GameAssembly.so"; 797 | } 798 | 799 | case "windows": 800 | return "GameAssembly.dll"; 801 | 802 | case "darwin": 803 | try { 804 | return "UnityFramework"; 805 | } catch (e) { 806 | return "GameAssembly.dylib"; 807 | } 808 | } 809 | (0, r.raise)(`${Process.platform} is not supported yet`); 810 | } 811 | static get applicationDataPath() { 812 | const e = this.internalCall("UnityEngine.Application::get_persistentDataPath", "pointer", []); 813 | return new Il2Cpp.String(e()).content; 814 | } 815 | static get applicationIdentifier() { 816 | const e = this.internalCall("UnityEngine.Application::get_identifier", "pointer", []) ?? this.internalCall("UnityEngine.Application::get_bundleIdentifier", "pointer", []); 817 | return e ? new Il2Cpp.String(e()).content : null; 818 | } 819 | static get applicationVersion() { 820 | const e = this.internalCall("UnityEngine.Application::get_version", "pointer", []); 821 | return e ? new Il2Cpp.String(e()).content : null; 822 | } 823 | static get attachedThreads() { 824 | null == Il2Cpp.currentThread && (0, r.raise)("only Il2Cpp threads can invoke Il2Cpp.attachedThreads"); 825 | const e = [], t = Memory.alloc(Process.pointerSize), n = Il2Cpp.Api._threadGetAllAttachedThreads(t), i = t.readInt(); 826 | for (let t = 0; t < i; t++) e.push(new Il2Cpp.Thread(n.add(t * Process.pointerSize).readPointer())); 827 | return e; 828 | } 829 | static get currentThread() { 830 | const e = Il2Cpp.Api._threadCurrent(); 831 | return e.isNull() ? null : new Il2Cpp.Thread(e); 832 | } 833 | static get module() { 834 | return Process.getModuleByName(this.moduleName); 835 | } 836 | static get unityVersion() { 837 | const e = this.internalCall("UnityEngine.Application::get_unityVersion", "pointer", []); 838 | return null == e && (0, r.raise)("couldn't determine the Unity version, please specify it manually"), 839 | new Il2Cpp.String(e()).content; 840 | } 841 | static get unityVersionIsBelow201830() { 842 | return i.default.lt(this.unityVersion, "2018.3.0"); 843 | } 844 | static alloc(e = Process.pointerSize) { 845 | return Il2Cpp.Api._alloc(e); 846 | } 847 | static dump(e, t) { 848 | e = e ?? `${Il2Cpp.applicationIdentifier ?? "unknown"}_${Il2Cpp.applicationVersion ?? "unknown"}.cs`; 849 | const n = `${t ?? Il2Cpp.applicationDataPath}/${e}`, i = new File(n, "w"); 850 | for (const e of Il2Cpp.Domain.assemblies) { 851 | (0, r.inform)(`dumping ${e.name}...`); 852 | for (const t of e.image.classes) i.write(`${t}\n\n`); 853 | } 854 | i.flush(), i.close(), (0, r.ok)(`dump saved to ${n}`); 855 | } 856 | static free(e) { 857 | return Il2Cpp.Api._free(e); 858 | } 859 | static async initialize() { 860 | if ("darwin" == Process.platform) { 861 | let e = Process.findModuleByAddress(Module.findExportByName(null, "il2cpp_init") ?? NULL)?.name; 862 | null == e && (e = await (0, a.forModule)("UnityFramework", "GameAssembly.dylib")), 863 | Reflect.defineProperty(Il2Cpp, "moduleName", { 864 | value: e 865 | }); 866 | } else await (0, a.forModule)(this.moduleName); 867 | Il2Cpp.Api._getCorlib().isNull() && await new Promise((e => { 868 | const t = Interceptor.attach(Il2Cpp.Api._init, { 869 | onLeave() { 870 | t.detach(), setImmediate(e); 871 | } 872 | }); 873 | })); 874 | } 875 | static installExceptionListener(e = "current") { 876 | const t = Process.getCurrentThreadId(); 877 | return Interceptor.attach(Il2Cpp.module.getExportByName("__cxa_throw"), (function(n) { 878 | "current" == e && this.threadId != t || (0, r.inform)(new Il2Cpp.Object(n[0].readPointer())); 879 | })); 880 | } 881 | static internalCall(e, t, n) { 882 | const i = Il2Cpp.Api._resolveInternalCall(Memory.allocUtf8String(e)); 883 | return i.isNull() ? null : new NativeFunction(i, t, n); 884 | } 885 | static scheduleOnInitializerThread(e) { 886 | return new Promise((t => { 887 | const n = Interceptor.attach(Il2Cpp.Api._threadCurrent, (() => { 888 | const i = Il2Cpp.currentThread?.id; 889 | if (null != i && i == Il2Cpp.attachedThreads[0].id) { 890 | n.detach(); 891 | const i = e(); 892 | setImmediate((() => t(i))); 893 | } 894 | })); 895 | })); 896 | } 897 | static async perform(e) { 898 | await this.initialize(); 899 | let t = this.currentThread; 900 | const n = null == t; 901 | null == t && (t = Il2Cpp.Domain.attach()); 902 | try { 903 | const t = e(); 904 | return t instanceof Promise ? await t : t; 905 | } catch (e) { 906 | throw globalThis.console.log(e), e; 907 | } finally { 908 | n && t.detach(); 909 | } 910 | } 911 | static trace() { 912 | return new Il2Cpp.Tracer; 913 | } 914 | } 915 | 916 | e([ n.cache ], l, "applicationDataPath", null), e([ n.cache ], l, "applicationIdentifier", null), 917 | e([ n.cache ], l, "applicationVersion", null), e([ n.cache ], l, "module", null), 918 | e([ n.cache ], l, "unityVersion", null), e([ n.cache ], l, "unityVersionIsBelow201830", null), 919 | Reflect.set(globalThis, "Il2Cpp", l); 920 | 921 | }).call(this)}).call(this,require("timers").setImmediate) 922 | },{"../utils/console":35,"../utils/native-wait":37,"decorator-cache-getter":6,"timers":40,"versioning":41}],10:[function(require,module,exports){ 923 | "use strict"; 924 | 925 | Object.defineProperty(exports, "__esModule", { 926 | value: !0 927 | }); 928 | 929 | class s { 930 | constructor() {} 931 | static Is(s) { 932 | return e => e instanceof Il2Cpp.Class ? s.isAssignableFrom(e) : s.isAssignableFrom(e.class); 933 | } 934 | static IsExactly(s) { 935 | return e => e instanceof Il2Cpp.Class ? e.equals(s) : e.class.equals(s); 936 | } 937 | } 938 | 939 | Il2Cpp.Filtering = s; 940 | 941 | },{}],11:[function(require,module,exports){ 942 | "use strict"; 943 | 944 | Object.defineProperty(exports, "__esModule", { 945 | value: !0 946 | }), require("./base"), require("./api"), require("./filtering"), require("./runtime"), 947 | require("./tracer"), require("./structs/array"), require("./structs/assembly"), 948 | require("./structs/class"), require("./structs/domain"), require("./structs/field"), 949 | require("./structs/gc"), require("./structs/gc-handle"), require("./structs/image"), 950 | require("./structs/memory-snapshot"), require("./structs/method"), require("./structs/object"), 951 | require("./structs/parameter"), require("./structs/pointer"), require("./structs/reference"), 952 | require("./structs/string"), require("./structs/thread"), require("./structs/type"), 953 | require("./structs/type-enum"), require("./structs/value-type"); 954 | 955 | },{"./api":8,"./base":9,"./filtering":10,"./runtime":12,"./structs/array":13,"./structs/assembly":14,"./structs/class":15,"./structs/domain":16,"./structs/field":17,"./structs/gc":19,"./structs/gc-handle":18,"./structs/image":20,"./structs/memory-snapshot":21,"./structs/method":22,"./structs/object":23,"./structs/parameter":24,"./structs/pointer":25,"./structs/reference":26,"./structs/string":27,"./structs/thread":28,"./structs/type":30,"./structs/type-enum":29,"./structs/value-type":31,"./tracer":32}],12:[function(require,module,exports){ 956 | "use strict"; 957 | 958 | var t = this && this.__decorate || function(t, e, r, o) { 959 | var i, n = arguments.length, a = n < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, r) : o; 960 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(t, e, r, o); else for (var c = t.length - 1; c >= 0; c--) (i = t[c]) && (a = (n < 3 ? i(a) : n > 3 ? i(e, r, a) : i(e, r)) || a); 961 | return n > 3 && a && Object.defineProperty(e, r, a), a; 962 | }; 963 | 964 | Object.defineProperty(exports, "__esModule", { 965 | value: !0 966 | }); 967 | 968 | const e = require("decorator-cache-getter"); 969 | 970 | class r { 971 | constructor() {} 972 | static get allocationGranularity() { 973 | return this.information[5]; 974 | } 975 | static get arrayHeaderSize() { 976 | return this.information[2]; 977 | } 978 | static get information() { 979 | const t = Il2Cpp.MemorySnapshot.capture(); 980 | try { 981 | return Il2Cpp.Api._memorySnapshotGetRuntimeInformation(t); 982 | } finally { 983 | Il2Cpp.Api._memorySnapshotFree(t); 984 | } 985 | } 986 | static get pointerSize() { 987 | return this.information[0]; 988 | } 989 | static get objectHeaderSize() { 990 | return this.information[1]; 991 | } 992 | } 993 | 994 | t([ e.cache ], r, "information", null), Il2Cpp.Runtime = r; 995 | 996 | },{"decorator-cache-getter":6}],13:[function(require,module,exports){ 997 | "use strict"; 998 | 999 | var e = this && this.__decorate || function(e, t, r, n) { 1000 | var l, s = arguments.length, i = s < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, r) : n; 1001 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, r, n); else for (var a = e.length - 1; a >= 0; a--) (l = e[a]) && (i = (s < 3 ? l(i) : s > 3 ? l(t, r, i) : l(t, r)) || i); 1002 | return s > 3 && i && Object.defineProperty(t, r, i), i; 1003 | }; 1004 | 1005 | Object.defineProperty(exports, "__esModule", { 1006 | value: !0 1007 | }); 1008 | 1009 | const t = require("decorator-cache-getter"), r = require("../../utils/console"), n = require("../../utils/native-struct"); 1010 | 1011 | class l extends n.NativeStruct { 1012 | static from(e, t) { 1013 | const r = "number" == typeof t ? t : t.length, n = new Il2Cpp.Array(Il2Cpp.Api._arrayNew(e, r)); 1014 | return Array.isArray(t) && n.elements.write(t), n; 1015 | } 1016 | get elements() { 1017 | return new Il2Cpp.Pointer(Il2Cpp.Api._arrayGetElements(this), this.elementType); 1018 | } 1019 | get elementSize() { 1020 | return this.elementType.class.arrayElementSize; 1021 | } 1022 | get elementType() { 1023 | return this.object.class.type.class.baseType; 1024 | } 1025 | get length() { 1026 | return Il2Cpp.Api._arrayGetLength(this); 1027 | } 1028 | get object() { 1029 | return new Il2Cpp.Object(this); 1030 | } 1031 | get(e) { 1032 | return (e < 0 || e >= this.length) && (0, r.raise)(`cannot get element at index ${e}: array length is ${this.length}`), 1033 | this.elements.get(e); 1034 | } 1035 | set(e, t) { 1036 | (e < 0 || e >= this.length) && (0, r.raise)(`cannot get element at index ${e}: array length is ${this.length}`), 1037 | this.elements.set(e, t); 1038 | } 1039 | toString() { 1040 | return this.isNull() ? "null" : `[${this.elements.read(this.length, 0)}]`; 1041 | } 1042 | * [Symbol.iterator]() { 1043 | for (let e = 0; e < this.length; e++) yield this.elements.get(e); 1044 | } 1045 | } 1046 | 1047 | e([ t.cache ], l.prototype, "elements", null), e([ t.cache ], l.prototype, "elementSize", null), 1048 | e([ t.cache ], l.prototype, "elementType", null), e([ t.cache ], l.prototype, "length", null), 1049 | e([ t.cache ], l.prototype, "object", null), Il2Cpp.Array = l; 1050 | 1051 | },{"../../utils/console":35,"../../utils/native-struct":36,"decorator-cache-getter":6}],14:[function(require,module,exports){ 1052 | "use strict"; 1053 | 1054 | var e = this && this.__decorate || function(e, t, r, l) { 1055 | var c, o = arguments.length, a = o < 3 ? t : null === l ? l = Object.getOwnPropertyDescriptor(t, r) : l; 1056 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, r, l); else for (var n = e.length - 1; n >= 0; n--) (c = e[n]) && (a = (o < 3 ? c(a) : o > 3 ? c(t, r, a) : c(t, r)) || a); 1057 | return o > 3 && a && Object.defineProperty(t, r, a), a; 1058 | }; 1059 | 1060 | Object.defineProperty(exports, "__esModule", { 1061 | value: !0 1062 | }); 1063 | 1064 | const t = require("decorator-cache-getter"), r = require("../../utils/native-struct"), l = require("../../utils/utils"); 1065 | 1066 | let c = class extends r.NonNullNativeStruct { 1067 | get image() { 1068 | return new Il2Cpp.Image(Il2Cpp.Api._assemblyGetImage(this)); 1069 | } 1070 | get name() { 1071 | return this.image.name.replace(".dll", ""); 1072 | } 1073 | get object() { 1074 | return Il2Cpp.Image.corlib.class("System.Reflection.Assembly").method("Load").invoke(Il2Cpp.String.from(this.name)); 1075 | } 1076 | }; 1077 | 1078 | e([ t.cache ], c.prototype, "image", null), e([ t.cache ], c.prototype, "name", null), 1079 | e([ t.cache ], c.prototype, "object", null), c = e([ l.cacheInstances ], c), Il2Cpp.Assembly = c; 1080 | 1081 | },{"../../utils/native-struct":36,"../../utils/utils":38,"decorator-cache-getter":6}],15:[function(require,module,exports){ 1082 | "use strict"; 1083 | 1084 | var e = this && this.__decorate || function(e, t, s, l) { 1085 | var r, a = arguments.length, n = a < 3 ? t : null === l ? l = Object.getOwnPropertyDescriptor(t, s) : l; 1086 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, t, s, l); else for (var p = e.length - 1; p >= 0; p--) (r = e[p]) && (n = (a < 3 ? r(n) : a > 3 ? r(t, s, n) : r(t, s)) || n); 1087 | return a > 3 && n && Object.defineProperty(t, s, n), n; 1088 | }; 1089 | 1090 | Object.defineProperty(exports, "__esModule", { 1091 | value: !0 1092 | }); 1093 | 1094 | const t = require("decorator-cache-getter"), s = require("../../utils/console"), l = require("../../utils/native-struct"), r = require("../../utils/utils"); 1095 | 1096 | let a = class extends l.NonNullNativeStruct { 1097 | get actualInstanceSize() { 1098 | return Il2Cpp.Api._classGetActualInstanceSize(this); 1099 | } 1100 | get arrayClass() { 1101 | return new Il2Cpp.Class(Il2Cpp.Api._classGetArrayClass(this, 1)); 1102 | } 1103 | get arrayElementSize() { 1104 | return Il2Cpp.Api._classGetArrayElementSize(this); 1105 | } 1106 | get assemblyName() { 1107 | return Il2Cpp.Api._classGetAssemblyName(this).readUtf8String(); 1108 | } 1109 | get declaringClass() { 1110 | const e = Il2Cpp.Api._classGetDeclaringType(this); 1111 | return e.isNull() ? null : new Il2Cpp.Class(e); 1112 | } 1113 | get baseType() { 1114 | const e = Il2Cpp.Api._classGetBaseType(this); 1115 | return e.isNull() ? null : new Il2Cpp.Type(e); 1116 | } 1117 | get elementClass() { 1118 | const e = Il2Cpp.Api._classGetElementClass(this); 1119 | return e.isNull() ? null : new Il2Cpp.Class(e); 1120 | } 1121 | get fields() { 1122 | return Array.from((0, r.nativeIterator)(this, Il2Cpp.Api._classGetFields, Il2Cpp.Field)); 1123 | } 1124 | get flags() { 1125 | return Il2Cpp.Api._classGetFlags(this); 1126 | } 1127 | get genericParameterCount() { 1128 | return this.isGeneric ? this.type.object.method("GetGenericArguments").invoke().length : 0; 1129 | } 1130 | get hasReferences() { 1131 | return !!Il2Cpp.Api._classHasReferences(this); 1132 | } 1133 | get hasStaticConstructor() { 1134 | const e = this.tryMethod(".cctor"); 1135 | return null != e && !e.virtualAddress.isNull(); 1136 | } 1137 | get image() { 1138 | return new Il2Cpp.Image(Il2Cpp.Api._classGetImage(this)); 1139 | } 1140 | get instanceSize() { 1141 | return Il2Cpp.Api._classGetInstanceSize(this); 1142 | } 1143 | get isAbstract() { 1144 | return !!Il2Cpp.Api._classIsAbstract(this); 1145 | } 1146 | get isBlittable() { 1147 | return !!Il2Cpp.Api._classIsBlittable(this); 1148 | } 1149 | get isEnum() { 1150 | return !!Il2Cpp.Api._classIsEnum(this); 1151 | } 1152 | get isGeneric() { 1153 | return !!Il2Cpp.Api._classIsGeneric(this); 1154 | } 1155 | get isInflated() { 1156 | return !!Il2Cpp.Api._classIsInflated(this); 1157 | } 1158 | get isInterface() { 1159 | return !!Il2Cpp.Api._classIsInterface(this); 1160 | } 1161 | get isValueType() { 1162 | return !!Il2Cpp.Api._classIsValueType(this); 1163 | } 1164 | get interfaces() { 1165 | return Array.from((0, r.nativeIterator)(this, Il2Cpp.Api._classGetInterfaces, Il2Cpp.Class)); 1166 | } 1167 | get methods() { 1168 | return Array.from((0, r.nativeIterator)(this, Il2Cpp.Api._classGetMethods, Il2Cpp.Method)); 1169 | } 1170 | get name() { 1171 | return Il2Cpp.Api._classGetName(this).readUtf8String(); 1172 | } 1173 | get namespace() { 1174 | return Il2Cpp.Api._classGetNamespace(this).readUtf8String(); 1175 | } 1176 | get nestedClasses() { 1177 | return Array.from((0, r.nativeIterator)(this, Il2Cpp.Api._classGetNestedClasses, Il2Cpp.Class)); 1178 | } 1179 | get parent() { 1180 | const e = Il2Cpp.Api._classGetParent(this); 1181 | return e.isNull() ? null : new Il2Cpp.Class(e); 1182 | } 1183 | get rank() { 1184 | return Il2Cpp.Api._classGetRank(this); 1185 | } 1186 | get staticFieldsData() { 1187 | return Il2Cpp.Api._classGetStaticFieldData(this); 1188 | } 1189 | get valueSize() { 1190 | return Il2Cpp.Api._classGetValueSize(this, NULL); 1191 | } 1192 | get type() { 1193 | return new Il2Cpp.Type(Il2Cpp.Api._classGetType(this)); 1194 | } 1195 | alloc() { 1196 | return new Il2Cpp.Object(Il2Cpp.Api._objectNew(this)); 1197 | } 1198 | field(e) { 1199 | return this.tryField(e); 1200 | } 1201 | inflate(...e) { 1202 | this.isGeneric || (0, s.raise)(`cannot inflate class ${this.type.name}: it has no generic parameters`), 1203 | this.genericParameterCount != e.length && (0, s.raise)(`cannot inflate class ${this.type.name}: it needs ${this.genericParameterCount} generic parameter(s), not ${e.length}`); 1204 | const t = e.map((e => e.type.object)), l = Il2Cpp.Array.from(Il2Cpp.Image.corlib.class("System.Type"), t), r = this.type.object.method("MakeGenericType", 1).invoke(l); 1205 | return new Il2Cpp.Class(Il2Cpp.Api._classFromSystemType(r)); 1206 | } 1207 | initialize() { 1208 | Il2Cpp.Api._classInit(this); 1209 | } 1210 | isAssignableFrom(e) { 1211 | return !!Il2Cpp.Api._classIsAssignableFrom(this, e); 1212 | } 1213 | isSubclassOf(e, t) { 1214 | return !!Il2Cpp.Api._classIsSubclassOf(this, e, +t); 1215 | } 1216 | method(e, t = -1) { 1217 | return this.tryMethod(e, t); 1218 | } 1219 | nested(e) { 1220 | return this.tryNested(e); 1221 | } 1222 | new() { 1223 | const e = this.alloc(), t = Memory.alloc(Process.pointerSize); 1224 | Il2Cpp.Api._objectInit(e, t); 1225 | const l = t.readPointer(); 1226 | return l.isNull() || (0, s.raise)(new Il2Cpp.Object(l).toString()), e; 1227 | } 1228 | tryField(e) { 1229 | const t = Il2Cpp.Api._classGetFieldFromName(this, Memory.allocUtf8String(e)); 1230 | return t.isNull() ? null : new Il2Cpp.Field(t); 1231 | } 1232 | tryMethod(e, t = -1) { 1233 | const s = Il2Cpp.Api._classGetMethodFromName(this, Memory.allocUtf8String(e), t); 1234 | return s.isNull() ? null : new Il2Cpp.Method(s); 1235 | } 1236 | tryNested(e) { 1237 | return this.nestedClasses.find((t => t.name == e)); 1238 | } 1239 | toString() { 1240 | const e = [ this.parent ].concat(this.interfaces); 1241 | return `// ${this.assemblyName}\n${this.isEnum ? "enum" : this.isValueType ? "struct" : this.isInterface ? "interface" : "class"} ${this.type.name}${e ? ` : ${e.map((e => e?.type.name)).join(", ")}` : ""}\n{\n ${this.fields.join("\n ")}\n ${this.methods.join("\n ")}\n}`; 1242 | } 1243 | static enumerate(e) { 1244 | const t = new NativeCallback((function(t, s) { 1245 | e(new Il2Cpp.Class(t)); 1246 | }), "void", [ "pointer", "pointer" ]); 1247 | return Il2Cpp.Api._classForEach(t, NULL); 1248 | } 1249 | }; 1250 | 1251 | e([ t.cache ], a.prototype, "actualInstanceSize", null), e([ t.cache ], a.prototype, "arrayClass", null), 1252 | e([ t.cache ], a.prototype, "arrayElementSize", null), e([ t.cache ], a.prototype, "assemblyName", null), 1253 | e([ t.cache ], a.prototype, "declaringClass", null), e([ t.cache ], a.prototype, "baseType", null), 1254 | e([ t.cache ], a.prototype, "elementClass", null), e([ t.cache ], a.prototype, "fields", null), 1255 | e([ t.cache ], a.prototype, "flags", null), e([ t.cache ], a.prototype, "genericParameterCount", null), 1256 | e([ t.cache ], a.prototype, "hasReferences", null), e([ t.cache ], a.prototype, "hasStaticConstructor", null), 1257 | e([ t.cache ], a.prototype, "image", null), e([ t.cache ], a.prototype, "instanceSize", null), 1258 | e([ t.cache ], a.prototype, "isAbstract", null), e([ t.cache ], a.prototype, "isBlittable", null), 1259 | e([ t.cache ], a.prototype, "isEnum", null), e([ t.cache ], a.prototype, "isGeneric", null), 1260 | e([ t.cache ], a.prototype, "isInflated", null), e([ t.cache ], a.prototype, "isInterface", null), 1261 | e([ t.cache ], a.prototype, "isValueType", null), e([ t.cache ], a.prototype, "interfaces", null), 1262 | e([ t.cache ], a.prototype, "methods", null), e([ t.cache ], a.prototype, "name", null), 1263 | e([ t.cache ], a.prototype, "namespace", null), e([ t.cache ], a.prototype, "nestedClasses", null), 1264 | e([ t.cache ], a.prototype, "parent", null), e([ t.cache ], a.prototype, "rank", null), 1265 | e([ t.cache ], a.prototype, "staticFieldsData", null), e([ t.cache ], a.prototype, "valueSize", null), 1266 | e([ t.cache ], a.prototype, "type", null), e([ (0, r.levenshtein)("fields") ], a.prototype, "field", null), 1267 | e([ (0, r.levenshtein)("methods") ], a.prototype, "method", null), e([ (0, r.levenshtein)("nestedClasses") ], a.prototype, "nested", null), 1268 | a = e([ r.cacheInstances ], a), Il2Cpp.Class = a; 1269 | 1270 | },{"../../utils/console":35,"../../utils/native-struct":36,"../../utils/utils":38,"decorator-cache-getter":6}],16:[function(require,module,exports){ 1271 | "use strict"; 1272 | 1273 | var e = this && this.__decorate || function(e, t, s, r) { 1274 | var l, n = arguments.length, o = n < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, s) : r; 1275 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(e, t, s, r); else for (var i = e.length - 1; i >= 0; i--) (l = e[i]) && (o = (n < 3 ? l(o) : n > 3 ? l(t, s, o) : l(t, s)) || o); 1276 | return n > 3 && o && Object.defineProperty(t, s, o), o; 1277 | }; 1278 | 1279 | Object.defineProperty(exports, "__esModule", { 1280 | value: !0 1281 | }); 1282 | 1283 | const t = require("decorator-cache-getter"), s = require("../../utils/utils"); 1284 | 1285 | class r { 1286 | constructor() {} 1287 | static get assemblies() { 1288 | const e = Memory.alloc(Process.pointerSize), t = Il2Cpp.Api._domainGetAssemblies(this, e), s = e.readInt(), r = new Array(s); 1289 | for (let e = 0; e < s; e++) r[e] = new Il2Cpp.Assembly(t.add(e * Process.pointerSize).readPointer()); 1290 | if (0 == s) for (const e of this.object.method("GetAssemblies").overload().invoke()) { 1291 | const t = e.method("GetSimpleName").invoke().content; 1292 | null != t && r.push(this.assembly(t)); 1293 | } 1294 | return r; 1295 | } 1296 | static get handle() { 1297 | return Il2Cpp.Api._domainGet(); 1298 | } 1299 | static get object() { 1300 | return Il2Cpp.Image.corlib.class("System.AppDomain").method("get_CurrentDomain").invoke(); 1301 | } 1302 | static assembly(e) { 1303 | return this.tryAssembly(e); 1304 | } 1305 | static attach() { 1306 | return new Il2Cpp.Thread(Il2Cpp.Api._threadAttach(this)); 1307 | } 1308 | static tryAssembly(e) { 1309 | const t = Il2Cpp.Api._domainAssemblyOpen(this, Memory.allocUtf8String(e)); 1310 | return t.isNull() ? null : new Il2Cpp.Assembly(t); 1311 | } 1312 | } 1313 | 1314 | e([ t.cache ], r, "assemblies", null), e([ t.cache ], r, "handle", null), e([ t.cache ], r, "object", null), 1315 | e([ (0, s.levenshtein)("assemblies") ], r, "assembly", null), Il2Cpp.Domain = r; 1316 | 1317 | },{"../../utils/utils":38,"decorator-cache-getter":6}],17:[function(require,module,exports){ 1318 | "use strict"; 1319 | 1320 | var e = this && this.__decorate || function(e, t, i, r) { 1321 | var l, s = arguments.length, a = s < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, i) : r; 1322 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, i, r); else for (var p = e.length - 1; p >= 0; p--) (l = e[p]) && (a = (s < 3 ? l(a) : s > 3 ? l(t, i, a) : l(t, i)) || a); 1323 | return s > 3 && a && Object.defineProperty(t, i, a), a; 1324 | }; 1325 | 1326 | Object.defineProperty(exports, "__esModule", { 1327 | value: !0 1328 | }); 1329 | 1330 | const t = require("decorator-cache-getter"), i = require("../../utils/console"), r = require("../../utils/native-struct"), l = require("../utils"); 1331 | 1332 | class s extends r.NonNullNativeStruct { 1333 | get class() { 1334 | return new Il2Cpp.Class(Il2Cpp.Api._fieldGetClass(this)); 1335 | } 1336 | get flags() { 1337 | return Il2Cpp.Api._fieldGetFlags(this); 1338 | } 1339 | get isLiteral() { 1340 | return !!Il2Cpp.Api._fieldIsLiteral(this); 1341 | } 1342 | get isStatic() { 1343 | return !!Il2Cpp.Api._fieldIsStatic(this); 1344 | } 1345 | get isThreadStatic() { 1346 | return !!Il2Cpp.Api._fieldIsThreadStatic(this); 1347 | } 1348 | get modifier() { 1349 | return Il2Cpp.Api._fieldGetModifier(this).readUtf8String(); 1350 | } 1351 | get name() { 1352 | return Il2Cpp.Api._fieldGetName(this).readUtf8String(); 1353 | } 1354 | get offset() { 1355 | return Il2Cpp.Api._fieldGetOffset(this); 1356 | } 1357 | get type() { 1358 | return new Il2Cpp.Type(Il2Cpp.Api._fieldGetType(this)); 1359 | } 1360 | get value() { 1361 | const e = Memory.alloc(Process.pointerSize); 1362 | return Il2Cpp.Api._fieldGetStaticValue(this.handle, e), (0, l.read)(e, this.type); 1363 | } 1364 | set value(e) { 1365 | (this.isThreadStatic || this.isLiteral) && (0, i.raise)(`cannot modify the value of field ${this.name}: is thread static or literal`); 1366 | const t = Memory.alloc(Process.pointerSize); 1367 | (0, l.write)(t, e, this.type), Il2Cpp.Api._fieldSetStaticValue(this.handle, t); 1368 | } 1369 | toString() { 1370 | return `${this.isThreadStatic ? "[ThreadStatic] " : ""}${this.isStatic ? "static " : ""}${this.type.name} ${this.name}${this.isLiteral ? ` = ${this.type.class.isEnum ? (0, 1371 | l.read)(this.value.handle, this.type.class.baseType) : this.value}` : ""};${this.isThreadStatic || this.isLiteral ? "" : ` // 0x${this.offset.toString(16)}`}`; 1372 | } 1373 | withHolder(e) { 1374 | let t = e.handle.add(this.offset); 1375 | return e instanceof Il2Cpp.ValueType && (t = t.sub(Il2Cpp.Runtime.objectHeaderSize)), 1376 | new Proxy(this, { 1377 | get: (e, i) => "value" == i ? (0, l.read)(t, e.type) : Reflect.get(e, i), 1378 | set: (e, i, r) => "value" == i ? ((0, l.write)(t, r, e.type), !0) : Reflect.set(e, i, r) 1379 | }); 1380 | } 1381 | } 1382 | 1383 | e([ t.cache ], s.prototype, "class", null), e([ t.cache ], s.prototype, "flags", null), 1384 | e([ t.cache ], s.prototype, "isLiteral", null), e([ t.cache ], s.prototype, "isStatic", null), 1385 | e([ t.cache ], s.prototype, "isThreadStatic", null), e([ t.cache ], s.prototype, "name", null), 1386 | e([ t.cache ], s.prototype, "offset", null), e([ t.cache ], s.prototype, "type", null), 1387 | Reflect.set(Il2Cpp, "Field", s); 1388 | 1389 | },{"../../utils/console":35,"../../utils/native-struct":36,"../utils":33,"decorator-cache-getter":6}],18:[function(require,module,exports){ 1390 | "use strict"; 1391 | 1392 | Object.defineProperty(exports, "__esModule", { 1393 | value: !0 1394 | }); 1395 | 1396 | class e { 1397 | handle; 1398 | constructor(e) { 1399 | this.handle = e; 1400 | } 1401 | get target() { 1402 | const e = Il2Cpp.Api._gcHandleGetTarget(this.handle); 1403 | return e.isNull() ? null : new Il2Cpp.Object(e); 1404 | } 1405 | free() { 1406 | return Il2Cpp.Api._gcHandleFree(this.handle); 1407 | } 1408 | } 1409 | 1410 | Il2Cpp.GC.Handle = e; 1411 | 1412 | },{}],19:[function(require,module,exports){ 1413 | "use strict"; 1414 | 1415 | var e = this && this.__importDefault || function(e) { 1416 | return e && e.__esModule ? e : { 1417 | default: e 1418 | }; 1419 | }; 1420 | 1421 | Object.defineProperty(exports, "__esModule", { 1422 | value: !0 1423 | }); 1424 | 1425 | const t = e(require("versioning")); 1426 | 1427 | class i { 1428 | constructor() {} 1429 | static get heapSize() { 1430 | return Il2Cpp.Api._gcGetHeapSize(); 1431 | } 1432 | static get isEnabled() { 1433 | return !Il2Cpp.Api._gcIsDisabled(); 1434 | } 1435 | static get isIncremental() { 1436 | return !!Il2Cpp.Api._gcIsIncremental(); 1437 | } 1438 | static get maxTimeSlice() { 1439 | return Il2Cpp.Api._gcGetMaxTimeSlice(); 1440 | } 1441 | static get usedHeapSize() { 1442 | return Il2Cpp.Api._gcGetUsedSize(); 1443 | } 1444 | static set isEnabled(e) { 1445 | e ? Il2Cpp.Api._gcEnable() : Il2Cpp.Api._gcDisable(); 1446 | } 1447 | static set maxTimeSlice(e) { 1448 | Il2Cpp.Api._gcSetMaxTimeSlice(e); 1449 | } 1450 | static choose(e) { 1451 | const i = [], l = new NativeCallback(((e, t, l) => { 1452 | for (let l = 0; l < t; l++) i.push(new Il2Cpp.Object(e.add(l * Process.pointerSize).readPointer())); 1453 | }), "void", [ "pointer", "int", "pointer" ]); 1454 | if (t.default.gte(Il2Cpp.unityVersion, "2021.2.0")) { 1455 | const t = new NativeCallback(((e, t) => e.isNull() || 0 != t.compare(0) ? Il2Cpp.alloc(t) : (Il2Cpp.free(e), 1456 | NULL)), "pointer", [ "pointer", "size_t", "pointer" ]), i = Il2Cpp.Api._livenessAllocateStruct(e.handle, 0, l, NULL, t); 1457 | Il2Cpp.Api._livenessCalculationFromStatics(i), Il2Cpp.Api._livenessFinalize(i), 1458 | Il2Cpp.Api._livenessFreeStruct(i); 1459 | } else { 1460 | const t = new NativeCallback((() => {}), "void", []), i = Il2Cpp.Api._livenessCalculationBegin(e.handle, 0, l, NULL, t, t); 1461 | Il2Cpp.Api._livenessCalculationFromStatics(i), Il2Cpp.Api._livenessCalculationEnd(i); 1462 | } 1463 | return i; 1464 | } 1465 | static collect(e) { 1466 | Il2Cpp.Api._gcCollect(e < 0 ? 0 : e > 2 ? 2 : e); 1467 | } 1468 | static collectALittle() { 1469 | Il2Cpp.Api._gcCollectALittle(); 1470 | } 1471 | static startWorld() { 1472 | return Il2Cpp.Api._gcStartWorld(); 1473 | } 1474 | static startIncrementalCollection() { 1475 | return Il2Cpp.Api._gcStartIncrementalCollection(); 1476 | } 1477 | static stopWorld() { 1478 | return Il2Cpp.Api._gcStopWorld(); 1479 | } 1480 | } 1481 | 1482 | Reflect.set(Il2Cpp, "GC", i); 1483 | 1484 | },{"versioning":41}],20:[function(require,module,exports){ 1485 | "use strict"; 1486 | 1487 | var e = this && this.__decorate || function(e, t, s, l) { 1488 | var r, a = arguments.length, n = a < 3 ? t : null === l ? l = Object.getOwnPropertyDescriptor(t, s) : l; 1489 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, t, s, l); else for (var p = e.length - 1; p >= 0; p--) (r = e[p]) && (n = (a < 3 ? r(n) : a > 3 ? r(t, s, n) : r(t, s)) || n); 1490 | return a > 3 && n && Object.defineProperty(t, s, n), n; 1491 | }; 1492 | 1493 | Object.defineProperty(exports, "__esModule", { 1494 | value: !0 1495 | }); 1496 | 1497 | const t = require("decorator-cache-getter"), s = require("../../utils/native-struct"), l = require("../../utils/utils"); 1498 | 1499 | let r = class extends s.NonNullNativeStruct { 1500 | static get corlib() { 1501 | return new Il2Cpp.Image(Il2Cpp.Api._getCorlib()); 1502 | } 1503 | get assembly() { 1504 | return new Il2Cpp.Assembly(Il2Cpp.Api._imageGetAssembly(this)); 1505 | } 1506 | get classCount() { 1507 | return Il2Cpp.Api._imageGetClassCount(this); 1508 | } 1509 | get classes() { 1510 | if (Il2Cpp.unityVersionIsBelow201830) { 1511 | const e = this.assembly.object.method("GetTypes").invoke(!1); 1512 | return Array.from(e).map((e => new Il2Cpp.Class(Il2Cpp.Api._classFromSystemType(e)))); 1513 | } 1514 | return Array.from(Array(this.classCount), ((e, t) => new Il2Cpp.Class(Il2Cpp.Api._imageGetClass(this, t)))); 1515 | } 1516 | get name() { 1517 | return Il2Cpp.Api._imageGetName(this).readUtf8String(); 1518 | } 1519 | class(e) { 1520 | return this.tryClass(e); 1521 | } 1522 | tryClass(e) { 1523 | const t = e.lastIndexOf("."), s = Memory.allocUtf8String(-1 == t ? "" : e.slice(0, t)), l = Memory.allocUtf8String(e.slice(t + 1)), r = Il2Cpp.Api._classFromName(this, s, l); 1524 | return r.isNull() ? null : new Il2Cpp.Class(r); 1525 | } 1526 | }; 1527 | 1528 | e([ t.cache ], r.prototype, "assembly", null), e([ t.cache ], r.prototype, "classCount", null), 1529 | e([ t.cache ], r.prototype, "classes", null), e([ t.cache ], r.prototype, "name", null), 1530 | e([ (0, l.levenshtein)("classes", (e => e.namespace ? `${e.namespace}.${e.name}` : e.name)) ], r.prototype, "class", null), 1531 | e([ t.cache ], r, "corlib", null), r = e([ l.cacheInstances ], r), Il2Cpp.Image = r; 1532 | 1533 | },{"../../utils/native-struct":36,"../../utils/utils":38,"decorator-cache-getter":6}],21:[function(require,module,exports){ 1534 | "use strict"; 1535 | 1536 | var e = this && this.__decorate || function(e, t, r, o) { 1537 | var s, p = arguments.length, c = p < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, r) : o; 1538 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) c = Reflect.decorate(e, t, r, o); else for (var l = e.length - 1; l >= 0; l--) (s = e[l]) && (c = (p < 3 ? s(c) : p > 3 ? s(t, r, c) : s(t, r)) || c); 1539 | return p > 3 && c && Object.defineProperty(t, r, c), c; 1540 | }; 1541 | 1542 | Object.defineProperty(exports, "__esModule", { 1543 | value: !0 1544 | }); 1545 | 1546 | const t = require("decorator-cache-getter"), r = require("../../utils/native-struct"), o = require("../../utils/utils"); 1547 | 1548 | class s extends r.NonNullNativeStruct { 1549 | static capture() { 1550 | return new Il2Cpp.MemorySnapshot; 1551 | } 1552 | constructor(e = Il2Cpp.Api._memorySnapshotCapture()) { 1553 | super(e); 1554 | } 1555 | get classes() { 1556 | return Array.from((0, o.nativeIterator)(this, Il2Cpp.Api._memorySnapshotGetClasses, Il2Cpp.Class)); 1557 | } 1558 | get objects() { 1559 | const e = [], [t, r] = Il2Cpp.Api._memorySnapshotGetGCHandles(this); 1560 | for (let o = 0; o < t; o++) e.push(new Il2Cpp.Object(r.add(o * Process.pointerSize).readPointer())); 1561 | return e; 1562 | } 1563 | free() { 1564 | Il2Cpp.Api._memorySnapshotFree(this); 1565 | } 1566 | } 1567 | 1568 | e([ t.cache ], s.prototype, "classes", null), e([ t.cache ], s.prototype, "objects", null), 1569 | Il2Cpp.MemorySnapshot = s; 1570 | 1571 | },{"../../utils/native-struct":36,"../../utils/utils":38,"decorator-cache-getter":6}],22:[function(require,module,exports){ 1572 | "use strict"; 1573 | 1574 | var e = this && this.__decorate || function(e, t, r, a) { 1575 | var i, n = arguments.length, s = n < 3 ? t : null === a ? a = Object.getOwnPropertyDescriptor(t, r) : a; 1576 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, r, a); else for (var o = e.length - 1; o >= 0; o--) (i = e[o]) && (s = (n < 3 ? i(s) : n > 3 ? i(t, r, s) : i(t, r)) || s); 1577 | return n > 3 && s && Object.defineProperty(t, r, s), s; 1578 | }; 1579 | 1580 | Object.defineProperty(exports, "__esModule", { 1581 | value: !0 1582 | }); 1583 | 1584 | const t = require("decorator-cache-getter"), r = require("../../utils/console"), a = require("../../utils/native-struct"), i = require("../../utils/utils"), n = require("../utils"); 1585 | 1586 | class s extends a.NonNullNativeStruct { 1587 | get class() { 1588 | return new Il2Cpp.Class(Il2Cpp.Api._methodGetClass(this)); 1589 | } 1590 | get flags() { 1591 | return Il2Cpp.Api._methodGetFlags(this, NULL); 1592 | } 1593 | get implementationFlags() { 1594 | const e = Memory.alloc(Process.pointerSize); 1595 | return Il2Cpp.Api._methodGetFlags(this, e), e.readU32(); 1596 | } 1597 | get fridaSignature() { 1598 | const e = []; 1599 | for (const t of this.parameters) e.push(t.type.fridaAlias); 1600 | return this.isStatic && !Il2Cpp.unityVersionIsBelow201830 || e.unshift("pointer"), 1601 | this.isInflated && e.push("pointer"), e; 1602 | } 1603 | get genericParameterCount() { 1604 | return this.isGeneric ? this.object.method("GetGenericArguments").invoke().length : 0; 1605 | } 1606 | get isExternal() { 1607 | return !!Il2Cpp.Api._methodIsExternal(this); 1608 | } 1609 | get isGeneric() { 1610 | return !!Il2Cpp.Api._methodIsGeneric(this); 1611 | } 1612 | get isInflated() { 1613 | return !!Il2Cpp.Api._methodIsInflated(this); 1614 | } 1615 | get isStatic() { 1616 | return !Il2Cpp.Api._methodIsInstance(this); 1617 | } 1618 | get isSynchronized() { 1619 | return !!Il2Cpp.Api._methodIsSynchronized(this); 1620 | } 1621 | get modifier() { 1622 | return Il2Cpp.Api._methodGetModifier(this).readUtf8String(); 1623 | } 1624 | get name() { 1625 | return Il2Cpp.Api._methodGetName(this).readUtf8String(); 1626 | } 1627 | get nativeFunction() { 1628 | return new NativeFunction(this.virtualAddress, this.returnType.fridaAlias, this.fridaSignature); 1629 | } 1630 | get object() { 1631 | return new Il2Cpp.Object(Il2Cpp.Api._methodGetObject(this, NULL)); 1632 | } 1633 | get parameterCount() { 1634 | return Il2Cpp.Api._methodGetParameterCount(this); 1635 | } 1636 | get parameters() { 1637 | return Array.from(Array(this.parameterCount), ((e, t) => { 1638 | const r = Il2Cpp.Api._methodGetParameterName(this, t).readUtf8String(), a = Il2Cpp.Api._methodGetParameterType(this, t); 1639 | return new Il2Cpp.Parameter(r, t, new Il2Cpp.Type(a)); 1640 | })); 1641 | } 1642 | get relativeVirtualAddress() { 1643 | return this.virtualAddress.sub(Il2Cpp.module.base); 1644 | } 1645 | get returnType() { 1646 | return new Il2Cpp.Type(Il2Cpp.Api._methodGetReturnType(this)); 1647 | } 1648 | get virtualAddress() { 1649 | return Il2Cpp.Api._methodGetPointer(this); 1650 | } 1651 | set implementation(e) { 1652 | const t = +!this.isStatic | +Il2Cpp.unityVersionIsBelow201830, a = (...r) => { 1653 | const a = this.parameters.map(((e, a) => (0, n.fromFridaValue)(r[a + t], e.type))); 1654 | return (0, n.toFridaValue)(e.call(this.isStatic ? this.class : new Il2Cpp.Object(r[0]), ...a)); 1655 | }; 1656 | try { 1657 | Interceptor.replace(this.virtualAddress, new NativeCallback(a, this.returnType.fridaAlias, this.fridaSignature)); 1658 | } catch (e) { 1659 | switch (e.message) { 1660 | case "access violation accessing 0x0": 1661 | (0, r.raise)(`cannot implement method ${this.name}: it has a NULL virtual address`); 1662 | 1663 | case `unable to intercept function at ${this.virtualAddress}; please file a bug`: 1664 | (0, r.warn)(`cannot implement method ${this.name}: it may be a thunk`); 1665 | break; 1666 | 1667 | case "already replaced this function": 1668 | (0, r.warn)(`cannot implement method ${this.name}: already replaced by a thunk`); 1669 | break; 1670 | 1671 | default: 1672 | throw e; 1673 | } 1674 | } 1675 | } 1676 | inflate(...e) { 1677 | this.isGeneric || (0, r.raise)(`cannot inflate method ${this.name}: it has no generic parameters`), 1678 | this.genericParameterCount != e.length && (0, r.raise)(`cannot inflate method ${this.name}: it needs ${this.genericParameterCount} generic parameter(s), not ${e.length}`); 1679 | const t = e.map((e => e.type.object)), a = Il2Cpp.Array.from(Il2Cpp.Image.corlib.class("System.Type"), t), i = this.object.method("MakeGenericMethod", 1).invoke(a); 1680 | return new Il2Cpp.Method(Il2Cpp.Api._methodGetFromReflection(i)); 1681 | } 1682 | invoke(...e) { 1683 | return this.isStatic || (0, r.raise)(`cannot invoke a non-static method ${this.name}: must be invoked throught a Il2Cpp.Object, not a Il2Cpp.Class`), 1684 | this.invokeRaw(NULL, ...e); 1685 | } 1686 | invokeRaw(e, ...t) { 1687 | const a = t.map(n.toFridaValue); 1688 | this.isStatic && !Il2Cpp.unityVersionIsBelow201830 || a.unshift(e), this.isInflated && a.push(this.handle); 1689 | try { 1690 | const e = this.nativeFunction(...a); 1691 | return (0, n.fromFridaValue)(e, this.returnType); 1692 | } catch (e) { 1693 | switch (null == e && (0, r.raise)("an unexpected native function exception occurred, this is due to parameter types mismatch"), 1694 | e.message) { 1695 | case "bad argument count": 1696 | (0, r.raise)(`cannot invoke method ${this.name}: it needs ${this.parameterCount} parameter(s), not ${t.length}`); 1697 | 1698 | case "expected a pointer": 1699 | case "expected number": 1700 | case "expected array with fields": 1701 | (0, r.raise)(`cannot invoke method ${this.name}: parameter types mismatch`); 1702 | } 1703 | throw e; 1704 | } 1705 | } 1706 | overload(...e) { 1707 | const t = this.tryOverload(...e); 1708 | if (null != t) return t; 1709 | (0, r.raise)(`cannot find overloaded method ${this.name}(${e})`); 1710 | } 1711 | parameter(e) { 1712 | return this.tryParameter(e); 1713 | } 1714 | revert() { 1715 | Interceptor.revert(this.virtualAddress), Interceptor.flush(); 1716 | } 1717 | tryOverload(...e) { 1718 | return this.class.methods.find((t => t.name == this.name && t.parameterCount == e.length && t.parameters.every(((t, r) => t.type.name == e[r])))); 1719 | } 1720 | tryParameter(e) { 1721 | return this.parameters.find((t => t.name == e)); 1722 | } 1723 | toString() { 1724 | return `${this.isStatic ? "static " : ""}${this.returnType.name} ${this.name}(${this.parameters.join(", ")});${this.virtualAddress.isNull() ? "" : ` // 0x${this.relativeVirtualAddress.toString(16).padStart(8, "0")}`}`; 1725 | } 1726 | withHolder(e) { 1727 | return new Proxy(this, { 1728 | get(t, r) { 1729 | switch (r) { 1730 | case "invoke": 1731 | return t.invokeRaw.bind(t, e.handle); 1732 | 1733 | case "inflate": 1734 | case "overload": 1735 | case "tryOverload": 1736 | return function(...a) { 1737 | return t[r](...a)?.withHolder(e); 1738 | }; 1739 | } 1740 | return Reflect.get(t, r); 1741 | } 1742 | }); 1743 | } 1744 | } 1745 | 1746 | e([ t.cache ], s.prototype, "class", null), e([ t.cache ], s.prototype, "flags", null), 1747 | e([ t.cache ], s.prototype, "implementationFlags", null), e([ t.cache ], s.prototype, "fridaSignature", null), 1748 | e([ t.cache ], s.prototype, "genericParameterCount", null), e([ t.cache ], s.prototype, "isExternal", null), 1749 | e([ t.cache ], s.prototype, "isGeneric", null), e([ t.cache ], s.prototype, "isInflated", null), 1750 | e([ t.cache ], s.prototype, "isStatic", null), e([ t.cache ], s.prototype, "isSynchronized", null), 1751 | e([ t.cache ], s.prototype, "name", null), e([ t.cache ], s.prototype, "nativeFunction", null), 1752 | e([ t.cache ], s.prototype, "object", null), e([ t.cache ], s.prototype, "parameterCount", null), 1753 | e([ t.cache ], s.prototype, "parameters", null), e([ t.cache ], s.prototype, "relativeVirtualAddress", null), 1754 | e([ t.cache ], s.prototype, "returnType", null), e([ t.cache ], s.prototype, "virtualAddress", null), 1755 | e([ (0, i.levenshtein)("parameters") ], s.prototype, "parameter", null), Reflect.set(Il2Cpp, "Method", s); 1756 | 1757 | },{"../../utils/console":35,"../../utils/native-struct":36,"../../utils/utils":38,"../utils":33,"decorator-cache-getter":6}],23:[function(require,module,exports){ 1758 | "use strict"; 1759 | 1760 | var t = this && this.__decorate || function(t, e, r, i) { 1761 | var l, p = arguments.length, s = p < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, r) : i; 1762 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(t, e, r, i); else for (var n = t.length - 1; n >= 0; n--) (l = t[n]) && (s = (p < 3 ? l(s) : p > 3 ? l(e, r, s) : l(e, r)) || s); 1763 | return p > 3 && s && Object.defineProperty(e, r, s), s; 1764 | }; 1765 | 1766 | Object.defineProperty(exports, "__esModule", { 1767 | value: !0 1768 | }); 1769 | 1770 | const e = require("decorator-cache-getter"), r = require("../../utils/native-struct"); 1771 | 1772 | class i extends r.NativeStruct { 1773 | get class() { 1774 | return new Il2Cpp.Class(Il2Cpp.Api._objectGetClass(this)); 1775 | } 1776 | get size() { 1777 | return Il2Cpp.Api._objectGetSize(this); 1778 | } 1779 | enter() { 1780 | return Il2Cpp.Api._monitorEnter(this); 1781 | } 1782 | exit() { 1783 | return Il2Cpp.Api._monitorExit(this); 1784 | } 1785 | field(t) { 1786 | return this.class.field(t).withHolder(this); 1787 | } 1788 | method(t, e = -1) { 1789 | return this.class.method(t, e).withHolder(this); 1790 | } 1791 | pulse() { 1792 | return Il2Cpp.Api._monitorPulse(this); 1793 | } 1794 | pulseAll() { 1795 | return Il2Cpp.Api._monitorPulseAll(this); 1796 | } 1797 | ref(t) { 1798 | return new Il2Cpp.GC.Handle(Il2Cpp.Api._gcHandleNew(this, +t)); 1799 | } 1800 | virtualMethod(t) { 1801 | return new Il2Cpp.Method(Il2Cpp.Api._objectGetVirtualMethod(this, t)).withHolder(this); 1802 | } 1803 | tryEnter(t) { 1804 | return !!Il2Cpp.Api._monitorTryEnter(this, t); 1805 | } 1806 | tryField(t) { 1807 | return this.class.tryField(t)?.withHolder(this); 1808 | } 1809 | tryMethod(t, e = -1) { 1810 | return this.class.tryMethod(t, e)?.withHolder(this); 1811 | } 1812 | tryWait(t) { 1813 | return !!Il2Cpp.Api._monitorTryWait(this, t); 1814 | } 1815 | toString() { 1816 | return this.isNull() ? "null" : this.method("ToString").invoke().content ?? "null"; 1817 | } 1818 | unbox() { 1819 | return new Il2Cpp.ValueType(Il2Cpp.Api._objectUnbox(this), this.class.type); 1820 | } 1821 | wait() { 1822 | return Il2Cpp.Api._monitorWait(this); 1823 | } 1824 | weakRef(t) { 1825 | return new Il2Cpp.GC.Handle(Il2Cpp.Api._gcHandleNewWeakRef(this, +t)); 1826 | } 1827 | } 1828 | 1829 | t([ e.cache ], i.prototype, "class", null), t([ e.cache ], i.prototype, "size", null), 1830 | Il2Cpp.Object = i; 1831 | 1832 | },{"../../utils/native-struct":36,"decorator-cache-getter":6}],24:[function(require,module,exports){ 1833 | "use strict"; 1834 | 1835 | Object.defineProperty(exports, "__esModule", { 1836 | value: !0 1837 | }); 1838 | 1839 | class t { 1840 | name; 1841 | position; 1842 | type; 1843 | constructor(t, e, s) { 1844 | this.name = t, this.position = e, this.type = s; 1845 | } 1846 | toString() { 1847 | return `${this.type.name} ${this.name}`; 1848 | } 1849 | } 1850 | 1851 | Il2Cpp.Parameter = t; 1852 | 1853 | },{}],25:[function(require,module,exports){ 1854 | "use strict"; 1855 | 1856 | Object.defineProperty(exports, "__esModule", { 1857 | value: !0 1858 | }); 1859 | 1860 | const t = require("../utils"), e = require("../../utils/native-struct"); 1861 | 1862 | class r extends e.NativeStruct { 1863 | type; 1864 | constructor(t, e) { 1865 | super(t), this.type = e; 1866 | } 1867 | get(e) { 1868 | return (0, t.read)(this.handle.add(e * this.type.class.arrayElementSize), this.type); 1869 | } 1870 | read(t, e = 0) { 1871 | const r = new Array(t); 1872 | for (let s = 0; s < t; s++) r[s] = this.get(s + e); 1873 | return r; 1874 | } 1875 | set(e, r) { 1876 | (0, t.write)(this.handle.add(e * this.type.class.arrayElementSize), r, this.type); 1877 | } 1878 | toString() { 1879 | return this.handle.toString(); 1880 | } 1881 | write(t, e = 0) { 1882 | for (let r = 0; r < t.length; r++) this.set(r + e, t[r]); 1883 | } 1884 | } 1885 | 1886 | Il2Cpp.Pointer = r; 1887 | 1888 | },{"../../utils/native-struct":36,"../utils":33}],26:[function(require,module,exports){ 1889 | "use strict"; 1890 | 1891 | Object.defineProperty(exports, "__esModule", { 1892 | value: !0 1893 | }); 1894 | 1895 | const e = require("../utils"), t = require("../../utils/native-struct"), r = require("../../utils/console"); 1896 | 1897 | class n extends t.NativeStruct { 1898 | type; 1899 | constructor(e, t) { 1900 | super(e), this.type = t; 1901 | } 1902 | get value() { 1903 | return (0, e.read)(this.handle, this.type); 1904 | } 1905 | set value(t) { 1906 | (0, e.write)(this.handle, t, this.type); 1907 | } 1908 | toString() { 1909 | return this.isNull() ? "null" : `->${this.value}`; 1910 | } 1911 | static to(e, t) { 1912 | const n = Memory.alloc(Process.pointerSize); 1913 | switch (typeof e) { 1914 | case "boolean": 1915 | return new Il2Cpp.Reference(n.writeS8(+e), Il2Cpp.Image.corlib.class("System.Boolean").type); 1916 | 1917 | case "number": 1918 | switch (t?.typeEnum) { 1919 | case 5: 1920 | return new Il2Cpp.Reference(n.writeU8(e), t); 1921 | 1922 | case 4: 1923 | return new Il2Cpp.Reference(n.writeS8(e), t); 1924 | 1925 | case 3: 1926 | case 7: 1927 | return new Il2Cpp.Reference(n.writeU16(e), t); 1928 | 1929 | case 6: 1930 | return new Il2Cpp.Reference(n.writeS16(e), t); 1931 | 1932 | case 9: 1933 | return new Il2Cpp.Reference(n.writeU32(e), t); 1934 | 1935 | case 8: 1936 | return new Il2Cpp.Reference(n.writeS32(e), t); 1937 | 1938 | case 11: 1939 | return new Il2Cpp.Reference(n.writeU64(e), t); 1940 | 1941 | case 10: 1942 | return new Il2Cpp.Reference(n.writeS64(e), t); 1943 | 1944 | case 12: 1945 | return new Il2Cpp.Reference(n.writeFloat(e), t); 1946 | 1947 | case 13: 1948 | return new Il2Cpp.Reference(n.writeDouble(e), t); 1949 | } 1950 | 1951 | case "object": 1952 | if (e instanceof Il2Cpp.ValueType || e instanceof Il2Cpp.Pointer) return new Il2Cpp.Reference(n.writePointer(e), e.type); 1953 | if (e instanceof Il2Cpp.Object) return new Il2Cpp.Reference(n.writePointer(e), e.class.type); 1954 | if (e instanceof Il2Cpp.String || e instanceof Il2Cpp.Array) return new Il2Cpp.Reference(n.writePointer(e), e.object.class.type); 1955 | if (e instanceof NativePointer) switch (t?.typeEnum) { 1956 | case 25: 1957 | case 24: 1958 | return new Il2Cpp.Reference(n.writePointer(e), t); 1959 | } else { 1960 | if (e instanceof Int64) return new Il2Cpp.Reference(n.writeS64(e), Il2Cpp.Image.corlib.class("System.Int64").type); 1961 | if (e instanceof UInt64) return new Il2Cpp.Reference(n.writeU64(e), Il2Cpp.Image.corlib.class("System.UInt64").type); 1962 | } 1963 | 1964 | default: 1965 | (0, r.raise)(`don't know how to create a reference to ${e} using type ${t?.name}`); 1966 | } 1967 | } 1968 | } 1969 | 1970 | Il2Cpp.Reference = n; 1971 | 1972 | },{"../../utils/console":35,"../../utils/native-struct":36,"../utils":33}],27:[function(require,module,exports){ 1973 | "use strict"; 1974 | 1975 | Object.defineProperty(exports, "__esModule", { 1976 | value: !0 1977 | }); 1978 | 1979 | const t = require("../../utils/native-struct"); 1980 | 1981 | class e extends t.NativeStruct { 1982 | get content() { 1983 | return Il2Cpp.Api._stringChars(this).readUtf16String(this.length); 1984 | } 1985 | set content(t) { 1986 | Il2Cpp.Api._stringChars(this).writeUtf16String(t ?? ""), Il2Cpp.Api._stringSetLength(this, t?.length ?? 0); 1987 | } 1988 | get length() { 1989 | return Il2Cpp.Api._stringLength(this); 1990 | } 1991 | get object() { 1992 | return new Il2Cpp.Object(this); 1993 | } 1994 | toString() { 1995 | return this.isNull() ? "null" : `"${this.content}"`; 1996 | } 1997 | static from(t) { 1998 | return new Il2Cpp.String(Il2Cpp.Api._stringNew(Memory.allocUtf8String(t || ""))); 1999 | } 2000 | } 2001 | 2002 | Il2Cpp.String = e; 2003 | 2004 | },{"../../utils/native-struct":36}],28:[function(require,module,exports){ 2005 | (function (setImmediate){(function (){ 2006 | "use strict"; 2007 | 2008 | var t = this && this.__decorate || function(t, e, r, n) { 2009 | var i, o = arguments.length, a = o < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, r) : n; 2010 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(t, e, r, n); else for (var c = t.length - 1; c >= 0; c--) (i = t[c]) && (a = (o < 3 ? i(a) : o > 3 ? i(e, r, a) : i(e, r)) || a); 2011 | return o > 3 && a && Object.defineProperty(e, r, a), a; 2012 | }; 2013 | 2014 | Object.defineProperty(exports, "__esModule", { 2015 | value: !0 2016 | }); 2017 | 2018 | const e = require("decorator-cache-getter"), r = require("../../utils/console"), n = require("../../utils/native-struct"); 2019 | 2020 | class i extends n.NativeStruct { 2021 | static get idOffset() { 2022 | const t = ptr(Il2Cpp.currentThread.internal.field("thread_id").value.toString()), e = Process.getCurrentThreadId(); 2023 | for (let r = 0; r < 1024; r++) { 2024 | if (t.add(r).readS32() == e) return r; 2025 | } 2026 | (0, r.raise)("couldn't determine the offset for a native thread id value"); 2027 | } 2028 | get id() { 2029 | return ptr(this.internal.field("thread_id").value.toString()).add(Il2Cpp.Thread.idOffset).readS32(); 2030 | } 2031 | get internal() { 2032 | const t = this.object.tryField("internal_thread")?.value; 2033 | return t || this.object; 2034 | } 2035 | get isFinalizer() { 2036 | return !Il2Cpp.Api._threadIsVm(this); 2037 | } 2038 | get object() { 2039 | return new Il2Cpp.Object(this); 2040 | } 2041 | get staticData() { 2042 | return this.internal.field("static_data").value; 2043 | } 2044 | get synchronizationContext() { 2045 | const t = this.object.tryMethod("GetMutableExecutionContext") || this.object.method("get_ExecutionContext"); 2046 | let e = t.invoke().tryMethod("get_SynchronizationContext")?.invoke(); 2047 | if (null == e) { 2048 | const t = Il2Cpp.Image.corlib.class("System.Threading.SynchronizationContext"); 2049 | for (let r = 0; r < 16; r++) try { 2050 | const n = new Il2Cpp.Object(this.staticData.add(Process.pointerSize * r).readPointer().readPointer()); 2051 | if (n.class.isSubclassOf(t, !1)) { 2052 | e = n; 2053 | break; 2054 | } 2055 | } catch (t) {} 2056 | } 2057 | return null == e && (0, r.raise)("couldn't retrieve the SynchronizationContext for this thread."), 2058 | e; 2059 | } 2060 | detach() { 2061 | return Il2Cpp.Api._threadDetach(this); 2062 | } 2063 | schedule(t, e = 0) { 2064 | const r = this.id, n = Il2Cpp.Image.corlib.class("Mono.Runtime").method("GetDisplayName"), i = Il2Cpp.Image.corlib.class("System.Threading.SendOrPostCallback").alloc(); 2065 | i.method(".ctor").invoke(NULL, n.handle); 2066 | const o = this.synchronizationContext.method("Post"); 2067 | return new Promise((a => { 2068 | const c = Interceptor.attach(n.virtualAddress, (function() { 2069 | if (this.threadId == r) { 2070 | c.detach(); 2071 | const e = t(); 2072 | setImmediate((() => a(e))); 2073 | } 2074 | })); 2075 | setTimeout((() => o.invoke(i, NULL)), e); 2076 | })); 2077 | } 2078 | } 2079 | 2080 | t([ e.cache ], i.prototype, "internal", null), t([ e.cache ], i.prototype, "object", null), 2081 | t([ e.cache ], i.prototype, "staticData", null), t([ e.cache ], i.prototype, "synchronizationContext", null), 2082 | t([ e.cache ], i, "idOffset", null), Il2Cpp.Thread = i; 2083 | 2084 | }).call(this)}).call(this,require("timers").setImmediate) 2085 | },{"../../utils/console":35,"../../utils/native-struct":36,"decorator-cache-getter":6,"timers":40}],29:[function(require,module,exports){ 2086 | "use strict"; 2087 | 2088 | Object.defineProperty(exports, "__esModule", { 2089 | value: !0 2090 | }); 2091 | 2092 | },{}],30:[function(require,module,exports){ 2093 | "use strict"; 2094 | 2095 | var e = this && this.__decorate || function(e, t, r, c) { 2096 | var n, s = arguments.length, i = s < 3 ? t : null === c ? c = Object.getOwnPropertyDescriptor(t, r) : c; 2097 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, r, c); else for (var a = e.length - 1; a >= 0; a--) (n = e[a]) && (i = (s < 3 ? n(i) : s > 3 ? n(t, r, i) : n(t, r)) || i); 2098 | return s > 3 && i && Object.defineProperty(t, r, i), i; 2099 | }; 2100 | 2101 | Object.defineProperty(exports, "__esModule", { 2102 | value: !0 2103 | }); 2104 | 2105 | const t = require("decorator-cache-getter"), r = require("../../utils/native-struct"); 2106 | 2107 | class c extends r.NonNullNativeStruct { 2108 | get class() { 2109 | return new Il2Cpp.Class(Il2Cpp.Api._classFromType(this)); 2110 | } 2111 | get fridaAlias() { 2112 | if (this.isByReference) return "pointer"; 2113 | switch (this.typeEnum) { 2114 | case 1: 2115 | return "void"; 2116 | 2117 | case 2: 2118 | return "bool"; 2119 | 2120 | case 3: 2121 | return "uchar"; 2122 | 2123 | case 4: 2124 | return "int8"; 2125 | 2126 | case 5: 2127 | return "uint8"; 2128 | 2129 | case 6: 2130 | return "int16"; 2131 | 2132 | case 7: 2133 | return "uint16"; 2134 | 2135 | case 8: 2136 | return "int32"; 2137 | 2138 | case 9: 2139 | return "uint32"; 2140 | 2141 | case 10: 2142 | return "int64"; 2143 | 2144 | case 11: 2145 | return "uint64"; 2146 | 2147 | case 12: 2148 | return "float"; 2149 | 2150 | case 13: 2151 | return "double"; 2152 | 2153 | case 17: 2154 | return n(this); 2155 | 2156 | case 24: 2157 | case 25: 2158 | case 15: 2159 | case 14: 2160 | case 29: 2161 | case 20: 2162 | default: 2163 | return "pointer"; 2164 | 2165 | case 18: 2166 | case 28: 2167 | case 21: 2168 | return this.class.isValueType ? n(this) : "pointer"; 2169 | } 2170 | } 2171 | get isByReference() { 2172 | return !!Il2Cpp.Api._typeIsByReference(this); 2173 | } 2174 | get isPrimitive() { 2175 | return !!Il2Cpp.Api._typeIsPrimitive(this); 2176 | } 2177 | get name() { 2178 | const e = Il2Cpp.Api._typeGetName(this); 2179 | try { 2180 | return e.readUtf8String(); 2181 | } finally { 2182 | Il2Cpp.free(e); 2183 | } 2184 | } 2185 | get object() { 2186 | return new Il2Cpp.Object(Il2Cpp.Api._typeGetObject(this)); 2187 | } 2188 | get typeEnum() { 2189 | return Il2Cpp.Api._typeGetTypeEnum(this); 2190 | } 2191 | toString() { 2192 | return this.name; 2193 | } 2194 | } 2195 | 2196 | function n(e) { 2197 | const t = e.class.fields.filter((e => !e.isStatic)); 2198 | return 0 == t.length ? [ "char" ] : t.map((e => e.type.fridaAlias)); 2199 | } 2200 | 2201 | e([ t.cache ], c.prototype, "class", null), e([ t.cache ], c.prototype, "fridaAlias", null), 2202 | e([ t.cache ], c.prototype, "isByReference", null), e([ t.cache ], c.prototype, "isPrimitive", null), 2203 | e([ t.cache ], c.prototype, "name", null), e([ t.cache ], c.prototype, "object", null), 2204 | e([ t.cache ], c.prototype, "typeEnum", null), Reflect.set(Il2Cpp, "Type", c); 2205 | 2206 | },{"../../utils/native-struct":36,"decorator-cache-getter":6}],31:[function(require,module,exports){ 2207 | "use strict"; 2208 | 2209 | Object.defineProperty(exports, "__esModule", { 2210 | value: !0 2211 | }); 2212 | 2213 | const t = require("../../utils/native-struct"); 2214 | 2215 | class e extends t.NativeStruct { 2216 | type; 2217 | constructor(t, e) { 2218 | super(t), this.type = e; 2219 | } 2220 | box() { 2221 | return new Il2Cpp.Object(Il2Cpp.Api._valueBox(this.type.class, this)); 2222 | } 2223 | field(t) { 2224 | return this.type.class.field(t).withHolder(this); 2225 | } 2226 | toString() { 2227 | return this.isNull() ? "null" : this.box().toString(); 2228 | } 2229 | } 2230 | 2231 | Il2Cpp.ValueType = e; 2232 | 2233 | },{"../../utils/native-struct":36}],32:[function(require,module,exports){ 2234 | "use strict"; 2235 | 2236 | Object.defineProperty(exports, "__esModule", { 2237 | value: !0 2238 | }); 2239 | 2240 | const s = require("../utils/console"), e = require("./utils"); 2241 | 2242 | class t { 2243 | targets=[]; 2244 | #s; 2245 | #e; 2246 | #t; 2247 | #i; 2248 | #r; 2249 | #a; 2250 | #l; 2251 | domain() { 2252 | return this; 2253 | } 2254 | assemblies(...s) { 2255 | return this.#s = s, this; 2256 | } 2257 | classes(...s) { 2258 | return this.#e = s, this; 2259 | } 2260 | methods(...s) { 2261 | return this.#t = s, this; 2262 | } 2263 | filterAssemblies(s) { 2264 | return this.#i = s, this; 2265 | } 2266 | filterClasses(s) { 2267 | return this.#r = s, this; 2268 | } 2269 | filterMethods(s) { 2270 | return this.#a = s, this; 2271 | } 2272 | filterParameters(s) { 2273 | return this.#l = s, this; 2274 | } 2275 | and() { 2276 | const s = s => { 2277 | if (null != this.#l) { 2278 | for (const e of s.parameters) if (this.#l(e)) { 2279 | this.targets.push(s); 2280 | break; 2281 | } 2282 | } else this.targets.push(s); 2283 | }, e = e => { 2284 | for (const t of e) s(t); 2285 | }, t = t => { 2286 | if (null != this.#a) for (const e of t.methods) this.#a(e) && s(e); else e(t.methods); 2287 | }, i = s => { 2288 | for (const e of s) t(e); 2289 | }, r = s => { 2290 | if (null != this.#r) for (const e of s.image.classes) this.#r(e) && t(e); else i(s.image.classes); 2291 | }, a = s => { 2292 | for (const e of s) r(e); 2293 | }; 2294 | return this.#t ? e(this.#t) : this.#e ? i(this.#e) : this.#s ? a(this.#s) : (s => { 2295 | if (null != this.#i) for (const e of s.assemblies) this.#i(e) && r(e); else a(s.assemblies); 2296 | })(Il2Cpp.Domain), this.#s = void 0, this.#e = void 0, this.#t = void 0, this.#i = void 0, 2297 | this.#r = void 0, this.#a = void 0, this.#l = void 0, this; 2298 | } 2299 | attach(t = "full") { 2300 | let i = 0; 2301 | for (const r of this.targets) { 2302 | if (r.virtualAddress.isNull()) continue; 2303 | const a = `0x${r.relativeVirtualAddress.toString(16).padStart(8, "0")}`, l = `${r.class.type.name}.${r.name}`; 2304 | if ("detailed" == t) { 2305 | const t = +!r.isStatic | +Il2Cpp.unityVersionIsBelow201830, o = (...o) => { 2306 | const m = r.isStatic ? void 0 : new Il2Cpp.Parameter("this", -1, r.class.type), n = m ? [ m ].concat(r.parameters) : r.parameters; 2307 | (0, s.inform)(`${a} ${"│ ".repeat(i++)}┌─${l}(${n.map((s => `${s.name} = ${(0, 2308 | e.fromFridaValue)(o[s.position + t], s.type)}`)).join(", ")});`); 2309 | const h = r.nativeFunction(...o); 2310 | return (0, s.inform)(`${a} ${"│ ".repeat(--i)}└─${l}${null == h ? "" : ` = ${(0, 2311 | e.fromFridaValue)(h, r.returnType)}`};`), h; 2312 | }; 2313 | try { 2314 | r.revert(); 2315 | const s = new NativeCallback(o, r.returnType.fridaAlias, r.fridaSignature); 2316 | Interceptor.replace(r.virtualAddress, s); 2317 | } catch (s) {} 2318 | } else try { 2319 | Interceptor.attach(r.virtualAddress, { 2320 | onEnter: () => (0, s.inform)(`${a} ${"│ ".repeat(i++)}┌─${l}`), 2321 | onLeave: () => (0, s.inform)(`${a} ${"│ ".repeat(--i)}└─${l}${0 == i ? "\n" : ""}`) 2322 | }); 2323 | } catch (s) {} 2324 | } 2325 | } 2326 | } 2327 | 2328 | Il2Cpp.Tracer = t; 2329 | 2330 | },{"../utils/console":35,"./utils":33}],33:[function(require,module,exports){ 2331 | "use strict"; 2332 | 2333 | Object.defineProperty(exports, "__esModule", { 2334 | value: !0 2335 | }), exports.toFridaValue = exports.fromFridaValue = exports.write = exports.read = void 0; 2336 | 2337 | const e = require("../utils/console"), r = require("../utils/native-struct"); 2338 | 2339 | function a(r, a) { 2340 | switch (a.typeEnum) { 2341 | case 2: 2342 | return !!r.readS8(); 2343 | 2344 | case 4: 2345 | return r.readS8(); 2346 | 2347 | case 5: 2348 | return r.readU8(); 2349 | 2350 | case 6: 2351 | return r.readS16(); 2352 | 2353 | case 7: 2354 | case 3: 2355 | return r.readU16(); 2356 | 2357 | case 8: 2358 | return r.readS32(); 2359 | 2360 | case 9: 2361 | return r.readU32(); 2362 | 2363 | case 10: 2364 | return r.readS64(); 2365 | 2366 | case 11: 2367 | return r.readU64(); 2368 | 2369 | case 12: 2370 | return r.readFloat(); 2371 | 2372 | case 13: 2373 | return r.readDouble(); 2374 | 2375 | case 24: 2376 | case 25: 2377 | return r.readPointer(); 2378 | 2379 | case 15: 2380 | return new Il2Cpp.Pointer(r.readPointer(), a.class.baseType); 2381 | 2382 | case 17: 2383 | return new Il2Cpp.ValueType(r, a); 2384 | 2385 | case 28: 2386 | case 18: 2387 | return new Il2Cpp.Object(r.readPointer()); 2388 | 2389 | case 21: 2390 | return a.class.isValueType ? new Il2Cpp.ValueType(r, a) : new Il2Cpp.Object(r.readPointer()); 2391 | 2392 | case 14: 2393 | return new Il2Cpp.String(r.readPointer()); 2394 | 2395 | case 29: 2396 | case 20: 2397 | return new Il2Cpp.Array(r.readPointer()); 2398 | } 2399 | (0, e.raise)(`read: "${a.name}" (${a.typeEnum}) has not been handled yet. Please file an issue!`); 2400 | } 2401 | 2402 | function t(r, a, t) { 2403 | switch (t.typeEnum) { 2404 | case 2: 2405 | return r.writeS8(+a); 2406 | 2407 | case 4: 2408 | return r.writeS8(a); 2409 | 2410 | case 5: 2411 | return r.writeU8(a); 2412 | 2413 | case 6: 2414 | return r.writeS16(a); 2415 | 2416 | case 7: 2417 | case 3: 2418 | return r.writeU16(a); 2419 | 2420 | case 8: 2421 | return r.writeS32(a); 2422 | 2423 | case 9: 2424 | return r.writeU32(a); 2425 | 2426 | case 10: 2427 | return r.writeS64(a); 2428 | 2429 | case 11: 2430 | return r.writeU64(a); 2431 | 2432 | case 12: 2433 | return r.writeFloat(a); 2434 | 2435 | case 13: 2436 | return r.writeDouble(a); 2437 | 2438 | case 24: 2439 | case 25: 2440 | case 15: 2441 | case 17: 2442 | case 14: 2443 | case 28: 2444 | case 18: 2445 | case 29: 2446 | case 20: 2447 | case 21: 2448 | return a instanceof Il2Cpp.ValueType ? (Memory.copy(r, a.handle, t.class.valueSize), 2449 | r) : r.writePointer(a); 2450 | } 2451 | (0, e.raise)(`write: "${t.name}" (${t.typeEnum}) has not been handled yet. Please file an issue!`); 2452 | } 2453 | 2454 | function s(e, r) { 2455 | if (Array.isArray(e)) return i(r, e); 2456 | if (!(e instanceof NativePointer)) return 2 == r.typeEnum ? !!e : e; 2457 | if (r.isByReference) return new Il2Cpp.Reference(e, r); 2458 | switch (r.typeEnum) { 2459 | case 15: 2460 | return new Il2Cpp.Pointer(e, r.class.baseType); 2461 | 2462 | case 14: 2463 | return new Il2Cpp.String(e); 2464 | 2465 | case 18: 2466 | case 21: 2467 | case 28: 2468 | return new Il2Cpp.Object(e); 2469 | 2470 | case 29: 2471 | case 20: 2472 | return new Il2Cpp.Array(e); 2473 | 2474 | default: 2475 | return e; 2476 | } 2477 | } 2478 | 2479 | function n(e) { 2480 | return "boolean" == typeof e ? +e : e instanceof Il2Cpp.ValueType ? c(e) : e; 2481 | } 2482 | 2483 | function c(e) { 2484 | const a = e.type.class.fields.filter((e => !e.isStatic)); 2485 | return 0 == a.length ? [ e.handle.readU8() ] : a.map((r => r.withHolder(e).value)).map((e => e instanceof Il2Cpp.ValueType ? c(e) : e instanceof r.NativeStruct ? e.handle : "boolean" == typeof e ? +e : e)); 2486 | } 2487 | 2488 | function i(r, a) { 2489 | const t = Memory.alloc(r.class.valueSize); 2490 | a = a.flat(1 / 0); 2491 | const s = function e(r, a = 0) { 2492 | const t = []; 2493 | for (const s of r.class.fields) if (!s.isStatic) { 2494 | const r = a + s.offset - Il2Cpp.Runtime.objectHeaderSize; 2495 | 17 == s.type.typeEnum || 21 == s.type.typeEnum && s.type.class.isValueType ? t.push(...e(s.type, r)) : t.push([ s.type.typeEnum, r ]); 2496 | } 2497 | return 0 == t.length && t.push([ 5, 0 ]), t; 2498 | }(r); 2499 | for (let r = 0; r < a.length; r++) { 2500 | const n = a[r], [c, i] = s[r], u = t.add(i); 2501 | switch (c) { 2502 | case 2: 2503 | case 4: 2504 | u.writeS8(n); 2505 | break; 2506 | 2507 | case 5: 2508 | u.writeU8(n); 2509 | break; 2510 | 2511 | case 6: 2512 | u.writeS16(n); 2513 | break; 2514 | 2515 | case 7: 2516 | case 3: 2517 | u.writeU16(n); 2518 | break; 2519 | 2520 | case 8: 2521 | u.writeS32(n); 2522 | break; 2523 | 2524 | case 9: 2525 | u.writeU32(n); 2526 | break; 2527 | 2528 | case 10: 2529 | u.writeS64(n); 2530 | break; 2531 | 2532 | case 11: 2533 | u.writeU64(n); 2534 | break; 2535 | 2536 | case 12: 2537 | u.writeFloat(n); 2538 | break; 2539 | 2540 | case 13: 2541 | u.writeDouble(n); 2542 | break; 2543 | 2544 | case 24: 2545 | case 25: 2546 | case 15: 2547 | case 29: 2548 | case 20: 2549 | case 14: 2550 | case 28: 2551 | case 18: 2552 | case 21: 2553 | u.writePointer(n); 2554 | break; 2555 | 2556 | default: 2557 | (0, e.warn)(`arrayToValueType: defaulting ${c} to pointer`), u.writePointer(n); 2558 | } 2559 | } 2560 | return new Il2Cpp.ValueType(t, r); 2561 | } 2562 | 2563 | exports.read = a, exports.write = t, exports.fromFridaValue = s, exports.toFridaValue = n; 2564 | 2565 | },{"../utils/console":35,"../utils/native-struct":36}],34:[function(require,module,exports){ 2566 | "use strict"; 2567 | 2568 | Object.defineProperty(exports, "__esModule", { 2569 | value: !0 2570 | }), require("./il2cpp"); 2571 | 2572 | },{"./il2cpp":11}],35:[function(require,module,exports){ 2573 | "use strict"; 2574 | 2575 | function o(o) { 2576 | throw `il2cpp: ${o}`; 2577 | } 2578 | 2579 | function e(o) { 2580 | globalThis.console.log(`il2cpp: ${o}`); 2581 | } 2582 | 2583 | function s(o) { 2584 | globalThis.console.log(`il2cpp: ${o}`); 2585 | } 2586 | 2587 | function r(o) { 2588 | globalThis.console.log(`il2cpp: ${o}`); 2589 | } 2590 | 2591 | Object.defineProperty(exports, "__esModule", { 2592 | value: !0 2593 | }), exports.inform = exports.ok = exports.warn = exports.raise = void 0, exports.raise = o, 2594 | exports.warn = e, exports.ok = s, exports.inform = r; 2595 | 2596 | },{}],36:[function(require,module,exports){ 2597 | "use strict"; 2598 | 2599 | Object.defineProperty(exports, "__esModule", { 2600 | value: !0 2601 | }), exports.NonNullNativeStruct = exports.NativeStruct = void 0; 2602 | 2603 | class t { 2604 | handle; 2605 | constructor(t) { 2606 | t instanceof NativePointer ? this.handle = t : this.handle = t.handle; 2607 | } 2608 | equals(t) { 2609 | return this.handle.equals(t.handle); 2610 | } 2611 | isNull() { 2612 | return this.handle.isNull(); 2613 | } 2614 | } 2615 | 2616 | exports.NativeStruct = t; 2617 | 2618 | class e extends t { 2619 | constructor(t) { 2620 | if (super(t), t.isNull()) throw new Error(`Handle for "${this.constructor.name}" cannot be NULL.`); 2621 | } 2622 | } 2623 | 2624 | exports.NonNullNativeStruct = e; 2625 | 2626 | },{}],37:[function(require,module,exports){ 2627 | (function (setImmediate){(function (){ 2628 | "use strict"; 2629 | 2630 | var e = this && this.__decorate || function(e, t, r, n) { 2631 | var o, s = arguments.length, i = s < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, r) : n; 2632 | if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, r, n); else for (var a = e.length - 1; a >= 0; a--) (o = e[a]) && (i = (s < 3 ? o(i) : s > 3 ? o(t, r, i) : o(t, r)) || i); 2633 | return s > 3 && i && Object.defineProperty(t, r, i), i; 2634 | }, t = this && this.__importDefault || function(e) { 2635 | return e && e.__esModule ? e : { 2636 | default: e 2637 | }; 2638 | }; 2639 | 2640 | Object.defineProperty(exports, "__esModule", { 2641 | value: !0 2642 | }), exports.forModule = void 0; 2643 | 2644 | const r = require("decorator-cache-getter"), n = t(require("versioning")); 2645 | 2646 | class o { 2647 | stringEncoding; 2648 | address; 2649 | constructor(e, t, r) { 2650 | this.stringEncoding = r, this.address = Module.findExportByName(e, t) ?? NULL; 2651 | } 2652 | static get targets() { 2653 | const [e, ...t] = function() { 2654 | switch (Process.platform) { 2655 | case "linux": 2656 | try { 2657 | return n.default.gte(Java.androidVersion, "12") ? [ null, [ "__loader_dlopen", "utf8" ] ] : [ "libdl.so", [ "dlopen", "utf8" ], [ "android_dlopen_ext", "utf8" ] ]; 2658 | } catch (e) { 2659 | return [ null, [ "dlopen", "utf8" ] ]; 2660 | } 2661 | 2662 | case "darwin": 2663 | return [ "libdyld.dylib", [ "dlopen", "utf8" ] ]; 2664 | 2665 | case "windows": 2666 | const e = "LoadLibrary"; 2667 | return [ "kernel32.dll", [ `${e}W`, "utf16" ], [ `${e}ExW`, "utf16" ], [ `${e}A`, "ansi" ], [ `${e}ExA`, "ansi" ] ]; 2668 | } 2669 | }(); 2670 | return t.map((([t, r]) => new o(e, t, r))).filter((e => !e.address.isNull())); 2671 | } 2672 | readString(e) { 2673 | switch (this.stringEncoding) { 2674 | case "utf8": 2675 | return e.readUtf8String(); 2676 | 2677 | case "utf16": 2678 | return e.readUtf16String(); 2679 | 2680 | case "ansi": 2681 | return e.readAnsiString(); 2682 | } 2683 | } 2684 | } 2685 | 2686 | function s(...e) { 2687 | return new Promise((t => { 2688 | for (const r of e) { 2689 | if (null != Process.findModuleByName(r)) return void t(r); 2690 | } 2691 | const r = o.targets.map((n => Interceptor.attach(n.address, { 2692 | onEnter(e) { 2693 | this.modulePath = n.readString(e[0]) ?? ""; 2694 | }, 2695 | onLeave(n) { 2696 | if (!n.isNull()) for (const n of e) this.modulePath.endsWith(n) && (setImmediate((() => r.forEach((e => e.detach())))), 2697 | t(n)); 2698 | } 2699 | }))); 2700 | })); 2701 | } 2702 | 2703 | e([ r.cache ], o, "targets", null), exports.forModule = s; 2704 | 2705 | }).call(this)}).call(this,require("timers").setImmediate) 2706 | },{"decorator-cache-getter":6,"timers":40,"versioning":41}],38:[function(require,module,exports){ 2707 | "use strict"; 2708 | 2709 | Object.defineProperty(exports, "__esModule", { 2710 | value: !0 2711 | }), exports.levenshtein = exports.cacheInstances = exports.nativeIterator = void 0; 2712 | 2713 | const e = require("fastest-levenshtein"), t = require("./console"); 2714 | 2715 | function* n(e, t, n) { 2716 | const s = Memory.alloc(Process.pointerSize); 2717 | let o; 2718 | for (;!(o = t(e, s)).isNull(); ) yield new n(o); 2719 | } 2720 | 2721 | function s(e) { 2722 | const t = new Map; 2723 | return new Proxy(e, { 2724 | construct(e, n) { 2725 | const s = n[0].toUInt32(); 2726 | return t.has(s) || t.set(s, new e(n[0])), t.get(s); 2727 | } 2728 | }); 2729 | } 2730 | 2731 | function o(n, s = (e => e.name)) { 2732 | return function(o, r, c) { 2733 | const i = c.value; 2734 | c.value = function(o, ...c) { 2735 | const a = i.call(this, o, ...c); 2736 | if (null != a) return a; 2737 | const u = (0, e.closest)(o, this[n].map(s)); 2738 | (0, t.raise)(`couldn't find ${r} ${o} in ${this.name}${u ? `, did you mean ${u}?` : ""}`); 2739 | }; 2740 | }; 2741 | } 2742 | 2743 | exports.nativeIterator = n, exports.cacheInstances = s, exports.levenshtein = o; 2744 | 2745 | },{"./console":35,"fastest-levenshtein":7}],39:[function(require,module,exports){ 2746 | var t, e, n = module.exports = {}; 2747 | 2748 | function r() { 2749 | throw new Error("setTimeout has not been defined"); 2750 | } 2751 | 2752 | function o() { 2753 | throw new Error("clearTimeout has not been defined"); 2754 | } 2755 | 2756 | function i(e) { 2757 | if (t === setTimeout) return setTimeout(e, 0); 2758 | if ((t === r || !t) && setTimeout) return t = setTimeout, setTimeout(e, 0); 2759 | try { 2760 | return t(e, 0); 2761 | } catch (n) { 2762 | try { 2763 | return t.call(null, e, 0); 2764 | } catch (n) { 2765 | return t.call(this, e, 0); 2766 | } 2767 | } 2768 | } 2769 | 2770 | function u(t) { 2771 | if (e === clearTimeout) return clearTimeout(t); 2772 | if ((e === o || !e) && clearTimeout) return e = clearTimeout, clearTimeout(t); 2773 | try { 2774 | return e(t); 2775 | } catch (n) { 2776 | try { 2777 | return e.call(null, t); 2778 | } catch (n) { 2779 | return e.call(this, t); 2780 | } 2781 | } 2782 | } 2783 | 2784 | !function() { 2785 | try { 2786 | t = "function" == typeof setTimeout ? setTimeout : r; 2787 | } catch (e) { 2788 | t = r; 2789 | } 2790 | try { 2791 | e = "function" == typeof clearTimeout ? clearTimeout : o; 2792 | } catch (t) { 2793 | e = o; 2794 | } 2795 | }(); 2796 | 2797 | var c, s = [], l = !1, a = -1; 2798 | 2799 | function f() { 2800 | l && c && (l = !1, c.length ? s = c.concat(s) : a = -1, s.length && h()); 2801 | } 2802 | 2803 | function h() { 2804 | if (!l) { 2805 | var t = i(f); 2806 | l = !0; 2807 | for (var e = s.length; e; ) { 2808 | for (c = s, s = []; ++a < e; ) c && c[a].run(); 2809 | a = -1, e = s.length; 2810 | } 2811 | c = null, l = !1, u(t); 2812 | } 2813 | } 2814 | 2815 | function m(t, e) { 2816 | this.fun = t, this.array = e; 2817 | } 2818 | 2819 | function p() {} 2820 | 2821 | n.nextTick = function(t) { 2822 | var e = new Array(arguments.length - 1); 2823 | if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n]; 2824 | s.push(new m(t, e)), 1 !== s.length || l || i(h); 2825 | }, m.prototype.run = function() { 2826 | this.fun.apply(null, this.array); 2827 | }, n.title = "browser", n.browser = !0, n.env = {}, n.argv = [], n.version = "", 2828 | n.versions = {}, n.on = p, n.addListener = p, n.once = p, n.off = p, n.removeListener = p, 2829 | n.removeAllListeners = p, n.emit = p, n.prependListener = p, n.prependOnceListener = p, 2830 | n.listeners = function(t) { 2831 | return []; 2832 | }, n.binding = function(t) { 2833 | throw new Error("process.binding is not supported"); 2834 | }, n.cwd = function() { 2835 | return "/"; 2836 | }, n.chdir = function(t) { 2837 | throw new Error("process.chdir is not supported"); 2838 | }, n.umask = function() { 2839 | return 0; 2840 | }; 2841 | 2842 | },{}],40:[function(require,module,exports){ 2843 | (function (setImmediate,clearImmediate){(function (){ 2844 | var e = require("process/browser.js").nextTick, t = Function.prototype.apply, o = Array.prototype.slice, i = {}, n = 0; 2845 | 2846 | function r(e, t) { 2847 | this._id = e, this._clearFn = t; 2848 | } 2849 | 2850 | exports.setTimeout = function() { 2851 | return new r(t.call(setTimeout, window, arguments), clearTimeout); 2852 | }, exports.setInterval = function() { 2853 | return new r(t.call(setInterval, window, arguments), clearInterval); 2854 | }, exports.clearTimeout = exports.clearInterval = function(e) { 2855 | e.close(); 2856 | }, r.prototype.unref = r.prototype.ref = function() {}, r.prototype.close = function() { 2857 | this._clearFn.call(window, this._id); 2858 | }, exports.enroll = function(e, t) { 2859 | clearTimeout(e._idleTimeoutId), e._idleTimeout = t; 2860 | }, exports.unenroll = function(e) { 2861 | clearTimeout(e._idleTimeoutId), e._idleTimeout = -1; 2862 | }, exports._unrefActive = exports.active = function(e) { 2863 | clearTimeout(e._idleTimeoutId); 2864 | var t = e._idleTimeout; 2865 | t >= 0 && (e._idleTimeoutId = setTimeout((function() { 2866 | e._onTimeout && e._onTimeout(); 2867 | }), t)); 2868 | }, exports.setImmediate = "function" == typeof setImmediate ? setImmediate : function(t) { 2869 | var r = n++, l = !(arguments.length < 2) && o.call(arguments, 1); 2870 | return i[r] = !0, e((function() { 2871 | i[r] && (l ? t.apply(null, l) : t.call(null), exports.clearImmediate(r)); 2872 | })), r; 2873 | }, exports.clearImmediate = "function" == typeof clearImmediate ? clearImmediate : function(e) { 2874 | delete i[e]; 2875 | }; 2876 | 2877 | }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) 2878 | },{"process/browser.js":39,"timers":40}],41:[function(require,module,exports){ 2879 | var t = ".", n = function(t) { 2880 | this._version = String(t); 2881 | }; 2882 | 2883 | function r(n, r, i) { 2884 | if ((n = String(n)) === (r = String(r))) return 0; 2885 | for (var e = n.split(t), o = r.split(t), u = Math[i ? "max" : "min"](e.length, o.length), s = 0; s < u; s++) { 2886 | if (e[s] = void 0 === e[s] ? 0 : parseInt(e[s], 10), o[s] = void 0 === o[s] ? 0 : parseInt(o[s], 10), 2887 | e[s] > o[s]) return 1; 2888 | if (e[s] < o[s]) return -1; 2889 | } 2890 | return 0; 2891 | } 2892 | 2893 | n.compare = function(t, n) { 2894 | return r(t, n, !0); 2895 | }, n.eq = function(t, n, i) { 2896 | return 0 === r(t, n, i); 2897 | }, n.gt = function(t, n) { 2898 | return r(t, n, !0) > 0; 2899 | }, n.gte = function(t, n) { 2900 | return r(t, n, !0) >= 0; 2901 | }, n.lt = function(t, n) { 2902 | return r(t, n, !0) < 0; 2903 | }, n.lte = function(t, n) { 2904 | return r(t, n, !0) <= 0; 2905 | }, n.prototype = { 2906 | eq: function(t) { 2907 | return n.eq(this._version, t); 2908 | }, 2909 | gt: function(t) { 2910 | return n.gt(this._version, t); 2911 | }, 2912 | gte: function(t) { 2913 | return n.gte(this._version, t); 2914 | }, 2915 | lt: function(t) { 2916 | return n.lt(this._version, t); 2917 | }, 2918 | lte: function(t) { 2919 | return n.lte(this._version, t); 2920 | }, 2921 | valueOf: function() { 2922 | return parseFloat(this._version.split(t).slice(0, 2).join(t), 10); 2923 | }, 2924 | toString: function(n) { 2925 | return void 0 === n ? this._version : this._version.split(t).slice(0, n).join(t); 2926 | } 2927 | }, module.exports = n; 2928 | 2929 | },{}]},{},[2]); 2930 | --------------------------------------------------------------------------------