Fixed right-click input painting in TAStudio. Also removed mouseWheelTimer as it is no longer needed.

This commit is contained in:
Suuper 2015-07-16 13:57:51 -05:00
parent 3609a9682f
commit bc8717c9f9
3 changed files with 13 additions and 17 deletions

View File

@ -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();
}
}

View File

@ -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();
}
/// <summary>
@ -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();

View File

@ -98,5 +98,13 @@ namespace BizHawk.Common.NumberExtensions
return 16;
}
/// <summary>
/// The % operator is a remainder operator. (e.g. -1 mod 4 returns -1, not 3.)
/// </summary>
public static int Mod(this int a, int b)
{
return a - (b * (int)System.Math.Floor((float)a / b));
}
}
}