* Initial commit of new UI c# component * Initial commit of new UI frontend component * target WinExe to hide console window in release mode, move ui exe into resources * force single file publishing and add initial gh workflow for publishing ui * fix workflow errors * update dependencies and remove cxxdemangler, as it was outdated * fix c# single file output due to invalid output path * smaller tweaks, hack around loops in cpp type layouting * process other queued exports even if one fails and show error message * add basic support for processing LC_DYLD_CHAINED_FIXUPS * ELF loading should not use the file offset for loading the dynamic section * fix symbol table loading in some modified elfs * add "start export" button on format selection screen, clear all toasts after selecting an export format * embed ui executable directly into c# assembly * only build tauri component in c# release builds * add il2cpp file (binary, metadata) export to advanced tab * fix and enable binary ninja fake string segment support * add support for metadata * unify logic for getting element type index * fix new ui not allowing script exports other than ida * new ui: clear out loaded binary if no IL2CPP images could be loaded * fix toAddr calls in ghidra script target * remove dependency on a section being named .text in loaded pe files * tweak symbol reading a bit and remove sht relocation reading * add initial support for required forward references in il2cpp types, also fix issues with type names clashing with il2cpp api types * reduce clang errors for header file, fix better array size struct, emit required forward definitions in header * expose forward definitions in AppModel, fix issue with method-only used types not being emitted * remove debug log line * fix spelling mistakes in gui outputs * fix il2cpp_array_size_t not being an actual type for later method definitions * change the default port for new ui dev to 5000 * show current version and hash in new ui footer * seperate redux ui impl into FrontendCore project * make inspector version a server api, split up output subtypes and tweak some option names * add redux CLI based on redux GUI output formats * replace all Console.WriteLine calls in core inspector with AnsiConsole calls * add workflow for new cli and add back old gui workflow * disable aot publish and enable single file for redux cli
75 lines
2.4 KiB
C#
75 lines
2.4 KiB
C#
/*
|
|
Copyright 2020-2021 Katy Coe - http://www.djkaty.com - https://github.com/djkaty
|
|
|
|
All rights reserved.
|
|
*/
|
|
|
|
using Spectre.Console;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO.Compression;
|
|
using System.Linq;
|
|
|
|
namespace Il2CppInspector
|
|
{
|
|
// This is a wrapper for multiple binary files of different architectures within a single AAB
|
|
public class AABReader : FileFormatStream<AABReader>
|
|
{
|
|
private ZipArchive zip;
|
|
private ZipArchiveEntry[] binaryFiles;
|
|
|
|
public override string DefaultFilename => "Package.aab";
|
|
|
|
protected override bool Init() {
|
|
|
|
// Check if it's a zip file first because ZipFile.OpenRead is extremely slow if it isn't
|
|
// 0x04034B50 = magic file header
|
|
// 0x02014B50 = central directory file header (will appear if we merged a split AAB in memory)
|
|
var magic = ReadUInt32();
|
|
if (magic != 0x04034B50 && magic != 0x02014B50)
|
|
return false;
|
|
|
|
try {
|
|
zip = new ZipArchive(this);
|
|
|
|
// Get list of binary files
|
|
binaryFiles = zip.Entries.Where(f => f.FullName.StartsWith("base/lib/") && f.Name == "libil2cpp.so").ToArray();
|
|
|
|
// This package doesn't contain an IL2CPP binary
|
|
if (!binaryFiles.Any())
|
|
return false;
|
|
}
|
|
|
|
// Not an archive
|
|
catch (InvalidDataException) {
|
|
return false;
|
|
}
|
|
|
|
NumImages = (uint) binaryFiles.Count();
|
|
return true;
|
|
}
|
|
|
|
public override IFileFormatStream this[uint index] {
|
|
get {
|
|
AnsiConsole.WriteLine($"Extracting binary from {binaryFiles[index].FullName}");
|
|
IFileFormatStream loaded = null;
|
|
|
|
// ZipArchiveEntry does not support seeking so we have to close and re-open for each possible load format
|
|
var binary = binaryFiles[index].Open();
|
|
loaded = ElfReader32.Load(binary, LoadOptions, OnStatusUpdate);
|
|
binary.Close();
|
|
|
|
if (loaded != null)
|
|
return loaded;
|
|
|
|
binary = binaryFiles[index].Open();
|
|
loaded = ElfReader64.Load(binary, LoadOptions, OnStatusUpdate);
|
|
binary.Close();
|
|
|
|
return loaded;
|
|
}
|
|
}
|
|
}
|
|
}
|