Misc tweaks

No noticeable change besides correctly indicating N's Pokemon in hover text (instead of Dream Radar)
This commit is contained in:
Kurt
2024-05-05 15:33:30 -05:00
parent 004795b329
commit e72ff1a899
6 changed files with 23 additions and 19 deletions

View File

@@ -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;

View File

@@ -6,7 +6,7 @@ namespace PKHeX.Core;
/// <summary>
/// Generation 6 savedata object that stores the player's trainer data.
/// </summary>
public class MyStatus6(SAV6 sav, Memory<byte> raw) : SaveBlock<SAV6>(sav, raw), IRegionOrigin
public class MyStatus6(SAV6 sav, Memory<byte> raw) : SaveBlock<SAV6>(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<byte> dest = Data.Slice(8, GameSyncIDSize / 2);
dest.Clear();
Util.GetBytesFromHexString(value, dest);
}
}

View File

@@ -60,6 +60,8 @@ private static bool ReadTrainer(List<string> result, ReadOnlySpan<byte> 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;

View File

@@ -3,7 +3,7 @@
namespace PKHeX.Core;
public sealed class MyStatus7b(SAV7b sav, Memory<byte> raw) : SaveBlock<SAV7b>(sav, raw)
public sealed class MyStatus7b(SAV7b sav, Memory<byte> raw) : SaveBlock<SAV7b>(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<byte> dest = Data.Slice(0x10, GameSyncIDSize / 2);
dest.Clear();
Util.GetBytesFromHexString(value, dest);
}
}

View File

@@ -3,10 +3,11 @@
namespace PKHeX.Core;
public sealed class MyStatus7(SAV7 sav, Memory<byte> raw) : SaveBlock<SAV7>(sav, raw), IRegionOrigin
public sealed class MyStatus7(SAV7 sav, Memory<byte> raw) : SaveBlock<SAV7>(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<byte> 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<byte> dest = Data.Slice(0x18, GameSyncIDSize / 2);
dest.Clear();
Util.GetBytesFromHexString(value, dest);
}
}

View File

@@ -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<byte>(0) && !LastData.SequenceEqual(CurrentPKM.Data);
private readonly MoveChoice[] Moves;
private readonly ComboBox[] Relearn;