From bea796fb2df6d65c9ce588303882b9a224052aad Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 15 Aug 2020 23:13:17 -0400 Subject: [PATCH] experimental "Frame Inch" designed to make quick presses of frame advance always do something (concerning #2303). --- src/BizHawk.Client.Common/config/Binding.cs | 1 + src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs | 4 ++++ src/BizHawk.Client.EmuHawk/MainForm.cs | 20 ++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/BizHawk.Client.Common/config/Binding.cs b/src/BizHawk.Client.Common/config/Binding.cs index 4ce4fc919d..b02abf9562 100644 --- a/src/BizHawk.Client.Common/config/Binding.cs +++ b/src/BizHawk.Client.Common/config/Binding.cs @@ -145,6 +145,7 @@ namespace BizHawk.Client.Common Bind("General", "Screen Client to Clipboard", "Ctrl+Shift+C"), Bind("General", "Toggle Skip Lag Frame"), Bind("General", "Toggle Key Priority"), + Bind("General", "Frame Inch"), Bind("Save States", "Save State 0", "Shift+F10"), Bind("Save States", "Save State 1", "Shift+F1"), diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs b/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs index 4a12f40fac..cd8ad4525f 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs @@ -19,6 +19,10 @@ namespace BizHawk.Client.EmuHawk case "Pause": TogglePause(); break; + case "Frame Inch": + //special! allow this key to get handled as Frame Advance, too + FrameInch = true; + return false; case "Toggle Throttle": _unthrottled ^= true; ThrottleMessage(); diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 187d94b1a2..00ffc816ea 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -771,6 +771,7 @@ namespace BizHawk.Client.EmuHawk public LoadRomArgs CurrentlyOpenRomArgs { get; private set; } public bool PauseAvi { get; set; } public bool PressFrameAdvance { get; set; } + public bool FrameInch { get; set; } public bool HoldFrameAdvance { get; set; } // necessary for tastudio > button public bool PressRewind { get; set; } // necessary for tastudio < button public bool FastForward { get; set; } @@ -2802,8 +2803,25 @@ namespace BizHawk.Client.EmuHawk runFrame = true; } - if (InputManager.ClientControls["Frame Advance"] || PressFrameAdvance || HoldFrameAdvance) + + bool oldFrameAdvanceCondition = InputManager.ClientControls["Frame Advance"] || PressFrameAdvance || HoldFrameAdvance; + if (FrameInch) { + FrameInch = false; + if (EmulatorPaused || oldFrameAdvanceCondition) + { + oldFrameAdvanceCondition = true; + } + else + { + PauseEmulator(); + oldFrameAdvanceCondition = false; + } + } + + if (oldFrameAdvanceCondition || FrameInch) + { + FrameInch = false; _runloopFrameAdvance = true; // handle the initial trigger of a frame advance