tastudio: AutoadjustInput

remove all consecutive was-lag frames in batch like taseditor does. current frame has no lag so they will all have to go anyway

still need to fix wrong pausing
This commit is contained in:
feos 2024-12-04 17:47:55 +03:00
parent cf464d4481
commit 1da3e4d773
4 changed files with 1033 additions and 1011 deletions

View File

@ -69,11 +69,11 @@ namespace BizHawk.Client.EmuHawk
this.CutMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.toolStripSeparator8 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
this.ClearFramesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertFrameMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.DeleteFramesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertFrameMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertNumFramesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.CloneFramesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.CloneFramesXTimesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertNumFramesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.toolStripSeparator6 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
this.TruncateMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.ClearGreenzoneMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
@ -81,8 +81,6 @@ namespace BizHawk.Client.EmuHawk
this.StateHistoryIntegrityCheckMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.ConfigSubMenu = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.SetMaxUndoLevelsMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.SetBranchCellHoverIntervalMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.SetSeekingCutoffIntervalMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.CopyIncludesFrameNoMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.toolStripSeparator26 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
this.autosaveToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
@ -153,6 +151,8 @@ namespace BizHawk.Client.EmuHawk
this.aboutToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.toolStripSeparator10 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
this.EnableTooltipsMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.SetBranchCellHoverIntervalMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.SetSeekingCutoffIntervalMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.TasView = new BizHawk.Client.EmuHawk.InputRoll();
this.TasStatusStrip = new BizHawk.WinForms.Controls.StatusStripEx();
this.MessageStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
@ -178,11 +178,11 @@ namespace BizHawk.Client.EmuHawk
this.cutToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.separateToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
this.ClearContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertFrameContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.DeleteFramesContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertFrameContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertNumFramesContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.CloneContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.CloneXTimesContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.InsertNumFramesContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.toolStripSeparator18 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
this.TruncateContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.BranchContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
@ -433,15 +433,21 @@ namespace BizHawk.Client.EmuHawk
this.ClearFramesMenuItem.Text = "Clear";
this.ClearFramesMenuItem.Click += new System.EventHandler(this.ClearFramesMenuItem_Click);
//
// DeleteFramesMenuItem
//
this.DeleteFramesMenuItem.Text = "&Delete";
this.DeleteFramesMenuItem.Click += new System.EventHandler(this.DeleteFramesMenuItem_Click);
//
// InsertFrameMenuItem
//
this.InsertFrameMenuItem.Text = "&Insert";
this.InsertFrameMenuItem.Click += new System.EventHandler(this.InsertFrameMenuItem_Click);
//
// DeleteFramesMenuItem
// InsertNumFramesMenuItem
//
this.DeleteFramesMenuItem.Text = "&Delete";
this.DeleteFramesMenuItem.Click += new System.EventHandler(this.DeleteFramesMenuItem_Click);
this.InsertNumFramesMenuItem.ShortcutKeyDisplayString = "";
this.InsertNumFramesMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);
//
// CloneFramesMenuItem
//
@ -453,12 +459,6 @@ namespace BizHawk.Client.EmuHawk
this.CloneFramesXTimesMenuItem.Text = "Clone # Times";
this.CloneFramesXTimesMenuItem.Click += new System.EventHandler(this.CloneFramesXTimesMenuItem_Click);
//
// InsertNumFramesMenuItem
//
this.InsertNumFramesMenuItem.ShortcutKeyDisplayString = "";
this.InsertNumFramesMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);
//
// TruncateMenuItem
//
this.TruncateMenuItem.Text = "&Truncate Movie";
@ -510,7 +510,7 @@ namespace BizHawk.Client.EmuHawk
//
// CopyIncludesFrameNoMenuItem
//
this.CopyIncludesFrameNoMenuItem.Text = "Include Frame No. When Copying Row(s)";
this.CopyIncludesFrameNoMenuItem.Text = "Include Frame # When Copying Input";
this.CopyIncludesFrameNoMenuItem.Click += new System.EventHandler(this.CopyIncludesFrameNoMenuItem_Click);
//
// autosaveToolStripMenuItem
@ -545,6 +545,7 @@ namespace BizHawk.Client.EmuHawk
//
this.AutoadjustInputMenuItem.CheckOnClick = true;
this.AutoadjustInputMenuItem.Text = "Auto-adjust Input according to Lag";
this.AutoadjustInputMenuItem.Click += new System.EventHandler(this.AutoadjustInputMenuItem_Click);
//
// applyPatternToPaintedInputToolStripMenuItem
//
@ -926,7 +927,7 @@ namespace BizHawk.Client.EmuHawk
// MessageStatusLabel
//
this.MessageStatusLabel.Name = "MessageStatusLabel";
this.MessageStatusLabel.Size = new System.Drawing.Size(103, 17);
this.MessageStatusLabel.Size = new System.Drawing.Size(110, 17);
this.MessageStatusLabel.Text = "TAStudio engaged";
//
// ProgressBar
@ -937,7 +938,7 @@ namespace BizHawk.Client.EmuHawk
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
this.toolStripStatusLabel2.Size = new System.Drawing.Size(269, 17);
this.toolStripStatusLabel2.Size = new System.Drawing.Size(262, 17);
this.toolStripStatusLabel2.Spring = true;
//
// SplicerStatusLabel
@ -996,7 +997,7 @@ namespace BizHawk.Client.EmuHawk
this.StartNewProjectFromNowMenuItem,
this.StartANewProjectFromSaveRamMenuItem});
this.RightClickMenu.Name = "RightClickMenu";
this.RightClickMenu.Size = new System.Drawing.Size(253, 524);
this.RightClickMenu.Size = new System.Drawing.Size(275, 502);
this.RightClickMenu.Opened += new System.EventHandler(this.RightClickMenu_Opened);
//
// SetMarkersContextMenuItem
@ -1063,15 +1064,20 @@ namespace BizHawk.Client.EmuHawk
this.ClearContextMenuItem.Text = "Clear";
this.ClearContextMenuItem.Click += new System.EventHandler(this.ClearFramesMenuItem_Click);
//
// DeleteFramesContextMenuItem
//
this.DeleteFramesContextMenuItem.Text = "Delete";
this.DeleteFramesContextMenuItem.Click += new System.EventHandler(this.DeleteFramesMenuItem_Click);
//
// InsertFrameContextMenuItem
//
this.InsertFrameContextMenuItem.Text = "Insert";
this.InsertFrameContextMenuItem.Click += new System.EventHandler(this.InsertFrameMenuItem_Click);
//
// DeleteFramesContextMenuItem
// InsertNumFramesContextMenuItem
//
this.DeleteFramesContextMenuItem.Text = "Delete";
this.DeleteFramesContextMenuItem.Click += new System.EventHandler(this.DeleteFramesMenuItem_Click);
this.InsertNumFramesContextMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesContextMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);
//
// CloneContextMenuItem
//
@ -1083,11 +1089,6 @@ namespace BizHawk.Client.EmuHawk
this.CloneXTimesContextMenuItem.Text = "Clone # Times";
this.CloneXTimesContextMenuItem.Click += new System.EventHandler(this.CloneFramesXTimesMenuItem_Click);
//
// InsertNumFramesContextMenuItem
//
this.InsertNumFramesContextMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesContextMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);
//
// TruncateContextMenuItem
//
this.TruncateContextMenuItem.Text = "Truncate Movie";

