From 5fd3575c0f928c07d53b3903647fb4bae2d061a1 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Sat, 20 Jul 2024 07:56:36 +0200 Subject: [PATCH] Improve tastudio refresh behavior in tastudiolualibrary should resolve #3969. Let's hope this doesn't break anything. There still seems to be some overhead, but I can't profile this so I can't say whether it's from submitclearframes or applyinputchanges. --- .../tools/Lua/Libraries/TAStudioLuaLibrary.cs | 4 ++-- .../tools/TAStudio/TAStudio.cs | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs index d03022007b..f2bb6d35f2 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; @@ -327,6 +327,7 @@ namespace BizHawk.Client.EmuHawk Tastudio.CurrentTasMovie.SetAxisState(_changeList[i].Frame, _changeList[i].Button, _changeList[i].ValueAxis); break; } + Tastudio.RefreshForInputChange(_changeList[i].Frame); break; case LuaChangeTypes.InsertFrames: Tastudio.InsertNumFrames(_changeList[i].Frame, _changeList[i].Number); @@ -340,7 +341,6 @@ namespace BizHawk.Client.EmuHawk } } _changeList.Clear(); - Tastudio.RefreshDialog(); Tastudio.JumpToGreenzone(); Tastudio.DoAutoRestore(); } diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index b2963242dd..d6b98e7766 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -886,6 +886,14 @@ namespace BizHawk.Client.EmuHawk } } + public void RefreshForInputChange(int firstChangedFrame) + { + if (TasView.IsPartiallyVisible(firstChangedFrame) || firstChangedFrame < TasView.FirstVisibleRow) + { + RefreshDialog(); + } + } + private void SetTasViewRowCount() { TasView.RowCount = CurrentTasMovie.InputLogLength + 1; @@ -1061,7 +1069,7 @@ namespace BizHawk.Client.EmuHawk } else { - RefreshDialog(); + RefreshForInputChange(insertionFrame); } } } @@ -1082,7 +1090,7 @@ namespace BizHawk.Client.EmuHawk } else { - RefreshDialog(); + RefreshForInputChange(beginningFrame); } } } @@ -1105,7 +1113,7 @@ namespace BizHawk.Client.EmuHawk } else { - RefreshDialog(); + RefreshForInputChange(beginningFrame); } } }