diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 4438863763..6f25fce1d6 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -5,6 +5,7 @@ using System.Windows.Forms; using System.Collections.Generic; using BizHawk.Emulation.Common.IEmulatorExtensions; +using BizHawk.Common.NumberExtensions; using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk @@ -61,8 +62,6 @@ namespace BizHawk.Client.EmuHawk } } - private System.Timers.Timer _mouseWheelTimer; - // public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why? public static Color CurrentFrame_InputLog = Color.FromArgb(0xB5E7F7); @@ -487,6 +486,7 @@ namespace BizHawk.Client.EmuHawk if (_rightClickFrame != -1) { _rightClickInput = null; + _rightClickOverInput = null; _rightClickFrame = -1; CurrentTasMovie.ChangeLog.EndBatch(); } @@ -524,12 +524,6 @@ namespace BizHawk.Client.EmuHawk GoToPreviousFrame(); } } - - if (_mouseWheelTimer.Enabled) // dunno if this is telling enough and nothing like bool _mouseWheelFast is needed, but we need to check on the first scroll event, and just decide by delta if it's fast enough to increase actual scrolling speed - { - _mouseWheelTimer.Stop(); - } - _mouseWheelTimer.Start(); } private void TasView_MouseDoubleClick(object sender, MouseEventArgs e) @@ -618,7 +612,7 @@ namespace BizHawk.Client.EmuHawk if (shouldInsert) { for (int i = startVal + 1; i <= endVal; i++) - CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame) % _rightClickInput.Length]); + CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]); } else { @@ -630,7 +624,7 @@ namespace BizHawk.Client.EmuHawk else // Overwrite { for (int i = startVal; i <= endVal; i++) - CurrentTasMovie.SetFrame(i, _rightClickInput[(_rightClickFrame - i) % _rightClickInput.Length]); + CurrentTasMovie.SetFrame(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]); JumpToGreenzone(); } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index c258df7251..bda1d00532 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -300,11 +300,6 @@ namespace BizHawk.Client.EmuHawk Global.Config.MovieEndAction = MovieEndAction.Record; GlobalWin.MainForm.SetMainformMovieInfo(); Global.MovieSession.ReadOnly = true; - _mouseWheelTimer = new System.Timers.Timer(100); // consider sub 100 ms fast scrolling - _mouseWheelTimer.Elapsed += (s, e) => - { - _mouseWheelTimer.Stop(); - }; } #endregion @@ -452,7 +447,6 @@ namespace BizHawk.Client.EmuHawk // Do not keep TAStudio's disk save states. if (Directory.Exists(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null))) Directory.Delete(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null), true); - _mouseWheelTimer.Dispose(); } /// @@ -555,7 +549,7 @@ namespace BizHawk.Client.EmuHawk // frame == Emualtor.Frame when frame == 0 if (frame > Emulator.Frame) { - if (GlobalWin.MainForm.EmulatorPaused || GlobalWin.MainForm.IsSeeking || _mouseWheelTimer.Enabled) // make seek frame keep up with emulation on fast scrolls + if (GlobalWin.MainForm.EmulatorPaused || GlobalWin.MainForm.IsSeeking) // make seek frame keep up with emulation on fast scrolls { GlobalWin.MainForm.PauseOnFrame = frame; GlobalWin.MainForm.UnpauseEmulator(); diff --git a/BizHawk.Common/Extensions/NumberExtensions.cs b/BizHawk.Common/Extensions/NumberExtensions.cs index 17d049adeb..cb2f5f19b6 100644 --- a/BizHawk.Common/Extensions/NumberExtensions.cs +++ b/BizHawk.Common/Extensions/NumberExtensions.cs @@ -98,5 +98,13 @@ namespace BizHawk.Common.NumberExtensions return 16; } + + /// + /// The % operator is a remainder operator. (e.g. -1 mod 4 returns -1, not 3.) + /// + public static int Mod(this int a, int b) + { + return a - (b * (int)System.Math.Floor((float)a / b)); + } } }