IL2CPP: Add IsModified flags to Metadata and Binary

This commit is contained in:
Katy Coe
2020-12-09 17:34:21 +01:00
parent 15663fb0cf
commit 90fa9cf193
3 changed files with 13 additions and 0 deletions

View File

@@ -80,9 +80,13 @@ namespace Il2CppInspector
// One assembly may contain multiple modules
public Dictionary<string, Il2CppCodeGenModule> Modules { get; private set; }
// Status update callback
private EventHandler<string> OnStatusUpdate { get; set; }
private void StatusUpdate(string status) => OnStatusUpdate?.Invoke(this, status);
// Set if something in the binary has been modified / decrypted
public bool IsModified { get; private set; } = false;
protected Il2CppBinary(IFileFormatReader stream, EventHandler<string> statusCallback = null) {
Image = stream;
OnStatusUpdate = statusCallback;

View File

@@ -45,6 +45,9 @@ namespace Il2CppInspector
public Dictionary<int, string> Strings { get; } = new Dictionary<int, string>();
// Set if something in the metadata has been modified / decrypted
public bool IsModified { get; } = false;
public Metadata(Stream stream, EventHandler<string> statusCallback = null) : base(stream)
{
// Read magic bytes
@@ -189,6 +192,7 @@ namespace Il2CppInspector
var decryptedString = Encoding.GetString(encryptedString.Select(b => (byte) (b ^ xorKey)).ToArray());
Strings.Add(offset.current, decryptedString);
}
IsModified = true;
}
// Get all managed code string literals

View File

@@ -319,6 +319,9 @@ namespace Il2CppInspector
CodeRegistration.unresolvedVirtualCallCount = 0;
CodeRegistration.interopDataCount = 0;
// TODO: Write changes to stream
IsModified = true;
// Things we need from Il2CppMetadataRegistration
// genericInsts -> list of Il2CppGenericInst* (argc is count of Il2CppType* at data pointer argv; datapoint = GenericParameterIndex)
@@ -767,6 +770,8 @@ namespace Il2CppInspector
MetadataRegistration.typeDefinitionsSizesCount = 0;
MetadataRegistration.genericClassesCount = MetadataRegistration.genericInstsCount + 1;
// TODO: Write changes to stream
StatusUpdate("Analyzing IL2CPP image");
}
}