From bccc118091b8d6d7f0f30a9639fe3e258fb01c62 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Thu, 26 Sep 2024 20:13:54 +0200 Subject: [PATCH] Cleanup some more TAStudio function calls in an ongoing effort to try and make the logic understandable This should also restore default columns now when an existing tasmovie is currently loaded with column changes and an existing bk2 is opened (which is then converted to a tasproj) (possible after 2ad7fc095c5b220db77cc65b9152baa575d828c9) --- .../CustomControls/InputRoll/InputRoll.cs | 1 + .../tools/TAStudio/TAStudio.MenuItems.cs | 4 +-- .../tools/TAStudio/TAStudio.cs | 28 +++++-------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index c1da181561..e524c151e8 100644 --- a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -666,6 +666,7 @@ namespace BizHawk.Client.EmuHawk { _columns = rollSettings.Columns; _columns.ChangedCallback = ColumnChangedCallback; + _columns.ColumnsChanged(); HorizontalOrientation = rollSettings.HorizontalOrientation; LagFramesToHide = rollSettings.LagFramesToHide; HideWasLagFrames = rollSettings.HideWasLagFrames; diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 99780673a8..027db96103 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -1282,16 +1282,14 @@ namespace BizHawk.Client.EmuHawk ColumnsSubMenu.DropDownItems.Add(item); } } - - TasView.AllColumns.ColumnsChanged(); } // ReSharper disable once UnusedMember.Local [RestoreDefaults] private void RestoreDefaults() { - TasView.AllColumns.Clear(); SetUpColumns(); + SetUpToolStripColumns(); TasView.Refresh(); CurrentTasMovie.FlagChanges(); diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 1cebee4957..216cc50af9 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -217,8 +217,6 @@ namespace BizHawk.Client.EmuHawk MainForm.PauseOnFrame = null; MainForm.PauseEmulator(); - SetupBoolPatterns(); - // Nag if inaccurate core, but not if auto-loading or movie is already loaded if (!CanAutoload && MovieSession.Movie.NotActive()) { @@ -249,7 +247,6 @@ namespace BizHawk.Client.EmuHawk ConvertCurrentMovieToTasproj(); _ = StartNewMovieWrapper(CurrentTasMovie, isNew: false); - SetUpColumns(); } // Start Scenario 2: A tasproj is already active @@ -258,7 +255,6 @@ namespace BizHawk.Client.EmuHawk bool result = LoadMovie(CurrentTasMovie, gotoFrame: Emulator.Frame); if (!result) { - TasView.AllColumns.Clear(); StartNewTasMovie(); } } @@ -400,7 +396,6 @@ namespace BizHawk.Client.EmuHawk } TasView.AllColumns.ColumnsChanged(); - SetupBoolPatterns(); } private void SetupBoolPatterns() @@ -436,8 +431,6 @@ namespace BizHawk.Client.EmuHawk AxisPatterns[AxisPatterns.Length - 2] = new([ 1 ]); AxisPatterns[AxisPatterns.Length - 1] = new(1, Config.AutofireOn, 0, Config.AutofireOff); - - SetUpToolStripColumns(); } /// for Lua @@ -519,18 +512,6 @@ namespace BizHawk.Client.EmuHawk GoToFrame(CurrentTasMovie.TasSession.CurrentFrame); } - // If we are loading an existing non-default movie, we will already have columns generated - // Only set up columns if needed - if (!TasView.AllColumns.Any()) - { - SetUpColumns(); - } - UpdateAutoFire(); - - SetUpToolStripColumns(); - - BookMarkControl.UpdateTextColumnWidth(); - MarkerControl.UpdateTextColumnWidth(); // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); @@ -559,9 +540,7 @@ namespace BizHawk.Client.EmuHawk TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); - SetUpColumns(); RefreshDialog(); - TasView.Refresh(); } private bool StartNewMovieWrapper(ITasMovie movie, bool isNew) @@ -588,6 +567,13 @@ namespace BizHawk.Client.EmuHawk { TasView.LoadSettingsSerialized(CurrentTasMovie.InputRollSettings); } + else + { + SetUpColumns(); + } + SetUpToolStripColumns(); + SetupBoolPatterns(); + UpdateAutoFire(); } _initializing = false;