tastudio: finally make < > buttons operate identically to advance/rewind hotkeys

This commit is contained in:
feos 2016-08-28 18:42:59 +03:00
parent 670501163b
commit 2b0dc82d16
5 changed files with 34 additions and 47 deletions

View File

@ -607,7 +607,8 @@ namespace BizHawk.Client.EmuHawk
public LoadRomArgs CurrentlyOpenRomArgs; public LoadRomArgs CurrentlyOpenRomArgs;
public bool PauseAVI = false; public bool PauseAVI = false;
public bool PressFrameAdvance = false; public bool PressFrameAdvance = false;
public bool PressRewind = false; public bool HoldFrameAdvance = false; // necessary for tastudio > button
public bool PressRewind = false; // necessary for tastudio < button
public bool FastForward = false; public bool FastForward = false;
public bool TurboFastForward = false; public bool TurboFastForward = false;
public bool RestoreReadWriteOnStop = false; public bool RestoreReadWriteOnStop = false;
@ -2678,7 +2679,7 @@ namespace BizHawk.Client.EmuHawk
runFrame = true; runFrame = true;
} }
if (Global.ClientControls["Frame Advance"] || PressFrameAdvance) if (Global.ClientControls["Frame Advance"] || PressFrameAdvance || HoldFrameAdvance)
{ {
// handle the initial trigger of a frame advance // handle the initial trigger of a frame advance
if (_frameAdvanceTimestamp == 0) if (_frameAdvanceTimestamp == 0)
@ -2890,7 +2891,7 @@ namespace BizHawk.Client.EmuHawk
if (Global.ClientControls["Rewind"] || PressRewind) if (Global.ClientControls["Rewind"] || PressRewind)
{ {
UpdateToolsAfter(); UpdateToolsAfter();
PressRewind = false; //PressRewind = false;
} }
if (UpdateFrame) if (UpdateFrame)

View File

@ -127,6 +127,8 @@
this.FrameAdvanceButton.Text = ">"; this.FrameAdvanceButton.Text = ">";
this.FrameAdvanceButton.UseVisualStyleBackColor = true; this.FrameAdvanceButton.UseVisualStyleBackColor = true;
this.FrameAdvanceButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FrameAdvanceButton_MouseDown); this.FrameAdvanceButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FrameAdvanceButton_MouseDown);
this.FrameAdvanceButton.MouseLeave += new System.EventHandler(this.FrameAdvanceButton_MouseLeave);
this.FrameAdvanceButton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FrameAdvanceButton_MouseUp);
// //
// PauseButton // PauseButton
// //
@ -149,6 +151,8 @@
this.RewindButton.Text = "<"; this.RewindButton.Text = "<";
this.RewindButton.UseVisualStyleBackColor = true; this.RewindButton.UseVisualStyleBackColor = true;
this.RewindButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RewindButton_MouseDown); this.RewindButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RewindButton_MouseDown);
this.RewindButton.MouseLeave += new System.EventHandler(this.RewindButton_MouseLeave);
this.RewindButton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.RewindButton_MouseUp);
// //
// PreviousMarkerButton // PreviousMarkerButton
// //

View File

@ -115,53 +115,11 @@ namespace BizHawk.Client.EmuHawk
Tastudio.GoToPreviousMarker(); Tastudio.GoToPreviousMarker();
} }
private void RewindButton_Click(object sender, EventArgs e)
{
if (GlobalWin.MainForm.IsSeeking && !GlobalWin.MainForm.EmulatorPaused)
{
GlobalWin.MainForm.PauseOnFrame--;
// that's a weird condition here, but for whatever reason it works best
if (Global.Emulator.Frame >= GlobalWin.MainForm.PauseOnFrame)
{
GlobalWin.MainForm.PauseEmulator();
GlobalWin.MainForm.PauseOnFrame = null;
Tastudio.StopSeeking();
Tastudio.GoToPreviousFrame();
}
Tastudio.RefreshDialog();
}
else
{
Tastudio.GoToPreviousFrame();
}
}
private void PauseButton_Click(object sender, EventArgs e) private void PauseButton_Click(object sender, EventArgs e)
{ {
Tastudio.TogglePause(); Tastudio.TogglePause();
} }
private void FrameAdvanceButton_Click(object sender, EventArgs e)
{
if (GlobalWin.MainForm.IsSeeking && !GlobalWin.MainForm.EmulatorPaused)
{
GlobalWin.MainForm.PauseOnFrame++;
// that's a weird condition here, but for whatever reason it works best
if (Global.Emulator.Frame >= GlobalWin.MainForm.PauseOnFrame)
{
GlobalWin.MainForm.PauseEmulator();
GlobalWin.MainForm.PauseOnFrame = null;
Tastudio.StopSeeking();
Tastudio.GoToNextFrame();
}
Tastudio.RefreshDialog();
}
else
{
Tastudio.GoToNextFrame();
}
}
private void NextMarkerButton_Click(object sender, EventArgs e) private void NextMarkerButton_Click(object sender, EventArgs e)
{ {
Tastudio.GoToNextMarker(); Tastudio.GoToNextMarker();
@ -204,12 +162,34 @@ namespace BizHawk.Client.EmuHawk
private void RewindButton_MouseDown(object sender, MouseEventArgs e) private void RewindButton_MouseDown(object sender, MouseEventArgs e)
{ {
RewindButton_Click(sender, e); GlobalWin.MainForm.PressRewind = true;
}
private void RewindButton_MouseUp(object sender, MouseEventArgs e)
{
GlobalWin.MainForm.PressRewind = false;
}
private void RewindButton_MouseLeave(object sender, EventArgs e)
{
GlobalWin.MainForm.PressRewind = false;
} }
private void FrameAdvanceButton_MouseDown(object sender, MouseEventArgs e) private void FrameAdvanceButton_MouseDown(object sender, MouseEventArgs e)
{ {
FrameAdvanceButton_Click(sender, e); GlobalWin.MainForm.HoldFrameAdvance = true;
} }
private void FrameAdvanceButton_MouseLeave(object sender, EventArgs e)
{
GlobalWin.MainForm.HoldFrameAdvance = false;
}
private void FrameAdvanceButton_MouseUp(object sender, MouseEventArgs e)
{
GlobalWin.MainForm.HoldFrameAdvance = false;
}
} }
} }

View File

@ -78,6 +78,7 @@ namespace BizHawk.Client.EmuHawk
public bool Rewind() public bool Rewind()
{ {
// copypasted from TasView_MouseWheel(), just without notch logic
if (GlobalWin.MainForm.IsSeeking) if (GlobalWin.MainForm.IsSeeking)
{ {
GlobalWin.MainForm.PauseOnFrame--; GlobalWin.MainForm.PauseOnFrame--;

View File

@ -670,6 +670,7 @@ namespace BizHawk.Client.EmuHawk
if (notch > 1) if (notch > 1)
notch *= 2; notch *= 2;
// warning: tastudio rewind hotket/button logic is copypasted from here!
if (GlobalWin.MainForm.IsSeeking && !GlobalWin.MainForm.EmulatorPaused) if (GlobalWin.MainForm.IsSeeking && !GlobalWin.MainForm.EmulatorPaused)
{ {
GlobalWin.MainForm.PauseOnFrame -= notch; GlobalWin.MainForm.PauseOnFrame -= notch;