public SAV5(byte[] data = null, GameVersion versionOverride = GameVersion.Any) { Data = data ?? new byte[SaveUtil.SIZE_G5RAW]; BAK = (byte[])Data.Clone(); Exportable = !IsRangeEmpty(0, Data.Length); // Get Version if (data == null) { Version = GameVersion.B2W2; } else if (versionOverride != GameVersion.Any) { Version = versionOverride; } else { Version = SaveUtil.GetIsG5SAV(Data); } if (Version == GameVersion.Invalid) { return; } // First blocks are always the same position/size PCLayout = 0x0; Box = 0x400; Party = 0x18E00; Trainer1 = 0x19400; WondercardData = 0x1C800; AdventureInfo = 0x1D900; // Different Offsets for later blocks switch (Version) { case GameVersion.BW: BattleBox = 0x20A00; Trainer2 = 0x21200; EventConst = 0x20100; EventFlag = EventConst + 0x27C; Daycare = 0x20E00; PokeDex = 0x21600; PokeDexLanguageFlags = PokeDex + 0x320; BattleSubway = 0x21D00; CGearInfoOffset = 0x1C000; CGearDataOffset = 0x52000; EntreeForestOffset = 0x22C00; // Inventory offsets are the same for each game. OFS_PouchHeldItem = 0x18400; // 0x188D7 OFS_PouchKeyItem = 0x188D8; // 0x18A23 OFS_PouchTMHM = 0x18A24; // 0x18BD7 OFS_PouchMedicine = 0x18BD8; // 0x18C97 OFS_PouchBerry = 0x18C98; // 0x18DBF LegalItems = Legal.Pouch_Items_BW; LegalKeyItems = Legal.Pouch_Key_BW; LegalTMHMs = Legal.Pouch_TMHM_BW; LegalMedicine = Legal.Pouch_Medicine_BW; LegalBerries = Legal.Pouch_Berries_BW; Personal = PersonalTable.BW; break; case GameVersion.B2W2: // B2W2 BattleBox = 0x20900; Trainer2 = 0x21100; EventConst = 0x1FF00; EventFlag = EventConst + 0x35E; Daycare = 0x20D00; PokeDex = 0x21400; PokeDexLanguageFlags = PokeDex + 0x328; // forme flags size is + 8 from bw with new formes (therians) BattleSubway = 0x21B00; CGearInfoOffset = 0x1C000; CGearDataOffset = 0x52800; EntreeForestOffset = 0x22A00; // Inventory offsets are the same for each game. OFS_PouchHeldItem = 0x18400; // 0x188D7 OFS_PouchKeyItem = 0x188D8; // 0x18A23 OFS_PouchTMHM = 0x18A24; // 0x18BD7 OFS_PouchMedicine = 0x18BD8; // 0x18C97 OFS_PouchBerry = 0x18C98; // 0x18DBF LegalItems = Legal.Pouch_Items_BW; LegalKeyItems = Legal.Pouch_Key_B2W2; LegalTMHMs = Legal.Pouch_TMHM_BW; LegalMedicine = Legal.Pouch_Medicine_BW; LegalBerries = Legal.Pouch_Berries_BW; Personal = PersonalTable.B2W2; break; } HeldItems = Legal.HeldItems_BW; Blocks = Version == GameVersion.BW ? BlockInfoNDS.BlocksBW : BlockInfoNDS.BlocksB2W2; if (!Exportable) { ClearBoxes(); } }