Skip to content

Commit 4a290db

Browse files
committed
ProxyAssemblyGenerator: fix to work with new Unhollower version
1 parent 16a7547 commit 4a290db

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

BepInEx.IL2CPP/ProxyAssemblyGenerator.cs

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using Il2CppDumper;
1515
using Mono.Cecil;
1616
using UnhollowerBaseLib;
17-
using AssemblyUnhollowerRunner = AssemblyUnhollower.Program;
1817
using Logger = BepInEx.Logging.Logger;
1918

2019
namespace BepInEx.IL2CPP;
@@ -93,7 +92,7 @@ static void HashString(ICryptoTransform hash, string str)
9392
}
9493

9594
// Hash some common dependencies as they can affect output
96-
HashString(md5, typeof(AssemblyUnhollowerRunner).Assembly.GetName().Version.ToString());
95+
HashString(md5, typeof(UnhollowedAssemblyGenerator).Assembly.GetName().Version.ToString());
9796
HashString(md5, typeof(Cpp2IlApi).Assembly.GetName().Version.ToString());
9897
HashString(md5, typeof(Il2CppDumper.Il2CppDumper).Assembly.GetName().Version.ToString());
9998

@@ -145,9 +144,9 @@ public static void GenerateAssemblies()
145144
});
146145

147146
var runner =
148-
(AppDomainRunner)AppDomainHelper.CreateInstanceAndUnwrap(domain,
149-
typeof(AppDomainRunner).Assembly.FullName,
150-
typeof(AppDomainRunner).FullName);
147+
(AppDomainRunner) AppDomainHelper.CreateInstanceAndUnwrap(domain,
148+
typeof(AppDomainRunner).Assembly.FullName,
149+
typeof(AppDomainRunner).FullName);
151150

152151
runner.Setup(Paths.ExecutablePath, Preloader.IL2CPPUnhollowedPath, Paths.BepInExRootPath,
153152
Paths.ManagedPath);
@@ -341,29 +340,9 @@ private void GenerateAssembliesInternal(AppDomainListener listener,
341340
if (File.Exists(renameMapLocation))
342341
{
343342
listener.DoPreloaderLog("Parsing deobfuscation rename mappings", LogLevel.Info);
344-
345-
using var fileStream =
346-
new FileStream(renameMapLocation, FileMode.Open, FileAccess.Read, FileShare.Read);
347-
using var gzipStream = new GZipStream(fileStream, CompressionMode.Decompress);
348-
349-
using var reader = new StreamReader(gzipStream, Encoding.UTF8, false);
350-
while (!reader.EndOfStream)
351-
{
352-
var line = reader.ReadLine();
353-
354-
if (string.IsNullOrWhiteSpace(line) || line.StartsWith("#"))
355-
continue;
356-
357-
var mapping = line.Split(';');
358-
359-
if (mapping.Length != 2)
360-
continue;
361-
362-
unhollowerOptions.RenameMap[mapping[0]] = mapping[1];
363-
}
343+
unhollowerOptions.ReadRenameMap(renameMapLocation);
364344
}
365345

366-
367346
listener.DoPreloaderLog("Executing Il2CppUnhollower generator", LogLevel.Info);
368347

369348
LogSupport.InfoHandler += s => listener.DoUnhollowerLog(s.Trim(), LogLevel.Info);
@@ -373,7 +352,7 @@ private void GenerateAssembliesInternal(AppDomainListener listener,
373352

374353
try
375354
{
376-
AssemblyUnhollowerRunner.Main(unhollowerOptions);
355+
UnhollowedAssemblyGenerator.GenerateUnhollowedAssemblies(unhollowerOptions);
377356
}
378357
catch (Exception e)
379358
{

0 commit comments

Comments
 (0)