From ba27cd5c7e8d4284226409cc6862f85bc36c0c18 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 1 Apr 2020 19:15:27 -0500 Subject: [PATCH] IncrementDSLayout - make decrement hotkey also wrap --- BizHawk.Client.EmuHawk/MainForm.Hotkey.cs | 16 +++++++++++----- BizHawk.sln.DotSettings | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs b/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs index 1a82ffa736..4d72596fe1 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs @@ -775,10 +775,14 @@ namespace BizHawk.Client.EmuHawk if (Emulator is MelonDS ds) { var settings = ds.GetSettings(); - if (settings.ScreenRotation == MelonDS.ScreenRotationKind.Rotate0) settings.ScreenRotation = settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate90; - else if (settings.ScreenRotation == MelonDS.ScreenRotationKind.Rotate90) settings.ScreenRotation = settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate180; - else if (settings.ScreenRotation == MelonDS.ScreenRotationKind.Rotate180) settings.ScreenRotation = settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate270; - else if (settings.ScreenRotation == MelonDS.ScreenRotationKind.Rotate270) settings.ScreenRotation = settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate0; + settings.ScreenRotation = settings.ScreenRotation switch + { + MelonDS.ScreenRotationKind.Rotate0 => settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate90, + MelonDS.ScreenRotationKind.Rotate90 => settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate180, + MelonDS.ScreenRotationKind.Rotate180 => settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate270, + MelonDS.ScreenRotationKind.Rotate270 => settings.ScreenRotation = MelonDS.ScreenRotationKind.Rotate0, + _ => settings.ScreenRotation + }; ds.PutSettings(settings); AddOnScreenMessage($"Screen rotation to {settings.ScreenRotation}"); FrameBufferResized(); @@ -803,7 +807,9 @@ namespace BizHawk.Client.EmuHawk var next = (MelonDS.ScreenLayoutKind)Enum.Parse(typeof(MelonDS.ScreenLayoutKind), num.ToString()); if (!typeof(MelonDS.ScreenLayoutKind).IsEnumDefined(next)) { - next = default; + next = decrement + ? Enum.GetValues(typeof(MelonDS.ScreenLayoutKind)).Cast().Last() + : default; } settings.ScreenLayout = next; diff --git a/BizHawk.sln.DotSettings b/BizHawk.sln.DotSettings index 06c2a5cc1b..03f109bb2a 100644 --- a/BizHawk.sln.DotSettings +++ b/BizHawk.sln.DotSettings @@ -80,6 +80,7 @@ DC DGB DMG + DS DX GB GBA