CLI/GUI: Add shim DLL output support
This commit is contained in:
@@ -48,6 +48,9 @@ namespace Il2CppInspector.CLI
|
|||||||
[Option('o', "json-out", Required = false, HelpText = "JSON metadata output file", Default = "metadata.json")]
|
[Option('o', "json-out", Required = false, HelpText = "JSON metadata output file", Default = "metadata.json")]
|
||||||
public string JsonOutPath { get; set; }
|
public string JsonOutPath { get; set; }
|
||||||
|
|
||||||
|
[Option('d', "dll-out", Required = false, HelpText = ".NET assembly shim DLLs output path", Default = "dll")]
|
||||||
|
public string DllOutPath { get; set; }
|
||||||
|
|
||||||
[Option("metadata-out", Required = false, HelpText = "IL2CPP metadata file output (for extracted or decrypted metadata; ignored otherwise)")]
|
[Option("metadata-out", Required = false, HelpText = "IL2CPP metadata file output (for extracted or decrypted metadata; ignored otherwise)")]
|
||||||
public string MetadataFileOut { get; set; }
|
public string MetadataFileOut { get; set; }
|
||||||
|
|
||||||
@@ -395,6 +398,10 @@ namespace Il2CppInspector.CLI
|
|||||||
getOutputPath(options.JsonOutPath, "json", imageIndex));
|
getOutputPath(options.JsonOutPath, "json", imageIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DLL output
|
||||||
|
using (new Benchmark("Generate .NET assembly shim DLLs"))
|
||||||
|
new AssemblyShims(model).Write(getOutputPath(options.DllOutPath, "", imageIndex));
|
||||||
|
|
||||||
imageIndex++;
|
imageIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ namespace Il2CppInspector.Outputs
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate and save all DLLs
|
// Generate and save all DLLs
|
||||||
public void Write(string outputPath) {
|
public void Write(string outputPath, EventHandler<string> statusCallback = null) {
|
||||||
|
|
||||||
// Create folder for DLLs
|
// Create folder for DLLs
|
||||||
Directory.CreateDirectory(outputPath);
|
Directory.CreateDirectory(outputPath);
|
||||||
@@ -516,13 +516,17 @@ namespace Il2CppInspector.Outputs
|
|||||||
AddCustomAttribute(modules[asm], modules[asm].Assembly, ca);
|
AddCustomAttribute(modules[asm], modules[asm].Assembly, ca);
|
||||||
|
|
||||||
// Add all types
|
// Add all types
|
||||||
foreach (var asm in model.Assemblies)
|
foreach (var asm in model.Assemblies) {
|
||||||
|
statusCallback?.Invoke(this, "Preparing " + asm.ShortName);
|
||||||
foreach (var type in asm.DefinedTypes.Where(t => !t.IsNested))
|
foreach (var type in asm.DefinedTypes.Where(t => !t.IsNested))
|
||||||
AddType(modules[asm], type);
|
AddType(modules[asm], type);
|
||||||
|
}
|
||||||
|
|
||||||
// Write all assemblies to disk
|
// Write all assemblies to disk
|
||||||
foreach (var asm in modules.Values)
|
foreach (var asm in modules.Values) {
|
||||||
|
statusCallback?.Invoke(this, "Generating " + asm.Name);
|
||||||
asm.Write(Path.Combine(outputPath, asm.Name));
|
asm.Write(Path.Combine(outputPath, asm.Name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
<LineBreak/>
|
<LineBreak/>
|
||||||
<Hyperlink NavigateUri="https://github.com/djkaty/Il2CppInspector" RequestNavigate="Hyperlink_OnRequestNavigate">Il2CppInspector on GitHub</Hyperlink><LineBreak/>
|
<Hyperlink NavigateUri="https://github.com/djkaty/Il2CppInspector" RequestNavigate="Hyperlink_OnRequestNavigate">Il2CppInspector on GitHub</Hyperlink><LineBreak/>
|
||||||
<Hyperlink NavigateUri="http://www.djkaty.com" RequestNavigate="Hyperlink_OnRequestNavigate">www.djkaty.com</Hyperlink><LineBreak/>
|
<Hyperlink NavigateUri="http://www.djkaty.com" RequestNavigate="Hyperlink_OnRequestNavigate">www.djkaty.com</Hyperlink><LineBreak/>
|
||||||
© Katy Coe 2017-2020
|
© Katy Coe 2017-2021
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<!-- Image details view -->
|
<!-- Image details view -->
|
||||||
@@ -345,6 +345,12 @@
|
|||||||
|
|
||||||
<Separator Margin="5,15,5,15"/>
|
<Separator Margin="5,15,5,15"/>
|
||||||
|
|
||||||
|
<!-- Assembly shim DLLs -->
|
||||||
|
<RadioButton GroupName="grpOutputType" Name="rdoOutputDll" VerticalContentAlignment="Center" FontSize="18" Foreground="{StaticResource MicrosoftGreen}">.NET assembly shim DLLs</RadioButton>
|
||||||
|
<TextBlock TextWrapping="WrapWithOverflow">No configuration required for assembly shims</TextBlock>
|
||||||
|
|
||||||
|
<Separator Margin="5,15,5,15"/>
|
||||||
|
|
||||||
<!-- Python script -->
|
<!-- Python script -->
|
||||||
<RadioButton GroupName="grpOutputType" Name="rdoOutputPy" VerticalContentAlignment="Center" FontSize="18" Foreground="{StaticResource MicrosoftGreen}">Python script for disassemblers</RadioButton>
|
<RadioButton GroupName="grpOutputType" Name="rdoOutputPy" VerticalContentAlignment="Center" FontSize="18" Foreground="{StaticResource MicrosoftGreen}">Python script for disassemblers</RadioButton>
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
|
|||||||
@@ -563,6 +563,26 @@ namespace Il2CppInspectorGUI
|
|||||||
new JSONMetadata(model).Write(jsonOutFile);
|
new JSONMetadata(model).Write(jsonOutFile);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// .NET assembly shim DLLs
|
||||||
|
case { rdoOutputDll: var r } when r.IsChecked == true:
|
||||||
|
|
||||||
|
var dllSaveFolderDialog = new VistaFolderBrowserDialog {
|
||||||
|
Description = "Select save location",
|
||||||
|
UseDescriptionForTitle = true
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dllSaveFolderDialog.ShowDialog() == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var dllOutPath = dllSaveFolderDialog.SelectedPath;
|
||||||
|
|
||||||
|
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||||
|
await Task.Run(() => {
|
||||||
|
OnStatusUpdate(this, "Generating .NET assembly shim DLLs");
|
||||||
|
new AssemblyShims(model.TypeModel).Write(dllOutPath, OnStatusUpdate);
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
areaBusyIndicator.Visibility = Visibility.Hidden;
|
areaBusyIndicator.Visibility = Visibility.Hidden;
|
||||||
|
|||||||
Reference in New Issue
Block a user