Skip to content

Commit 23285b5

Browse files
committed
Fixed #683
1 parent 6c9bf66 commit 23285b5

File tree

6 files changed

+26
-16
lines changed

6 files changed

+26
-16
lines changed

Il2CppDumper/ExecutableFormats/Elf64.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected override void Load()
2929
FixedProgramSegment();
3030
}
3131
pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC);
32-
dynamicSection = ReadClassArray<Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L);
32+
dynamicSection = ReadClassArray<Elf64_Dyn>(pt_dynamic.p_offset, pt_dynamic.p_filesz / 16L);
3333
if (IsDumped)
3434
{
3535
FixedDynamicSection();
@@ -187,7 +187,7 @@ private void RelocationProcessing()
187187
{
188188
var relaOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_RELA).d_un);
189189
var relaSize = dynamicSection.First(x => x.d_tag == DT_RELASZ).d_un;
190-
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, (long)relaSize / 24L);
190+
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, relaSize / 24L);
191191
foreach (var rela in relaTable)
192192
{
193193
var type = rela.r_info & 0xffffffff;

Il2CppDumper/ExecutableFormats/Macho64.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public override bool Search()
9797
if (Version < 23)
9898
{
9999
var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func");
100-
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, (long)__mod_init_func.size / 8);
100+
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, __mod_init_func.size / 8);
101101
foreach (var i in addrs)
102102
{
103103
if (i > 0)
@@ -163,7 +163,7 @@ public override bool Search()
163163
* B sub
164164
*/
165165
var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func");
166-
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, (long)__mod_init_func.size / 8);
166+
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, __mod_init_func.size / 8);
167167
foreach (var i in addrs)
168168
{
169169
if (i > 0)
@@ -200,7 +200,7 @@ public override bool Search()
200200
* B sub
201201
*/
202202
var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func");
203-
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, (long)__mod_init_func.size / 8);
203+
var addrs = ReadClassArray<ulong>(__mod_init_func.offset, __mod_init_func.size / 8);
204204
foreach (var i in addrs)
205205
{
206206
if (i > 0)

Il2CppDumper/ExecutableFormats/NSO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private void RelocationProcessing()
169169
{
170170
var relaOffset = MapVATR(dynamicSection.First(x => x.d_tag == DT_RELA).d_un);
171171
var relaSize = dynamicSection.First(x => x.d_tag == DT_RELASZ).d_un;
172-
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, (long)relaSize / 24L);
172+
var relaTable = ReadClassArray<Elf64_Rela>(relaOffset, relaSize / 24L);
173173
foreach (var rela in relaTable)
174174
{
175175
var type = rela.r_info & 0xffffffff;

Il2CppDumper/IO/BinaryStream.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ private object ReadPrimitive(Type type)
199199
return t;
200200
}
201201

202+
public T[] ReadClassArray<T>(ulong addr, ulong count) where T : new()
203+
{
204+
return ReadClassArray<T>(addr, (long)count);
205+
}
206+
202207
public T[] ReadClassArray<T>(ulong addr, long count) where T : new()
203208
{
204209
Position = addr;

Il2CppDumper/Il2Cpp/Il2Cpp.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected bool AutoPlusInit(ulong codeRegistration, ulong metadataRegistration)
5252
{
5353
if (codeRegistration != 0)
5454
{
55-
var limit = this is WebAssemblyMemory ? 0x35000 : 0x50000; //TODO
55+
var limit = this is WebAssemblyMemory ? 0x35000u : 0x50000u; //TODO
5656
if (Version >= 24.2)
5757
{
5858
pCodeRegistration = MapVATR<Il2CppCodeRegistration>(codeRegistration);
@@ -108,7 +108,7 @@ protected bool AutoPlusInit(ulong codeRegistration, ulong metadataRegistration)
108108
public virtual void Init(ulong codeRegistration, ulong metadataRegistration)
109109
{
110110
pCodeRegistration = MapVATR<Il2CppCodeRegistration>(codeRegistration);
111-
var limit = this is WebAssemblyMemory ? 0x35000 : 0x50000; //TODO
111+
var limit = this is WebAssemblyMemory ? 0x35000u : 0x50000u; //TODO
112112
if (Version == 27 && pCodeRegistration.invokerPointersCount > limit)
113113
{
114114
Version = 27.1;
@@ -249,6 +249,11 @@ public virtual void Init(ulong codeRegistration, ulong metadataRegistration)
249249
return ReadClass<T>(MapVATR(addr));
250250
}
251251

252+
public T[] MapVATR<T>(ulong addr, ulong count) where T : new()
253+
{
254+
return ReadClassArray<T>(MapVATR(addr), count);
255+
}
256+
252257
public T[] MapVATR<T>(ulong addr, long count) where T : new()
253258
{
254259
return ReadClassArray<T>(MapVATR(addr), count);

Il2CppDumper/Il2Cpp/Il2CppClass.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ namespace Il2CppDumper
55
public class Il2CppCodeRegistration
66
{
77
[Version(Max = 24.1)]
8-
public long methodPointersCount;
8+
public ulong methodPointersCount;
99
[Version(Max = 24.1)]
1010
public ulong methodPointers;
1111
[Version(Max = 21)]
1212
public ulong delegateWrappersFromNativeToManagedCount;
1313
[Version(Max = 21)]
1414
public ulong delegateWrappersFromNativeToManaged; // note the double indirection to handle different calling conventions
1515
[Version(Min = 22)]
16-
public long reversePInvokeWrapperCount;
16+
public ulong reversePInvokeWrapperCount;
1717
[Version(Min = 22)]
1818
public ulong reversePInvokeWrappers;
1919
[Version(Max = 22)]
@@ -28,23 +28,23 @@ public class Il2CppCodeRegistration
2828
public ulong ccwMarshalingFunctionsCount;
2929
[Version(Min = 21, Max = 22)]
3030
public ulong ccwMarshalingFunctions;
31-
public long genericMethodPointersCount;
31+
public ulong genericMethodPointersCount;
3232
public ulong genericMethodPointers;
3333
[Version(Min = 24.5, Max = 24.5)]
3434
[Version(Min = 27.1)]
3535
public ulong genericAdjustorThunks;
36-
public long invokerPointersCount;
36+
public ulong invokerPointersCount;
3737
public ulong invokerPointers;
3838
[Version(Max = 24.5)]
39-
public long customAttributeCount;
39+
public ulong customAttributeCount;
4040
[Version(Max = 24.5)]
4141
public ulong customAttributeGenerators;
4242
[Version(Min = 21, Max = 22)]
43-
public long guidCount;
43+
public ulong guidCount;
4444
[Version(Min = 21, Max = 22)]
4545
public ulong guids; // Il2CppGuid
4646
[Version(Min = 22)]
47-
public long unresolvedVirtualCallCount; //29.1 unresolvedIndirectCallCount;
47+
public ulong unresolvedVirtualCallCount; //29.1 unresolvedIndirectCallCount;
4848
[Version(Min = 22)]
4949
public ulong unresolvedVirtualCallPointers;
5050
[Version(Min = 29.1)]
@@ -60,7 +60,7 @@ public class Il2CppCodeRegistration
6060
[Version(Min = 24.3)]
6161
public ulong windowsRuntimeFactoryTable;
6262
[Version(Min = 24.2)]
63-
public long codeGenModulesCount;
63+
public ulong codeGenModulesCount;
6464
[Version(Min = 24.2)]
6565
public ulong codeGenModules;
6666
}

0 commit comments

Comments
 (0)