Added a couple Refreshes to TAStudio; Lag History is no longer completely cleared on making an edit.
This commit is contained in:
parent
5fd1f6912b
commit
9891e73313
|
@ -9,9 +9,9 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public class TasLagLog
|
||||
{
|
||||
// TODO: Change this into a regular list.
|
||||
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]
|
||||
|
@ -58,39 +58,23 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void Clear()
|
||||
{
|
||||
if (LagLog.Any())
|
||||
for (int i = 0; i < LagLog.Count; i++)
|
||||
{
|
||||
RemovedFrames.Clear();
|
||||
foreach (var lag in LagLog)
|
||||
{
|
||||
RemovedFrames.Add(lag.Key, lag.Value);
|
||||
}
|
||||
RemovedFrames.Remove(LagLog.Keys[i]);
|
||||
RemovedFrames.Add(i, LagLog[i]);
|
||||
}
|
||||
|
||||
LagLog.Clear();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void RemoveFrom(int frame)
|
||||
{
|
||||
if (frame > 0 && frame <= LagLog.Count)
|
||||
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.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(LagLog.Keys[i], LagLog.Values[i]); // use .Keys[i] instead of [i] here because indizes might not be consistent with keys
|
||||
LagLog.Remove(LagLog.Keys[i]);
|
||||
}
|
||||
}
|
||||
else if (frame == 0)
|
||||
{
|
||||
RemovedFrames.Clear();
|
||||
foreach (var lag in LagLog)
|
||||
{
|
||||
RemovedFrames.Add(lag.Key, lag.Value);
|
||||
}
|
||||
this.Clear();
|
||||
RemovedFrames.Remove(LagLog.Keys[i]);
|
||||
RemovedFrames.Add(LagLog.Keys[i], LagLog.Values[i]); // use .Keys[i] instead of [i] here because indizes might not be consistent with keys
|
||||
LagLog.Remove(LagLog.Keys[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -938,7 +938,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.MarkerControl.Emulator = null;
|
||||
this.MarkerControl.Location = new System.Drawing.Point(2, 16);
|
||||
this.MarkerControl.Name = "MarkerControl";
|
||||
this.MarkerControl.Size = new System.Drawing.Size(198, 320);
|
||||
this.MarkerControl.Size = new System.Drawing.Size(198, 343);
|
||||
this.MarkerControl.TabIndex = 6;
|
||||
this.MarkerControl.Tastudio = null;
|
||||
//
|
||||
|
|
|
@ -216,6 +216,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
TasView.SelectRow(i, true);
|
||||
}
|
||||
|
||||
RefreshTasView();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,6 +228,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
TasView.SelectRow(item.Frame, true);
|
||||
}
|
||||
|
||||
RefreshTasView();
|
||||
}
|
||||
|
||||
private void CopyMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -580,12 +584,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (!state.SequenceEqual(greenzone))
|
||||
{
|
||||
List<byte> stateList = state.ToList();
|
||||
List<byte> greenList = greenzone.ToList();
|
||||
int diffAt = FirstDifference(stateList, greenList);
|
||||
stateList.RemoveRange(0, diffAt);
|
||||
greenList.RemoveRange(0, diffAt);
|
||||
|
||||
MessageBox.Show("Bad data between frames " + lastState + " and " + Emulator.Frame);
|
||||
return;
|
||||
}
|
||||
|
@ -596,11 +594,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
MessageBox.Show("Integrity Check passed");
|
||||
}
|
||||
private int FirstDifference(List<byte> b1, List<byte> b2)
|
||||
{
|
||||
int dummyVar = -1;
|
||||
return b1.FindIndex(b => { dummyVar++; return b != b2[dummyVar]; });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
Loading…
Reference in New Issue