From 626e6805104ab908bb7b338d0a1aa55c3178359f Mon Sep 17 00:00:00 2001
From: sinaioutlander <49360850+sinaioutlander@users.noreply.github.com>
Date: Wed, 28 Oct 2020 20:49:18 +1100
Subject: [PATCH] 2.0.9
* Fix an issue in mono builds causing a crash
* Fix for games which only contain one scene
* A few small cleanups
---
src/Explorer.csproj | 2 +-
src/UI/ForceUnlockCursor.cs | 15 +++++++--------
src/UI/Inspectors/ReflectionInspector.cs | 5 +++--
.../InteractiveValue/Object/InteractiveSprite.cs | 7 ++++++-
src/UI/Main/ScenePage.cs | 1 +
src/Unstrip/IMGUI/GUIHelper.cs | 2 +-
6 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/Explorer.csproj b/src/Explorer.csproj
index 42d0b4e..eef283a 100644
--- a/src/Explorer.csproj
+++ b/src/Explorer.csproj
@@ -25,7 +25,7 @@
Explorer
Explorer
- D:\Steam\steamapps\common\Hellpoint
+ D:\Steam\steamapps\common\VRChat
D:\Steam\steamapps\common\Outward
diff --git a/src/UI/ForceUnlockCursor.cs b/src/UI/ForceUnlockCursor.cs
index 90363d6..a56299f 100644
--- a/src/UI/ForceUnlockCursor.cs
+++ b/src/UI/ForceUnlockCursor.cs
@@ -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);
diff --git a/src/UI/Inspectors/ReflectionInspector.cs b/src/UI/Inspectors/ReflectionInspector.cs
index 91fb4dd..86bc01b 100644
--- a/src/UI/Inspectors/ReflectionInspector.cs
+++ b/src/UI/Inspectors/ReflectionInspector.cs
@@ -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)
diff --git a/src/UI/InteractiveValue/Object/InteractiveSprite.cs b/src/UI/InteractiveValue/Object/InteractiveSprite.cs
index e6cc7c8..0c5a122 100644
--- a/src/UI/InteractiveValue/Object/InteractiveSprite.cs
+++ b/src/UI/InteractiveValue/Object/InteractiveSprite.cs
@@ -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;
}
diff --git a/src/UI/Main/ScenePage.cs b/src/UI/Main/ScenePage.cs
index 870387d..90f755e 100644
--- a/src/UI/Main/ScenePage.cs
+++ b/src/UI/Main/ScenePage.cs
@@ -35,6 +35,7 @@ namespace Explorer.UI.Main
public override void Init()
{
Instance = this;
+ m_currentScene = UnityHelpers.ActiveSceneName;
}
public void OnSceneChange()
diff --git a/src/Unstrip/IMGUI/GUIHelper.cs b/src/Unstrip/IMGUI/GUIHelper.cs
index dc219ef..978bdc5 100644
--- a/src/Unstrip/IMGUI/GUIHelper.cs
+++ b/src/Unstrip/IMGUI/GUIHelper.cs
@@ -18,7 +18,7 @@ namespace Explorer
#if CPP
return GUIUnstrip.ExpandWidth(expand);
#else
- return GUIHelper.ExpandWidth(expand);
+ return GUILayout.ExpandWidth(expand);
#endif
}