diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen5/EncounterStatic5N.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen5/EncounterStatic5N.cs index f0310901d..ee748f131 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen5/EncounterStatic5N.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen5/EncounterStatic5N.cs @@ -30,7 +30,7 @@ public sealed record EncounterStatic5N(uint PID) public required Nature Nature { get; init; } public required AbilityPermission Ability { get; init; } - public string Name => "Dream Radar Encounter"; + public string Name => "N's Pokémon"; public string LongName => Name; public byte LevelMin => Level; public byte LevelMax => Level; diff --git a/PKHeX.Core/Saves/Substructures/Gen6/MyStatus6.cs b/PKHeX.Core/Saves/Substructures/Gen6/MyStatus6.cs index d6f1ebc7c..d365e7f9d 100644 --- a/PKHeX.Core/Saves/Substructures/Gen6/MyStatus6.cs +++ b/PKHeX.Core/Saves/Substructures/Gen6/MyStatus6.cs @@ -6,7 +6,7 @@ namespace PKHeX.Core; /// /// Generation 6 savedata object that stores the player's trainer data. /// -public class MyStatus6(SAV6 sav, Memory raw) : SaveBlock(sav, raw), IRegionOrigin +public class MyStatus6(SAV6 sav, Memory raw) : SaveBlock(sav, raw), IRegionOrigin, IGameSync { public uint ID32 { @@ -51,17 +51,17 @@ public int MultiplayerSpriteID_2 } public const int GameSyncIDSize = 16; // 64 bits + int IGameSync.GameSyncIDSize => GameSyncIDSize; public string GameSyncID { get => Util.GetHexStringFromBytes(Data.Slice(0x08, GameSyncIDSize / 2)); set { - if (value.Length != GameSyncIDSize) - throw new ArgumentOutOfRangeException(nameof(value)); - - var data = Util.GetBytesFromHexString(value); - SAV.SetData(Data[0x8..], data); + ArgumentOutOfRangeException.ThrowIfNotEqual(value.Length, GameSyncIDSize); + Span dest = Data.Slice(8, GameSyncIDSize / 2); + dest.Clear(); + Util.GetBytesFromHexString(value, dest); } } diff --git a/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs b/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs index 54b6ce2e7..d983e884e 100644 --- a/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs +++ b/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs @@ -60,6 +60,8 @@ private static bool ReadTrainer(List result, ReadOnlySpan data) // uint unk4 = ReadUInt16LittleEndian(data[0x54..]); byte regionID = data[0x56]; byte countryID = data[0x57]; + // byte birthMonth = data[0x58]; + // byte birthDay = data[0x59]; var game = (GameVersion)data[0x5A]; // ulong outfit = ReadUInt64LittleEndian(data.AsSpan(ofs + 0x5C)); int favpkm = ReadUInt16LittleEndian(data[0x9C..]) & 0x7FF; diff --git a/PKHeX.Core/Saves/Substructures/Gen7/LGPE/MyStatus7b.cs b/PKHeX.Core/Saves/Substructures/Gen7/LGPE/MyStatus7b.cs index f1025377a..4109e7331 100644 --- a/PKHeX.Core/Saves/Substructures/Gen7/LGPE/MyStatus7b.cs +++ b/PKHeX.Core/Saves/Substructures/Gen7/LGPE/MyStatus7b.cs @@ -3,7 +3,7 @@ namespace PKHeX.Core; -public sealed class MyStatus7b(SAV7b sav, Memory raw) : SaveBlock(sav, raw) +public sealed class MyStatus7b(SAV7b sav, Memory raw) : SaveBlock(sav, raw), IGameSync { // Player Information @@ -40,6 +40,7 @@ public byte Gender } public const int GameSyncIDSize = 16; // 8 bytes + int IGameSync.GameSyncIDSize => GameSyncIDSize; public string GameSyncID { @@ -47,9 +48,9 @@ public string GameSyncID set { ArgumentOutOfRangeException.ThrowIfGreaterThan(value.Length, 16); - - var data = Util.GetBytesFromHexString(value); - SAV.SetData(Data[0x10..], data); + Span dest = Data.Slice(0x10, GameSyncIDSize / 2); + dest.Clear(); + Util.GetBytesFromHexString(value, dest); } } diff --git a/PKHeX.Core/Saves/Substructures/Gen7/MyStatus7.cs b/PKHeX.Core/Saves/Substructures/Gen7/MyStatus7.cs index 99c4cb446..344b0a26f 100644 --- a/PKHeX.Core/Saves/Substructures/Gen7/MyStatus7.cs +++ b/PKHeX.Core/Saves/Substructures/Gen7/MyStatus7.cs @@ -3,10 +3,11 @@ namespace PKHeX.Core; -public sealed class MyStatus7(SAV7 sav, Memory raw) : SaveBlock(sav, raw), IRegionOrigin +public sealed class MyStatus7(SAV7 sav, Memory raw) : SaveBlock(sav, raw), IRegionOrigin, IGameSync { public const int GameSyncIDSize = 16; // 64 bits public const int NexUniqueIDSize = 32; // 128 bits + int IGameSync.GameSyncIDSize => GameSyncIDSize; public uint ID32 { @@ -44,9 +45,9 @@ public string GameSyncID set { ArgumentOutOfRangeException.ThrowIfNotEqual(value.Length, GameSyncIDSize); - - var data = Util.GetBytesFromHexString(value); - SAV.SetData(Data[0x10..], data); + Span dest = Data.Slice(0x10, GameSyncIDSize / 2); + dest.Clear(); + Util.GetBytesFromHexString(value, dest); } } @@ -56,9 +57,9 @@ public string NexUniqueID set { ArgumentOutOfRangeException.ThrowIfNotEqual(value.Length, NexUniqueIDSize); - - var data = Util.GetBytesFromHexString(value); - SAV.SetData(Data[0x18..], data); + Span dest = Data.Slice(0x18, GameSyncIDSize / 2); + dest.Clear(); + Util.GetBytesFromHexString(value, dest); } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index be49edc82..f1fac39e2 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -188,7 +188,7 @@ public bool HideSecretValues private readonly PictureBox[] relearnPB; public SaveFile RequestSaveFile => SaveFileRequested.Invoke(this, EventArgs.Empty); - public bool PKMIsUnsaved => FieldsLoaded && LastData.Any(b => b != 0) && !LastData.SequenceEqual(CurrentPKM.Data); + public bool PKMIsUnsaved => FieldsLoaded && LastData.AsSpan().ContainsAnyExcept(0) && !LastData.SequenceEqual(CurrentPKM.Data); private readonly MoveChoice[] Moves; private readonly ComboBox[] Relearn;