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

Commit

Permalink
Fix for deobfuscated unhollowed types not being properly resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
sinai-dev committed Feb 20, 2021
1 parent 77b97cb commit d4dac58
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ExplorerCore.cs
Expand Up @@ -17,7 +17,7 @@ namespace UnityExplorer
public class ExplorerCore
{
public const string NAME = "UnityExplorer";
public const string VERSION = "3.1.7";
public const string VERSION = "3.1.8";
public const string AUTHOR = "Sinai";
public const string GUID = "com.sinai.unityexplorer";

Expand Down
20 changes: 18 additions & 2 deletions src/Helpers/ReflectionHelpers.cs
Expand Up @@ -101,8 +101,24 @@ public static Type GetMonoType(CppType cppType)
return Il2CppToMonoType[cppType];

var getType = Type.GetType(cppType.AssemblyQualifiedName);
Il2CppToMonoType.Add(cppType, getType);
return getType;

if (getType != null)
{
Il2CppToMonoType.Add(cppType, getType);
return getType;
}
else
{
string baseName = cppType.FullName;
string baseAssembly = cppType.Assembly.GetName().name;

Type unhollowedType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == baseAssembly)?.GetTypes().FirstOrDefault(t =>
t.CustomAttributes.Any(ca =>
ca.AttributeType.Name == "ObfuscatedNameAttribute" && (string)ca.ConstructorArguments[0].Value == baseName));

Il2CppToMonoType.Add(cppType, unhollowedType);
return unhollowedType;
}
}

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

0 comments on commit d4dac58

Please sign in to comment.