diff --git a/Il2CppDumper/ExecutableFormats/WebAssembly.cs b/Il2CppDumper/ExecutableFormats/WebAssembly.cs index 36ad64a..eee93da 100644 --- a/Il2CppDumper/ExecutableFormats/WebAssembly.cs +++ b/Il2CppDumper/ExecutableFormats/WebAssembly.cs @@ -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); } } } diff --git a/Il2CppDumper/ExecutableFormats/WebAssemblyMemory.cs b/Il2CppDumper/ExecutableFormats/WebAssemblyMemory.cs index e96c3fa..dfb2b72 100644 --- a/Il2CppDumper/ExecutableFormats/WebAssemblyMemory.cs +++ b/Il2CppDumper/ExecutableFormats/WebAssemblyMemory.cs @@ -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); diff --git a/Il2CppDumper/Utils/SectionHelper.cs b/Il2CppDumper/Utils/SectionHelper.cs index 7de135b..a246b46 100644 --- a/Il2CppDumper/Utils/SectionHelper.cs +++ b/Il2CppDumper/Utils/SectionHelper.cs @@ -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)