From 8310e5420c7ede08f647b4c99893430766e5f3e8 Mon Sep 17 00:00:00 2001
From: feos <feykomylce@gmail.com>
Date: Sun, 19 Jan 2025 15:43:22 +0300
Subject: [PATCH] Revert "fix wrong pause in AutoAdjustInput()" This reverts
 commit b2f3bb3cbaedff8fee0a468e0bb6d1439fb3d40a.

Revert "fix removing everything"
This reverts commit a0da874431ad27103d91cba4b056d42c9419d6c1.

YEP. this "feature" is COMPLETELY, ABSOLUTELY, UNIVERSALLY fucked. sure #4184 can be "fixed" by flipping some bools, like setting MainForm.HoldFrameAdvance back to false in TasView_MouseWheel. but then there's still the problem of removing actual input if farther lag picture changed after initial removal, and I'm not going to debug that. taseditor's ONLY bug was related to erroneous detection of lag change that we were never able to consistently reproduce or figure out, and it's completely impossible to replicate identical behavior in tastudio due to crazy overhead. but even SIMULATING that behavior would involve touching that minefield of bools that control everything in insane ways. given zero requests for this feature during tastudio's decade of existence, I'm considering it too useless for all the chaos it introduces.

so instead I'm closing #4184 by disabling the "feature" that caused it
---
 src/BizHawk.Client.EmuHawk/MainForm.cs        | 11 +---
 .../tools/TAStudio/TAStudio.Designer.cs       | 57 ++++++++-----------
 .../tools/TAStudio/TAStudio.IToolForm.cs      |  2 +-
 .../tools/TAStudio/TAStudio.ListView.cs       |  3 -
 .../tools/TAStudio/TAStudio.MenuItems.cs      |  4 --
 .../tools/TAStudio/TAStudio.cs                | 13 +----
 6 files changed, 30 insertions(+), 60 deletions(-)

diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs
index f9249cb0a1..db9eebe215 100644
--- a/src/BizHawk.Client.EmuHawk/MainForm.cs
+++ b/src/BizHawk.Client.EmuHawk/MainForm.cs
@@ -3116,15 +3116,8 @@ namespace BizHawk.Client.EmuHawk
 					if (PauseOnFrame.Value == Emulator.Frame)
 					{
 						PauseEmulator();
-						if (Tools.IsLoaded<TAStudio>())
-						{
-							Tools.TAStudio.StopSeeking();
-							HoldFrameAdvance = false;
-						}
-						else
-						{
-							PauseOnFrame = null;
-						}
+						if (Tools.IsLoaded<TAStudio>()) Tools.TAStudio.StopSeeking();
+						else PauseOnFrame = null;
 					}
 					else if (Tools.IsLoaded<TAStudio>()
 						&& Tools.TAStudio.LastPositionFrame == Emulator.Frame
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs
index 76f6c1752d..cd5f4551f0 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs
@@ -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();
@@ -89,7 +89,6 @@ namespace BizHawk.Client.EmuHawk
 			this.AutosaveAsBackupFileMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
 			this.BackupPerFileSaveMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
 			this.toolStripSeparator9 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
-			this.AutoadjustInputMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
 			this.applyPatternToPaintedInputToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
 			this.onlyOnAutoFireColumnsToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
 			this.SingleClickAxisEditMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
@@ -176,11 +175,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();
@@ -431,15 +430,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
 			// 
@@ -451,12 +456,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";
@@ -483,7 +482,6 @@ namespace BizHawk.Client.EmuHawk
             this.autosaveToolStripMenuItem,
             this.BackupPerFileSaveMenuItem,
             this.toolStripSeparator9,
-            this.AutoadjustInputMenuItem,
             this.applyPatternToPaintedInputToolStripMenuItem,
             this.onlyOnAutoFireColumnsToolStripMenuItem,
             this.SingleClickAxisEditMenuItem,
@@ -539,12 +537,6 @@ namespace BizHawk.Client.EmuHawk
 			this.BackupPerFileSaveMenuItem.Text = "Backup Per File Save";
 			this.BackupPerFileSaveMenuItem.Click += new System.EventHandler(this.BackupPerFileSaveMenuItem_Click);
 			// 
-			// AutoadjustInputMenuItem
-			// 
-			this.AutoadjustInputMenuItem.CheckOnClick = true;
-			this.AutoadjustInputMenuItem.Text = "Auto-adjust Input according to Lag";
-			this.AutoadjustInputMenuItem.Click += new System.EventHandler(this.AutoadjustInputMenuItem_Click);
-			// 
 			// applyPatternToPaintedInputToolStripMenuItem
 			// 
 			this.applyPatternToPaintedInputToolStripMenuItem.CheckOnClick = true;
@@ -925,7 +917,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
@@ -936,7 +928,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
@@ -995,7 +987,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
@@ -1062,15 +1054,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
 			// 
@@ -1082,11 +1079,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";
@@ -1242,7 +1234,6 @@ namespace BizHawk.Client.EmuHawk
 		private BizHawk.WinForms.Controls.ToolStripSeparatorEx toolStripSeparator10;
 		private BizHawk.WinForms.Controls.ToolStripMenuItemEx aboutToolStripMenuItem;
 		private BizHawk.WinForms.Controls.ToolStripMenuItemEx SetMaxUndoLevelsMenuItem;
-		private BizHawk.WinForms.Controls.ToolStripMenuItemEx AutoadjustInputMenuItem;
 		private BizHawk.WinForms.Controls.ToolStripMenuItemEx UseInputKeysItem;
 		private BizHawk.WinForms.Controls.ToolStripMenuItemEx BindMarkersToInputMenuItem;
 		private BizHawk.WinForms.Controls.ToolStripMenuItemEx OldControlSchemeForBranchesMenuItem;
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
index 7b1f8f124b..9083965268 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs
@@ -72,7 +72,7 @@ namespace BizHawk.Client.EmuHawk
 			var refreshNeeded = false;
 			if (Settings.AutoadjustInput)
 			{
-				refreshNeeded = AutoAdjustInput();
+				//refreshNeeded = AutoAdjustInput();
 			}
 
 			CurrentTasMovie.TasSession.UpdateValues(Emulator.Frame, CurrentTasMovie.Branches.Current);
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs
index ff490d1e0c..6e05848efc 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs
@@ -901,9 +901,6 @@ namespace BizHawk.Client.EmuHawk
 				}
 				else
 				{
-					// needed for AutoAdjustInput() when it removes was-lag frames
-					MainForm.HoldFrameAdvance = true;
-
 					GoToFrame(Emulator.Frame - notch);
 				}
 			}
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs
index 7b43f1e89e..d0acfecc9a 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs
@@ -768,7 +768,6 @@ 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)
@@ -803,9 +802,6 @@ 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
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs
index 33c8fc717f..64fbff6637 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs
@@ -1110,29 +1110,22 @@ namespace BizHawk.Client.EmuHawk
 						{
 							framesToRemove.Add(frame);
 						}
-						else
-						{
-							break;
-						}
 					}
 
 					// 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.RemoveFrames(framesToRemove);
 					foreach (int f in framesToRemove)
 					{
 						CurrentTasMovie.LagLog.RemoveHistoryAt(f + 1); // Removes from WasLag
 					}
-					CurrentTasMovie.ChangeLog.IsRecording = wasRecording;
 
-					CurrentTasMovie.LastPositionStable = true;
+					CurrentTasMovie.ChangeLog.IsRecording = wasRecording;
 					GoToLastEmulatedFrameIfNecessary(Emulator.Frame - 1);
-					if (!MainForm.HoldFrameAdvance)
-					{
-						MainForm.PauseOnFrame = LastPositionFrame;
-					}
+					DoAutoRestore();
 					return true;
 				}