mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-21 23:14:59 -05:00
Check counter rollover the opposite way
FFFF and 0000 -> prefer 0000 FFFF and 0001 -> prefer 0001 ... FFFF and FFFE -> prefer FFFF they shouldn't be desync'd (incremental); only the uninitialized case is important to handle.
This commit is contained in:
@@ -35,10 +35,10 @@ public static int CompareFooters(byte[] data, int offset1, int offset2)
|
||||
|
||||
private static int CompareCounters(uint counter1, uint counter2)
|
||||
{
|
||||
// Uninitialized
|
||||
if (counter1 == uint.MaxValue && counter2 == 0)
|
||||
// Uninitialized -- only continue if a rollover case (humanly impossible)
|
||||
if (counter1 == uint.MaxValue && counter2 != uint.MaxValue - 1)
|
||||
return Second;
|
||||
if (counter1 == 0 && counter2 == uint.MaxValue)
|
||||
if (counter2 == uint.MaxValue && counter1 != uint.MaxValue - 1)
|
||||
return First;
|
||||
|
||||
// Different
|
||||
|
||||
Reference in New Issue
Block a user