public SAV6(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G6ORAS] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); // Load Info getBlockInfo(); getSAVOffsets(); HeldItems = ORAS ? Legal.HeldItem_AO : Legal.HeldItem_XY; Personal = ORAS ? PersonalTable.AO : PersonalTable.XY; if (!Exportable) { resetBoxes(); } }
public SAV4BR(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G4BR] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); if (SaveUtil.getIsG4BRSAV(Data) != GameVersion.BATREV) { return; } Data = DecryptPBRSaveData(data); // Detect active save SaveCount = Math.Max(BigEndian.ToUInt32(Data, 0x1C004C), BigEndian.ToUInt32(Data, 0x4C)); if (BigEndian.ToUInt32(Data, 0x1C004C) > BigEndian.ToUInt32(Data, 0x4C)) { byte[] tempData = new byte[0x1C0000]; Array.Copy(Data, 0, tempData, 0, 0x1C0000); Array.Copy(Data, 0x1C0000, Data, 0, 0x1C0000); tempData.CopyTo(Data, 0x1C0000); } SaveSlots = new List <int>(); SaveNames = new string[SAVE_COUNT]; for (int i = 0; i < SAVE_COUNT; i++) { if (BitConverter.ToUInt16(Data, 0x390 + 0x6FF00 * i) != 0) { SaveSlots.Add(i); SaveNames[i] = Encoding.BigEndianUnicode.GetString(Data, 0x390 + 0x6FF00 * i, 0x10); } } CurrentSlot = SaveSlots.First(); Personal = PersonalTable.DP; HeldItems = Legal.HeldItems_DP; if (!Exportable) { resetBoxes(); } }
public SAV3RSBox(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G3BOX] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); if (SaveUtil.getIsG3BOXSAV(Data) != GameVersion.RSBOX) { return; } Blocks = new RSBOX_Block[2 * BLOCK_COUNT]; for (int i = 0; i < Blocks.Length; i++) { int offset = BLOCK_SIZE + i * BLOCK_SIZE; Blocks[i] = new RSBOX_Block(Data.Skip(offset).Take(BLOCK_SIZE).ToArray(), offset); } // Detect active save int[] SaveCounts = Blocks.Select(block => (int)block.SaveCount).ToArray(); SaveCount = SaveCounts.Max(); int ActiveSAV = Array.IndexOf(SaveCounts, SaveCount) / BLOCK_COUNT; Blocks = Blocks.Skip(ActiveSAV * BLOCK_COUNT).Take(BLOCK_COUNT).OrderBy(b => b.BlockNumber).ToArray(); // Set up PC data buffer beyond end of save file. Box = Data.Length; Array.Resize(ref Data, Data.Length + SIZE_RESERVED); // More than enough empty space. // Copy block to the allocated location foreach (RSBOX_Block b in Blocks) { Array.Copy(b.Data, 0xC, Data, Box + b.BlockNumber * (BLOCK_SIZE - 0x10), b.Data.Length - 0x10); } Personal = PersonalTable.RS; HeldItems = Legal.HeldItems_RS; if (!Exportable) { resetBoxes(); } }
public SAV4(byte[] data = null, GameVersion versionOverride = GameVersion.Any) { Data = data == null ? new byte[SaveUtil.SIZE_G4RAW] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); // Get Version if (data == null) { Version = GameVersion.HGSS; } else if (versionOverride != GameVersion.Any) { Version = versionOverride; } else { Version = SaveUtil.getIsG4SAV(Data); } if (Version == GameVersion.Invalid) { return; } getActiveGeneralBlock(); getActiveStorageBlock(); getSAVOffsets(); switch (Version) { case GameVersion.DP: Personal = PersonalTable.DP; break; case GameVersion.Pt: Personal = PersonalTable.Pt; break; case GameVersion.HGSS: Personal = PersonalTable.HGSS; break; } if (!Exportable) { resetBoxes(); } }
public SAV7(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G7SM] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); // Load Info getBlockInfo(); getSAVOffsets(); HeldItems = Legal.HeldItems_SM; Personal = PersonalTable.SM; if (!Exportable) { resetBoxes(); } var demo = new byte[0x4C4].SequenceEqual(Data.Skip(PCLayout).Take(0x4C4)); // up to Battle Box values if (demo || !Exportable) { PokeDex = -1; // Disabled LockedSlots = new int[0]; } else // Valid slot locking info present { int lockedCount = 0; for (int i = 0; i < LockedSlots.Length; i++) { short val = BitConverter.ToInt16(Data, BattleBoxFlags + i * 2); if (val >= 0) { LockedSlots[lockedCount++] = (BoxSlotCount * (val >> 8) + (val & 0xFF)) & 0xFFFF; } } Array.Resize(ref LockedSlots, lockedCount); } }
public SAV7(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G7SM] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); // Load Info getBlockInfo(); getSAVOffsets(); HeldItems = Legal.HeldItems_SM; Personal = PersonalTable.SM; if (!Exportable) { resetBoxes(); } var demo = new byte[0x4C4].SequenceEqual(Data.Skip(PCLayout).Take(0x4C4)); if (demo) { PokeDex = -1; // Disabled } }
public SAV5(byte[] data = null, GameVersion versionOverride = GameVersion.Any) { Data = data == null ? new byte[SaveUtil.SIZE_G5RAW] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[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; Daycare = 0x20E00; PokeDex = 0x21600; PokeDexLanguageFlags = PokeDex + 0x320; CGearInfoOffset = 0x1C000; CGearDataOffset = 0x52000; // 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) CGearInfoOffset = 0x1C000; CGearDataOffset = 0x52800; // 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; getBlockInfo(); if (!Exportable) { resetBoxes(); } }
public SAV1(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G1RAW] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); Version = data == null ? GameVersion.RBY : SaveUtil.getIsG1SAV(Data); if (Version == GameVersion.Invalid) { return; } Box = Data.Length; Array.Resize(ref Data, Data.Length + SIZE_RESERVED); Party = getPartyOffset(0); Japanese = SaveUtil.getIsG1SAVJ(data); Personal = PersonalTable.RBY; // Stash boxes after the save file's end. byte[] TempBox = new byte[SIZE_STOREDBOX]; for (int i = 0; i < BoxCount; i++) { if (i < BoxCount / 2) { Array.Copy(Data, 0x4000 + i * TempBox.Length, TempBox, 0, TempBox.Length); } else { Array.Copy(Data, 0x6000 + (i - BoxCount / 2) * TempBox.Length, TempBox, 0, TempBox.Length); } PokemonList1 PL1 = new PokemonList1(TempBox, Japanese ? PokemonList1.CapacityType.StoredJP : PokemonList1.CapacityType.Stored, Japanese); for (int j = 0; j < PL1.Pokemon.Length; j++) { if (j < PL1.Count) { byte[] pkDat = new PokemonList1(PL1[j]).GetBytes(); pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + i * SIZE_BOX + j * SIZE_STORED); } else { byte[] pkDat = new byte[PokemonList1.GetDataLength(PokemonList1.CapacityType.Single, Japanese)]; pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + i * SIZE_BOX + j * SIZE_STORED); } } } Array.Copy(Data, Japanese ? 0x302D : 0x30C0, TempBox, 0, TempBox.Length); PokemonList1 curBoxPL = new PokemonList1(TempBox, Japanese ? PokemonList1.CapacityType.StoredJP : PokemonList1.CapacityType.Stored, Japanese); for (int i = 0; i < curBoxPL.Pokemon.Length; i++) { if (i < curBoxPL.Count) { byte[] pkDat = new PokemonList1(curBoxPL[i]).GetBytes(); pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + CurrentBox * SIZE_BOX + i * SIZE_STORED); } else { byte[] pkDat = new byte[PokemonList1.GetDataLength(PokemonList1.CapacityType.Single, Japanese)]; pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + CurrentBox * SIZE_BOX + i * SIZE_STORED); } } byte[] TempParty = new byte[PokemonList1.GetDataLength(PokemonList1.CapacityType.Party, Japanese)]; Array.Copy(Data, Japanese ? 0x2ED5 : 0x2F2C, TempParty, 0, TempParty.Length); PokemonList1 partyList = new PokemonList1(TempParty, PokemonList1.CapacityType.Party, Japanese); for (int i = 0; i < partyList.Pokemon.Length; i++) { if (i < partyList.Count) { byte[] pkDat = new PokemonList1(partyList[i]).GetBytes(); pkDat.CopyTo(Data, getPartyOffset(i)); } else { byte[] pkDat = new byte[PokemonList1.GetDataLength(PokemonList1.CapacityType.Single, Japanese)]; pkDat.CopyTo(Data, getPartyOffset(i)); } } byte[] rawDC = new byte[0x38]; Array.Copy(Data, Japanese ? 0x2CA7 : 0x2CF4, rawDC, 0, rawDC.Length); byte[] TempDaycare = new byte[PokemonList1.GetDataLength(PokemonList1.CapacityType.Single, Japanese)]; TempDaycare[0] = rawDC[0]; Array.Copy(rawDC, 1, TempDaycare, 2 + 1 + PKX.SIZE_1PARTY + StringLength, StringLength); Array.Copy(rawDC, 1 + StringLength, TempDaycare, 2 + 1 + PKX.SIZE_1PARTY, StringLength); Array.Copy(rawDC, 1 + 2 * StringLength, TempDaycare, 2 + 1, PKX.SIZE_1STORED); PokemonList1 daycareList = new PokemonList1(TempDaycare, PokemonList1.CapacityType.Single, Japanese); daycareList.GetBytes().CopyTo(Data, getPartyOffset(7)); Daycare = getPartyOffset(7); // Enable Pokedex editing PokeDex = 0; if (!Exportable) { resetBoxes(); } }
public SAV3(byte[] data = null, GameVersion versionOverride = GameVersion.Any) { Data = data == null ? new byte[SaveUtil.SIZE_G3RAW] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); if (data == null) { Version = GameVersion.FRLG; } else if (versionOverride != GameVersion.Any) { Version = versionOverride; } else { Version = SaveUtil.getIsG3SAV(Data); } if (Version == GameVersion.Invalid) { return; } int[] BlockOrder1 = new int[14]; for (int i = 0; i < 14; i++) { BlockOrder1[i] = BitConverter.ToInt16(Data, i * 0x1000 + 0xFF4); } int zeroBlock1 = Array.IndexOf(BlockOrder1, 0); if (data.Length > SaveUtil.SIZE_G3RAWHALF) { int[] BlockOrder2 = new int[14]; for (int i = 0; i < 14; i++) { BlockOrder2[i] = BitConverter.ToInt16(Data, 0xE000 + i * 0x1000 + 0xFF4); } int zeroBlock2 = Array.IndexOf(BlockOrder2, 0); if (zeroBlock2 < 0) { ActiveSAV = 0; } else if (zeroBlock1 < 0) { ActiveSAV = 1; } else { ActiveSAV = BitConverter.ToUInt32(Data, zeroBlock1 * 0x1000 + 0xFFC) > BitConverter.ToUInt32(Data, zeroBlock2 * 0x1000 + 0xEFFC) ? 0 : 1; } BlockOrder = ActiveSAV == 0 ? BlockOrder1 : BlockOrder2; } else { ActiveSAV = 0; BlockOrder = BlockOrder1; } BlockOfs = new int[14]; for (int i = 0; i < 14; i++) { BlockOfs[i] = Array.IndexOf(BlockOrder, i) * 0x1000 + ABO; } // Set up PC data buffer beyond end of save file. Box = Data.Length; Array.Resize(ref Data, Data.Length + SIZE_RESERVED); // More than enough empty space. // Copy chunk to the allocated location for (int i = 5; i < 14; i++) { int blockIndex = Array.IndexOf(BlockOrder, i); if (blockIndex == -1) // block empty { continue; } Array.Copy(Data, blockIndex * 0x1000 + ABO, Data, Box + (i - 5) * 0xF80, chunkLength[i]); } switch (Version) { case GameVersion.RS: LegalKeyItems = Legal.Pouch_Key_RS; OFS_PouchHeldItem = BlockOfs[1] + 0x0560; OFS_PouchKeyItem = BlockOfs[1] + 0x05B0; OFS_PouchBalls = BlockOfs[1] + 0x0600; OFS_PouchTMHM = BlockOfs[1] + 0x0640; OFS_PouchBerry = BlockOfs[1] + 0x0740; Personal = PersonalTable.RS; break; case GameVersion.FRLG: LegalKeyItems = Legal.Pouch_Key_FRLG; OFS_PouchHeldItem = BlockOfs[1] + 0x0310; OFS_PouchKeyItem = BlockOfs[1] + 0x03B8; OFS_PouchBalls = BlockOfs[1] + 0x0430; OFS_PouchTMHM = BlockOfs[1] + 0x0464; OFS_PouchBerry = BlockOfs[1] + 0x054C; Personal = PersonalTable.FR; break; case GameVersion.E: LegalKeyItems = Legal.Pouch_Key_E; OFS_PouchHeldItem = BlockOfs[1] + 0x0560; OFS_PouchKeyItem = BlockOfs[1] + 0x05D8; OFS_PouchBalls = BlockOfs[1] + 0x0650; OFS_PouchTMHM = BlockOfs[1] + 0x0690; OFS_PouchBerry = BlockOfs[1] + 0x0790; Personal = PersonalTable.E; break; } LegalItems = Legal.Pouch_Items_RS; LegalBalls = Legal.Pouch_Ball_RS; LegalTMHMs = Legal.Pouch_TMHM_RS; LegalBerries = Legal.Pouch_Berries_RS; HeldItems = Legal.HeldItems_RS; if (!Exportable) { resetBoxes(); } }
public SAV3XD(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G3XD] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); if (SaveUtil.getIsG3XDSAV(Data) != GameVersion.XD) { return; } OriginalData = (byte[])Data.Clone(); // Scan all 3 save slots for the highest counter for (int i = 0; i < SLOT_COUNT; i++) { int slotOffset = SLOT_START + i * SLOT_SIZE; int SaveCounter = BigEndian.ToInt32(Data, slotOffset + 4); if (SaveCounter <= SaveCount) { continue; } SaveCount = SaveCounter; SaveIndex = i; } // Decrypt most recent save slot { byte[] slot = new byte[SLOT_SIZE]; int slotOffset = SLOT_START + SaveIndex * SLOT_SIZE; Array.Copy(Data, slotOffset, slot, 0, slot.Length); ushort[] keys = new ushort[4]; for (int i = 0; i < keys.Length; i++) { keys[i] = BigEndian.ToUInt16(slot, 8 + i * 2); } // Decrypt Slot Data = SaveUtil.DecryptGC(slot, 0x00010, 0x27FD8, keys); } // Get Offset Info ushort[] subLength = new ushort[16]; for (int i = 0; i < 16; i++) { subLength[i] = BigEndian.ToUInt16(Data, 0x20 + 2 * i); subOffsets[i] = BigEndian.ToUInt16(Data, 0x40 + 4 * i) | BigEndian.ToUInt16(Data, 0x40 + 4 * i + 2) << 16; } // Offsets are displaced by the 0xA8 savedata region Trainer1 = subOffsets[1] + 0xA8; Party = Trainer1 + 0x30; Box = subOffsets[2] + 0xA8; Daycare = subOffsets[4] + 0xA8; Memo = subOffsets[5] + 0xA8; Shadow = subOffsets[7] + 0xA8; // Purifier = subOffsets[14] + 0xA8; StrategyMemo = new StrategyMemo(Data, Memo, xd: true); ShadowInfo = new ShadowInfoTableXD(Data.Skip(Shadow).Take(subLength[7]).ToArray()); OFS_PouchHeldItem = Trainer1 + 0x4C8; OFS_PouchKeyItem = Trainer1 + 0x540; OFS_PouchBalls = Trainer1 + 0x5EC; OFS_PouchTMHM = Trainer1 + 0x62C; OFS_PouchBerry = Trainer1 + 0x72C; OFS_PouchCologne = Trainer1 + 0x7E4; OFS_PouchDisc = Trainer1 + 0x7F0; LegalItems = Legal.Pouch_Items_XD; LegalKeyItems = Legal.Pouch_Key_XD; LegalBalls = Legal.Pouch_Ball_RS; LegalTMHMs = Legal.Pouch_TM_RS; // not HMs LegalBerries = Legal.Pouch_Berries_RS; LegalCologne = Legal.Pouch_Cologne_CXD; LegalDisc = Legal.Pouch_Disc_XD; Personal = PersonalTable.RS; HeldItems = Legal.HeldItems_XD; if (!Exportable) { resetBoxes(); } // Since PartyCount is not stored in the save file, // Count up how many party slots are active. for (int i = 0; i < 6; i++) { if (getPartySlot(getPartyOffset(i)).Species != 0) { PartyCount++; } } }
public SAV3Colosseum(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G3COLO] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); if (SaveUtil.getIsG3COLOSAV(Data) != GameVersion.COLO) { return; } OriginalData = (byte[])Data.Clone(); // Scan all 3 save slots for the highest counter for (int i = 0; i < SLOT_COUNT; i++) { int slotOffset = SLOT_START + i * SLOT_SIZE; int SaveCounter = BigEndian.ToInt32(Data, slotOffset + 4); if (SaveCounter <= SaveCount) { continue; } SaveCount = SaveCounter; SaveIndex = i; } // Decrypt most recent save slot { byte[] slot = new byte[SLOT_SIZE]; int slotOffset = SLOT_START + SaveIndex * SLOT_SIZE; Array.Copy(Data, slotOffset, slot, 0, slot.Length); byte[] digest = new byte[20]; Array.Copy(slot, SLOT_SIZE - 20, digest, 0, digest.Length); // Decrypt Slot Data = DecryptColosseum(slot, digest); } Trainer1 = 0x00078; Party = 0x000A8; OFS_PouchHeldItem = 0x007F8; OFS_PouchKeyItem = 0x00848; OFS_PouchBalls = 0x008F4; OFS_PouchTMHM = 0x00934; OFS_PouchBerry = 0x00A34; OFS_PouchCologne = 0x00AEC; // Cologne Box = 0x00B90; Daycare = 0x08170; Memo = 0x082B0; StrategyMemo = new StrategyMemo(Data, Memo, xd: false); LegalItems = Legal.Pouch_Items_COLO; LegalKeyItems = Legal.Pouch_Key_COLO; LegalBalls = Legal.Pouch_Ball_RS; LegalTMHMs = Legal.Pouch_TM_RS; // not HMs LegalBerries = Legal.Pouch_Berries_RS; LegalCologne = Legal.Pouch_Cologne_CXD; Personal = PersonalTable.RS; HeldItems = Legal.HeldItems_COLO; if (!Exportable) { resetBoxes(); } // Since PartyCount is not stored in the save file, // Count up how many party slots are active. for (int i = 0; i < 6; i++) { if (getPartySlot(getPartyOffset(i)).Species != 0) { PartyCount++; } } }
public SAV2(byte[] data = null) { Data = data == null ? new byte[SaveUtil.SIZE_G2RAW_U] : (byte[])data.Clone(); BAK = (byte[])Data.Clone(); Exportable = !Data.SequenceEqual(new byte[Data.Length]); Version = data == null ? GameVersion.GSC : SaveUtil.getIsG2SAV(Data); if (Version == GameVersion.Invalid) { return; } Japanese = SaveUtil.getIsG2SAVJ(Data) != GameVersion.Invalid; if (Japanese && Data.Length < SaveUtil.SIZE_G2RAW_J) { Array.Resize(ref Data, SaveUtil.SIZE_G2RAW_J); } Box = Data.Length; Array.Resize(ref Data, Data.Length + SIZE_RESERVED); Party = getPartyOffset(0); Personal = Version == GameVersion.GS ? PersonalTable.GS : PersonalTable.C; getSAVOffsets(); LegalItems = Legal.Pouch_Items_GSC; LegalBalls = Legal.Pouch_Ball_GSC; LegalKeyItems = Version == GameVersion.C ? Legal.Pouch_Key_C : Legal.Pouch_Key_GS; LegalTMHMs = Legal.Pouch_TMHM_GSC; HeldItems = Legal.HeldItems_GSC; // Stash boxes after the save file's end. byte[] TempBox = new byte[SIZE_STOREDBOX]; for (int i = 0; i < BoxCount; i++) { if (i < (Japanese ? 6 : 7)) { Array.Copy(Data, 0x4000 + i * (TempBox.Length + 2), TempBox, 0, TempBox.Length); } else { Array.Copy(Data, 0x6000 + (i - (Japanese ? 6 : 7)) * (TempBox.Length + 2), TempBox, 0, TempBox.Length); } PokemonList2 PL2 = new PokemonList2(TempBox, Japanese ? PokemonList2.CapacityType.StoredJP : PokemonList2.CapacityType.Stored, Japanese); for (int j = 0; j < PL2.Pokemon.Length; j++) { if (j < PL2.Count) { byte[] pkDat = new PokemonList2(PL2[j]).GetBytes(); pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + i * SIZE_BOX + j * SIZE_STORED); } else { byte[] pkDat = new byte[PokemonList2.GetDataLength(PokemonList2.CapacityType.Single, Japanese)]; pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + i * SIZE_BOX + j * SIZE_STORED); } } } Array.Copy(Data, CurrentBoxOffset, TempBox, 0, TempBox.Length); PokemonList2 curBoxPL = new PokemonList2(TempBox, Japanese ? PokemonList2.CapacityType.StoredJP : PokemonList2.CapacityType.Stored, Japanese); for (int i = 0; i < curBoxPL.Pokemon.Length; i++) { if (i < curBoxPL.Count) { byte[] pkDat = new PokemonList2(curBoxPL[i]).GetBytes(); pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + CurrentBox * SIZE_BOX + i * SIZE_STORED); } else { byte[] pkDat = new byte[PokemonList2.GetDataLength(PokemonList2.CapacityType.Single, Japanese)]; pkDat.CopyTo(Data, Data.Length - SIZE_RESERVED + CurrentBox * SIZE_BOX + i * SIZE_STORED); } } byte[] TempParty = new byte[PokemonList2.GetDataLength(PokemonList2.CapacityType.Party, Japanese)]; Array.Copy(Data, PartyOffset, TempParty, 0, TempParty.Length); PokemonList2 partyList = new PokemonList2(TempParty, PokemonList2.CapacityType.Party, Japanese); for (int i = 0; i < partyList.Pokemon.Length; i++) { if (i < partyList.Count) { byte[] pkDat = new PokemonList2(partyList[i]).GetBytes(); pkDat.CopyTo(Data, getPartyOffset(i)); } else { byte[] pkDat = new byte[PokemonList2.GetDataLength(PokemonList2.CapacityType.Single, Japanese)]; pkDat.CopyTo(Data, getPartyOffset(i)); } } // Daycare currently undocumented for all Gen II games. // Enable Pokedex editing PokeDex = 0; if (!Exportable) { resetBoxes(); } }