* 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> <RootNamespace>Explorer</RootNamespace>
<AssemblyName>Explorer</AssemblyName> <AssemblyName>Explorer</AssemblyName>
<!-- Set this to the MelonLoader Il2Cpp Game folder, without the ending '\' character. --> <!-- 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. --> <!-- Set this to the MelonLoader Mono Game folder, without the ending '\' character. -->
<MLMonoGameFolder>D:\Steam\steamapps\common\Outward</MLMonoGameFolder> <MLMonoGameFolder>D:\Steam\steamapps\common\Outward</MLMonoGameFolder>
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. --> <!-- 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 // Get current cursor state and enable cursor
try try
{ {
//m_lastLockMode = Cursor.lockState; m_lastLockMode = (CursorLockMode)typeof(Cursor).GetProperty("lockState", BF.Public | BF.Static).GetValue(null, null);
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);
?? CursorLockMode.None; }
catch
//m_lastVisibleState = Cursor.visible; {
m_lastVisibleState = (bool?)typeof(Cursor).GetProperty("visible", BF.Public | BF.Static)?.GetValue(null, null) m_lastLockMode = CursorLockMode.None;
?? false; m_lastVisibleState = true;
} }
catch { }
// Setup Harmony Patches // Setup Harmony Patches
TryPatch("lockState", new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_lockState))), true); 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) if (m < 4 || m > 16)
continue; continue;
var fi = member as FieldInfo;
var pi = member as PropertyInfo; var pi = member as PropertyInfo;
var mi = member as MethodInfo; var mi = member as MethodInfo;
if (IsStaticInspector) 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 (pi != null && !pi.GetAccessors()[0].IsStatic) continue;
else if (mi != null && !mi.IsStatic) continue; else if (mi != null && !mi.IsStatic) continue;
} }
@ -195,6 +194,8 @@ namespace Explorer.UI.Inspectors
try try
{ {
// ExplorerCore.Log($"Trying to cache member {sig}...");
var cached = CacheFactory.GetCacheObject(member, Target); var cached = CacheFactory.GetCacheObject(member, Target);
if (cached != null) if (cached != null)

View File

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

View File

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

View File

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