Tastudio - when doing a loadstate action, update other tools

This commit is contained in:
adelikat 2014-09-27 15:19:07 +00:00
parent 681b3b570d
commit ac69e8fcb4
2 changed files with 21 additions and 3 deletions

View File

@ -7,6 +7,8 @@ namespace BizHawk.Client.EmuHawk
{
public bool UpdateBefore { get { return false; } }
private bool _hackyDontUpdate = false;
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed || _currentTasMovie == null)
@ -14,6 +16,11 @@ namespace BizHawk.Client.EmuHawk
return;
}
if (_hackyDontUpdate)
{
return;
}
SetVisibleIndex();
RefreshDialog();
}

View File

@ -282,13 +282,24 @@ namespace BizHawk.Client.EmuHawk
var closestState = _currentTasMovie.GetStateClosestToFrame(frame);
if (closestState != null)
{
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(closestState.ToArray())));
LoadState(closestState.ToArray());
}
GlobalWin.MainForm.PauseOnFrame = frame;
GlobalWin.MainForm.UnpauseEmulator();
}
private void LoadState(byte[] state)
{
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(state)));
_hackyDontUpdate = true;
GlobalWin.Tools.UpdateBefore();
GlobalWin.Tools.UpdateAfter();
_hackyDontUpdate = false;
}
private void GoToFrame(int frame)
{
// If past greenzone, emulate and capture states
@ -306,7 +317,7 @@ namespace BizHawk.Client.EmuHawk
if (_currentTasMovie[goToFrame].HasState) // Go back 1 frame and emulate to get the display (we don't store that)
{
_currentTasMovie.SwitchToPlay();
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(_currentTasMovie[goToFrame].State.ToArray())));
LoadState(_currentTasMovie[goToFrame].State.ToArray());
if (frame > 0) // We can't emulate up to frame 0!
{
@ -356,7 +367,7 @@ namespace BizHawk.Client.EmuHawk
if (_currentTasMovie.LastEmulatedFrame > 0 && shouldLoadstate)
{
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(_currentTasMovie[_currentTasMovie.LastEmulatedFrame].State.ToArray())));
LoadState(_currentTasMovie[_currentTasMovie.LastEmulatedFrame].State.ToArray());
}
GlobalWin.MainForm.UnpauseEmulator();