From dab7ecd441751704d6a669e42db3391ba6464311 Mon Sep 17 00:00:00 2001 From: sinaioutlander <49360850+sinaioutlander@users.noreply.github.com> Date: Tue, 29 Sep 2020 05:40:06 +1000 Subject: [PATCH] Cleanups and refactorings, and some small UI fixes --- src/CachedObjects/CacheFactory.cs | 169 ++++++++ src/CachedObjects/CacheObjectBase.cs | 400 +++++------------- src/CachedObjects/Object/CacheDictionary.cs | 4 +- src/CachedObjects/Object/CacheList.cs | 3 +- src/CachedObjects/Other/CacheMethod.cs | 2 +- src/CachedObjects/Struct/CacheEnum.cs | 2 +- src/CachedObjects/Struct/CacheEnumFlags.cs | 45 +- src/CachedObjects/Struct/CachePrimitive.cs | 222 +++++----- src/Explorer.csproj | 193 ++++----- ..._BepInPlugin.cs => ExplorerBepInPlugin.cs} | 79 ++-- src/ExplorerCore.cs | 6 +- ...plorer_MelonMod.cs => ExplorerMelonMod.cs} | 4 +- src/Extensions/ReflectionExtensions.cs | 16 +- src/Helpers/InputHelper.cs | 2 +- src/Helpers/ReflectionHelpers.cs | 27 +- src/Menu/CursorControl.cs | 4 +- src/Menu/MainMenu/Pages/SearchPage.cs | 2 +- src/Menu/UIStyles.cs | 2 +- src/Menu/Windows/GameObjectWindow.cs | 2 +- src/Menu/Windows/ReflectionWindow.cs | 2 +- src/Properties/AssemblyInfo.cs | 2 +- 21 files changed, 553 insertions(+), 635 deletions(-) create mode 100644 src/CachedObjects/CacheFactory.cs rename src/{Explorer_BepInPlugin.cs => ExplorerBepInPlugin.cs} (60%) rename src/{Explorer_MelonMod.cs => ExplorerMelonMod.cs} (85%) diff --git a/src/CachedObjects/CacheFactory.cs b/src/CachedObjects/CacheFactory.cs new file mode 100644 index 0000000..6faf977 --- /dev/null +++ b/src/CachedObjects/CacheFactory.cs @@ -0,0 +1,169 @@ +using System; +using System.Reflection; +using UnityEngine; + +namespace Explorer +{ + public static class CacheFactory + { + public static CacheObjectBase GetTypeAndCacheObject(object obj) + => GetTypeAndCacheObject(obj, null, null); + + public static CacheObjectBase GetTypeAndCacheObject(MemberInfo memberInfo, object declarer) + => GetTypeAndCacheObject(null, memberInfo, declarer); + + public static CacheObjectBase GetTypeAndCacheObject(object obj, MemberInfo memberInfo, object declarer) + { + Type type = null; + + if (memberInfo != null) + { + if (memberInfo is FieldInfo fi) + { + type = fi.FieldType; + } + else if (memberInfo is PropertyInfo pi) + { + type = pi.PropertyType; + } + else if (memberInfo is MethodInfo mi) + { + type = mi.ReturnType; + } + } + else if (obj != null) + { + type = ReflectionHelpers.GetActualType(obj); + } + + if (type == null) + { + return null; + } + + return GetCacheObject(obj, memberInfo, declarer, type); + } + + public static CacheObjectBase GetCacheObject(object obj, Type valueType) + => GetCacheObject(obj, null, null, valueType); + + private static CacheObjectBase GetCacheObject(object obj, MemberInfo memberInfo, object declaringInstance, Type valueType) + { + CacheObjectBase cached; + + var pi = memberInfo as PropertyInfo; + var mi = memberInfo as MethodInfo; + + // Check if can process args + if ((pi != null && !CanProcessArgs(pi.GetIndexParameters())) + || (mi != null && !CanProcessArgs(mi.GetParameters()))) + { + return null; + } + + if (mi != null) + { + cached = new CacheMethod(); + } + else if (valueType == typeof(GameObject) || valueType == typeof(Transform)) + { + cached = new CacheGameObject(); + } + else if (valueType.IsPrimitive || valueType == typeof(string)) + { + cached = new CachePrimitive(); + } + else if (valueType.IsEnum) + { + if (valueType.GetCustomAttributes(typeof(FlagsAttribute), true) is object[] attributes && attributes.Length > 0) + { + cached = new CacheEnumFlags(); + } + else + { + cached = new CacheEnum(); + } + } + else if (valueType == typeof(Vector2) || valueType == typeof(Vector3) || valueType == typeof(Vector4)) + { + cached = new CacheVector(); + } + else if (valueType == typeof(Quaternion)) + { + cached = new CacheQuaternion(); + } + else if (valueType == typeof(Color)) + { + cached = new CacheColor(); + } + else if (valueType == typeof(Rect)) + { + cached = new CacheRect(); + } + // must check this before IsEnumerable + else if (ReflectionHelpers.IsDictionary(valueType)) + { + cached = new CacheDictionary(); + } + else if (ReflectionHelpers.IsEnumerable(valueType)) + { + cached = new CacheList(); + } + else + { + cached = new CacheOther(); + } + + cached.Value = obj; + cached.ValueType = valueType; + + if (memberInfo != null) + { + cached.MemInfo = memberInfo; + cached.DeclaringType = memberInfo.DeclaringType; + cached.DeclaringInstance = declaringInstance; + } + + if (pi != null) + { + cached.m_arguments = pi.GetIndexParameters(); + } + else if (mi != null) + { + cached.m_arguments = mi.GetParameters(); + } + + cached.m_argumentInput = new string[cached.m_arguments.Length]; + + cached.UpdateValue(); + + cached.Init(); + + return cached; + } + + public static bool CanProcessArgs(ParameterInfo[] parameters) + { + foreach (var param in parameters) + { + var pType = param.ParameterType; + + if (pType.IsByRef && pType.HasElementType) + { + pType = pType.GetElementType(); + } + + if (pType.IsPrimitive || pType == typeof(string)) + { + continue; + } + else + { + return false; + } + } + + return true; + } + } +} diff --git a/src/CachedObjects/CacheObjectBase.cs b/src/CachedObjects/CacheObjectBase.cs index c5fbe21..f257905 100644 --- a/src/CachedObjects/CacheObjectBase.cs +++ b/src/CachedObjects/CacheObjectBase.cs @@ -27,278 +27,12 @@ namespace Explorer public string RichTextName => m_richTextName ?? GetRichTextName(); private string m_richTextName; - public bool CanWrite - { - get - { - if (MemInfo is FieldInfo fi) - return !(fi.IsLiteral && !fi.IsInitOnly); - else if (MemInfo is PropertyInfo pi) - return pi.CanWrite; - else - return false; - } - } + public bool CanWrite => m_canWrite ?? (bool)(m_canWrite = GetCanWrite()); + private bool? m_canWrite; public virtual void Init() { } - public abstract void DrawValue(Rect window, float width); - - /// - /// Get CacheObject from only an object instance - /// Calls GetCacheObject(obj, memberInfo, declaringInstance) with (obj, null, null) - public static CacheObjectBase GetCacheObject(object obj) - { - return GetCacheObject(obj, null, null); - } - - /// - /// Get CacheObject from an object instance and provide the value type - /// Calls GetCacheObjectImpl directly - public static CacheObjectBase GetCacheObject(object obj, Type valueType) - { - return GetCacheObjectImpl(obj, null, null, valueType); - } - - /// - /// Get CacheObject from only a MemberInfo and declaring instance - /// Calls GetCacheObject(obj, memberInfo, declaringInstance) with (null, memberInfo, declaringInstance) - public static CacheObjectBase GetCacheObject(MemberInfo memberInfo, object declaringInstance) - { - return GetCacheObject(null, memberInfo, declaringInstance); - } - - /// - /// Get CacheObject from either an object or MemberInfo, and don't provide the type. - /// This gets the type and then calls GetCacheObjectImpl - public static CacheObjectBase GetCacheObject(object obj, MemberInfo memberInfo, object declaringInstance) - { - Type type = null; - - if (memberInfo != null) - { - if (memberInfo is FieldInfo fi) - { - type = fi.FieldType; - } - else if (memberInfo is PropertyInfo pi) - { - type = pi.PropertyType; - } - else if (memberInfo is MethodInfo mi) - { - type = mi.ReturnType; - } - } - else if (obj != null) - { - type = ReflectionHelpers.GetActualType(obj); - } - - if (type == null) - { - return null; - } - - return GetCacheObjectImpl(obj, memberInfo, declaringInstance, type); - } - - /// - /// Actual GetCacheObject implementation (private) - /// - private static CacheObjectBase GetCacheObjectImpl(object obj, MemberInfo memberInfo, object declaringInstance, Type valueType) - { - CacheObjectBase holder; - - var pi = memberInfo as PropertyInfo; - var mi = memberInfo as MethodInfo; - - // Check if can process args - if ((pi != null && !CanProcessArgs(pi.GetIndexParameters())) - || (mi != null && !CanProcessArgs(mi.GetParameters()))) - { - return null; - } - - if (mi != null) - { - holder = new CacheMethod(); - } - else if (valueType == typeof(GameObject) || valueType == typeof(Transform)) - { - holder = new CacheGameObject(); - } - else if (valueType.IsPrimitive || valueType == typeof(string)) - { - holder = new CachePrimitive(); - } - else if (valueType.IsEnum) - { - if (valueType.GetCustomAttributes(typeof(FlagsAttribute), true) is object[] attributes && attributes.Length > 0) - { - holder = new CacheEnumFlags(); - } - else - { - holder = new CacheEnum(); - } - } - else if (valueType == typeof(Vector2) || valueType == typeof(Vector3) || valueType == typeof(Vector4)) - { - holder = new CacheVector(); - } - else if (valueType == typeof(Quaternion)) - { - holder = new CacheQuaternion(); - } - else if (valueType == typeof(Color)) - { - holder = new CacheColor(); - } - else if (valueType == typeof(Rect)) - { - holder = new CacheRect(); - } - // must check this before IsEnumerable - else if (ReflectionHelpers.IsDictionary(valueType)) - { - holder = new CacheDictionary(); - } - else if (ReflectionHelpers.IsEnumerable(valueType)) - { - holder = new CacheList(); - } - else - { - holder = new CacheOther(); - } - - holder.Value = obj; - holder.ValueType = valueType; - - if (memberInfo != null) - { - holder.MemInfo = memberInfo; - holder.DeclaringType = memberInfo.DeclaringType; - holder.DeclaringInstance = declaringInstance; - } - - if (pi != null) - { - holder.m_arguments = pi.GetIndexParameters(); - } - else if (mi != null) - { - holder.m_arguments = mi.GetParameters(); - } - - holder.m_argumentInput = new string[holder.m_arguments.Length]; - - holder.UpdateValue(); - - holder.Init(); - - return holder; - } - - public static bool CanProcessArgs(ParameterInfo[] parameters) - { - foreach (var param in parameters) - { - var pType = param.ParameterType; - - if (pType.IsByRef && pType.HasElementType) - { - pType = pType.GetElementType(); - } - - if (pType.IsPrimitive || pType == typeof(string)) - { - continue; - } - else - { - return false; - } - } - - return true; - } - - public float CalcWhitespace(Rect window) - { - if (!(this is IExpandHeight)) return 0f; - - float whitespace = (this as IExpandHeight).WhiteSpace; - if (whitespace > 0) - { - ClampLabelWidth(window, ref whitespace); - } - - return whitespace; - } - - public object[] ParseArguments() - { - var parsedArgs = new List(); - for (int i = 0; i < m_arguments.Length; i++) - { - var input = m_argumentInput[i]; - var type = m_arguments[i].ParameterType; - - if (type.IsByRef) - { - type = type.GetElementType(); - } - - if (!string.IsNullOrEmpty(input)) - { - // strings can obviously just be used directly - if (type == typeof(string)) - { - parsedArgs.Add(input); - continue; - } - else - { - // try to invoke the parse method and use that. - try - { - parsedArgs.Add(type.GetMethod("Parse", new Type[] { typeof(string) }) - .Invoke(null, new object[] { input })); - - continue; - } - catch - { - ExplorerCore.Log($"Argument #{i} '{m_arguments[i].Name}' ({type.Name}), could not parse input '{input}'."); - } - } - } - - // Didn't use input, see if there is a default value. - if (HasDefaultValue(m_arguments[i])) - { - parsedArgs.Add(m_arguments[i].DefaultValue); - continue; - } - - // Try add a null arg I guess - parsedArgs.Add(null); - } - - return parsedArgs.ToArray(); - } - - public static bool HasDefaultValue(ParameterInfo arg) - { - return -#if NET35 - arg.DefaultValue != null; // rip null default args in NET35 -#else - arg.HasDefaultValue; -#endif - } + public abstract void DrawValue(Rect window, float width); public virtual void UpdateValue() { @@ -367,11 +101,83 @@ namespace Explorer } } + public object[] ParseArguments() + { + var parsedArgs = new List(); + for (int i = 0; i < m_arguments.Length; i++) + { + var input = m_argumentInput[i]; + var type = m_arguments[i].ParameterType; + + if (type.IsByRef) + { + type = type.GetElementType(); + } + + if (string.IsNullOrEmpty(input)) + { + // No input, see if there is a default value. + if (HasDefaultValue(m_arguments[i])) + { + parsedArgs.Add(m_arguments[i].DefaultValue); + continue; + } + + // Try add a null arg I guess + parsedArgs.Add(null); + continue; + } + + // strings can obviously just be used directly + if (type == typeof(string)) + { + parsedArgs.Add(input); + continue; + } + else + { + try + { + var arg = type.GetMethod("Parse", new Type[] { typeof(string) }) + .Invoke(null, new object[] { input }); + parsedArgs.Add(arg); + continue; + } + catch + { + ExplorerCore.Log($"Argument #{i} '{m_arguments[i].Name}' ({type.Name}), could not parse input '{input}'."); + } + } + } + + return parsedArgs.ToArray(); + } + + public static bool HasDefaultValue(ParameterInfo arg) => +#if NET35 + arg.DefaultValue != null; +#else + arg.HasDefaultValue; +#endif + // ========= Gui Draw ========== public const float MAX_LABEL_WIDTH = 400f; public const string EVALUATE_LABEL = "Evaluate"; + public float CalcWhitespace(Rect window) + { + if (!(this is IExpandHeight)) return 0f; + + float whitespace = (this as IExpandHeight).WhiteSpace; + if (whitespace > 0) + { + ClampLabelWidth(window, ref whitespace); + } + + return whitespace; + } + public static void ClampLabelWidth(Rect window, ref float labelWidth) { float min = window.width * 0.37f; @@ -436,7 +242,10 @@ namespace Explorer GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUI.skin.label.alignment = TextAnchor.MiddleCenter; - GUILayout.Label($"{cm.GenericArgs[i].Name}", new GUILayoutOption[] { GUILayout.Width(15) }); + GUILayout.Label( + $"{cm.GenericArgs[i].Name}", + new GUILayoutOption[] { GUILayout.Width(15) } + ); cm.GenericArgInput[i] = GUILayout.TextField(input, new GUILayoutOption[] { GUILayout.Width(150) }); GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUILayout.Label(types, new GUILayoutOption[0]); @@ -477,13 +286,9 @@ namespace Explorer if (GUILayout.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) { if (cm != null) - { cm.Evaluate(); - } else - { UpdateValue(); - } } if (GUILayout.Button("Cancel", new GUILayoutOption[] { GUILayout.Width(70) })) { @@ -506,21 +311,17 @@ namespace Explorer GUILayout.EndVertical(); - // new line and space GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(labelWidth); } else if (cm != null) { - //GUILayout.BeginHorizontal(null); - if (GUILayout.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) { cm.Evaluate(); } - // new line and space GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(labelWidth); @@ -546,6 +347,16 @@ namespace Explorer } } + private bool GetCanWrite() + { + if (MemInfo is FieldInfo fi) + return !(fi.IsLiteral && !fi.IsInitOnly); + else if (MemInfo is PropertyInfo pi) + return pi.CanWrite; + else + return false; + } + private string GetRichTextName() { string memberColor = ""; @@ -582,9 +393,19 @@ namespace Explorer memberColor = UIStyles.Syntax.Prop_Instance; } - string classColor = MemInfo.DeclaringType.IsAbstract && MemInfo.DeclaringType.IsSealed - ? UIStyles.Syntax.Class_Static - : UIStyles.Syntax.Class_Instance; + string classColor; + if (MemInfo.DeclaringType.IsValueType) + { + classColor = UIStyles.Syntax.StructGreen; + } + else if (MemInfo.DeclaringType.IsAbstract && MemInfo.DeclaringType.IsSealed) + { + classColor = UIStyles.Syntax.Class_Static; + } + else + { + classColor = UIStyles.Syntax.Class_Instance; + } m_richTextName = $"{MemInfo.DeclaringType.Name}."; if (isStatic) m_richTextName += ""; @@ -607,23 +428,6 @@ namespace Explorer m_richTextName += ">"; } - // Method / Property arguments - - //if (m_arguments.Length > 0 || this is CacheMethod) - //{ - // m_richTextName += "("; - // var args = ""; - // foreach (var param in m_arguments) - // { - // if (args != "") args += ", "; - - // args += $"{param.ParameterType.Name} "; - // args += $"{param.Name}"; - // } - // m_richTextName += args; - // m_richTextName += ")"; - //} - return m_richTextName; } } diff --git a/src/CachedObjects/Object/CacheDictionary.cs b/src/CachedObjects/Object/CacheDictionary.cs index b0de568..c8aaaad 100644 --- a/src/CachedObjects/Object/CacheDictionary.cs +++ b/src/CachedObjects/Object/CacheDictionary.cs @@ -131,7 +131,7 @@ namespace Explorer foreach (var key in IDict.Keys) { Type t = ReflectionHelpers.GetActualType(key) ?? TypeOfKeys; - var cache = GetCacheObject(key, t); + var cache = CacheFactory.GetCacheObject(key, t); keys.Add(cache); } @@ -139,7 +139,7 @@ namespace Explorer foreach (var val in IDict.Values) { Type t = ReflectionHelpers.GetActualType(val) ?? TypeOfValues; - var cache = GetCacheObject(val, t); + var cache = CacheFactory.GetCacheObject(val, t); values.Add(cache); } diff --git a/src/CachedObjects/Object/CacheList.cs b/src/CachedObjects/Object/CacheList.cs index 807d37c..b3fcf73 100644 --- a/src/CachedObjects/Object/CacheList.cs +++ b/src/CachedObjects/Object/CacheList.cs @@ -246,7 +246,7 @@ namespace Explorer } #endif - if (GetCacheObject(obj, t) is CacheObjectBase cached) + if (CacheFactory.GetCacheObject(obj, t) is CacheObjectBase cached) { list.Add(cached); } @@ -354,6 +354,7 @@ namespace Explorer GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUILayout.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) }); + GUI.skin.label.alignment = TextAnchor.MiddleLeft; entry.DrawValue(window, window.width - (whitespace + 85)); } diff --git a/src/CachedObjects/Other/CacheMethod.cs b/src/CachedObjects/Other/CacheMethod.cs index 1eac493..1435d86 100644 --- a/src/CachedObjects/Other/CacheMethod.cs +++ b/src/CachedObjects/Other/CacheMethod.cs @@ -64,7 +64,7 @@ namespace Explorer if (ret != null) { - m_cachedReturnValue = GetCacheObject(ret); + m_cachedReturnValue = CacheFactory.GetTypeAndCacheObject(ret); m_cachedReturnValue.UpdateValue(); } else diff --git a/src/CachedObjects/Struct/CacheEnum.cs b/src/CachedObjects/Struct/CacheEnum.cs index 716f55c..f59f826 100644 --- a/src/CachedObjects/Struct/CacheEnum.cs +++ b/src/CachedObjects/Struct/CacheEnum.cs @@ -56,7 +56,7 @@ namespace Explorer } } - GUILayout.Label(Value.ToString() + " (" + ValueType + ")", new GUILayoutOption[0]); + GUILayout.Label(Value.ToString() + $" ({ValueType})", new GUILayoutOption[0]); } public void SetEnum(int change) diff --git a/src/CachedObjects/Struct/CacheEnumFlags.cs b/src/CachedObjects/Struct/CacheEnumFlags.cs index fdd107e..74b1ae3 100644 --- a/src/CachedObjects/Struct/CacheEnumFlags.cs +++ b/src/CachedObjects/Struct/CacheEnumFlags.cs @@ -6,9 +6,8 @@ using UnityEngine; namespace Explorer { - public class CacheEnumFlags : CacheObjectBase, IExpandHeight + public class CacheEnumFlags : CacheEnum, IExpandHeight { - public string[] EnumNames = new string[0]; public bool[] m_enabledFlags = new bool[0]; public bool IsExpanded { get; set; } @@ -18,38 +17,12 @@ namespace Explorer { base.Init(); - if (ValueType == null && Value != null) - { - ValueType = Value.GetType(); - } - if (ValueType != null) { - EnumNames = Enum.GetNames(ValueType); - m_enabledFlags = new bool[EnumNames.Length]; UpdateValue(); } - else - { - ReflectionException = "Unknown, could not get Enum names."; - } - } - - public void SetFlagsFromInput() - { - string val = ""; - for (int i = 0; i < EnumNames.Length; i++) - { - if (m_enabledFlags[i]) - { - if (val != "") val += ", "; - val += EnumNames[i]; - } - } - Value = Enum.Parse(ValueType, val); - SetValue(); } public override void UpdateValue() @@ -71,7 +44,6 @@ namespace Explorer } } - public override void DrawValue(Rect window, float width) { if (CanWrite) @@ -121,5 +93,20 @@ namespace Explorer GUILayout.BeginHorizontal(new GUILayoutOption[0]); } } + + public void SetFlagsFromInput() + { + string val = ""; + for (int i = 0; i < EnumNames.Length; i++) + { + if (m_enabledFlags[i]) + { + if (val != "") val += ", "; + val += EnumNames[i]; + } + } + Value = Enum.Parse(ValueType, val); + SetValue(); + } } } diff --git a/src/CachedObjects/Struct/CachePrimitive.cs b/src/CachedObjects/Struct/CachePrimitive.cs index 898226b..bd66fef 100644 --- a/src/CachedObjects/Struct/CachePrimitive.cs +++ b/src/CachedObjects/Struct/CachePrimitive.cs @@ -2,28 +2,26 @@ using System.Collections; using System.Collections.Generic; using System.Reflection; +using UnityEngine; #if CPP using UnhollowerRuntimeLib; #endif -using UnityEngine; namespace Explorer { public class CachePrimitive : CacheObjectBase { + private string m_valueToString; private bool m_isBool; private bool m_isString; - private string m_valueToString; - public MethodInfo ParseMethod => m_parseMethod ?? (m_parseMethod = Value.GetType().GetMethod("Parse", new Type[] { typeof(string) })); private MethodInfo m_parseMethod; private bool m_canBitwiseOperate; private bool m_inBitwiseMode; private string m_bitwiseOperatorInput = "0"; - private string m_bitwiseToString; - //private BitArray m_bitMask; // not needed I think + private string m_binaryInput; public override void Init() { @@ -48,6 +46,8 @@ namespace Explorer } m_canBitwiseOperate = typeof(int).IsAssignableFrom(ValueType); + + UpdateValue(); } public override void UpdateValue() @@ -57,20 +57,19 @@ namespace Explorer RefreshToString(); } - public void RefreshToString() + private void RefreshToString() { m_valueToString = Value?.ToString(); - if (m_inBitwiseMode) + if (m_canBitwiseOperate) { var _int = (int)Value; - m_bitwiseToString = Convert.ToString(_int, toBase: 2); + m_binaryInput = Convert.ToString(_int, toBase: 2); } } public override void DrawValue(Rect window, float width) { - // bool uses Toggle if (m_isBool) { var b = (bool)Value; @@ -81,7 +80,8 @@ namespace Explorer b = GUILayout.Toggle(b, label, new GUILayoutOption[0]); if (b != (bool)Value) { - SetValueFromInput(b.ToString()); + Value = b; + SetValue(); } } else @@ -98,39 +98,20 @@ namespace Explorer GUILayout.BeginHorizontal(new GUILayoutOption[0]); - // using ValueType.Name instead of ValueTypeName, because we only want the short name. GUILayout.Label("" + ValueType.Name + "", new GUILayoutOption[] { GUILayout.Width(50) }); - int dynSize = 25 + (m_valueToString.Length * 15); - var maxwidth = window.width - 310f; - if (CanWrite) maxwidth -= 60; - - if (dynSize > maxwidth) - { - m_valueToString = GUIUnstrip.TextArea(m_valueToString, new GUILayoutOption[] { GUILayout.Width(maxwidth) }); - } - else - { - m_valueToString = GUILayout.TextField(m_valueToString, new GUILayoutOption[] { GUILayout.Width(dynSize) }); - } - + m_valueToString = GUIUnstrip.TextArea(m_valueToString, new GUILayoutOption[] { GUILayout.ExpandWidth(true) }); if (CanWrite) { if (GUILayout.Button("Apply", new GUILayoutOption[] { GUILayout.Width(60) })) { - SetValueFromInput(m_valueToString); - RefreshToString(); + SetValueFromInput(); } } if (m_canBitwiseOperate) { - bool orig = m_inBitwiseMode; m_inBitwiseMode = GUILayout.Toggle(m_inBitwiseMode, "Bitwise?", new GUILayoutOption[0]); - if (orig != m_inBitwiseMode) - { - RefreshToString(); - } } GUIUnstrip.Space(10); @@ -139,79 +120,91 @@ namespace Explorer if (m_inBitwiseMode) { - if (CanWrite) - { - GUILayout.BeginHorizontal(new GUILayoutOption[0]); - - GUI.skin.label.alignment = TextAnchor.MiddleRight; - GUILayout.Label("RHS:", new GUILayoutOption[] { GUILayout.Width(35) }); - GUI.skin.label.alignment = TextAnchor.UpperLeft; - - if (GUILayout.Button("~", new GUILayoutOption[] { GUILayout.Width(25) })) - { - if (int.TryParse(m_bitwiseOperatorInput, out int bit)) - { - Value = ~bit; - RefreshToString(); - } - } - - if (GUILayout.Button("<<", new GUILayoutOption[] { GUILayout.Width(25) })) - { - if (int.TryParse(m_bitwiseOperatorInput, out int bit)) - { - Value = (int)Value << bit; - RefreshToString(); - } - } - if (GUILayout.Button(">>", new GUILayoutOption[] { GUILayout.Width(25) })) - { - if (int.TryParse(m_bitwiseOperatorInput, out int bit)) - { - Value = (int)Value >> bit; - RefreshToString(); - } - } - if (GUILayout.Button("|", new GUILayoutOption[] { GUILayout.Width(25) })) - { - if (int.TryParse(m_bitwiseOperatorInput, out int bit)) - { - Value = (int)Value | bit; - RefreshToString(); - } - } - if (GUILayout.Button("&", new GUILayoutOption[] { GUILayout.Width(25) })) - { - if (int.TryParse(m_bitwiseOperatorInput, out int bit)) - { - Value = (int)Value & bit; - RefreshToString(); - } - } - if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) - { - if (int.TryParse(m_bitwiseOperatorInput, out int bit)) - { - Value = (int)Value ^ bit; - RefreshToString(); - } - } - - m_bitwiseOperatorInput = GUILayout.TextField(m_bitwiseOperatorInput, new GUILayoutOption[] { GUILayout.Width(55) }); - - GUILayout.EndHorizontal(); - } - - GUILayout.BeginHorizontal(new GUILayoutOption[0]); - GUILayout.Label($"Binary:", new GUILayoutOption[] { GUILayout.Width(60) }); - GUILayout.TextField(m_bitwiseToString, new GUILayoutOption[0]); - GUILayout.EndHorizontal(); + DrawBitwise(); } GUILayout.EndVertical(); } - public void SetValueFromInput(string valueString) + private void DrawBitwise() + { + if (CanWrite) + { + GUILayout.BeginHorizontal(new GUILayoutOption[0]); + + GUI.skin.label.alignment = TextAnchor.MiddleRight; + GUILayout.Label("RHS:", new GUILayoutOption[] { GUILayout.Width(35) }); + GUI.skin.label.alignment = TextAnchor.UpperLeft; + + if (GUILayout.Button("~", new GUILayoutOption[] { GUILayout.Width(25) })) + { + if (int.TryParse(m_bitwiseOperatorInput, out int bit)) + { + Value = ~bit; + RefreshToString(); + } + } + + if (GUILayout.Button("<<", new GUILayoutOption[] { GUILayout.Width(25) })) + { + if (int.TryParse(m_bitwiseOperatorInput, out int bit)) + { + Value = (int)Value << bit; + RefreshToString(); + } + } + if (GUILayout.Button(">>", new GUILayoutOption[] { GUILayout.Width(25) })) + { + if (int.TryParse(m_bitwiseOperatorInput, out int bit)) + { + Value = (int)Value >> bit; + RefreshToString(); + } + } + if (GUILayout.Button("|", new GUILayoutOption[] { GUILayout.Width(25) })) + { + if (int.TryParse(m_bitwiseOperatorInput, out int bit)) + { + Value = (int)Value | bit; + RefreshToString(); + } + } + if (GUILayout.Button("&", new GUILayoutOption[] { GUILayout.Width(25) })) + { + if (int.TryParse(m_bitwiseOperatorInput, out int bit)) + { + Value = (int)Value & bit; + RefreshToString(); + } + } + if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) + { + if (int.TryParse(m_bitwiseOperatorInput, out int bit)) + { + Value = (int)Value ^ bit; + RefreshToString(); + } + } + + m_bitwiseOperatorInput = GUILayout.TextField(m_bitwiseOperatorInput, new GUILayoutOption[] { GUILayout.Width(55) }); + + GUILayout.EndHorizontal(); + } + + GUILayout.BeginHorizontal(new GUILayoutOption[0]); + GUILayout.Label($"Binary:", new GUILayoutOption[] { GUILayout.Width(60) }); + m_binaryInput = GUILayout.TextField(m_binaryInput, new GUILayoutOption[0]); + if (CanWrite) + { + if (GUILayout.Button("Apply", new GUILayoutOption[0])) + { + SetValueFromBinaryInput(); + } + } + GUILayout.EndHorizontal(); + } + + public void SetValueFromInput() { if (MemInfo == null) { @@ -221,23 +214,13 @@ namespace Explorer if (m_isString) { - Value = valueString; + Value = m_valueToString; } else { try { - Value = ParseMethod.Invoke(null, new object[] { valueString }); - - //if (m_inBitwiseMode) - //{ - // var method = typeof(Convert).GetMethod($"To{ValueType.Name}", new Type[] { typeof(string), typeof(int) }); - // Value = method.Invoke(null, new object[] { valueString, 2 }); - //} - //else - //{ - // Value = ParseMethod.Invoke(null, new object[] { valueString }); - //} + Value = ParseMethod.Invoke(null, new object[] { m_valueToString }); } catch (Exception e) { @@ -246,6 +229,23 @@ namespace Explorer } SetValue(); + RefreshToString(); + } + + private void SetValueFromBinaryInput() + { + try + { + var method = typeof(Convert).GetMethod($"To{ValueType.Name}", new Type[] { typeof(string), typeof(int) }); + Value = method.Invoke(null, new object[] { m_binaryInput, 2 }); + + SetValue(); + RefreshToString(); + } + catch (Exception e) + { + ExplorerCore.Log("Exception setting value: " + e.GetType() + ", " + e.Message); + } } } } diff --git a/src/Explorer.csproj b/src/Explorer.csproj index 57c5698..53b12e8 100644 --- a/src/Explorer.csproj +++ b/src/Explorer.csproj @@ -2,58 +2,48 @@ - Debug + Release_ML_Cpp AnyCPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D} Library v4.7.2 Properties - Explorer 512 true - Explorer true true false - - D:\Steam\steamapps\common\Hellpoint - - - D:\Steam\steamapps\common\Outward - - - D:\Steam\steamapps\common\Outward - Il2Cpp - - - D:\Steam\steamapps\common\Outward - - - - v4.7.2 false none false - ..\Release\Explorer.MelonLoader.Il2Cpp\ - CPP,ML prompt 4 x64 false + Explorer + Explorer + + D:\Steam\steamapps\common\Hellpoint + + D:\Steam\steamapps\common\Outward + + D:\Steam\steamapps\common\Outward - Il2Cpp + + D:\Steam\steamapps\common\Outward + + + v4.7.2 + ..\Release\Explorer.MelonLoader.Il2Cpp\ + CPP,ML true true false v4.7.2 - false - none - false ..\Release\Explorer.MelonLoader.Mono\ MONO,ML - prompt - 4 - x64 false false true @@ -61,60 +51,32 @@ v3.5 - false - none - false ..\Release\Explorer.MelonLoader.Mono.NET35\ MONO,ML,NET35 - prompt - 4 - x64 - false false true true v4.7.2 - false - none - false ..\Release\Explorer.BepInEx.Il2Cpp\ CPP,BIE - prompt - 4 - x64 - false true false false v4.7.2 - false - none - false ..\Release\Explorer.BepInEx.Mono\ MONO,BIE - prompt - 4 - x64 - false false false false v3.5 - false - none - false ..\Release\Explorer.BepInEx.Mono.NET35\ MONO,BIE,NET35 - prompt - 4 - x64 - false false false true @@ -126,7 +88,7 @@ - + ..\lib\mcs.dll True @@ -135,119 +97,128 @@ ..\lib\mcs.NET35.dll True - - - $(MLCppGameFolder)\MelonLoader\MelonLoader.ModHandler.dll - False - - - - $(MLMonoGameFolder)\MelonLoader\MelonLoader.ModHandler.dll - False - - - - $(BIEMonoGameFolder)\BepInEx\core\BepInEx.dll - False - - - $(BIEMonoGameFolder)\BepInEx\core\0Harmony.dll - False - - - - $(BIECppGameFolder)\BepInEx\core\BepInEx.Core.dll - False - - - $(BIECppGameFolder)\BepInEx\core\0Harmony.dll - False - - - $(BIECppGameFolder)\BepInEx\core\BepInEx.IL2CPP.dll - False - - - + + + + ..\lib\UnityEngine.dll False - - + + + + + $(MLMonoGameFolder)\MelonLoader\MelonLoader.ModHandler.dll + False + + + + + + $(BIEMonoGameFolder)\BepInEx\core\BepInEx.dll + False + + + $(BIEMonoGameFolder)\BepInEx\core\0Harmony.dll + False + + + + + + $(MLCppGameFolder)\MelonLoader\MelonLoader.ModHandler.dll + False + + $(MLCppGameFolder)\MelonLoader\Managed\UnhollowerBaseLib.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\Il2Cppmscorlib.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\Il2CppSystem.Core.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.CoreModule.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.IMGUIModule.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.PhysicsModule.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll False - + $(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.UI.dll False - - + + + + + $(BIECppGameFolder)\BepInEx\core\BepInEx.Core.dll + False + + + $(BIECppGameFolder)\BepInEx\core\0Harmony.dll + False + + + $(BIECppGameFolder)\BepInEx\core\BepInEx.IL2CPP.dll + False + + $(BIECppGameFolder)\BepInEx\core\UnhollowerBaseLib.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\Il2Cppmscorlib.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\Il2CppSystem.Core.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.CoreModule.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.IMGUIModule.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.PhysicsModule.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.TextRenderingModule.dll False - + $(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.UI.dll False + @@ -263,8 +234,8 @@ - - + + diff --git a/src/Explorer_BepInPlugin.cs b/src/ExplorerBepInPlugin.cs similarity index 60% rename from src/Explorer_BepInPlugin.cs rename to src/ExplorerBepInPlugin.cs index 0d417c5..cceb9c4 100644 --- a/src/Explorer_BepInPlugin.cs +++ b/src/ExplorerBepInPlugin.cs @@ -1,17 +1,12 @@ #if BIE using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; using System.IO; +using System.Reflection; using BepInEx; using BepInEx.Logging; using HarmonyLib; -using Mono.CSharp; -using UnityEngine.SceneManagement; -using UnityEngine.Events; using UnityEngine; +using UnityEngine.SceneManagement; #if CPP using UnhollowerRuntimeLib; using BepInEx.IL2CPP; @@ -21,15 +16,16 @@ namespace Explorer { [BepInPlugin(ExplorerCore.GUID, ExplorerCore.NAME, ExplorerCore.VERSION)] #if CPP - public class Explorer_BepInPlugin : BasePlugin + public class ExplorerBepInPlugin : BasePlugin #else - public class Explorer_BepInPlugin : BaseUnityPlugin + public class ExplorerBepInPlugin : BaseUnityPlugin #endif { - public static Explorer_BepInPlugin Instance; + public static ExplorerBepInPlugin Instance; + public static ManualLogSource Logging => #if CPP - Instance.Log; + Instance?.Log; #else Instance?.Logger; #endif @@ -37,8 +33,7 @@ namespace Explorer public static readonly Harmony HarmonyInstance = new Harmony(ExplorerCore.GUID); #if CPP - // temporary for BIE Il2Cpp - private static bool tempSceneChangeCheck; + // temporary for Il2Cpp until scene change delegate works private static string lastSceneName; #endif @@ -53,17 +48,16 @@ namespace Explorer Instance = this; #if CPP - tempSceneChangeCheck = true; - ClassInjector.RegisterTypeInIl2Cpp(); + ClassInjector.RegisterTypeInIl2Cpp(); - GameObject.DontDestroyOnLoad( - new GameObject( - "Explorer_Dummy", - new Il2CppSystem.Type[] - { - Il2CppType.Of() - }) + var obj = new GameObject( + "ExplorerBehaviour", + new Il2CppSystem.Type[] + { + Il2CppType.Of() + } ); + GameObject.DontDestroyOnLoad(obj); #else SceneManager.activeSceneChanged += DoSceneChange; #endif @@ -91,47 +85,34 @@ namespace Explorer ExplorerCore.OnSceneChange(); } - internal static void DoUpdate() +#if CPP // BepInEx Il2Cpp mod class doesn't have monobehaviour methods yet, so wrap them in a dummy. + public class ExplorerBehaviour : MonoBehaviour { - ExplorerCore.Update(); + public ExplorerBehaviour(IntPtr ptr) : base(ptr) { } + + internal void Awake() + { + Logging.LogMessage("ExplorerBehaviour.Awake"); + } + +#endif + internal void Update() + { + ExplorerCore.Update(); #if CPP - if (tempSceneChangeCheck) - { var scene = SceneManager.GetActiveScene(); if (scene.name != lastSceneName) { lastSceneName = scene.name; DoSceneChange(scene, scene); } - } #endif - } - - internal static void DoOnGUI() - { - ExplorerCore.OnGUI(); - } - -#if CPP - public class DummyMB : MonoBehaviour - { - public DummyMB(IntPtr ptr) : base(ptr) { } - - internal void Awake() - { - Logging.LogMessage("DummyMB Awake"); - } - -#endif - internal void Update() - { - DoUpdate(); } internal void OnGUI() { - DoOnGUI(); + ExplorerCore.OnGUI(); } #if CPP } diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index 0dbbdb6..0ab5217 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -95,7 +95,7 @@ namespace Explorer #if ML MelonLoader.MelonLogger.Log(message); #else - Explorer_BepInPlugin.Logging?.LogMessage(message); + ExplorerBepInPlugin.Logging?.LogMessage(message); #endif } @@ -104,7 +104,7 @@ namespace Explorer #if ML MelonLoader.MelonLogger.LogWarning(message); #else - Explorer_BepInPlugin.Logging?.LogWarning(message); + ExplorerBepInPlugin.Logging?.LogWarning(message); #endif } @@ -113,7 +113,7 @@ namespace Explorer #if ML MelonLoader.MelonLogger.LogError(message); #else - Explorer_BepInPlugin.Logging?.LogError(message); + ExplorerBepInPlugin.Logging?.LogError(message); #endif } } diff --git a/src/Explorer_MelonMod.cs b/src/ExplorerMelonMod.cs similarity index 85% rename from src/Explorer_MelonMod.cs rename to src/ExplorerMelonMod.cs index d3ba446..3af2a2d 100644 --- a/src/Explorer_MelonMod.cs +++ b/src/ExplorerMelonMod.cs @@ -7,9 +7,9 @@ using MelonLoader; namespace Explorer { - public class Explorer_MelonMod : MelonMod + public class ExplorerMelonMod : MelonMod { - public static Explorer_MelonMod Instance; + public static ExplorerMelonMod Instance; public override void OnApplicationStart() { diff --git a/src/Extensions/ReflectionExtensions.cs b/src/Extensions/ReflectionExtensions.cs index 09d9855..14d9ffc 100644 --- a/src/Extensions/ReflectionExtensions.cs +++ b/src/Extensions/ReflectionExtensions.cs @@ -8,19 +8,12 @@ namespace Explorer public static class ReflectionExtensions { #if CPP - /// - /// Extension to allow for easy, non-generic Il2Cpp casting. - /// The extension is on System.Object, but only Il2Cpp objects would be a valid target. - /// public static object Il2CppCast(this object obj, Type castTo) { return ReflectionHelpers.Il2CppCast(obj, castTo); } #endif - /// - /// Extension to safely try to get all Types from an Assembly, with a fallback for ReflectionTypeLoadException. - /// public static IEnumerable TryGetTypes(this Assembly asm) { try @@ -29,7 +22,14 @@ namespace Explorer } catch (ReflectionTypeLoadException e) { - return e.Types.Where(t => t != null); + try + { + return asm.GetExportedTypes(); + } + catch + { + return e.Types.Where(t => t != null); + } } catch { diff --git a/src/Helpers/InputHelper.cs b/src/Helpers/InputHelper.cs index 28389d5..47c5f9d 100644 --- a/src/Helpers/InputHelper.cs +++ b/src/Helpers/InputHelper.cs @@ -82,7 +82,7 @@ namespace Explorer { ExplorerCore.Log("UnityEngine.Input is null, trying to load manually...."); - if ((ReflectionHelpers.LoadModule("UnityEngine.InputLegacyModule.dll") || ReflectionHelpers.LoadModule("UnityEngine.CoreModule.dll")) + if ((ReflectionHelpers.LoadModule("UnityEngine.InputLegacyModule") || ReflectionHelpers.LoadModule("UnityEngine.CoreModule")) && Input != null) { ExplorerCore.Log("Ok!"); diff --git a/src/Helpers/ReflectionHelpers.cs b/src/Helpers/ReflectionHelpers.cs index 65a70d0..8a507c4 100644 --- a/src/Helpers/ReflectionHelpers.cs +++ b/src/Helpers/ReflectionHelpers.cs @@ -20,10 +20,10 @@ namespace Explorer #if CPP public static ILType GameObjectType => Il2CppType.Of(); - public static ILType TransformType => Il2CppType.Of(); - public static ILType ObjectType => Il2CppType.Of(); - public static ILType ComponentType => Il2CppType.Of(); - public static ILType BehaviourType => Il2CppType.Of(); + public static ILType TransformType => Il2CppType.Of(); + public static ILType ObjectType => Il2CppType.Of(); + public static ILType ComponentType => Il2CppType.Of(); + public static ILType BehaviourType => Il2CppType.Of(); private static readonly MethodInfo tryCastMethodInfo = typeof(Il2CppObjectBase).GetMethod("TryCast"); private static readonly Dictionary cachedTryCastMethods = new Dictionary(); @@ -41,10 +41,10 @@ namespace Explorer } #else public static Type GameObjectType => typeof(GameObject); - public static Type TransformType => typeof(Transform); - public static Type ObjectType => typeof(UnityEngine.Object); - public static Type ComponentType => typeof(Component); - public static Type BehaviourType => typeof(Behaviour); + public static Type TransformType => typeof(Transform); + public static Type ObjectType => typeof(UnityEngine.Object); + public static Type ComponentType => typeof(Component); + public static Type BehaviourType => typeof(Behaviour); #endif public static bool IsEnumerable(Type t) @@ -148,7 +148,12 @@ namespace Explorer public static bool LoadModule(string module) { - var path = $@"MelonLoader\Managed\{module}"; +#if CPP +#if ML + var path = $@"MelonLoader\Managed\{module}.dll"; +#else + var path = $@"BepInEx\unhollowed\{module}.dll"; +#endif if (!File.Exists(path)) return false; try @@ -159,8 +164,9 @@ namespace Explorer catch (Exception e) { ExplorerCore.Log(e.GetType() + ", " + e.Message); - return false; } +#endif + return false; } public static string ExceptionToString(Exception e) @@ -175,7 +181,6 @@ namespace Explorer return "Garbage collected in Il2Cpp."; } #endif - return e.GetType() + ", " + e.Message; } diff --git a/src/Menu/CursorControl.cs b/src/Menu/CursorControl.cs index 9cbc1af..21c4567 100644 --- a/src/Menu/CursorControl.cs +++ b/src/Menu/CursorControl.cs @@ -74,9 +74,9 @@ namespace Explorer var harmony = #if ML - Explorer_MelonMod.Instance.harmonyInstance; + ExplorerMelonMod.Instance.harmonyInstance; #else - Explorer_BepInPlugin.HarmonyInstance; + ExplorerBepInPlugin.HarmonyInstance; #endif ; diff --git a/src/Menu/MainMenu/Pages/SearchPage.cs b/src/Menu/MainMenu/Pages/SearchPage.cs index 164afd7..a4ad4dd 100644 --- a/src/Menu/MainMenu/Pages/SearchPage.cs +++ b/src/Menu/MainMenu/Pages/SearchPage.cs @@ -76,7 +76,7 @@ namespace Explorer } #endif - var cache = CacheObjectBase.GetCacheObject(toCache); + var cache = CacheFactory.GetTypeAndCacheObject(toCache); m_searchResults.Add(cache); } diff --git a/src/Menu/UIStyles.cs b/src/Menu/UIStyles.cs index 2551539..b66e9fa 100644 --- a/src/Menu/UIStyles.cs +++ b/src/Menu/UIStyles.cs @@ -21,7 +21,7 @@ namespace Explorer public const string Local = "#a6e9e9"; - public const string StructGreen = "#b8d7a3"; + public const string StructGreen = "#92c470"; } public static Color LightGreen = new Color(Color.green.r - 0.3f, Color.green.g - 0.3f, Color.green.b - 0.3f); diff --git a/src/Menu/Windows/GameObjectWindow.cs b/src/Menu/Windows/GameObjectWindow.cs index 46649c3..74f9461 100644 --- a/src/Menu/Windows/GameObjectWindow.cs +++ b/src/Menu/Windows/GameObjectWindow.cs @@ -369,7 +369,7 @@ namespace Explorer GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); - var width = m_rect.width / 2 - 115f; + var width = m_rect.width / 2 - 135f; m_addComponentInput = GUILayout.TextField(m_addComponentInput, new GUILayoutOption[] { GUILayout.Width(width) }); if (GUILayout.Button("Add Comp", new GUILayoutOption[0])) { diff --git a/src/Menu/Windows/ReflectionWindow.cs b/src/Menu/Windows/ReflectionWindow.cs index 7da2444..84f43d7 100644 --- a/src/Menu/Windows/ReflectionWindow.cs +++ b/src/Menu/Windows/ReflectionWindow.cs @@ -204,7 +204,7 @@ namespace Explorer try { - var cached = CacheObjectBase.GetCacheObject(member, target); + var cached = CacheFactory.GetTypeAndCacheObject(member, target); if (cached != null) { cachedSigs.Add(sig); diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index 3cb5bd9..89c2874 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ using Explorer; #if ML using MelonLoader; -[assembly: MelonInfo(typeof(Explorer_MelonMod), ExplorerCore.NAME, ExplorerCore.VERSION, ExplorerCore.AUTHOR)] +[assembly: MelonInfo(typeof(ExplorerMelonMod), ExplorerCore.NAME, ExplorerCore.VERSION, ExplorerCore.AUTHOR)] [assembly: MelonGame(null, null)] #endif