Revert "This fixes a bug in TAStudio where you cannot use '<'to get to frame 0" (#1382)

I'm committing the proper fix after this
This commit is contained in:
feos 2018-11-28 22:03:16 +03:00 committed by GitHub
parent 76bfd7c355
commit 0433b10d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 25 deletions

View File

@ -43,7 +43,7 @@
/// Returns whether or not the rewind action actually occured /// Returns whether or not the rewind action actually occured
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
bool Rewind(ref bool runframe); bool Rewind();
bool WantsToControlRestartMovie { get; } bool WantsToControlRestartMovie { get; }

View File

@ -4468,7 +4468,7 @@ namespace BizHawk.Client.EmuHawk
if (isRewinding) if (isRewinding)
{ {
runFrame = true; // TODO: the master should be deciding this! runFrame = true; // TODO: the master should be deciding this!
Master.Rewind(ref runFrame); Master.Rewind();
} }
} }
else else

View File

@ -28,7 +28,7 @@ namespace BizHawk.Client.EmuHawk
// TODO: We probably want to do this // TODO: We probably want to do this
public bool WantsToControlRewind { get { return false; } } public bool WantsToControlRewind { get { return false; } }
public void CaptureRewind() { } public void CaptureRewind() { }
public bool Rewind(ref bool runframe) { return false; } public bool Rewind() { return false; }
public bool WantsToControlRestartMovie { get { return false; } } public bool WantsToControlRestartMovie { get { return false; } }
public void RestartMovie() { } public void RestartMovie() { }

View File

@ -84,7 +84,7 @@
// Do nothing, Tastudio handles this just fine // Do nothing, Tastudio handles this just fine
} }
public bool Rewind(ref bool runframe) public bool Rewind()
{ {
// copypasted from TasView_MouseWheel(), just without notch logic // copypasted from TasView_MouseWheel(), just without notch logic
if (Mainform.IsSeeking && !Mainform.EmulatorPaused) if (Mainform.IsSeeking && !Mainform.EmulatorPaused)
@ -105,9 +105,7 @@
else else
{ {
StopSeeking(); // late breaking memo: dont know whether this is needed StopSeeking(); // late breaking memo: dont know whether this is needed
int dist = GoToPreviousFrame(); GoToPreviousFrame();
if (Emulator.Frame == 0) { runframe = false; }
} }
return true; return true;

View File

@ -28,18 +28,17 @@ namespace BizHawk.Client.EmuHawk
} }
// SuuperW: I changed this to public so that it could be used by MarkerControl.cs // SuuperW: I changed this to public so that it could be used by MarkerControl.cs
public int GoToFrame(int frame, bool fromLua = false, bool fromRewinding = false) public void GoToFrame(int frame, bool fromLua = false, bool fromRewinding = false)
{ {
// If seeking to a frame before or at the end of the movie, use StartAtNearestFrameAndEmulate // 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. // Otherwise, load the latest state (if not already there) and seek while recording.
int dist = 0;
WasRecording = CurrentTasMovie.IsRecording || WasRecording; WasRecording = CurrentTasMovie.IsRecording || WasRecording;
if (frame <= CurrentTasMovie.InputLogLength) if (frame <= CurrentTasMovie.InputLogLength)
{ {
// Get as close as we can then emulate there // Get as close as we can then emulate there
dist = StartAtNearestFrameAndEmulate(frame, fromLua, fromRewinding); StartAtNearestFrameAndEmulate(frame, fromLua, fromRewinding);
MaybeFollowCursor(); MaybeFollowCursor();
} }
@ -70,20 +69,14 @@ namespace BizHawk.Client.EmuHawk
RefreshDialog(); RefreshDialog();
UpdateOtherTools(); UpdateOtherTools();
return dist;
} }
public int GoToPreviousFrame() public void GoToPreviousFrame()
{ {
int dist = -1;
if (Emulator.Frame > 0) if (Emulator.Frame > 0)
{ {
dist = GoToFrame(Emulator.Frame - 1); GoToFrame(Emulator.Frame - 1);
} }
return dist;
} }
public void GoToNextFrame() public void GoToNextFrame()

View File

@ -880,17 +880,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private int StartAtNearestFrameAndEmulate(int frame, bool fromLua, bool fromRewinding) private void StartAtNearestFrameAndEmulate(int frame, bool fromLua, bool fromRewinding)
{ {
if (frame == Emulator.Frame) if (frame == Emulator.Frame)
return 0; return;
_unpauseAfterSeeking = (fromRewinding || WasRecording) && !Mainform.EmulatorPaused; _unpauseAfterSeeking = (fromRewinding || WasRecording) && !Mainform.EmulatorPaused;
TastudioPlayMode(); TastudioPlayMode();
KeyValuePair<int, byte[]> closestState = CurrentTasMovie.TasStateManager.GetStateClosestToFrame(frame); KeyValuePair<int, byte[]> closestState = CurrentTasMovie.TasStateManager.GetStateClosestToFrame(frame);
int dist = frame - closestState.Key;
if (closestState.Value != null && (frame < Emulator.Frame || closestState.Key > Emulator.Frame)) if (closestState.Value != null && (frame < Emulator.Frame || closestState.Key > Emulator.Frame))
{ {
LoadState(closestState); LoadState(closestState);
@ -942,8 +939,6 @@ namespace BizHawk.Client.EmuHawk
// users who are clicking around.. I dont know. // users who are clicking around.. I dont know.
} }
} }
return dist;
} }
public void LoadState(KeyValuePair<int, byte[]> state) public void LoadState(KeyValuePair<int, byte[]> state)