public ulong FindCodeRegistration() { foreach (var section in search) { il2Cpp.Position = section.start; while ((ulong)il2Cpp.Position < section.end) { var addr = il2Cpp.Position; if (il2Cpp.ReadUInt32() == methodCount) { try { var pointer = il2Cpp.MapVATR(il2Cpp.ReadUInt32()); if (CheckPointerRangeFirst(pointer)) { var sign = il2Cpp.Position; var pointers = il2Cpp.ReadClassArray <uint>(pointer, methodCount); if (CheckPointerRangeSecond(pointers)) { return((ulong)addr - section.start + section.address); //VirtualAddress } il2Cpp.Position = sign; } } catch { // ignored } } } } return(0ul); }
private ulong FindCodeRegistration32Bit() { foreach (var section in data) { il2Cpp.Position = section.offset; while (il2Cpp.Position < section.offsetEnd) { var addr = il2Cpp.Position; if (il2Cpp.ReadUInt32() == methodCount) { try { var pointer = il2Cpp.MapVATR(il2Cpp.ReadUInt32()); if (CheckPointerRangeDataRa(pointer)) { var pointers = il2Cpp.ReadClassArray <uint>(pointer, methodCount); if (CheckPointerRangeExecVa(pointers)) { return(addr - section.offset + section.address); } } } catch { // ignored } } il2Cpp.Position = addr + 4; } } return(0ul); }