From bdb860b4bd0d5e9a2e8e0a0ced5b885dd0c99535 Mon Sep 17 00:00:00 2001 From: Daniel Wong Date: Wed, 12 Oct 2022 14:38:34 +1100 Subject: [PATCH] Add button to reset fullscreen resolution --- MOD.Scripts.Core/MODWindowManager.cs | 5 +++++ MOD.Scripts.UI/MODMenuResolution.cs | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/MOD.Scripts.Core/MODWindowManager.cs b/MOD.Scripts.Core/MODWindowManager.cs index 46106a6e..e8b55453 100644 --- a/MOD.Scripts.Core/MODWindowManager.cs +++ b/MOD.Scripts.Core/MODWindowManager.cs @@ -322,6 +322,11 @@ public static void ForceUnconfigureFullscreenLock() { PlayerPrefs.DeleteKey(FULLSCREEN_LOCK_KEY); } + public static void ClearPlayerPrefsFullscreenResolution() + { + PlayerPrefs.DeleteKey("fullscreen_width"); + PlayerPrefs.DeleteKey("fullscreen_height"); + } private static Resolution GetFullscreenResolution() { diff --git a/MOD.Scripts.UI/MODMenuResolution.cs b/MOD.Scripts.UI/MODMenuResolution.cs index 05817fe6..cc7e4a05 100644 --- a/MOD.Scripts.UI/MODMenuResolution.cs +++ b/MOD.Scripts.UI/MODMenuResolution.cs @@ -24,7 +24,7 @@ public void OnBeforeMenuVisible() public void OnGUI() { - Label("Resolution Settings"); + Label($"Resolution Settings (Current: {Screen.width}x{Screen.height})"); { GUILayout.BeginHorizontal(); if (Button(new GUIContent("480p", "Set resolution to 853 x 480"))) { SetAndSaveResolution(480); } @@ -51,6 +51,16 @@ public void OnGUI() } } GUILayout.EndHorizontal(); + + if (Button(new GUIContent( + "Reset Fullscreen Resolution", + "Force re-detection of the fullscreen resolution (matching your monitor's max resolution).\n\n" + + "You may want to do this if you change to a monitor with a different fullscreen resolution, and the game detects the wrong resolution.") + )) + { + MODWindowManager.ClearPlayerPrefsFullscreenResolution(); + MODWindowManager.GoFullscreen(); + } } }