Add files via upload

This commit is contained in:
alyosha-tas 2018-11-18 09:04:56 -06:00 committed by GitHub
parent ae21d1748f
commit 4794c1bd46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 8 deletions

View File

@ -84,7 +84,7 @@
// Do nothing, Tastudio handles this just fine // Do nothing, Tastudio handles this just fine
} }
public bool Rewind() public bool Rewind(ref bool runframe)
{ {
// 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,7 +105,9 @@
else else
{ {
StopSeeking(); // late breaking memo: dont know whether this is needed StopSeeking(); // late breaking memo: dont know whether this is needed
GoToPreviousFrame(); int dist = GoToPreviousFrame();
if (Emulator.Frame == 0) { runframe = false; }
} }
return true; return true;

View File

@ -28,17 +28,18 @@ 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 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 // 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
StartAtNearestFrameAndEmulate(frame, fromLua, fromRewinding); dist = StartAtNearestFrameAndEmulate(frame, fromLua, fromRewinding);
MaybeFollowCursor(); MaybeFollowCursor();
} }
@ -69,14 +70,20 @@ namespace BizHawk.Client.EmuHawk
RefreshDialog(); RefreshDialog();
UpdateOtherTools(); UpdateOtherTools();
return dist;
} }
public void GoToPreviousFrame() public int GoToPreviousFrame()
{ {
int dist = -1;
if (Emulator.Frame > 0) if (Emulator.Frame > 0)
{ {
GoToFrame(Emulator.Frame - 1); dist = GoToFrame(Emulator.Frame - 1);
} }
return dist;
} }
public void GoToNextFrame() public void GoToNextFrame()

View File

@ -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) if (frame == Emulator.Frame)
return; return 0;
_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);
@ -913,6 +916,8 @@ 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)