Skip to content

Commit 9c2b17f

Browse files
authored
Merge pull request #443 from TheLounger/master
Add unhollower RegEx rename config option
2 parents 3a54f7e + ca9a912 commit 9c2b17f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

BepInEx.IL2CPP/ProxyAssemblyGenerator.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Net.Http;
77
using System.Security.Cryptography;
88
using System.Text;
9+
using System.Text.RegularExpressions;
910
using AssemblyUnhollower;
1011
using BepInEx.Configuration;
1112
using BepInEx.Logging;
@@ -64,6 +65,15 @@ internal static class ProxyAssemblyGenerator
6465
.AppendLine("{ProcessName} - Name of the current process")
6566
.ToString());
6667

68+
private static readonly ConfigEntry<string> ConfigUnhollowerDeobfuscationRegex = ConfigFile.CoreConfig.Bind(
69+
"IL2CPP", "UnhollowerDeobfuscationRegex",
70+
string.Empty,
71+
new StringBuilder()
72+
.AppendLine("The RegEx string to pass to Il2CppAssemblyUnhollower for renaming obfuscated names.")
73+
.AppendLine("All types and members matching this RegEx will get a name based on their signature,")
74+
.AppendLine("resulting in names that persist after game updates.")
75+
.ToString());
76+
6777
private static ManualLogSource Il2cppDumperLogger;
6878

6979
private static string unhollowedBasePath;
@@ -367,7 +377,8 @@ private void GenerateAssembliesInternal(AppDomainListener listener,
367377
Source = sourceAssemblies,
368378
OutputDir = Preloader.IL2CPPUnhollowedPath,
369379
UnityBaseLibsDir = Directory.Exists(UnityBaseLibsDirectory) ? UnityBaseLibsDirectory : null,
370-
NoCopyUnhollowerLibs = true
380+
NoCopyUnhollowerLibs = true,
381+
ObfuscatedNamesRegex = !string.IsNullOrEmpty(ConfigUnhollowerDeobfuscationRegex.Value) ? new Regex(ConfigUnhollowerDeobfuscationRegex.Value) : null
371382
};
372383

373384
var renameMapLocation = Path.Combine(Paths.BepInExRootPath, "DeobfuscationMap.csv.gz");

0 commit comments

Comments
 (0)