diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs index b51d978..0905737 100644 --- a/Il2CppInspector.CLI/Program.cs +++ b/Il2CppInspector.CLI/Program.cs @@ -176,7 +176,6 @@ namespace Il2CppInspector.CLI // Set load options var loadOptions = new LoadOptions { - ImageBase = 0xffffffff_ffffffff, BinaryFilePath = options.BinaryFiles.First() }; diff --git a/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs b/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs index 42fac72..ae207e8 100644 --- a/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs +++ b/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs @@ -201,9 +201,14 @@ namespace Il2CppInspector // Dumped images must be rebased if (isMemoryImage) { - if (LoadOptions.ImageBase == 0xffffffff_ffffffff) + if (LoadOptions.ImageBase == 0) throw new InvalidOperationException("To load a dumped ELF image, you must specify the image base virtual address"); + } + // Rebase if requested (whether dumped or not) and treat it as a memory image, + // disabling processing of relocations, symbols and decryption + if (LoadOptions.ImageBase != 0) { + isMemoryImage = true; rebase(conv.FromULong(LoadOptions.ImageBase)); } diff --git a/Il2CppInspector.Common/FileFormatStreams/LoadOptions.cs b/Il2CppInspector.Common/FileFormatStreams/LoadOptions.cs index 4e2d86c..4c4a0d3 100644 --- a/Il2CppInspector.Common/FileFormatStreams/LoadOptions.cs +++ b/Il2CppInspector.Common/FileFormatStreams/LoadOptions.cs @@ -9,9 +9,9 @@ namespace Il2CppInspector // Modifiers for use when loading binary files public class LoadOptions { - // For dumped ELF files, the virtual address to which we should rebase - ignored for other file types - // Use 2^64-1 to prevent rebasing on a dumped file - public ulong ImageBase { get; set; } + // For ELF files, the virtual address to which we should rebase - ignored for other file types + // Use zero to prevent rebasing + public ulong ImageBase { get; set; } = 0ul; // For Linux process memory map inputs, we need the full path so we can find the .bin files // For packed PE files, we need the full path to reload the file via Win32 API diff --git a/Il2CppInspector.GUI/App.xaml.cs b/Il2CppInspector.GUI/App.xaml.cs index e246270..7a850f0 100644 --- a/Il2CppInspector.GUI/App.xaml.cs +++ b/Il2CppInspector.GUI/App.xaml.cs @@ -240,10 +240,7 @@ namespace Il2CppInspectorGUI // Reset image load options to their defaults public void ResetLoadOptions() { - ImageLoadOptions = new LoadOptions { - ImageBase = 0xffffffff_ffffffff, - BinaryFilePath = null - }; + ImageLoadOptions = new LoadOptions(); } // Attempt to load an IL2CPP application package (APK or IPA) diff --git a/Il2CppInspector.GUI/LoadOptionsDialog.xaml b/Il2CppInspector.GUI/LoadOptionsDialog.xaml index 83378b4..a486e08 100644 --- a/Il2CppInspector.GUI/LoadOptionsDialog.xaml +++ b/Il2CppInspector.GUI/LoadOptionsDialog.xaml @@ -60,7 +60,7 @@ - For ELF binaries that have been dumped from memory, specify the base address of the dumpIgnored for normal ELF binaries + For ELF binaries that have been dumped from memory, specify the base address of the dumpUse zero to disable rebasing