Make Pause status bar icon show turbo seeking and seeking if emulator is those modes, clicking it will cancel out the seek. Fix tastudio's integration with the seek feature, and refactor and simplify some of the code, and a few other tastudio tweaks

This commit is contained in:
adelikat 2014-07-27 19:07:13 +00:00
parent 95e7c534f6
commit 4258c4a579
5 changed files with 63 additions and 12 deletions

View File

@ -94,7 +94,18 @@ namespace BizHawk.Client.Common
public bool AVI_CaptureOSD = false;
public bool Screenshot_CaptureOSD = false;
public bool FirstBoot = true;
public bool TurboSeek = true; // When PauseOnFrame is set, this will decide whether the client goes into turbo mode or not
//public bool TurboSeek = true; // When PauseOnFrame is set, this will decide whether the client goes into turbo mode or not
private bool _turboSeek;
public bool TurboSeek
{
get { return _turboSeek; }
set
{
_turboSeek = value;
}
}
public enum SaveStateTypeE { Default, Binary, Text };

View File

@ -625,7 +625,11 @@ namespace BizHawk.Client.EmuHawk
private void PauseMenuItem_Click(object sender, EventArgs e)
{
if (EmulatorPaused)
if (IsTurboSeeking || IsSeeking)
{
PauseOnFrame = null;
}
else if (EmulatorPaused)
{
UnpauseEmulator();
}

View File

@ -557,22 +557,34 @@ namespace BizHawk.Client.EmuHawk
public bool EmulatorPaused { get; private set; }
private int? _pauseOnFrame;
private bool _forceTurbo = false;
public int? PauseOnFrame // If set, upon completion of this frame, the client wil pause
{
get { return _pauseOnFrame; }
set
{
_pauseOnFrame = value;
_forceTurbo = _pauseOnFrame.HasValue && Global.Config.TurboSeek;
SetPauseStatusbarIcon();
}
}
}
public bool IsSeeking
{
get { return PauseOnFrame.HasValue; }
}
public bool IsTurboSeeking
{
get
{
return PauseOnFrame.HasValue && Global.Config.TurboSeek;
}
}
public bool IsTurboing
{
get
{
return Global.ClientControls["Turbo"] || _forceTurbo;
return Global.ClientControls["Turbo"] || IsTurboSeeking;
}
}
@ -828,6 +840,12 @@ namespace BizHawk.Client.EmuHawk
{
EmulatorPaused ^= true;
SetPauseStatusbarIcon();
// TODO: have tastudio set a pause status change callback, or take control over pause
if (GlobalWin.Tools.Has<TAStudio>())
{
GlobalWin.Tools.UpdateValues<TAStudio>();
}
}
public void TakeScreenshotToClipboard()
@ -1560,7 +1578,19 @@ namespace BizHawk.Client.EmuHawk
private void SetPauseStatusbarIcon()
{
if (EmulatorPaused)
if (IsTurboing)
{
PauseStatusButton.Image = Properties.Resources.Lightning;
PauseStatusButton.Visible = true;
PauseStatusButton.ToolTipText = "Emulator is turbo seeking to frame " + PauseOnFrame.Value + " click to stop seek";
}
else if (PauseOnFrame.HasValue)
{
PauseStatusButton.Image = Properties.Resources.YellowRight;
PauseStatusButton.Visible = true;
PauseStatusButton.ToolTipText = "Emulator is playing to frame " + PauseOnFrame.Value + " click to stop seek";
}
else if (EmulatorPaused)
{
PauseStatusButton.Image = Properties.Resources.Pause;
PauseStatusButton.Visible = true;
@ -2666,7 +2696,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.FastUpdateAfter();
}
if (PauseOnFrame.HasValue && Global.Emulator.Frame == PauseOnFrame.Value)
if (IsSeeking && Global.Emulator.Frame == PauseOnFrame.Value)
{
PauseEmulator();
PauseOnFrame = null;
@ -3321,7 +3351,6 @@ namespace BizHawk.Client.EmuHawk
UpdateCoreStatusBarButton();
ClearHolds();
PauseOnFrame = null;
_forceTurbo = false;
ToolHelpers.UpdateCheatRelatedTools(null, null);
}
}

View File

@ -13,6 +13,8 @@ namespace BizHawk.Client.EmuHawk
{
public partial class PlaybackBox : UserControl
{
private bool _programmaticallyChangingSeekBox = false;
public TAStudio Tastudio { get; set; }
public bool TurboSeek
@ -31,7 +33,9 @@ namespace BizHawk.Client.EmuHawk
public PlaybackBox()
{
InitializeComponent();
_programmaticallyChangingSeekBox = true;
TurboSeekCheckbox.Checked = Global.Config.TurboSeek;
_programmaticallyChangingSeekBox = false;
}
private void PreviousMarkerButton_Click(object sender, EventArgs e)
@ -61,7 +65,10 @@ namespace BizHawk.Client.EmuHawk
private void TurboSeekCheckbox_CheckedChanged(object sender, EventArgs e)
{
Global.Config.TurboSeek ^= true;
if (!_programmaticallyChangingSeekBox)
{
Global.Config.TurboSeek ^= true;
}
}
}
}

View File

@ -357,7 +357,6 @@ namespace BizHawk.Client.EmuHawk
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(_tas[_tas.LastEmulatedFrame].State.ToArray())));
GlobalWin.MainForm.UnpauseEmulator();
GlobalWin.MainForm.PauseOnFrame = frame;
// TODO: if turbo seek, ramp up the speed
}
}
}
@ -368,8 +367,9 @@ namespace BizHawk.Client.EmuHawk
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(_tas[_tas.LastEmulatedFrame].State.ToArray())));
GlobalWin.MainForm.UnpauseEmulator();
GlobalWin.MainForm.PauseOnFrame = frame;
// TODO: if turbo seek, ramp up the speed
}
RefreshDialog();
}
#region Playback Controls