diff --git a/Blackout/HarmonyPatches.cs b/Blackout/HarmonyPatches.cs index a78b1e9..1387e9e 100644 --- a/Blackout/HarmonyPatches.cs +++ b/Blackout/HarmonyPatches.cs @@ -1,5 +1,7 @@ using ABI_RC.Core.Player; +using ABI_RC.Core.Savior; using HarmonyLib; +using MelonLoader; namespace Blackout; @@ -11,9 +13,10 @@ internal class HarmonyPatches [HarmonyPatch(typeof(PlayerSetup), "CalibrateAvatar")] private static void CheckVRModeOnSwitch() { - if (Blackout.inVR != PlayerSetup.Instance._inVr) + if (Blackout.inVR != MetaPort.Instance.isUsingVr) { - Blackout.inVR = PlayerSetup.Instance._inVr; + MelonLogger.Msg("VRMode change detected! Reinitializing Blackout Instance..."); + Blackout.inVR = MetaPort.Instance.isUsingVr; BlackoutController.Instance.SetupBlackoutInstance(); BlackoutController.Instance.ChangeBlackoutState(BlackoutController.BlackoutState.Awake); } diff --git a/Blackout/Main.cs b/Blackout/Main.cs index e1ac4a4..b4926a3 100644 --- a/Blackout/Main.cs +++ b/Blackout/Main.cs @@ -1,4 +1,5 @@ using ABI_RC.Core.Player; +using ABI_RC.Core.Savior; using MelonLoader; namespace Blackout; @@ -28,14 +29,10 @@ public class Blackout : MelonMod m_entryDrowsyDimStrength = m_categoryBlackout.CreateEntry("Drowsy Dim Strength", 0.5f, description: "How strong of a dimming effect should drowsy mode have."); m_categoryBlackout.SaveToFile(false); - m_entryEnabled.OnEntryValueChangedUntyped.Subscribe(OnUpdateEnabled); - m_entryHudMessages.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); - m_entryDropFPSOnSleep.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); - m_entryDrowsyThreshold.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); - m_entryAwakeThreshold.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); - m_entryDrowsyModeTimer.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); - m_entrySleepModeTimer.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); - m_entryDrowsyDimStrength.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); + foreach (var setting in m_categoryBlackout.Entries) + { + setting.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); + } //UIExpansionKit addon if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "UI Expansion Kit")) @@ -55,7 +52,7 @@ public class Blackout : MelonMod while (PlayerSetup.Instance == null) yield return null; - inVR = PlayerSetup.Instance._inVr; + inVR = MetaPort.Instance.isUsingVr; PlayerSetup.Instance.gameObject.AddComponent(); //update BlackoutController settings after it initializes diff --git a/Blackout/Properties/AssemblyInfo.cs b/Blackout/Properties/AssemblyInfo.cs index f50fc51..c79bb81 100644 --- a/Blackout/Properties/AssemblyInfo.cs +++ b/Blackout/Properties/AssemblyInfo.cs @@ -25,6 +25,6 @@ using System.Reflection; namespace Blackout.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.3"; + public const string Version = "1.0.4"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/Blackout/format.json b/Blackout/format.json index 0455ec4..eb09686 100644 --- a/Blackout/format.json +++ b/Blackout/format.json @@ -1,9 +1,9 @@ { "_id": 106, "name": "Blackout", - "modversion": "1.0.3", - "gameversion": "2022r169p1", - "loaderversion": "0.5.5", + "modversion": "1.0.4", + "gameversion": "2022r169", + "loaderversion": "0.5.7", "modtype": "Mod", "author": "NotAKidoS", "description": "Dim screen after set time of sitting still. Should be nice for VR sleeping.\n\nNotable Options:\n Cap FPS while sleeping.\nManual control via UIX\nConfigurable dimming strength.", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/Blackout/releases/download/r4/Blackout.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/Blackout/releases/download/r5/Blackout.dll", "sourcelink": "https://github.com/NotAKidOnSteam/Blackout/", - "changelog": "Fixed rendering in every camera other than player camera. Should now behave in both automatic and manual modes.", + "changelog": "Small tweak to fix VRMode change detection with latest experimental.", "embedcolor": "#161b22" } \ No newline at end of file