TAStudio: -Put lag log and change log back into branches.
-Bugfix: clearing states in a savestate-anchored movie threw an exception -Clear disk states when clearing states
This commit is contained in:
parent
e78b39208b
commit
0d87c8330c
|
@ -459,26 +459,18 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
int? divergentPoint = DivergantPoint(_log, branch.InputLog);
|
||||
|
||||
_log = branch.InputLog.ToList();
|
||||
_log = branch.InputLog;
|
||||
_changes = true;
|
||||
LagLog.FromLagLog(branch.LagLog);
|
||||
|
||||
if (divergentPoint.HasValue)
|
||||
{
|
||||
StateManager.Invalidate(divergentPoint.Value);
|
||||
|
||||
// For now, even though we loaded the lag log, we are invalidating it the same as savestates to show the user the space isn't navigatable without re-emulating
|
||||
LagLog.RemoveFrom(divergentPoint.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
StateManager.Invalidate(branch.InputLog.Count);
|
||||
}
|
||||
|
||||
StateManager.SetState(branch.Frame, branch.CoreData);
|
||||
|
||||
// TODO: we save the changelog, but not to disk, also this may not be intended behavior
|
||||
//ChangeLog = branch.ChangeLog;
|
||||
ChangeLog = branch.ChangeLog;
|
||||
}
|
||||
|
||||
// TODO: use LogGenerators rather than string comparisons
|
||||
|
|
|
@ -292,6 +292,9 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
private void StateAccessed(int index)
|
||||
{
|
||||
if (index == 0 && _movie.StartsFromSavestate)
|
||||
return;
|
||||
|
||||
bool removed = accessed.Remove(index);
|
||||
accessed.Add(index);
|
||||
|
||||
|
@ -355,31 +358,39 @@ namespace BizHawk.Client.Common
|
|||
accessed.Clear();
|
||||
Used = 0;
|
||||
DiskUsed = 0;
|
||||
clearDiskStates();
|
||||
}
|
||||
|
||||
public void ClearStateHistory()
|
||||
{
|
||||
if (States.Any())
|
||||
{
|
||||
KeyValuePair<int, byte[]> power = States.FirstOrDefault(s => s.Key == 0);
|
||||
if (power.Value == null)
|
||||
{
|
||||
StateAccessed(power.Key);
|
||||
StateAccessed(power.Key);
|
||||
if (power.Value == null) // if it was on disk
|
||||
power = States.FirstOrDefault(s => s.Key == 0);
|
||||
}
|
||||
|
||||
States.Clear();
|
||||
accessed.Clear();
|
||||
|
||||
if (power.Value.Length > 0)
|
||||
if (power.Value != null) // savestate-anchored movie?
|
||||
{
|
||||
SetState(0, power.Value);
|
||||
Used = (ulong)power.Value.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
Used = 0;
|
||||
DiskUsed = 0;
|
||||
}
|
||||
|
||||
DiskUsed = 0;
|
||||
clearDiskStates();
|
||||
}
|
||||
}
|
||||
private void clearDiskStates()
|
||||
{
|
||||
string path = PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null);
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
Directory.Delete(path, true);
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Branch()
|
||||
{
|
||||
var branch = CreateBranch();
|
||||
TasBranch branch = CreateBranch();
|
||||
Branches.Add(branch);
|
||||
BranchView.RowCount = Branches.Count;
|
||||
CurrentBranch = Branches.IndexOf(branch);
|
||||
|
|
|
@ -42,6 +42,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
Size = new Size(256, 240),
|
||||
};
|
||||
|
||||
public string statesPath
|
||||
{
|
||||
get { return PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null); }
|
||||
}
|
||||
|
||||
[ConfigPersist]
|
||||
public TAStudioSettings Settings { get; set; }
|
||||
|
||||
|
@ -517,8 +522,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.MovieEndAction = _originalEndAction;
|
||||
GlobalWin.MainForm.SetMainformMovieInfo();
|
||||
// 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);
|
||||
if (Directory.Exists(statesPath))
|
||||
Directory.Delete(statesPath, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue