From b65d87f40c67f43395effef24f8f90f1997a7b58 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 18 Nov 2018 09:03:03 -0600 Subject: [PATCH 1/3] Add files via upload --- BizHawk.Client.EmuHawk/IControlMainform.cs | 2 +- BizHawk.Client.EmuHawk/MainForm.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/IControlMainform.cs b/BizHawk.Client.EmuHawk/IControlMainform.cs index 3716de65b5..f5ea4e2dbe 100644 --- a/BizHawk.Client.EmuHawk/IControlMainform.cs +++ b/BizHawk.Client.EmuHawk/IControlMainform.cs @@ -43,7 +43,7 @@ /// Returns whether or not the rewind action actually occured /// /// - bool Rewind(); + bool Rewind(ref bool runframe); bool WantsToControlRestartMovie { get; } diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 3d2d80c2e8..a0a5369741 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -4461,7 +4461,7 @@ namespace BizHawk.Client.EmuHawk if (isRewinding) { runFrame = true; // TODO: the master should be deciding this! - Master.Rewind(); + Master.Rewind(ref runFrame); } } else From ae21d1748f7dcb1997276c2d62b33a1027faa7dc Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 18 Nov 2018 09:03:49 -0600 Subject: [PATCH 2/3] Add files via upload --- .../tools/Debugger/GenericDebugger.IControlMainform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IControlMainform.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IControlMainform.cs index c7f95fbc04..767d927afd 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IControlMainform.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IControlMainform.cs @@ -28,7 +28,7 @@ namespace BizHawk.Client.EmuHawk // TODO: We probably want to do this public bool WantsToControlRewind { get { return false; } } public void CaptureRewind() { } - public bool Rewind() { return false; } + public bool Rewind(ref bool runframe) { return false; } public bool WantsToControlRestartMovie { get { return false; } } public void RestartMovie() { } From 4794c1bd462d930d5f775e302fe895272647e68d Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 18 Nov 2018 09:04:56 -0600 Subject: [PATCH 3/3] Add files via upload --- .../tools/TAStudio/TAStudio.IControlMainForm.cs | 6 ++++-- .../tools/TAStudio/TAStudio.Navigation.cs | 15 +++++++++++---- BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs | 9 +++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs index 8abd471b26..d01305b4af 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs @@ -84,7 +84,7 @@ // Do nothing, Tastudio handles this just fine } - public bool Rewind() + public bool Rewind(ref bool runframe) { // copypasted from TasView_MouseWheel(), just without notch logic if (Mainform.IsSeeking && !Mainform.EmulatorPaused) @@ -105,7 +105,9 @@ else { StopSeeking(); // late breaking memo: dont know whether this is needed - GoToPreviousFrame(); + int dist = GoToPreviousFrame(); + + if (Emulator.Frame == 0) { runframe = false; } } return true; diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs index e6ec6e7615..24c81e9995 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs @@ -28,17 +28,18 @@ namespace BizHawk.Client.EmuHawk } // SuuperW: I changed this to public so that it could be used by MarkerControl.cs - public void GoToFrame(int frame, bool fromLua = false, bool fromRewinding = false) + public int GoToFrame(int frame, bool fromLua = false, bool fromRewinding = false) { // If seeking to a frame before or at the end of the movie, use StartAtNearestFrameAndEmulate // Otherwise, load the latest state (if not already there) and seek while recording. + int dist = 0; WasRecording = CurrentTasMovie.IsRecording || WasRecording; if (frame <= CurrentTasMovie.InputLogLength) { // Get as close as we can then emulate there - StartAtNearestFrameAndEmulate(frame, fromLua, fromRewinding); + dist = StartAtNearestFrameAndEmulate(frame, fromLua, fromRewinding); MaybeFollowCursor(); } @@ -69,14 +70,20 @@ namespace BizHawk.Client.EmuHawk RefreshDialog(); UpdateOtherTools(); + + return dist; } - public void GoToPreviousFrame() + public int GoToPreviousFrame() { + int dist = -1; + if (Emulator.Frame > 0) { - GoToFrame(Emulator.Frame - 1); + dist = GoToFrame(Emulator.Frame - 1); } + + return dist; } public void GoToNextFrame() diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index bfc1b12614..54958d58b5 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -854,14 +854,17 @@ namespace BizHawk.Client.EmuHawk } } - private void StartAtNearestFrameAndEmulate(int frame, bool fromLua, bool fromRewinding) + private int StartAtNearestFrameAndEmulate(int frame, bool fromLua, bool fromRewinding) { if (frame == Emulator.Frame) - return; + return 0; _unpauseAfterSeeking = (fromRewinding || WasRecording) && !Mainform.EmulatorPaused; TastudioPlayMode(); KeyValuePair closestState = CurrentTasMovie.TasStateManager.GetStateClosestToFrame(frame); + + int dist = frame - closestState.Key; + if (closestState.Value != null && (frame < Emulator.Frame || closestState.Key > Emulator.Frame)) { LoadState(closestState); @@ -913,6 +916,8 @@ namespace BizHawk.Client.EmuHawk // users who are clicking around.. I dont know. } } + + return dist; } public void LoadState(KeyValuePair state)