IL2CPP: Change metadata and binary to derive from BinaryObjectStream

This commit is contained in:
Katy Coe
2020-12-21 06:37:29 +01:00
parent 620d985b71
commit c00b474f33
31 changed files with 172 additions and 179 deletions

View File

@@ -801,17 +801,9 @@ namespace Il2CppInspector
MetadataRegistration.methodReferences = 0;
// Write changes to stream
using var sw = new BinaryObjectWriter(Image.Stream.BaseStream, Image.Stream.Endianness, true);
sw.Version = Image.Version;
// Set width of long (convert to sizeof(int) for 32-bit files)
if (Image.Bits == 32) {
sw.PrimitiveMappings.Add(typeof(long), typeof(int));
sw.PrimitiveMappings.Add(typeof(ulong), typeof(uint));
}
sw.WriteObject(Image.MapVATR(CodeRegistrationPointer), CodeRegistration);
sw.WriteObject(Image.MapVATR(MetadataRegistrationPointer), MetadataRegistration);
Image.WriteObject(Image.MapVATR(CodeRegistrationPointer), CodeRegistration);
Image.WriteObject(Image.MapVATR(MetadataRegistrationPointer), MetadataRegistration);
isModified = true;
StatusUpdate("Analyzing IL2CPP image");