* Fix an issue in mono builds causing a crash
* Fix for games which only contain one scene
* A few small cleanups
This commit is contained in:
sinaioutlander 2020-10-28 20:49:18 +11:00
parent 7c85969085
commit 626e680510
6 changed files with 19 additions and 13 deletions

View File

@ -25,7 +25,7 @@
<RootNamespace>Explorer</RootNamespace>
<AssemblyName>Explorer</AssemblyName>
<!-- Set this to the MelonLoader Il2Cpp Game folder, without the ending '\' character. -->
<MLCppGameFolder>D:\Steam\steamapps\common\Hellpoint</MLCppGameFolder>
<MLCppGameFolder>D:\Steam\steamapps\common\VRChat</MLCppGameFolder>
<!-- Set this to the MelonLoader Mono Game folder, without the ending '\' character. -->
<MLMonoGameFolder>D:\Steam\steamapps\common\Outward</MLMonoGameFolder>
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->

View File

@ -43,15 +43,14 @@ namespace Explorer.UI
// Get current cursor state and enable cursor
try
{
//m_lastLockMode = Cursor.lockState;
m_lastLockMode = (CursorLockMode?)typeof(Cursor).GetProperty("lockState", BF.Public | BF.Static)?.GetValue(null, null)
?? CursorLockMode.None;
//m_lastVisibleState = Cursor.visible;
m_lastVisibleState = (bool?)typeof(Cursor).GetProperty("visible", BF.Public | BF.Static)?.GetValue(null, null)
?? false;
m_lastLockMode = (CursorLockMode)typeof(Cursor).GetProperty("lockState", BF.Public | BF.Static).GetValue(null, null);
m_lastVisibleState = (bool)typeof(Cursor).GetProperty("visible", BF.Public | BF.Static).GetValue(null, null);
}
catch
{
m_lastLockMode = CursorLockMode.None;
m_lastVisibleState = true;
}
catch { }
// Setup Harmony Patches
TryPatch("lockState", new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_lockState))), true);

View File

@ -150,13 +150,12 @@ namespace Explorer.UI.Inspectors
if (m < 4 || m > 16)
continue;
var fi = member as FieldInfo;
var pi = member as PropertyInfo;
var mi = member as MethodInfo;
if (IsStaticInspector)
{
if (fi != null && !fi.IsStatic) continue;
if (member is FieldInfo fi && !fi.IsStatic) continue;
else if (pi != null && !pi.GetAccessors()[0].IsStatic) continue;
else if (mi != null && !mi.IsStatic) continue;
}
@ -195,6 +194,8 @@ namespace Explorer.UI.Inspectors
try
{
// ExplorerCore.Log($"Trying to cache member {sig}...");
var cached = CacheFactory.GetCacheObject(member, Target);
if (cached != null)

View File

@ -11,6 +11,11 @@ namespace Explorer.UI
{
private Sprite refSprite;
public override void Init()
{
base.Init();
}
public override void UpdateValue()
{
#if CPP
@ -30,7 +35,7 @@ namespace Explorer.UI
public override void GetTexture2D()
{
if (refSprite)
if (refSprite && refSprite.texture)
{
currentTex = refSprite.texture;
}

View File

@ -35,6 +35,7 @@ namespace Explorer.UI.Main
public override void Init()
{
Instance = this;
m_currentScene = UnityHelpers.ActiveSceneName;
}
public void OnSceneChange()

View File

@ -18,7 +18,7 @@ namespace Explorer
#if CPP
return GUIUnstrip.ExpandWidth(expand);
#else
return GUIHelper.ExpandWidth(expand);
return GUILayout.ExpandWidth(expand);
#endif
}