mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
Check block index before calculating
Missing/Duplicate blocks (???) result in -1, so skip them. https://projectpokemon.org/home/forums/topic/52437-cant-export-unmodified-sav-file/ replace linq with manual allocation
This commit is contained in:
parent
a220970124
commit
0dc45c00ec
1 changed files with 7 additions and 2 deletions
|
@ -239,7 +239,9 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
SetChecksums();
|
||||
return Data.Take(Data.Length - SIZE_RESERVED).ToArray();
|
||||
var result = new byte[Data.Length - SIZE_RESERVED];
|
||||
Buffer.BlockCopy(Data, 0, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
|
||||
private readonly int ActiveSAV;
|
||||
|
@ -283,7 +285,10 @@ namespace PKHeX.Core
|
|||
for (int i = 0; i < BLOCK_COUNT; i++)
|
||||
{
|
||||
int ofs = ABO + (i * SIZE_BLOCK);
|
||||
int len = chunkLength[BlockOrder[i]];
|
||||
var index = BlockOrder[i];
|
||||
if (index == -1)
|
||||
continue;
|
||||
int len = chunkLength[index];
|
||||
ushort chk = Checksums.CRC32(Data, ofs, len);
|
||||
BitConverter.GetBytes(chk).CopyTo(Data, ofs + 0xFF6);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue