From 4794c1bd462d930d5f775e302fe895272647e68d Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 18 Nov 2018 09:04:56 -0600 Subject: [PATCH] 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)