diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index 7ffe0d9..3d84bf3 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -15,7 +15,7 @@ namespace UnityExplorer public class ExplorerCore { public const string NAME = "UnityExplorer"; - public const string VERSION = "3.2.1"; + public const string VERSION = "3.2.2"; public const string AUTHOR = "Sinai"; public const string GUID = "com.sinai.unityexplorer"; diff --git a/src/Helpers/ICallHelper.cs b/src/Helpers/ICallHelper.cs index 11f5f33..bc1f370 100644 --- a/src/Helpers/ICallHelper.cs +++ b/src/Helpers/ICallHelper.cs @@ -11,20 +11,27 @@ namespace UnityExplorer.Helpers { private static readonly Dictionary iCallCache = new Dictionary(); - public static T GetICall(string iCallName) where T : Delegate + /// + /// Helper to get and cache an iCall by providing the signature (eg. "UnityEngine.Resources::FindObjectsOfTypeAll"). + /// + /// The Type of Delegate to provide for the iCall. + /// The signature of the iCall you want to get. + /// The delegate if successful. + /// If the iCall could not be found. + public static T GetICall(string signature) where T : Delegate { - if (iCallCache.ContainsKey(iCallName)) - return (T)iCallCache[iCallName]; + if (iCallCache.ContainsKey(signature)) + return (T)iCallCache[signature]; - IntPtr ptr = il2cpp_resolve_icall(iCallName); + IntPtr ptr = il2cpp_resolve_icall(signature); if (ptr == IntPtr.Zero) { - throw new MissingMethodException($"Could not resolve internal call by name '{iCallName}'!"); + throw new MissingMethodException($"Could not resolve internal call by name '{signature}'!"); } Delegate iCall = Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)); - iCallCache.Add(iCallName, iCall); + iCallCache.Add(signature, iCall); return (T)iCall; } diff --git a/src/Inspectors/Reflection/CacheObject/CacheMember.cs b/src/Inspectors/Reflection/CacheObject/CacheMember.cs index 732ca5e..e10856c 100644 --- a/src/Inspectors/Reflection/CacheObject/CacheMember.cs +++ b/src/Inspectors/Reflection/CacheObject/CacheMember.cs @@ -381,7 +381,7 @@ namespace UnityExplorer.Inspectors.Reflection argLabelLayout.minHeight = 25; var argText = argLabelObj.GetComponent(); var argTypeTxt = UISyntaxHighlight.ParseFullSyntax(arg.ParameterType, false); - argText.text = $"{argTypeTxt} {arg.Name}"; + argText.text = $"{argTypeTxt} {arg.Name}"; var argInputObj = UIFactory.CreateInputField(rowObj, 14, (int)TextAnchor.MiddleLeft, 1); var argInputLayout = argInputObj.AddComponent(); diff --git a/src/Inspectors/Reflection/CacheObject/CacheMethod.cs b/src/Inspectors/Reflection/CacheObject/CacheMethod.cs index 5e1ed88..d0a1823 100644 --- a/src/Inspectors/Reflection/CacheObject/CacheMethod.cs +++ b/src/Inspectors/Reflection/CacheObject/CacheMethod.cs @@ -168,7 +168,7 @@ namespace UnityExplorer.Inspectors.Reflection //var argLayout = argLabelObj.AddComponent(); //argLayout.minWidth = 20; var argText = argLabelObj.GetComponent(); - argText.text = $"{constrainTxt} {arg.Name}"; + argText.text = $"{constrainTxt} {arg.Name}"; var argInputObj = UIFactory.CreateInputField(rowObj, 14, (int)TextAnchor.MiddleLeft, 1); var argInputLayout = argInputObj.AddComponent(); diff --git a/src/UI/UISyntaxHighlight.cs b/src/UI/UISyntaxHighlight.cs index 94eda0e..7ccbf32 100644 --- a/src/UI/UISyntaxHighlight.cs +++ b/src/UI/UISyntaxHighlight.cs @@ -8,36 +8,36 @@ namespace UnityExplorer.UI { public class UISyntaxHighlight { - public const string Field_Static = "#8d8dc6"; - public const string Field_Instance = "#c266ff"; + public const string FIELD_STATIC = "#8d8dc6"; + public const string FIELD_INSTANCE = "#c266ff"; - public const string Method_Static = "#b55b02"; - public const string Method_Instance = "#ff8000"; + public const string METHOD_STATIC = "#b55b02"; + public const string METHOD_INSTANCE = "#ff8000"; - public const string Prop_Static = "#588075"; - public const string Prop_Instance = "#55a38e"; + public const string PROP_STATIC = "#588075"; + public const string PROP_INSTANCE = "#55a38e"; - public const string Class_Static = "#3a8d71"; - public const string Class_Instance = "#2df7b2"; + public const string CLASS_STATIC = "#3a8d71"; + public const string CLASS_INSTANCE = "#2df7b2"; - public const string Local = "#a6e9e9"; + public const string CLASS_STRUCT = "#0fba3a"; - public const string StructGreen = "#0fba3a"; + public const string LOCAL_ARG = "#a6e9e9"; - public static string Enum = "#92c470"; + public static string CONST_VAR = "#92c470"; internal static readonly Color s_silver = new Color(0.66f, 0.66f, 0.66f); internal static string GetClassColor(Type type) { if (type.IsAbstract && type.IsSealed) - return Class_Static; + return CLASS_STATIC; else if (type.IsEnum || type.IsGenericParameter) - return Enum; + return CONST_VAR; else if (type.IsValueType) - return StructGreen; + return CLASS_STRUCT; else - return Class_Instance; + return CLASS_INSTANCE; } public static string ParseFullSyntax(Type type, bool includeNamespace, MemberInfo memberInfo = null) @@ -49,7 +49,7 @@ namespace UnityExplorer.UI if (type.IsGenericParameter || (type.HasElementType && type.GetElementType().IsGenericParameter)) { - ret = $"{type.Name}"; + ret = $"{type.Name}"; } else { @@ -134,7 +134,7 @@ namespace UnityExplorer.UI if (allGeneric) { - args += $"{arg.Name}"; + args += $"{arg.Name}"; continue; } @@ -153,30 +153,30 @@ namespace UnityExplorer.UI if (fi.IsStatic) { isStatic = true; - memberColor = Field_Static; + memberColor = FIELD_STATIC; } else - memberColor = Field_Instance; + memberColor = FIELD_INSTANCE; } else if (memberInfo is MethodInfo mi) { if (mi.IsStatic) { isStatic = true; - memberColor = Method_Static; + memberColor = METHOD_STATIC; } else - memberColor = Method_Instance; + memberColor = METHOD_INSTANCE; } else if (memberInfo is PropertyInfo pi) { if (pi.GetAccessors(true)[0].IsStatic) { isStatic = true; - memberColor = Prop_Static; + memberColor = PROP_STATIC; } else - memberColor = Prop_Instance; + memberColor = PROP_INSTANCE; } return memberColor; }