diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs
index d5f6f39..501d43d 100644
--- a/Il2CppInspector.CLI/Program.cs
+++ b/Il2CppInspector.CLI/Program.cs
@@ -85,6 +85,9 @@ namespace Il2CppInspector.CLI
[Option('n', "suppress-metadata", Required = false, HelpText = "Diff tidying: suppress method pointers, field offsets and type indices from C# output. Useful for comparing two versions of a binary for changes with a diff tool")]
public bool SuppressMetadata { get; set; }
+ [Option("suppress-dll-metadata", Required = false, HelpText = "Diff tidying: suppress method pointers, field offsets and type indices attributes from DLL output. Useful for comparing two versions of a binary for changes")]
+ public bool SuppressDllMetadata { get; set; }
+
[Option('k', "must-compile", Required = false, HelpText = "Compilation tidying: try really hard to make code that compiles. Suppress generation of code for items with CompilerGenerated attribute. Comment out attributes without parameterless constructors or all-optional constructor arguments. Don't emit add/remove/raise on events. Specify AttributeTargets.All on classes with AttributeUsage attribute. Force auto-properties to have get accessors. Force regular properties to have bodies. Suppress global::Locale classes. Generate dummy parameterless base constructors and ref return fields.")]
public bool MustCompile { get; set; }
@@ -427,7 +430,10 @@ namespace Il2CppInspector.CLI
// DLL output
using (new Benchmark("Generate .NET assembly shim DLLs"))
- new AssemblyShims(model).Write(getOutputPath(options.DllOutPath, "", imageIndex));
+ new AssemblyShims(model) {
+ SuppressMetadata = options.SuppressDllMetadata
+ }
+ .Write(getOutputPath(options.DllOutPath, "", imageIndex));
imageIndex++;
}
diff --git a/Il2CppInspector.Common/Outputs/AssemblyShims.cs b/Il2CppInspector.Common/Outputs/AssemblyShims.cs
index 3666df4..b0fa8bb 100644
--- a/Il2CppInspector.Common/Outputs/AssemblyShims.cs
+++ b/Il2CppInspector.Common/Outputs/AssemblyShims.cs
@@ -36,6 +36,11 @@ namespace Il2CppInspector.Outputs
// Add custom attribute to item with named property arguments
// 'module' is the module that owns 'type'; type.Module may still be null when this is called
public static CustomAttribute AddAttribute(this IHasCustomAttribute def, ModuleDef module, TypeDef attrTypeDef, params (string prop, object value)[] args) {
+
+ // If SuppressMetadata is set, our own attributes will never be generated so attrTypeDef will be null
+ if (attrTypeDef == null)
+ return null;
+
var attRef = module.Import(attrTypeDef);
var attCtorRef = new MemberRefUser(attrTypeDef.Module, ".ctor", MethodSig.CreateInstance(module.CorLibTypes.Void), attRef);
@@ -53,6 +58,9 @@ namespace Il2CppInspector.Outputs
// Output module to create .NET DLLs containing type definitions
public class AssemblyShims
{
+ // Suppress informational attributes
+ public bool SuppressMetadata { get; set; }
+
// .NET type model
private readonly TypeModel model;
@@ -502,10 +510,12 @@ namespace Il2CppInspector.Outputs
}
// Generate our custom types assembly (relies on mscorlib.dll being added above)
- var baseDll = CreateBaseAssembly();
+ if (!SuppressMetadata) {
+ var baseDll = CreateBaseAssembly();
- // Write base assembly to disk
- baseDll.Write(Path.Combine(outputPath, baseDll.Name));
+ // Write base assembly to disk
+ baseDll.Write(Path.Combine(outputPath, baseDll.Name));
+ }
// Add assembly custom attribute attributes (must do this after all assemblies are created due to type referencing)
foreach (var asm in model.Assemblies) {
diff --git a/Il2CppInspector.GUI/MainWindow.xaml b/Il2CppInspector.GUI/MainWindow.xaml
index 8640534..216d90b 100644
--- a/Il2CppInspector.GUI/MainWindow.xaml
+++ b/Il2CppInspector.GUI/MainWindow.xaml
@@ -350,7 +350,8 @@
.NET assembly shim DLLs
- No configuration required for assembly shims
+
+ Suppress output of all metadata attributes
diff --git a/Il2CppInspector.GUI/MainWindow.xaml.cs b/Il2CppInspector.GUI/MainWindow.xaml.cs
index 482c943..f3420bc 100644
--- a/Il2CppInspector.GUI/MainWindow.xaml.cs
+++ b/Il2CppInspector.GUI/MainWindow.xaml.cs
@@ -612,11 +612,15 @@ namespace Il2CppInspectorGUI
return;
var dllOutPath = dllSaveFolderDialog.SelectedPath;
+ var suppressMetadata = cbSuppressDllMetadata.IsChecked == true;
areaBusyIndicator.Visibility = Visibility.Visible;
await Task.Run(() => {
OnStatusUpdate(this, "Generating .NET assembly shim DLLs");
- new AssemblyShims(model.TypeModel).Write(dllOutPath, OnStatusUpdate);
+ new AssemblyShims(model.TypeModel) {
+ SuppressMetadata = suppressMetadata
+ }
+ .Write(dllOutPath, OnStatusUpdate);
});
break;
}