TasStateManager.cs -> fixed stateHasDuplicate
This commit is contained in:
parent
8b5440d963
commit
a751412c1f
|
@ -138,7 +138,8 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
if (frame == 0) {
|
||||
if (frame == 0)
|
||||
{
|
||||
return new KeyValuePair<int, byte[]>(0, InitialState);
|
||||
}
|
||||
|
||||
|
@ -391,7 +392,7 @@ namespace BizHawk.Client.Common
|
|||
else
|
||||
Used -= (ulong)BranchStates[frame][branch].Length;
|
||||
BranchStates[frame].RemoveAt(BranchStates[frame].IndexOfKey(branch));
|
||||
|
||||
|
||||
if (BranchStates[frame].Count == 0)
|
||||
BranchStates.Remove(frame);
|
||||
}
|
||||
|
@ -716,7 +717,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
StateManagerState stateToMatch;
|
||||
|
||||
// figure out what state we're checking
|
||||
// Get the state instance
|
||||
if (branchHash == -1)
|
||||
stateToMatch = States[frame];
|
||||
else
|
||||
|
@ -724,26 +725,28 @@ namespace BizHawk.Client.Common
|
|||
if (!BranchStates[frame].ContainsKey(branchHash))
|
||||
return -2;
|
||||
stateToMatch = BranchStates[frame][branchHash];
|
||||
//if (States.ContainsKey(frame) && States[frame] == stateToMatch)
|
||||
// return -1;
|
||||
// Check the current branch for duplicate.
|
||||
if (States.ContainsKey(frame) && States[frame] == stateToMatch)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// there's no state for that frame at all
|
||||
if (!BranchStates.ContainsKey(frame))
|
||||
// Check if there are any branch states for the given frame.
|
||||
if (!BranchStates.ContainsKey(frame) || BranchStates[frame] == null)
|
||||
return -2;
|
||||
|
||||
// find the branches whose state for that frame is the same
|
||||
// Loop through branch states for the given frame.
|
||||
SortedList<int, StateManagerState> stateList = BranchStates[frame];
|
||||
for (int i = 0; i < _movie.BranchCount; i++)
|
||||
{
|
||||
// Don't check the branch containing the state to match.
|
||||
if (i == _movie.BranchIndexByHash(branchHash))
|
||||
continue;
|
||||
|
||||
if (stateList != null && stateList.ContainsKey(i) && stateList[i] == stateToMatch)
|
||||
if (stateList.Values[i] == stateToMatch)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -2;
|
||||
return -2; // No match.
|
||||
}
|
||||
|
||||
private Point findState(StateManagerState s)
|
||||
|
@ -795,13 +798,11 @@ namespace BizHawk.Client.Common
|
|||
if (stateList == null)
|
||||
continue;
|
||||
|
||||
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
|
||||
if (stateList.ContainsKey(branchHash))
|
||||
{
|
||||
if (stateList.ContainsKey(branchHash))
|
||||
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
|
||||
{
|
||||
if (stateList[branchHash].IsOnDisk)
|
||||
{ }
|
||||
else
|
||||
if (!stateList[branchHash].IsOnDisk)
|
||||
Used -= (ulong)stateList[branchHash].Length;
|
||||
}
|
||||
}
|
||||
|
@ -823,13 +824,11 @@ namespace BizHawk.Client.Common
|
|||
if (stateList == null)
|
||||
continue;
|
||||
|
||||
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
|
||||
if (stateList.ContainsKey(branchHash))
|
||||
{
|
||||
if (stateList.ContainsKey(branchHash))
|
||||
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
|
||||
{
|
||||
if (stateList[branchHash].IsOnDisk)
|
||||
{ }
|
||||
else
|
||||
if (!stateList[branchHash].IsOnDisk)
|
||||
Used -= (ulong)stateList[branchHash].Length;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue