Fix for XD. XF files testes from inside a memory card only return true in getIsG3XDSAV if ignore the second pass in the for, only the first is equal to the sequence

This commit is contained in:
javierhimura 2017-04-02 16:54:53 +02:00
parent a38e923e83
commit b53a101f20

View file

@ -274,12 +274,16 @@ namespace PKHeX.Core
// Check the intro bytes for each save slot
byte[] slotintroXD = { 0x01, 0x01, 0x01, 0x00 };
int offset = data.Length - SIZE_G3XD;
// For XD savegames inside a memory card only the firs sequence is equal to slotintroXD
bool valid = false;
for (int i = 0; i < 2; i++)
{
var ident = data.Skip(0x6000 + offset + 0x28000 * i).Take(4);
if (!ident.SequenceEqual(slotintroXD))
return GameVersion.Invalid;
if (ident.SequenceEqual(slotintroXD))
valid = true;
}
if(!valid)
return GameVersion.Invalid;
return GameVersion.XD;
}
/// <summary>Determines the type of 4th gen save</summary>