This commit is contained in:
Perfare 2022-04-23 21:27:32 +08:00
parent aa1be209f5
commit bf36e1d5cc
3 changed files with 11 additions and 6 deletions

View file

@ -46,13 +46,15 @@ namespace Il2CppDumper
public WebAssemblyMemory CreateMemory()
{
var last = dataSections[dataSections.Length - 1];
var bssStart = last.Offset + (uint)last.Data.Length;
var stream = new MemoryStream(new byte[Length]);
foreach (var dataSection in dataSections)
{
stream.Position = dataSection.Offset;
stream.Write(dataSection.Data, 0, dataSection.Data.Length);
}
return new WebAssemblyMemory(stream, Is32Bit);
return new WebAssemblyMemory(stream, bssStart);
}
}
}

View file

@ -4,9 +4,12 @@ namespace Il2CppDumper
{
public sealed class WebAssemblyMemory : Il2Cpp
{
public WebAssemblyMemory(Stream stream, bool is32Bit) : base(stream)
private uint bssStart;
public WebAssemblyMemory(Stream stream, uint bssStart) : base(stream)
{
Is32Bit = is32Bit;
Is32Bit = true;
this.bssStart = bssStart;
}
public override ulong MapVATR(ulong addr)
@ -55,9 +58,9 @@ namespace Il2CppDumper
};
var bss = new SearchSection
{
offset = Length,
offset = bssStart,
offsetEnd = long.MaxValue, //hack
address = Length,
address = bssStart,
addressEnd = long.MaxValue //hack
};
var sectionHelper = new SectionHelper(this, methodCount, typeDefinitionsCount, metadataUsagesCount, imageCount);

View file

@ -220,7 +220,7 @@ namespace Il2CppDumper
foreach (var section in data)
{
il2Cpp.Position = section.offset;
while (il2Cpp.Position < section.offsetEnd)
while (il2Cpp.Position < section.offsetEnd - il2Cpp.PointerSize)
{
var addr = il2Cpp.Position;
if (il2Cpp.ReadIntPtr() == typeDefinitionsCount)