mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Increase gen3 sav loading stability
reject if game has only been saved once, the trainer block is inexplicably not set up to be able to be detected. #305 Old code would default to RS (reading from any uninitialized 'block0' yielded 0, gamecode for RS. #305
This commit is contained in:
parent
95ca86033a
commit
f9a72abb4c
1 changed files with 5 additions and 1 deletions
|
@ -227,8 +227,12 @@ namespace PKHeX
|
|||
|
||||
// Detect RS/E/FRLG
|
||||
// Section 0 stores Game Code @ 0x00AC; 0 for RS, 1 for FRLG, else for Emerald
|
||||
|
||||
int Block0 = Array.IndexOf(BlockOrder, 0);
|
||||
|
||||
// Sometimes not all blocks are present (start of game), yielding multiple block0's.
|
||||
// Real 0th block comes before block1.
|
||||
if (BlockOrder[0] == 1 && Block0 != BlockOrder.Length - 1)
|
||||
continue;
|
||||
uint GameCode = BitConverter.ToUInt32(data, Block0 * 0x1000 + 0xAC + ofs);
|
||||
if (GameCode == uint.MaxValue)
|
||||
return GameVersion.Unknown; // what a hack
|
||||
|
|
Loading…
Reference in a new issue