From f65e0a96a7eb3e60c64e169f7835add9982cdfa1 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 27 Dec 2019 18:30:39 -0800 Subject: [PATCH] repoint sav4 event constant reads should work fine now --- PKHeX.Core/Saves/SAV4.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index 8281ca676..1e5257c6e 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -954,6 +954,32 @@ public override byte[] SetString(string value, int maxLength, int PadToSize = 0, return StringConverter4.SetString4(value, maxLength, PadToSize, PadWith); } + + /// All Event Constant values for the savegame + public override ushort[] EventConsts + { + get + { + if (EventConstMax <= 0) + return Array.Empty(); + + ushort[] Constants = new ushort[EventConstMax]; + for (int i = 0; i < Constants.Length; i++) + Constants[i] = BitConverter.ToUInt16(General, EventConst + (i * 2)); + return Constants; + } + set + { + if (EventConstMax <= 0) + return; + if (value.Length != EventConstMax) + return; + + for (int i = 0; i < value.Length; i++) + BitConverter.GetBytes(value[i]).CopyTo(General, EventConst + (i * 2)); + } + } + // Seals private const byte SealMaxCount = 99; public byte[] SealCase { get => General.Slice(Seal, (int) Seal4.MAX); set => SetData(General, value, Seal); }