Tastudio - proof of concept for cachine the input state during a screen refresh. A huge speed up here, about 400-500%. Implementation is a bit sloppy but works
This commit is contained in:
parent
86fc66820c
commit
c7949501b2
|
@ -133,10 +133,29 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DisplayValue(int frame, string buttonName)
|
public string DisplayValue(int frame, string buttonName)
|
||||||
{
|
{
|
||||||
|
if (UseInputCache && InputStateCache.ContainsKey(frame))
|
||||||
|
{
|
||||||
|
return CreateDisplayValueForButton(InputStateCache[frame], buttonName);
|
||||||
|
}
|
||||||
|
|
||||||
var adapter = GetInputState(frame);
|
var adapter = GetInputState(frame);
|
||||||
|
|
||||||
|
if (UseInputCache)
|
||||||
|
{
|
||||||
|
InputStateCache.Add(frame, adapter);
|
||||||
|
}
|
||||||
|
|
||||||
return CreateDisplayValueForButton(adapter, buttonName);
|
return CreateDisplayValueForButton(adapter, buttonName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly Dictionary<int, IController> InputStateCache = new Dictionary<int, IController>();
|
||||||
|
|
||||||
|
public bool UseInputCache { get; set; }
|
||||||
|
public void FlushInputCache()
|
||||||
|
{
|
||||||
|
InputStateCache.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public string CreateDisplayValueForButton(IController adapter, string buttonName)
|
public string CreateDisplayValueForButton(IController adapter, string buttonName)
|
||||||
{
|
{
|
||||||
if (adapter.Type.BoolButtons.Contains(buttonName))
|
if (adapter.Type.BoolButtons.Contains(buttonName))
|
||||||
|
|
|
@ -153,9 +153,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void RefreshDialog()
|
public void RefreshDialog()
|
||||||
{
|
{
|
||||||
|
_currentTasMovie.FlushInputCache();
|
||||||
|
_currentTasMovie.UseInputCache = true;
|
||||||
|
|
||||||
TasView.ItemCount = _currentTasMovie.InputLogLength + 1;
|
TasView.ItemCount = _currentTasMovie.InputLogLength + 1;
|
||||||
TasView.Refresh();
|
TasView.Refresh();
|
||||||
|
|
||||||
|
_currentTasMovie.FlushInputCache();
|
||||||
|
_currentTasMovie.UseInputCache = false;
|
||||||
|
|
||||||
if (MarkerControl != null)
|
if (MarkerControl != null)
|
||||||
{
|
{
|
||||||
MarkerControl.UpdateValues();
|
MarkerControl.UpdateValues();
|
||||||
|
|
Loading…
Reference in New Issue