From a1ce9b12d13e80f71209e0c951fcbe2a9ef55ef8 Mon Sep 17 00:00:00 2001 From: ManlyMarco <39247311+ManlyMarco@users.noreply.github.com> Date: Sun, 28 May 2023 11:51:54 +0200 Subject: [PATCH] [KKLB] Fix crash in VR mode --- KKLB_CheatTools/CheatToolsWindow.cs | 15 ++++++--------- KKLB_CheatTools/KKLB_CheatTools.csproj | 8 ++++---- KKLB_CheatTools/packages.config | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/KKLB_CheatTools/CheatToolsWindow.cs b/KKLB_CheatTools/CheatToolsWindow.cs index b7f19ea..6219b0c 100644 --- a/KKLB_CheatTools/CheatToolsWindow.cs +++ b/KKLB_CheatTools/CheatToolsWindow.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using HarmonyLib; using RuntimeUnityEditor.Core.Inspector; using RuntimeUnityEditor.Core.Inspector.Entries; using RuntimeUnityEditor.Core.Utils; @@ -18,14 +19,6 @@ public static void InitializeCheats() { _openInInspectorButtons = new[] { - //new KeyValuePair(_gameMgr != null && _gameMgr.HeroineList.Count > 0 ? (Func)(() => _gameMgr.HeroineList.Select(x => new ReadonlyCacheEntry(x.ChaName, x))) : null, "Heroine //list"), - //new KeyValuePair(_gameMgr, "Manager.Game.Instance"), - //new KeyValuePair(_sceneInstance, "Manager.Scene.Instance"), - //new KeyValuePair(_communicationInstance, "Manager.Communication.Instance"), - //new KeyValuePair(_soundInstance, "Manager.Sound.Instance"), - //new KeyValuePair(_hFlag, "HFlag"), - //new KeyValuePair(_talkScene, "TalkScene"), - //new KeyValuePair(_studioInstance, "Studio.Instance"), new KeyValuePair((Func)(() => Game.Instance) , "Game.Instance"), new KeyValuePair((Func)EditorUtilities.GetRootGoScanner, "Root Objects") }; @@ -98,8 +91,12 @@ void EnsureNonzeroCount(List list) } } EnsureNonzeroCount(gameStatus.listEndingCount); - EnsureNonzeroCount(gameStatus.listMiniGamePlayCount); EnsureNonzeroCount(gameStatus.listMiniGameClearCount); + + // Doesn't exist in VR version, only NonVR + var tvf = Traverse.Create(gameStatus).Field("listMiniGamePlayCount"); + if (tvf.FieldExists()) + EnsureNonzeroCount(tvf.GetValue>()); gameStatus.SetSystemFlag(ID_SFlag.SFlag_End, true); } diff --git a/KKLB_CheatTools/KKLB_CheatTools.csproj b/KKLB_CheatTools/KKLB_CheatTools.csproj index a2ce111..57bd6d3 100644 --- a/KKLB_CheatTools/KKLB_CheatTools.csproj +++ b/KKLB_CheatTools/KKLB_CheatTools.csproj @@ -41,7 +41,7 @@ False - ..\packages\IllusionLibs.KoiKoiLB.Assembly-CSharp.2023.5.27.1\lib\net45\Assembly-CSharp.dll + ..\packages\IllusionLibs.KoiKoiLB.Assembly-CSharp.2023.5.27.2\lib\net45\Assembly-CSharp.dll False @@ -49,7 +49,7 @@ False - ..\packages\IllusionLibs.KoiKoiLB.Assembly-CSharp.2023.5.27.1\lib\net45\netstandard.dll + ..\packages\IllusionLibs.KoiKoiLB.Assembly-CSharp.2023.5.27.2\lib\net45\netstandard.dll False @@ -110,11 +110,11 @@ - + - + \ No newline at end of file diff --git a/KKLB_CheatTools/packages.config b/KKLB_CheatTools/packages.config index 9aed10b..ab72e3f 100644 --- a/KKLB_CheatTools/packages.config +++ b/KKLB_CheatTools/packages.config @@ -6,6 +6,6 @@ - + \ No newline at end of file