Merge branch 'master' of https://github.com/TASVideos/bizhawk into Release
This commit is contained in:
commit
19ecbd844d
|
@ -155,5 +155,14 @@ namespace BizHawk.Client.Common
|
|||
|
||||
return null;
|
||||
}
|
||||
public int LastValidFrame
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LagLog.Count == 0)
|
||||
return 0;
|
||||
return LagLog.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,11 @@ namespace BizHawk.Client.Common
|
|||
_progressReportWorker = newWorker;
|
||||
}
|
||||
|
||||
public int LastValidFrame
|
||||
{
|
||||
get { return LagLog.LastValidFrame; }
|
||||
}
|
||||
|
||||
public TasMovie(string path, bool startsFromSavestate = false, BackgroundWorker progressReportWorker = null)
|
||||
: base(path)
|
||||
{
|
||||
|
@ -240,19 +245,14 @@ namespace BizHawk.Client.Common
|
|||
return base.GetInputState(frame);
|
||||
}
|
||||
|
||||
public bool SupressGreenzoneing { get; set; }
|
||||
|
||||
public void GreenzoneCurrentFrame()
|
||||
{
|
||||
if (!SupressGreenzoneing)
|
||||
{
|
||||
LagLog[Global.Emulator.Frame] = Global.Emulator.AsInputPollable().IsLagFrame;
|
||||
|
||||
if (!StateManager.HasState(Global.Emulator.Frame))
|
||||
{
|
||||
StateManager.Capture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearLagLog()
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
string[] coresToHide = { "PSX", "INTV", "C64" };
|
||||
string[] coresToHide = { "INTV", "C64" };
|
||||
|
||||
foreach (var core in coresToHide)
|
||||
{
|
||||
|
|
|
@ -42,9 +42,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private bool _triggerAutoRestore; // If true, autorestore will be called on mouse up
|
||||
private int? _triggerAutoRestoreFromFrame; // If set and _triggerAutoRestore is true, will call GoToFrameIfNecessary() with this value
|
||||
private int? _autoRestoreFrame; // The frame auto-restore will restore to, if set
|
||||
private bool? _autoRestorePaused = null;
|
||||
private void JumpToGreenzone()
|
||||
{
|
||||
if (Global.Emulator.Frame > CurrentTasMovie.LastValidFrame)
|
||||
{
|
||||
if (_autoRestorePaused == null)
|
||||
{
|
||||
_autoRestorePaused = GlobalWin.MainForm.EmulatorPaused;
|
||||
if (GlobalWin.MainForm.IsSeeking) // If seeking, do not shorten seek.
|
||||
_autoRestoreFrame = GlobalWin.MainForm.PauseOnFrame;
|
||||
}
|
||||
|
||||
private System.Timers.Timer _mouseWheelTimer;
|
||||
GoToLastEmulatedFrameIfNecessary(CurrentTasMovie.LastValidFrame);
|
||||
GlobalWin.MainForm.PauseOnFrame = _autoRestoreFrame;
|
||||
GlobalWin.MainForm.PauseEmulator();
|
||||
}
|
||||
}
|
||||
|
||||
private System.Timers.Timer _mouseWheelTimer;
|
||||
|
||||
// public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why?
|
||||
public static Color CurrentFrame_InputLog = Color.FromArgb(0xB5E7F7);
|
||||
|
@ -226,8 +243,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
CurrentTasMovie.ToggleBoolState(index, columnName);
|
||||
_triggerAutoRestore = true;
|
||||
_triggerAutoRestoreFromFrame = TasView.SelectedRows.Min();
|
||||
}
|
||||
JumpToGreenzone();
|
||||
|
||||
RefreshDialog();
|
||||
}
|
||||
|
@ -324,7 +341,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_floatEditYPos = e.Y;
|
||||
_floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName);
|
||||
_triggerAutoRestore = true;
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
JumpToGreenzone();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -341,15 +358,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else // User changed input
|
||||
{
|
||||
CurrentTasMovie.SupressGreenzoneing = true; // This is necessary because we will invalidate, but we won't navigate until mouse up, during that time the user may have emulated frames and we don't want to caputre states for those
|
||||
|
||||
if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName))
|
||||
{
|
||||
CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool");
|
||||
|
||||
CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
|
||||
_triggerAutoRestore = true;
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
JumpToGreenzone();
|
||||
RefreshDialog();
|
||||
|
||||
_startBoolDrawColumn = buttonName;
|
||||
|
@ -373,7 +388,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
RefreshDialog();
|
||||
}
|
||||
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
JumpToGreenzone();
|
||||
|
||||
_floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName);
|
||||
if (applyPatternToPaintedInputToolStripMenuItem.Checked &&
|
||||
|
@ -405,7 +420,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_floatTypedValue = "";
|
||||
_floatEditYPos = e.Y;
|
||||
_triggerAutoRestore = true;
|
||||
_triggerAutoRestoreFromFrame = frame;
|
||||
JumpToGreenzone();
|
||||
}
|
||||
RefreshDialog();
|
||||
}
|
||||
|
@ -434,7 +449,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
_rightClickLastFrame = -1;
|
||||
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
JumpToGreenzone();
|
||||
// TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here.
|
||||
CurrentTasMovie.ChangeLog.BeginNewBatch("Right-Click Edit");
|
||||
}
|
||||
|
@ -449,7 +464,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
CurrentTasMovie.SupressGreenzoneing = false;
|
||||
_startCursorDrag = false;
|
||||
_startFrameDrag = false;
|
||||
_startBoolDrawColumn = string.Empty;
|
||||
|
@ -488,21 +502,34 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (TasView.RightButtonHeld && TasView.CurrentCell.RowIndex.HasValue)
|
||||
{
|
||||
_supressContextMenu = true;
|
||||
if (e.Delta < 0)
|
||||
if (GlobalWin.MainForm.IsSeeking)
|
||||
{
|
||||
GoToNextFrame();
|
||||
if (e.Delta < 0)
|
||||
GlobalWin.MainForm.PauseOnFrame++;
|
||||
else
|
||||
{
|
||||
GlobalWin.MainForm.PauseOnFrame--;
|
||||
if (Global.Emulator.Frame == GlobalWin.MainForm.PauseOnFrame)
|
||||
{
|
||||
GlobalWin.MainForm.PauseEmulator();
|
||||
GlobalWin.MainForm.PauseOnFrame = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GoToPreviousFrame();
|
||||
if (e.Delta < 0)
|
||||
GoToNextFrame();
|
||||
else
|
||||
GoToPreviousFrame();
|
||||
}
|
||||
}
|
||||
|
||||
if (_mouseWheelTimer.Enabled) // dunno if this is telling enough and nothing like bool _mouseWheelFast is needed, but we need to check on the first scroll event, and just decide by delta if it's fast enough to increase actual scrolling speed
|
||||
{
|
||||
_mouseWheelTimer.Stop();
|
||||
}
|
||||
_mouseWheelTimer.Start();
|
||||
if (_mouseWheelTimer.Enabled) // dunno if this is telling enough and nothing like bool _mouseWheelFast is needed, but we need to check on the first scroll event, and just decide by delta if it's fast enough to increase actual scrolling speed
|
||||
{
|
||||
_mouseWheelTimer.Stop();
|
||||
}
|
||||
_mouseWheelTimer.Start();
|
||||
}
|
||||
|
||||
private void TasView_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
|
@ -604,8 +631,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
for (int i = startVal; i <= endVal; i++)
|
||||
CurrentTasMovie.SetFrame(i, _rightClickInput[(_rightClickFrame - i) % _rightClickInput.Length]);
|
||||
if (startVal < _triggerAutoRestoreFromFrame)
|
||||
_triggerAutoRestoreFromFrame = startVal;
|
||||
JumpToGreenzone();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -647,9 +673,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
_rightClickFrame = frame;
|
||||
}
|
||||
|
||||
if (frame < _triggerAutoRestoreFromFrame)
|
||||
_triggerAutoRestoreFromFrame = frame;
|
||||
}
|
||||
JumpToGreenzone();
|
||||
}
|
||||
}
|
||||
|
||||
else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startBoolDrawColumn))
|
||||
|
@ -667,8 +692,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
setVal = BoolPatterns[controllerType.BoolButtons.IndexOf(_startBoolDrawColumn)].GetNextValue();
|
||||
}
|
||||
CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
|
||||
if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame)
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
JumpToGreenzone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -687,18 +711,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
else
|
||||
setVal = FloatPatterns[controllerType.FloatControls.IndexOf(_startFloatDrawColumn)].GetNextValue();
|
||||
}
|
||||
CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
|
||||
if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame)
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
|
||||
JumpToGreenzone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.FollowCursor && mouseButtonHeld)
|
||||
{
|
||||
SetVisibleIndex(TasView.CurrentCell.RowIndex.Value); // todo: limit scrolling speed
|
||||
}
|
||||
RefreshTasView();
|
||||
if (Settings.FollowCursor && mouseButtonHeld)
|
||||
{
|
||||
SetVisibleIndex(TasView.CurrentCell.RowIndex.Value); // todo: limit scrolling speed
|
||||
}
|
||||
RefreshTasView();
|
||||
}
|
||||
|
||||
private void TasView_MouseMove(object sender, MouseEventArgs e)
|
||||
|
@ -847,7 +870,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (value != prev) // Auto-restore
|
||||
{
|
||||
_triggerAutoRestore = true;
|
||||
_triggerAutoRestoreFromFrame = _floatEditRow;
|
||||
JumpToGreenzone();
|
||||
DoTriggeredAutoRestoreIfNeeded();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
GoToFrame(frame);
|
||||
}
|
||||
|
||||
_autoRestoreFrame = restoreFrame;
|
||||
if (!_autoRestoreFrame.HasValue || _autoRestoreFrame.Value < restoreFrame)
|
||||
_autoRestoreFrame = restoreFrame;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private UndoHistoryForm undoForm;
|
||||
|
||||
private int? _autoRestoreFrame; // The frame auto-restore will restore to, if set
|
||||
|
||||
[ConfigPersist]
|
||||
public TAStudioSettings Settings { get; set; }
|
||||
|
||||
|
@ -530,6 +528,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.MainForm.UnpauseEmulator();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_autoRestorePaused.HasValue && !_autoRestorePaused.Value)
|
||||
GlobalWin.MainForm.UnpauseEmulator();
|
||||
_autoRestorePaused = null;
|
||||
GlobalWin.MainForm.PauseOnFrame = null; // Cancel seek to autorestore point
|
||||
}
|
||||
|
||||
|
||||
_autoRestoreFrame = null;
|
||||
}
|
||||
|
@ -655,18 +661,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (_triggerAutoRestore)
|
||||
{
|
||||
int? pauseOn = GlobalWin.MainForm.PauseOnFrame;
|
||||
GoToLastEmulatedFrameIfNecessary(_triggerAutoRestoreFromFrame.Value);
|
||||
|
||||
if (pauseOn.HasValue && _autoRestoreFrame.HasValue && _autoRestoreFrame < pauseOn)
|
||||
{ // If we are already seeking to a later frame don't shorten that journey here
|
||||
_autoRestoreFrame = pauseOn;
|
||||
}
|
||||
|
||||
DoAutoRestore();
|
||||
|
||||
_triggerAutoRestore = false;
|
||||
_triggerAutoRestoreFromFrame = null;
|
||||
_autoRestorePaused = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue