TasMovie - don't create a Bk2MnemonicConstants object everytime a display value is requested, gives a modest speed up to tastudio performance

This commit is contained in:
adelikat 2014-08-29 01:59:08 +00:00
parent d7f9b2ccd7
commit c033b26ad0
2 changed files with 4 additions and 5 deletions

View File

@ -12,6 +12,7 @@ namespace BizHawk.Client.Common
{
public sealed partial class TasMovie : Bk2Movie, INotifyPropertyChanged
{
private readonly Bk2MnemonicConstants MnemonicConstants = new Bk2MnemonicConstants();
private List<bool> LagLog = new List<bool>();
private readonly TasStateManager StateManager;
public TasMovieMarkerList Markers { get; set; }
@ -137,14 +138,12 @@ namespace BizHawk.Client.Common
return CreateDisplayValueForButton(adapter, buttonName);
}
public static string CreateDisplayValueForButton(IController adapter, string buttonName)
public string CreateDisplayValueForButton(IController adapter, string buttonName)
{
var mnemonics = new Bk2MnemonicConstants();
if (adapter.Type.BoolButtons.Contains(buttonName))
{
return adapter.IsPressed(buttonName) ?
mnemonics[buttonName].ToString() :
MnemonicConstants[buttonName].ToString() :
string.Empty;
}

View File

@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (Global.Emulator.Frame == _currentTasMovie.InputLogLength) // In this situation we have a "pending" frame for the user to click
{
text = TasMovie.CreateDisplayValueForButton(
text = _currentTasMovie.CreateDisplayValueForButton(
Global.ClickyVirtualPadController,
columnName);
}