ELF: Tidy up LoadOptions and handling of dumped files

This commit is contained in:
Katy Coe
2020-12-13 01:37:28 +01:00
parent 752cd6184c
commit 625cba808f
6 changed files with 28 additions and 13 deletions

View File

@@ -34,7 +34,7 @@ namespace Il2CppInspectorGUI
}
}
public LoadOptions LoadOptions { get; private set; } = null;
public LoadOptions LoadOptions { get; private set; }
public List<AppModel> AppModels { get; } = new List<AppModel>();
@@ -45,9 +45,15 @@ namespace Il2CppInspectorGUI
private void StatusUpdate(object sender, string status) => OnStatusUpdate?.Invoke(sender, status);
// Initialization entry point
protected override void OnStartup(StartupEventArgs e) {
ResetLoadOptions();
}
public void ResetLoadOptions() {
LoadOptions = new LoadOptions {
ImageBase = 0ul
ImageBase = 0xffffffff_ffffffff,
BinaryFilePath = null
};
}
@@ -94,6 +100,9 @@ namespace Il2CppInspectorGUI
// Attempt to load an IL2CPP binary file
public async Task<bool> LoadBinaryAsync(string binaryFile) {
// For loaders which require the file path to find additional files
LoadOptions.BinaryFilePath = binaryFile;
var stream = new MemoryStream(await File.ReadAllBytesAsync(binaryFile));
return await LoadBinaryAsync(stream);
}

View File

@@ -20,7 +20,7 @@ namespace Il2CppInspector.GUI
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
if (value == null || targetType != typeof(ulong?))
if (value == null || targetType != typeof(ulong))
return DependencyProperty.UnsetValue;
try {

View File

@@ -25,9 +25,6 @@ namespace Il2CppInspector.GUI
InitializeComponent();
var app = (App) Application.Current;
if (app.LoadOptions == null)
app.ResetLoadOptions();
DataContext = app.LoadOptions;
}