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

Commit d4dac58

Browse files
committed
Fix for deobfuscated unhollowed types not being properly resolved
1 parent 77b97cb commit d4dac58

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace UnityExplorer
1717
public class ExplorerCore
1818
{
1919
public const string NAME = "UnityExplorer";
20-
public const string VERSION = "3.1.7";
20+
public const string VERSION = "3.1.8";
2121
public const string AUTHOR = "Sinai";
2222
public const string GUID = "com.sinai.unityexplorer";
2323

src/Helpers/ReflectionHelpers.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,24 @@ public static Type GetMonoType(CppType cppType)
101101
return Il2CppToMonoType[cppType];
102102

103103
var getType = Type.GetType(cppType.AssemblyQualifiedName);
104-
Il2CppToMonoType.Add(cppType, getType);
105-
return getType;
104+
105+
if (getType != null)
106+
{
107+
Il2CppToMonoType.Add(cppType, getType);
108+
return getType;
109+
}
110+
else
111+
{
112+
string baseName = cppType.FullName;
113+
string baseAssembly = cppType.Assembly.GetName().name;
114+
115+
Type unhollowedType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == baseAssembly)?.GetTypes().FirstOrDefault(t =>
116+
t.CustomAttributes.Any(ca =>
117+
ca.AttributeType.Name == "ObfuscatedNameAttribute" && (string)ca.ConstructorArguments[0].Value == baseName));
118+
119+
Il2CppToMonoType.Add(cppType, unhollowedType);
120+
return unhollowedType;
121+
}
106122
}
107123

108124
private static readonly Dictionary<Type, IntPtr> CppClassPointers = new Dictionary<Type, IntPtr>();

0 commit comments

Comments
 (0)