Merge branch 'master' of https://github.com/TASVideos/bizhawk into Release

This commit is contained in:
hegyak 2015-07-15 16:31:15 -07:00
commit 19ecbd844d
6 changed files with 85 additions and 54 deletions

View File

@ -155,5 +155,14 @@ namespace BizHawk.Client.Common
return null;
}
public int LastValidFrame
{
get
{
if (LagLog.Count == 0)
return 0;
return LagLog.Count - 1;
}
}
}
}

View File

@ -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,11 +245,7 @@ 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;
@ -253,7 +254,6 @@ namespace BizHawk.Client.Common
StateManager.Capture();
}
}
}
public void ClearLagLog()
{

View File

@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
string[] coresToHide = { "PSX", "INTV", "C64" };
string[] coresToHide = { "INTV", "C64" };
foreach (var core in coresToHide)
{

View File

@ -42,7 +42,24 @@ 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;
}
GoToLastEmulatedFrameIfNecessary(CurrentTasMovie.LastValidFrame);
GlobalWin.MainForm.PauseOnFrame = _autoRestoreFrame;
GlobalWin.MainForm.PauseEmulator();
}
}
private System.Timers.Timer _mouseWheelTimer;
@ -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,12 +502,25 @@ 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
{
if (e.Delta < 0)
GoToNextFrame();
else
GoToPreviousFrame();
}
}
@ -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,8 +673,7 @@ namespace BizHawk.Client.EmuHawk
_rightClickFrame = frame;
}
if (frame < _triggerAutoRestoreFromFrame)
_triggerAutoRestoreFromFrame = frame;
JumpToGreenzone();
}
}
@ -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();
}
}
}
@ -688,8 +712,7 @@ namespace BizHawk.Client.EmuHawk
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;
JumpToGreenzone();
}
}
}
@ -847,7 +870,7 @@ namespace BizHawk.Client.EmuHawk
if (value != prev) // Auto-restore
{
_triggerAutoRestore = true;
_triggerAutoRestoreFromFrame = _floatEditRow;
JumpToGreenzone();
DoTriggeredAutoRestoreIfNeeded();
}
}

View File

@ -21,6 +21,7 @@ namespace BizHawk.Client.EmuHawk
GoToFrame(frame);
}
if (!_autoRestoreFrame.HasValue || _autoRestoreFrame.Value < restoreFrame)
_autoRestoreFrame = restoreFrame;
}
}

View File

@ -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;
}
}