Tastudio - track lag log history (1 level deep) and color "invalidated greenzone" using this information (a lighter shade of normal greezone colors)
This commit is contained in:
parent
734101a8fd
commit
6a02656417
|
@ -11,6 +11,9 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
private readonly SortedList<int, bool> LagLog = new SortedList<int, bool>();
|
||||
|
||||
// TODO: eventually we want multiple levels of history
|
||||
private readonly SortedList<int, bool> RemovedFrames = new SortedList<int, bool>();
|
||||
|
||||
public bool? this[int frame]
|
||||
{
|
||||
get
|
||||
|
@ -55,20 +58,38 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void Clear()
|
||||
{
|
||||
if (LagLog.Any())
|
||||
{
|
||||
RemovedFrames.Clear();
|
||||
foreach (var lag in LagLog)
|
||||
{
|
||||
RemovedFrames.Add(lag.Key, lag.Value);
|
||||
}
|
||||
}
|
||||
|
||||
LagLog.Clear();
|
||||
|
||||
}
|
||||
|
||||
public void RemoveFrom(int frame)
|
||||
{
|
||||
if (frame > 0 && frame <= LagLog.Count)
|
||||
{
|
||||
RemovedFrames.Clear();
|
||||
|
||||
for (int i = LagLog.Count - 1; i > frame; i--) // Reverse order because removing from a sorted list re-indexes the items after the removed item
|
||||
{
|
||||
RemovedFrames.Add(i, LagLog[i]);
|
||||
LagLog.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
else if (frame == 0)
|
||||
{
|
||||
RemovedFrames.Clear();
|
||||
foreach (var lag in LagLog)
|
||||
{
|
||||
RemovedFrames.Add(lag.Key, lag.Value);
|
||||
}
|
||||
this.Clear();
|
||||
}
|
||||
|
||||
|
@ -96,5 +117,15 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool? History(int frame)
|
||||
{
|
||||
if (RemovedFrames.ContainsKey(frame))
|
||||
{
|
||||
return RemovedFrames[frame];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,8 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
State = StateManager[index],
|
||||
LogEntry = GetInputLogEntry(index),
|
||||
Lagged = LagLog[index + 1]
|
||||
Lagged = LagLog[index + 1],
|
||||
WasLagged = LagLog.History(index + 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public KeyValuePair<int, byte[]> State { get; set; }
|
||||
public bool? Lagged { get; set; }
|
||||
public bool? WasLagged { get; set; }
|
||||
public string LogEntry { get; set; }
|
||||
|
||||
public bool HasState
|
||||
|
|
|
@ -91,8 +91,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (columnName == FrameColumnName)
|
||||
{
|
||||
if (Emulator.Frame == index)
|
||||
|
@ -109,6 +107,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
LagZone_FrameCol :
|
||||
GreenZone_FrameCol;
|
||||
}
|
||||
else if (record.WasLagged.HasValue)
|
||||
{
|
||||
color = record.WasLagged.Value ?
|
||||
LagZone_Invalidated_FrameCol :
|
||||
GreenZone_Invalidated_FrameCol;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.White;
|
||||
|
@ -134,6 +138,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
LagZone_InputLog :
|
||||
GreenZone_InputLog;
|
||||
}
|
||||
else if (record.WasLagged.HasValue)
|
||||
{
|
||||
color = record.WasLagged.Value ?
|
||||
LagZone_Invalidated_InputLog :
|
||||
GreenZone_Invalidated_FrameCol;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.FromArgb(0xFFFEEE);
|
||||
|
|
Loading…
Reference in New Issue