From a2fb9c48ebd9e5c28ecb9c5e62f449c84dc43b1a Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 1 Nov 2020 17:55:52 -0800 Subject: [PATCH] Add fused calyrex block --- PKHeX.Core/Editing/Saves/Slots/Extensions.cs | 11 ++++++++++- PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs | 1 + PKHeX.Core/Saves/Substructures/Gen8/Fused8.cs | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Editing/Saves/Slots/Extensions.cs b/PKHeX.Core/Editing/Saves/Slots/Extensions.cs index b691d2cbb..234f476a2 100644 --- a/PKHeX.Core/Editing/Saves/Slots/Extensions.cs +++ b/PKHeX.Core/Editing/Saves/Slots/Extensions.cs @@ -162,7 +162,7 @@ private static List GetExtraSlots8(ISaveBlock8Main sav) { var fused = sav.Fused; var dc = sav.Daycare; - return new List + var list = new List { new SlotInfoMisc(fused.Data, 0, Fused8.GetFusedSlotOffset(0), true) {Type = StorageSlotType.Fused}, new SlotInfoMisc(fused.Data, 0, Fused8.GetFusedSlotOffset(1), true) {Type = StorageSlotType.Fused}, @@ -173,6 +173,15 @@ private static List GetExtraSlots8(ISaveBlock8Main sav) new SlotInfoMisc(dc.Data, 0, Daycare8.GetDaycareSlotOffset(1, 0)) {Type = StorageSlotType.Daycare}, new SlotInfoMisc(dc.Data, 0, Daycare8.GetDaycareSlotOffset(1, 1)) {Type = StorageSlotType.Daycare}, }; + + if (sav is SAV8SWSH s8 && s8.SaveRevision >= 2) + { + var block = s8.Blocks.GetBlockSafe(SaveBlockAccessor8SWSH.KFusedCalyrex); + var c = new SlotInfoMisc(block.Data, 0, 0, true) {Type = StorageSlotType.Fused}; + list.Insert(3, c); + } + + return list; } } } diff --git a/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs b/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs index dcb516872..9445e89ea 100644 --- a/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs +++ b/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs @@ -78,6 +78,7 @@ public SaveBlockAccessor8SWSH(SAV8SWSH sav) private const uint KRaidSpawnListR1 = 0x158DA896; // Raid Data for DLC1 private const uint KRaidSpawnListR2 = 0x148DA703; // Raid Data for DLC2 private const uint KFused = 0xc0de5c5f; // Fused PKM (*3) + public const uint KFusedCalyrex = 0xC37F267B; // Fused Horse private const uint KFashionUnlock = 0xd224f9ac; // Fashion unlock bool array (owned for (each apparel type) * 0x80, then another array for "new") private const uint KTitleScreenTeam = 0xE9BE28BF; // Title Screen Team details public const uint KEnteredHallOfFame = 0xE2F6E456; // U64 Unix Timestamp diff --git a/PKHeX.Core/Saves/Substructures/Gen8/Fused8.cs b/PKHeX.Core/Saves/Substructures/Gen8/Fused8.cs index 6161d1ab3..45bdbcf7b 100644 --- a/PKHeX.Core/Saves/Substructures/Gen8/Fused8.cs +++ b/PKHeX.Core/Saves/Substructures/Gen8/Fused8.cs @@ -1,7 +1,7 @@ namespace PKHeX.Core { /// - /// Storage for the species that was fused into , , . + /// Storage for the species that was fused into and . /// public sealed class Fused8 : SaveBlock { @@ -20,13 +20,13 @@ public PK8 Kyurem set => value.EncryptedBoxData.CopyTo(Data, GetFusedSlotOffset(0)); } - public PK8 Necrozma + public PK8 NecrozmaSolgaleo { get => (PK8)SAV.GetStoredSlot(Data, GetFusedSlotOffset(1)); set => value.EncryptedBoxData.CopyTo(Data, GetFusedSlotOffset(1)); } - public PK8 Calyrex + public PK8 NecrozmaLunala { get => (PK8)SAV.GetStoredSlot(Data, GetFusedSlotOffset(2)); set => value.EncryptedBoxData.CopyTo(Data, GetFusedSlotOffset(2));