diff --git a/src/BizHawk.Client.EmuHawk/IMainFormForTools.cs b/src/BizHawk.Client.EmuHawk/IMainFormForTools.cs index 4c13ecf2b0..3a2649872b 100644 --- a/src/BizHawk.Client.EmuHawk/IMainFormForTools.cs +++ b/src/BizHawk.Client.EmuHawk/IMainFormForTools.cs @@ -35,6 +35,9 @@ namespace BizHawk.Client.EmuHawk /// only referenced from bool IsTurboing { get; } + /// only referenced from + bool IsFastForwarding { get; } + int? PauseOnFrame { get; set; } /// only referenced from diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 94ab1672cc..89eb30349b 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -1101,6 +1101,7 @@ namespace BizHawk.Client.EmuHawk public bool IsSeeking => PauseOnFrame.HasValue; private bool IsTurboSeeking => PauseOnFrame.HasValue && Config.TurboSeek; public bool IsTurboing => InputManager.ClientControls["Turbo"] || IsTurboSeeking; + public bool IsFastForwarding => InputManager.ClientControls["Fast Forward"] || IsTurboing || InvisibleEmulation; /// /// Used to disable secondary throttling (e.g. vsync, audio) for unthrottled modes or when the primary (clock) throttle is taking over (e.g. during fast forward/rewind). @@ -3118,7 +3119,7 @@ namespace BizHawk.Client.EmuHawk // BlockFrameAdvance (true when input it being editted in TAStudio) supercedes all other frame advance conditions if ((runFrame || force) && !BlockFrameAdvance) { - var isFastForwarding = InputManager.ClientControls["Fast Forward"] || IsTurboing || InvisibleEmulation; + var isFastForwarding = IsFastForwarding; var isFastForwardingOrRewinding = isFastForwarding || isRewinding || Config.Unthrottled; if (isFastForwardingOrRewinding != _lastFastForwardingOrRewinding) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index 07e9e8ffb0..f565d8b4d6 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -81,6 +81,7 @@ namespace BizHawk.Client.EmuHawk this.StateHistoryIntegrityCheckMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.ConfigSubMenu = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.SetMaxUndoLevelsMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); + this.SetRewindStepFastMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.CopyIncludesFrameNoMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.toolStripSeparator26 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx(); this.autosaveToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); @@ -190,6 +191,7 @@ namespace BizHawk.Client.EmuHawk this.BranchesMarkersSplit = new System.Windows.Forms.SplitContainer(); this.MainVertialSplit = new System.Windows.Forms.SplitContainer(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.SetRewindStepMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.TASMenu.SuspendLayout(); this.TasStatusStrip.SuspendLayout(); this.RightClickMenu.SuspendLayout(); @@ -476,6 +478,8 @@ namespace BizHawk.Client.EmuHawk // this.ConfigSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.SetMaxUndoLevelsMenuItem, + this.SetRewindStepMenuItem, + this.SetRewindStepFastMenuItem, this.CopyIncludesFrameNoMenuItem, this.toolStripSeparator26, this.autosaveToolStripMenuItem, @@ -503,6 +507,11 @@ namespace BizHawk.Client.EmuHawk this.SetMaxUndoLevelsMenuItem.Text = "Set max Undo Levels"; this.SetMaxUndoLevelsMenuItem.Click += new System.EventHandler(this.SetMaxUndoLevelsMenuItem_Click); // + // SetRewindStepFastMenuItem + // + this.SetRewindStepFastMenuItem.Text = "Set Fast-Forward Rewind Step"; + this.SetRewindStepFastMenuItem.Click += new System.EventHandler(this.SetRewindStepFastMenuItem_Click); + // // CopyIncludesFrameNoMenuItem // this.CopyIncludesFrameNoMenuItem.Text = "Include Frame # When Copying Input"; @@ -1152,6 +1161,11 @@ namespace BizHawk.Client.EmuHawk this.MainVertialSplit.TabIndex = 10; this.MainVertialSplit.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.MainVerticalSplit_SplitterMoved); // + // SetRewindStepMenuItem + // + this.SetRewindStepMenuItem.Text = "Set Rewind Step"; + this.SetRewindStepMenuItem.Click += new System.EventHandler(this.SetRewindStepMenuItem_Click); + // // TAStudio // this.AllowDrop = true; @@ -1349,5 +1363,7 @@ namespace BizHawk.Client.EmuHawk private BizHawk.WinForms.Controls.ToolStripMenuItemEx SetFontMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx CopyIncludesFrameNoMenuItem; private System.Windows.Forms.ToolTip toolTip1; + private BizHawk.WinForms.Controls.ToolStripMenuItemEx SetRewindStepFastMenuItem; + private BizHawk.WinForms.Controls.ToolStripMenuItemEx SetRewindStepMenuItem; } } \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs index b242aad94d..f8860f73d9 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs @@ -77,17 +77,18 @@ public bool Rewind() { + int rewindStep = MainForm.IsFastForwarding ? Settings.RewindStepFast : Settings.RewindStep; // copy pasted from TasView_MouseWheel(), just without notch logic if (MainForm.IsSeeking && !MainForm.EmulatorPaused) { - MainForm.PauseOnFrame--; + MainForm.PauseOnFrame -= rewindStep; // that's a weird condition here, but for whatever reason it works best if (Emulator.Frame >= MainForm.PauseOnFrame) { MainForm.PauseEmulator(); StopSeeking(); - GoToPreviousFrame(); + GoToFrame(Math.Max(0, Emulator.Frame - rewindStep)); } RefreshDialog(); @@ -95,7 +96,7 @@ else { StopSeeking(); // late breaking memo: don't know whether this is needed - GoToPreviousFrame(); + GoToFrame(Math.Max(0, Emulator.Frame - rewindStep)); } return true; diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 2d6e662b7f..5448462118 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -788,6 +788,67 @@ namespace BizHawk.Client.EmuHawk } } } + private void SetRewindStepFastMenuItem_Click(object sender, EventArgs e) + { + using var prompt = new InputPrompt + { + TextInputType = InputPrompt.InputType.Unsigned, + Message = "Number of frames to go back\nwhen pressing the rewind key\nwhile fast-forwarding:", + InitialValue = Settings.RewindStepFast.ToString(), + }; + + var result = MainForm.DoWithTempMute(() => prompt.ShowDialogOnScreen()); + if (!result.IsOk()) + { + return; + } + + int val = 0; + try + { + val = int.Parse(prompt.PromptText); + } + catch + { + DialogController.ShowMessageBox("Invalid Entry.", "Input Error", EMsgBoxIcon.Error); + } + + if (val > 0) + { + Settings.RewindStepFast = val; + } + } + + private void SetRewindStepMenuItem_Click(object sender, EventArgs e) + { + using var prompt = new InputPrompt + { + TextInputType = InputPrompt.InputType.Unsigned, + Message = "Number of frames to go back\nwhen pressing the rewind key:", + InitialValue = Settings.RewindStep.ToString(), + }; + + var result = MainForm.DoWithTempMute(() => prompt.ShowDialogOnScreen()); + if (!result.IsOk()) + { + return; + } + + int val = 0; + try + { + val = int.Parse(prompt.PromptText); + } + catch + { + DialogController.ShowMessageBox("Invalid Entry.", "Input Error", EMsgBoxIcon.Error); + } + + if (val > 0) + { + Settings.RewindStep = val; + } + } private void CopyIncludesFrameNoMenuItem_Click(object sender, EventArgs e) => Settings.CopyIncludesFrameNo = !Settings.CopyIncludesFrameNo; diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 53e6b65de5..93519700d6 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -114,6 +114,8 @@ namespace BizHawk.Client.EmuHawk public bool AutoadjustInput { get; set; } public TAStudioPalette Palette { get; set; } public int MaxUndoSteps { get; set; } = 1000; + public int RewindStep { get; set; } = 1; + public int RewindStepFast { get; set; } = 4; } public TAStudio()