GUI: Improve progress updates

This commit is contained in:
Katy Coe
2020-09-12 14:06:43 +02:00
parent e384ec226e
commit 0b97a78a8d
2 changed files with 13 additions and 2 deletions

View File

@@ -176,7 +176,7 @@ namespace Il2CppInspector
// Find all relocations; target address => (rela header (rels are converted to rela), symbol table base address, is rela?) // Find all relocations; target address => (rela header (rels are converted to rela), symbol table base address, is rela?)
var rels = new HashSet<ElfReloc>(); var rels = new HashSet<ElfReloc>();
StatusUpdate("Processing relocations"); StatusUpdate("Finding relocations");
// Two types: add value from offset in image, and add value from specified addend // Two types: add value from offset in image, and add value from specified addend
foreach (var relSection in getSections(Elf.SHT_REL)) { foreach (var relSection in getSections(Elf.SHT_REL)) {
@@ -222,7 +222,14 @@ namespace Il2CppInspector
using var writer = new BinaryWriter(BaseStream, Encoding.Default, true); using var writer = new BinaryWriter(BaseStream, Encoding.Default, true);
var relsz = Sizeof(typeof(TSym)); var relsz = Sizeof(typeof(TSym));
var currentRel = 0;
var totalRel = rels.Count();
foreach (var rel in rels) { foreach (var rel in rels) {
currentRel++;
if (currentRel % 1000 == 0)
StatusUpdate($"Processing relocations ({currentRel * 100 / totalRel:F0}%)");
var symValue = ReadObject<TSym>(conv.Long(rel.SymbolTable) + conv.Long(rel.SymbolIndex) * relsz).st_value; // S var symValue = ReadObject<TSym>(conv.Long(rel.SymbolTable) + conv.Long(rel.SymbolIndex) * relsz).st_value; // S
// Ignore relocations into memory addresses not mapped from the image // Ignore relocations into memory addresses not mapped from the image
@@ -269,6 +276,8 @@ namespace Il2CppInspector
Console.WriteLine($"Processed {rels.Count} relocations"); Console.WriteLine($"Processed {rels.Count} relocations");
// Detect and defeat trivial XOR encryption // Detect and defeat trivial XOR encryption
StatusUpdate("Detecting encryption");
if (getDynamic(Elf.DT_INIT) != null && sectionByName.ContainsKey(".rodata")) { if (getDynamic(Elf.DT_INIT) != null && sectionByName.ContainsKey(".rodata")) {
// Use the data section to determine IF the file is obfuscated // Use the data section to determine IF the file is obfuscated
var rodataFirstBytes = ReadArray<byte>(conv.Long(sectionByName[".rodata"].sh_offset), 256); var rodataFirstBytes = ReadArray<byte>(conv.Long(sectionByName[".rodata"].sh_offset), 256);
@@ -323,6 +332,8 @@ namespace Il2CppInspector
public override IEnumerable<Export> GetExports() => exports; public override IEnumerable<Export> GetExports() => exports;
private void processSymbols() { private void processSymbols() {
StatusUpdate("Processing symbols");
// Three possible symbol tables in ELF files // Three possible symbol tables in ELF files
var pTables = new List<(TWord offset, TWord count, TWord strings)>(); var pTables = new List<(TWord offset, TWord count, TWord strings)>();

View File

@@ -35,7 +35,7 @@ namespace Il2CppInspectorGUI
try { try {
OnStatusUpdate?.Invoke(this, "Extracting package"); OnStatusUpdate?.Invoke(this, "Extracting package");
var streams = Inspector.GetStreamsFromPackage(packageFiles); var streams = await Task.Run(() => Inspector.GetStreamsFromPackage(packageFiles));
if (streams == null) if (streams == null)
throw new InvalidOperationException("The supplied package is not an APK or IPA file, or does not contain a complete IL2CPP application"); throw new InvalidOperationException("The supplied package is not an APK or IPA file, or does not contain a complete IL2CPP application");