View File

@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk
}
var refreshNeeded = false;
if (AutoadjustInputMenuItem.Checked)
if (Settings.AutoadjustInput)
{
refreshNeeded = AutoAdjustInput();
}

View File

@ -768,6 +768,7 @@ namespace BizHawk.Client.EmuHawk
LoadBranchOnDoubleclickMenuItem.Checked = Settings.LoadBranchOnDoubleClick;
BindMarkersToInputMenuItem.Checked = CurrentTasMovie.BindMarkersToInput;
CopyIncludesFrameNoMenuItem.Checked = Settings.CopyIncludesFrameNo;
AutoadjustInputMenuItem.Checked = Settings.AutoadjustInput;
}
private void SetMaxUndoLevelsMenuItem_Click(object sender, EventArgs e)
@ -802,6 +803,9 @@ namespace BizHawk.Client.EmuHawk
private void CopyIncludesFrameNoMenuItem_Click(object sender, EventArgs e)
=> Settings.CopyIncludesFrameNo = !Settings.CopyIncludesFrameNo;
private void AutoadjustInputMenuItem_Click(object sender, EventArgs e)
=> Settings.AutoadjustInput = !Settings.AutoadjustInput;
private void SetAutosaveIntervalMenuItem_Click(object sender, EventArgs e)
{
using var prompt = new InputPrompt

View File

@ -78,6 +78,7 @@ namespace BizHawk.Client.EmuHawk
OldControlSchemeForBranches = false;
LoadBranchOnDoubleClick = true;
CopyIncludesFrameNo = false;
AutoadjustInput = false;
// default to taseditor fashion
DenoteStatesWithIcons = false;
@ -110,8 +111,9 @@ namespace BizHawk.Client.EmuHawk
public int BranchMarkerSplitDistance { get; set; }
public bool BindMarkersToInput { get; set; }
public bool CopyIncludesFrameNo { get; set; }
public bool AutoadjustInput { get; set; }
public TAStudioPalette Palette { get; set; }
public int MaxUndoSteps { get; set; } = 100;
public int MaxUndoSteps { get; set; } = 1000;
}
public TAStudio()
@ -1099,16 +1101,31 @@ namespace BizHawk.Client.EmuHawk
{
if (lagLog.WasLagged.Value && !isLag)
{
// remove all consecutive was-lag frames in batch like taseditor
// current frame has no lag so they will all have to go anyway
var framesToRemove = new List<int>{ Emulator.Frame - 1 };
for (int frame = Emulator.Frame; CurrentTasMovie[frame].WasLagged.HasValue; frame++)
{
if (CurrentTasMovie[frame].WasLagged.Value)
{
framesToRemove.Add(frame);
}
}
// Deleting this frame requires rewinding a frame.
CurrentTasMovie.ChangeLog.AddInputBind(Emulator.Frame - 1, true, $"Bind Input; Delete {Emulator.Frame - 1}");
bool wasRecording = CurrentTasMovie.ChangeLog.IsRecording;
CurrentTasMovie.ChangeLog.IsRecording = false;
CurrentTasMovie.RemoveFrame(Emulator.Frame - 1);
CurrentTasMovie.LagLog.RemoveHistoryAt(Emulator.Frame); // Removes from WasLag
CurrentTasMovie.RemoveFrames(framesToRemove);
foreach (int f in framesToRemove)
{
CurrentTasMovie.LagLog.RemoveHistoryAt(f + 1); // Removes from WasLag
}
CurrentTasMovie.ChangeLog.IsRecording = wasRecording;
GoToFrame(Emulator.Frame - 1);
GoToLastEmulatedFrameIfNecessary(Emulator.Frame - 1);
DoAutoRestore();
return true;
}