Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit c4fa0d6

Browse files
committed
Add better time logging to reflection init
1 parent a5f56cf commit c4fa0d6

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/Core/Reflection/Il2CppReflection.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using BF = System.Reflection.BindingFlags;
1717
using UnityExplorer.Core.Config;
1818
using UnhollowerBaseLib.Attributes;
19+
using UnityEngine;
1920

2021
namespace UnityExplorer
2122
{
@@ -25,10 +26,15 @@ protected override void Initialize()
2526
{
2627
base.Initialize();
2728

29+
float start = Time.realtimeSinceStartup;
2830
TryLoadGameModules();
31+
ExplorerCore.Log($"Loaded Unhollowed modules in {Time.realtimeSinceStartup - start} seconds");
2932

33+
start = Time.realtimeSinceStartup;
3034
BuildDeobfuscationCache();
3135
OnTypeLoaded += TryCacheDeobfuscatedType;
36+
ExplorerCore.Log($"Setup IL2CPP reflection in {Time.realtimeSinceStartup - start} seconds, " +
37+
$"deobfuscated types count: {DeobfuscatedTypes.Count}");
3238
}
3339

3440
#region IL2CPP Extern and pointers
@@ -67,19 +73,11 @@ public static bool Il2CppTypeNotNull(Type type, out IntPtr il2cppPtr)
6773

6874
private static void BuildDeobfuscationCache()
6975
{
70-
float start = UnityEngine.Time.realtimeSinceStartup;
71-
7276
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
7377
{
7478
foreach (var type in asm.TryGetTypes())
7579
TryCacheDeobfuscatedType(type);
7680
}
77-
78-
if (DeobfuscatedTypes.Count > 0)
79-
{
80-
ExplorerCore.Log($"Built deobfuscation cache in {UnityEngine.Time.realtimeSinceStartup - start} seconds, " +
81-
$"initial count: {DeobfuscatedTypes.Count} ");
82-
}
8381
}
8482

8583
private static void TryCacheDeobfuscatedType(Type type)

src/Core/Reflection/ReflectionUtility.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ public static string[] GetTypeNameArray()
6565

6666
private static void SetupTypeCache()
6767
{
68+
float start = Time.realtimeSinceStartup;
69+
6870
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
6971
CacheTypes(asm);
7072

7173
AppDomain.CurrentDomain.AssemblyLoad += AssemblyLoaded;
74+
75+
ExplorerCore.Log($"Cached AppDomain assemblies in {Time.realtimeSinceStartup - start} seconds");
7276
}
7377

7478
private static void AssemblyLoaded(object sender, AssemblyLoadEventArgs args)

0 commit comments

Comments
 (0)