import {NativeStruct} from "./NativeStruct"; import {il2cppApi} from "../il2cppApi"; import {getStructOffset, StructItem} from "./structItem"; import {FromTypeDefinition_Addr, soName, UNITY_VER, UnityVer} from "../../config"; import {Il2CppClass} from "./Il2CppClass"; import {log} from "../../logger"; let il2CppImage_struct = new Array(); il2CppImage_struct.push(new StructItem("name", Process.pointerSize)); il2CppImage_struct.push(new StructItem("nameNoExt", Process.pointerSize)); il2CppImage_struct.push(new StructItem("assemblyIndex", Process.pointerSize)); il2CppImage_struct.push(new StructItem("typeStart", 4)); il2CppImage_struct.push(new StructItem("typeCount", 4)); il2CppImage_struct.push(new StructItem("exportedTypeStart", 4)); export class Il2CppImage extends NativeStruct { name() { return il2cppApi.il2cpp_image_get_name(this).readCString(); } nameNoExt() { let name1 = this.name(); return name1.replace(".dll", ""); } typeStart() { return this.get("typeStart").readPointer().toInt32(); } typeCount() { return il2cppApi.il2cpp_image_get_class_count(this); // return this.getOffsetTypeCount(); } getOffsetTypeCount(){ if (UNITY_VER===UnityVer.V_2020){ return this.add(24).readPointer().toInt32(); }else { return this.get("typeCount").readPointer().toInt32(); } } getClass(index) { return il2cppApi.il2cpp_image_get_class(this, index); } get(params) { return this.add(getStructOffset(il2CppImage_struct, params)); } }