diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index ba7477c060..97776b49e8 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -452,6 +452,11 @@ namespace BizHawk.Client.EmuHawk } } + public bool IsVisible(int index) + { + return (index >= FirstVisibleRow) && (index <= LastVisibleRow); + } + /// /// Gets the number of rows currently visible including partially visible rows. /// @@ -465,12 +470,12 @@ namespace BizHawk.Client.EmuHawk { var width = DrawWidth - (NeedsVScrollbar ? VBar.Width : 0); - return (int)Math.Floor((decimal)(width - ColumnWidth) / CellWidth); + return (int)((width - ColumnWidth) / CellWidth); } var height = DrawHeight - (NeedsHScrollbar ? HBar.Height : 0); - return (int)((decimal)height / CellHeight); + return (int)height / CellHeight; } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs index 15aaee4876..c578db81b0 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs @@ -5,6 +5,8 @@ namespace BizHawk.Client.EmuHawk { public partial class TAStudio : IToolForm { + public bool UpdateBefore { get { return false; } } + public void UpdateValues() { if (!IsHandleCreated || IsDisposed || _currentTasMovie == null) @@ -12,15 +14,7 @@ namespace BizHawk.Client.EmuHawk return; } - if (_currentTasMovie.IsRecording) - { - TasView.LastVisibleRow = _currentTasMovie.InputLogLength - 1; - } - else - { - TasView.LastVisibleRow = Global.Emulator.Frame; - } - + SetVisibleIndex(); RefreshDialog(); } @@ -31,14 +25,7 @@ namespace BizHawk.Client.EmuHawk return; } - if (_currentTasMovie.IsRecording) - { - TasView.LastVisibleRow = _currentTasMovie.InputLogLength - 1; - } - else - { - TasView.LastVisibleRow = Global.Emulator.Frame; - } + SetVisibleIndex(); } public void Restart() @@ -86,6 +73,16 @@ namespace BizHawk.Client.EmuHawk return true; } - public bool UpdateBefore { get { return false; } } + private void SetVisibleIndex() + { + int indexThatMustBeVisible = _currentTasMovie.IsRecording + ? _currentTasMovie.InputLogLength + : Global.Emulator.Frame + 1; + + if (!TasView.IsVisible(indexThatMustBeVisible)) + { + TasView.LastVisibleRow = indexThatMustBeVisible; + } + } } }