Tastudio - go to frame stuff
This commit is contained in:
parent
907ab29aaa
commit
3c23c5028d
|
@ -565,6 +565,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
_pauseOnFrame = value;
|
_pauseOnFrame = value;
|
||||||
SetPauseStatusbarIcon();
|
SetPauseStatusbarIcon();
|
||||||
|
|
||||||
|
if (value == null) // TODO: make an Event handler instead, but the logic here is that after turbo seeking, tools will want to do a real update when the emulator finally pauses
|
||||||
|
{
|
||||||
|
GlobalWin.Tools.UpdateToolsBefore();
|
||||||
|
GlobalWin.Tools.UpdateToolsAfter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void FastUpdate()
|
public void FastUpdate()
|
||||||
{
|
{
|
||||||
// TODO: think more about this
|
if (!IsHandleCreated || IsDisposed || _currentTasMovie == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_currentTasMovie.IsRecording)
|
||||||
|
{
|
||||||
|
TasView.LastVisibleRow = _currentTasMovie.InputLogLength - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TasView.LastVisibleRow = Global.Emulator.Frame;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
|
|
|
@ -244,6 +244,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GoToFrame(marker.Frame);
|
GoToFrame(marker.Frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void StartAtNearestFrameAndEmulate(int frame)
|
||||||
|
{
|
||||||
|
_currentTasMovie.SwitchToPlay();
|
||||||
|
var closestState = _currentTasMovie.GetStateClosestToFrame(frame);
|
||||||
|
if (closestState != null)
|
||||||
|
{
|
||||||
|
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(closestState.ToArray())));
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalWin.MainForm.PauseOnFrame = frame;
|
||||||
|
GlobalWin.MainForm.UnpauseEmulator();
|
||||||
|
}
|
||||||
|
|
||||||
private void GoToFrame(int frame)
|
private void GoToFrame(int frame)
|
||||||
{
|
{
|
||||||
// If past greenzone, emulate and capture states
|
// If past greenzone, emulate and capture states
|
||||||
|
@ -273,15 +287,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else // Get as close as we can then emulate there
|
else // Get as close as we can then emulate there
|
||||||
{
|
{
|
||||||
_currentTasMovie.SwitchToPlay();
|
StartAtNearestFrameAndEmulate(frame);
|
||||||
var closestState = _currentTasMovie.GetStateClosestToFrame(frame);
|
return;
|
||||||
if (closestState != null)
|
|
||||||
{
|
|
||||||
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(closestState.ToArray())));
|
|
||||||
}
|
|
||||||
|
|
||||||
GlobalWin.MainForm.UnpauseEmulator();
|
|
||||||
GlobalWin.MainForm.PauseOnFrame = frame;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // We are going foward
|
else // We are going foward
|
||||||
|
@ -297,22 +304,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_currentTasMovie.SwitchToPlay();
|
StartAtNearestFrameAndEmulate(frame);
|
||||||
var closestState = _currentTasMovie.GetStateClosestToFrame(frame);
|
return;
|
||||||
if (closestState != null)
|
|
||||||
{
|
|
||||||
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(closestState.ToArray())));
|
|
||||||
}
|
|
||||||
|
|
||||||
GlobalWin.MainForm.UnpauseEmulator();
|
|
||||||
GlobalWin.MainForm.PauseOnFrame = frame;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Emulate to a future frame
|
else // Emulate to a future frame
|
||||||
{
|
{
|
||||||
// TODO: get the last greenzone frame and go there
|
// TODO: get the last greenzone frame and go there
|
||||||
_currentTasMovie.SwitchToPlay(); // TODO: stop copy/pasting this logic
|
_currentTasMovie.SwitchToPlay();
|
||||||
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(_currentTasMovie[_currentTasMovie.LastEmulatedFrame].State.ToArray())));
|
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(_currentTasMovie[_currentTasMovie.LastEmulatedFrame].State.ToArray())));
|
||||||
GlobalWin.MainForm.UnpauseEmulator();
|
GlobalWin.MainForm.UnpauseEmulator();
|
||||||
if(Global.Config.TAStudioAutoPause)
|
if(Global.Config.TAStudioAutoPause)
|
||||||
|
|
Loading…
Reference in New Issue