|
15 | 15 | using CppType = Il2CppSystem.Type;
|
16 | 16 | using BF = System.Reflection.BindingFlags;
|
17 | 17 | using UnityExplorer.Core.Config;
|
| 18 | +using UnhollowerBaseLib.Attributes; |
18 | 19 |
|
19 | 20 | namespace UnityExplorer
|
20 | 21 | {
|
@@ -80,15 +81,19 @@ private static void TryCacheDeobfuscatedType(Type type)
|
80 | 81 | {
|
81 | 82 | try
|
82 | 83 | {
|
83 |
| - // Thanks to Slaynash for this |
84 |
| - if (type.CustomAttributes.Any(it => it.AttributeType.Name == "ObfuscatedNameAttribute")) |
| 84 | + if (!type.CustomAttributes.Any()) |
| 85 | + return; |
| 86 | + |
| 87 | + foreach (var att in type.CustomAttributes) |
85 | 88 | {
|
86 |
| - var cppType = Il2CppType.From(type); |
| 89 | + // Thanks to Slaynash for this |
87 | 90 |
|
88 |
| - if (!DeobfuscatedTypes.ContainsKey(cppType.FullName)) |
| 91 | + if (att.AttributeType == typeof(ObfuscatedNameAttribute)) |
89 | 92 | {
|
90 |
| - DeobfuscatedTypes.Add(cppType.FullName, type); |
91 |
| - reverseDeobCache.Add(type.FullName, cppType.FullName); |
| 93 | + string obfuscatedName = att.ConstructorArguments[0].Value.ToString(); |
| 94 | + |
| 95 | + DeobfuscatedTypes.Add(obfuscatedName, type); |
| 96 | + reverseDeobCache.Add(type.FullName, obfuscatedName); |
92 | 97 | }
|
93 | 98 | }
|
94 | 99 | }
|
@@ -462,14 +467,6 @@ internal override void Internal_FindSingleton(string[] possibleNames, Type type,
|
462 | 467 |
|
463 | 468 | // Helper for IL2CPP to try to make sure the Unhollowed game assemblies are actually loaded.
|
464 | 469 |
|
465 |
| - //internal override bool Internal_LoadModule(string moduleName) |
466 |
| - //{ |
467 |
| - // if (!moduleName.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase)) |
468 |
| - // moduleName += ".dll"; |
469 |
| - // |
470 |
| - // return DoLoadModule(Path.Combine(UnhollowedFolderPath, moduleName)); |
471 |
| - //} |
472 |
| - |
473 | 470 | // Force loading all il2cpp modules
|
474 | 471 |
|
475 | 472 | internal void TryLoadGameModules()
|
|
0 commit comments