diff --git a/PKHeX.Core/Saves/Access/ISaveBlock8LA.cs b/PKHeX.Core/Saves/Access/ISaveBlock8LA.cs
index 5a18fb1e2..432d91e9f 100644
--- a/PKHeX.Core/Saves/Access/ISaveBlock8LA.cs
+++ b/PKHeX.Core/Saves/Access/ISaveBlock8LA.cs
@@ -1,4 +1,4 @@
-namespace PKHeX.Core;
+namespace PKHeX.Core;
///
/// Interface for Accessing named blocks within a Generation 8 save file.
@@ -12,6 +12,6 @@ public interface ISaveBlock8LA
BoxLayout8a BoxLayout { get; }
MyItem8a Items { get; }
Epoch1970Value AdventureStart { get; }
- LastSaved8a LastSaved { get; }
+ Epoch1900DateTimeValue LastSaved { get; }
PlayTime8a Played { get; }
}
diff --git a/PKHeX.Core/Saves/Access/ISaveBlock8Main.cs b/PKHeX.Core/Saves/Access/ISaveBlock8Main.cs
index a82f499cd..5e060aef3 100644
--- a/PKHeX.Core/Saves/Access/ISaveBlock8Main.cs
+++ b/PKHeX.Core/Saves/Access/ISaveBlock8Main.cs
@@ -12,7 +12,7 @@ public interface ISaveBlock8Main
Misc8 Misc { get; }
Zukan8 Zukan { get; }
BoxLayout8 BoxLayout { get; }
- PlayTime8 Played { get; }
+ PlayTime7b Played { get; }
Fused8 Fused { get; }
Daycare8 Daycare { get; }
Record8 Records { get; }
diff --git a/PKHeX.Core/Saves/Access/SaveBlockAccessor8LA.cs b/PKHeX.Core/Saves/Access/SaveBlockAccessor8LA.cs
index 94e3666bf..f3ff34bc2 100644
--- a/PKHeX.Core/Saves/Access/SaveBlockAccessor8LA.cs
+++ b/PKHeX.Core/Saves/Access/SaveBlockAccessor8LA.cs
@@ -15,7 +15,7 @@ public sealed class SaveBlockAccessor8LA(SAV8LA sav) : SCBlockAccessor, ISaveBlo
public MyItem8a Items { get; } = new(sav, Block(sav, KItemRegular));
public Epoch1970Value AdventureStart { get; } = new(Block(sav, KAdventureStart));
public Coordinates8a Coordinates { get; } = new(sav, Block(sav, KCoordinates));
- public LastSaved8a LastSaved { get; } = new(sav, Block(sav, KLastSaved));
+ public Epoch1900DateTimeValue LastSaved { get; } = new(Block(sav, KLastSaved));
public PlayerFashion8a FashionPlayer { get; } = new(sav, Block(sav, KFashionPlayer));
public PlayTime8a Played { get; } = new(sav, Block(sav, KPlayTime));
diff --git a/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs b/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs
index 2349f46f3..f15100175 100644
--- a/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs
+++ b/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs
@@ -18,7 +18,7 @@ public sealed class SaveBlockAccessor8SWSH(SAV8SWSH sav) : SCBlockAccessor, ISav
public Misc8 Misc { get; } = new(sav, Block(sav, KMisc));
public Zukan8 Zukan { get; } = new(sav, Block(sav, KZukan), BlockSafe(sav, KZukanR1), BlockSafe(sav, KZukanR2));
public BoxLayout8 BoxLayout { get; } = new(sav, Block(sav, KBoxLayout));
- public PlayTime8 Played { get; } = new(sav, Block(sav, KPlayTime));
+ public PlayTime7b Played { get; } = new(sav, Block(sav, KPlayTime));
public Fused8 Fused { get; } = new(sav, Block(sav, KFused));
public Daycare8 Daycare { get; } = new(sav, Block(sav, KDaycare));
public Record8 Records { get; } = new(sav, Block(sav, KRecord));
diff --git a/PKHeX.Core/Saves/SAV8LA.cs b/PKHeX.Core/Saves/SAV8LA.cs
index fd6f753a5..a18368f4c 100644
--- a/PKHeX.Core/Saves/SAV8LA.cs
+++ b/PKHeX.Core/Saves/SAV8LA.cs
@@ -8,7 +8,7 @@ namespace PKHeX.Core;
///
public sealed class SAV8LA : SaveFile, ISaveBlock8LA, ISCBlockArray, ISaveFileRevision, IBoxDetailName, IBoxDetailWallpaper
{
- protected internal override string ShortSummary => $"{OT} ({Version}) - {LastSaved.LastSavedTime}";
+ protected internal override string ShortSummary => $"{OT} ({Version}) - {LastSaved.DisplayValue}";
public override string Extension => string.Empty;
public SAV8LA(byte[] data) : this(SwishCrypto.Decrypt(data)) { }
@@ -114,7 +114,7 @@ public sealed class SAV8LA : SaveFile, ISaveBlock8LA, ISCBlockArray, ISaveFileRe
public MyItem8a Items => Blocks.Items;
public Epoch1970Value AdventureStart => Blocks.AdventureStart;
public Coordinates8a Coordinates => Blocks.Coordinates;
- public LastSaved8a LastSaved => Blocks.LastSaved;
+ public Epoch1900DateTimeValue LastSaved => Blocks.LastSaved;
public PlayTime8a Played => Blocks.Played;
public AreaSpawnerSet8a AreaSpawners => new(Blocks.GetBlock(SaveBlockAccessor8LA.KSpawners));
#endregion
diff --git a/PKHeX.Core/Saves/SAV8SWSH.cs b/PKHeX.Core/Saves/SAV8SWSH.cs
index 912094627..009f72906 100644
--- a/PKHeX.Core/Saves/SAV8SWSH.cs
+++ b/PKHeX.Core/Saves/SAV8SWSH.cs
@@ -70,7 +70,7 @@ public sealed class SAV8SWSH : SaveFile, ISaveBlock8SWSH, ITrainerStatRecord, IS
public Misc8 Misc => Blocks.Misc;
public Zukan8 Zukan => Blocks.Zukan;
public BoxLayout8 BoxLayout => Blocks.BoxLayout;
- public PlayTime8 Played => Blocks.Played;
+ public PlayTime7b Played => Blocks.Played;
public Fused8 Fused => Blocks.Fused;
public Daycare8 Daycare => Blocks.Daycare;
public Record8 Records => Blocks.Records;
diff --git a/PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayTime7b.cs b/PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayTime7b.cs
index 68d4fcc1c..f5a4ed7a3 100644
--- a/PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayTime7b.cs
+++ b/PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayTime7b.cs
@@ -3,8 +3,11 @@ using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core;
-public sealed class PlayTime7b(SAV7b sav, Memory raw) : SaveBlock(sav, raw)
+public sealed class PlayTime7b : SaveBlock
{
+ public PlayTime7b(SAV7b sav, Memory raw) : base(sav, raw) { }
+ public PlayTime7b(SAV8SWSH sav, SCBlock block) : base(sav, block.Data) { }
+
public int PlayedHours
{
get => ReadUInt16LittleEndian(Data);
@@ -24,23 +27,19 @@ public sealed class PlayTime7b(SAV7b sav, Memory raw) : SaveBlock(s
}
private Epoch1900DateTimeValue LastSaved => new(Raw.Slice(0x4, 4));
- public string LastSavedTime => $"{LastSaved.Year:0000}-{LastSaved.Month:00}-{LastSaved.Day:00} {LastSaved.Hour:00}ː{LastSaved.Minute:00}"; // not :
+ public string LastSavedTime => LastSaved.DisplayValue;
public DateTime? LastSavedDate
{
get => !DateUtil.IsDateValid(LastSaved.Year, LastSaved.Month, LastSaved.Day)
? null
- : new DateTime(LastSaved.Year, LastSaved.Month, LastSaved.Day, LastSaved.Hour, LastSaved.Minute, 0);
+ : LastSaved.Timestamp;
set
{
// Only update the properties if a value is provided.
if (value is { } dt)
{
- LastSaved.Year = dt.Year;
- LastSaved.Month = dt.Month;
- LastSaved.Day = dt.Day;
- LastSaved.Hour = dt.Hour;
- LastSaved.Minute = dt.Minute;
+ LastSaved.Timestamp = dt;
}
else // Clear the date.
{
diff --git a/PKHeX.Core/Saves/Substructures/Gen8/LA/LastSaved8a.cs b/PKHeX.Core/Saves/Substructures/Gen8/LA/LastSaved8a.cs
deleted file mode 100644
index 6e5aaafca..000000000
--- a/PKHeX.Core/Saves/Substructures/Gen8/LA/LastSaved8a.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-using System.ComponentModel;
-using static System.Buffers.Binary.BinaryPrimitives;
-
-namespace PKHeX.Core;
-
-///
-/// Stores the of the player.
-///
-///
-/// Year value is offset by -1900.
-/// Month value is offset by -1.
-///
-[TypeConverter(typeof(ExpandableObjectConverter))]
-public sealed class LastSaved8a(SAV8LA sav, SCBlock block) : SaveBlock(sav, block.Data)
-{
- private uint LastSaved { get => ReadUInt32LittleEndian(Data); set => WriteUInt32LittleEndian(Data, value); }
- private int LastSavedYear { get => (int)(LastSaved & 0xFFF); set => LastSaved = (LastSaved & 0xFFFFF000) | (uint)value; }
- private int LastSavedMonth { get => (int)((LastSaved >> 12) & 0xF); set => LastSaved = (LastSaved & 0xFFFF0FFF) | (((uint)value & 0xF) << 12); }
- private int LastSavedDay { get => (int)((LastSaved >> 16) & 0x1F); set => LastSaved = (LastSaved & 0xFFE0FFFF) | (((uint)value & 0x1F) << 16); }
- private int LastSavedHour { get => (int)((LastSaved >> 21) & 0x1F); set => LastSaved = (LastSaved & 0xFC1FFFFF) | (((uint)value & 0x1F) << 21); }
- private int LastSavedMinute { get => (int)((LastSaved >> 26) & 0x3F); set => LastSaved = (LastSaved & 0x03FFFFFF) | (((uint)value & 0x3F) << 26); }
- public string LastSavedTime => $"{LastSavedYear+1900:0000}-{LastSavedMonth+1:00}-{LastSavedDay:00} {LastSavedHour:00}ː{LastSavedMinute:00}"; // not :
-
- public DateTime? LastSavedDate
- {
- get => !DateUtil.IsDateValid(LastSavedYear + 1900, LastSavedMonth + 1, LastSavedDay)
- ? null
- : new DateTime(LastSavedYear + 1900, LastSavedMonth + 1, LastSavedDay, LastSavedHour, LastSavedMinute, 0);
- set
- {
- // Only update the properties if a value is provided.
- if (value is { } dt)
- {
- LastSavedYear = dt.Year - 1900;
- LastSavedMonth = dt.Month - 1;
- LastSavedDay = dt.Day;
- LastSavedHour = dt.Hour;
- LastSavedMinute = dt.Minute;
- }
- else // Clear the date.
- {
- // If code tries to access MetDate again, null will be returned.
- LastSavedYear = 0;
- LastSavedMonth = 0;
- LastSavedDay = 0;
- LastSavedHour = 0;
- LastSavedMinute = 0;
- }
- }
- }
-}
diff --git a/PKHeX.Core/Saves/Substructures/Gen8/LA/PlayTime8a.cs b/PKHeX.Core/Saves/Substructures/Gen8/LA/PlayTime8a.cs
index 543d228c9..f33460abf 100644
--- a/PKHeX.Core/Saves/Substructures/Gen8/LA/PlayTime8a.cs
+++ b/PKHeX.Core/Saves/Substructures/Gen8/LA/PlayTime8a.cs
@@ -18,5 +18,5 @@ public sealed class PlayTime8a(SAV8LA sav, SCBlock block) : SaveBlock(sa
public byte PlayedMinutes { get => Data[2]; set => Data[2] = value; }
public byte PlayedSeconds { get => Data[3]; set => Data[3] = value; }
- public string LastSavedTime => $"{PlayedHours:0000}ː{PlayedMinutes:00}ː{PlayedSeconds:00}"; // not :
+ public string PlayedTime => $"{PlayedHours:0000}ː{PlayedMinutes:00}ː{PlayedSeconds:00}"; // not :
}
diff --git a/PKHeX.Core/Saves/Substructures/Gen8/SWSH/PlayTime8.cs b/PKHeX.Core/Saves/Substructures/Gen8/SWSH/PlayTime8.cs
deleted file mode 100644
index 61345907a..000000000
--- a/PKHeX.Core/Saves/Substructures/Gen8/SWSH/PlayTime8.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using static System.Buffers.Binary.BinaryPrimitives;
-
-namespace PKHeX.Core;
-
-public sealed class PlayTime8(SAV8SWSH sav, SCBlock block) : SaveBlock(sav, block.Data)
-{
- public int PlayedHours
- {
- get => ReadUInt16LittleEndian(Data);
- set => WriteUInt16LittleEndian(Data, (ushort)value);
- }
-
- public int PlayedMinutes
- {
- get => Data[2];
- set => Data[2] = (byte)value;
- }
-
- public int PlayedSeconds
- {
- get => Data[3];
- set => Data[3] = (byte)value;
- }
-
- private uint LastSaved { get => ReadUInt32LittleEndian(Data[0x4..]); set => WriteUInt32LittleEndian(Data[0x4..], value); }
- private int LastSavedYear { get => (int)(LastSaved & 0xFFF) + 1900; set => LastSaved = (LastSaved & 0xFFFFF000) | (uint)(value - 1900); }
- private int LastSavedMonth { get => (int)((LastSaved >> 12) & 0xF) + 1; set => LastSaved = (LastSaved & 0xFFFF0FFF) | (((uint)(value - 1) & 0xF) << 12); }
- private int LastSavedDay { get => (int)((LastSaved >> 16) & 0x1F); set => LastSaved = (LastSaved & 0xFFE0FFFF) | (((uint)value & 0x1F) << 16); }
- private int LastSavedHour { get => (int)((LastSaved >> 21) & 0x1F); set => LastSaved = (LastSaved & 0xFC1FFFFF) | (((uint)value & 0x1F) << 21); }
- private int LastSavedMinute { get => (int)((LastSaved >> 26) & 0x3F); set => LastSaved = (LastSaved & 0x03FFFFFF) | (((uint)value & 0x3F) << 26); }
- public string LastSavedTime => $"{LastSavedYear:0000}-{LastSavedMonth:00}-{LastSavedDay:00} {LastSavedHour:00}ː{LastSavedMinute:00}"; // not :
-
- public DateTime? LastSavedDate
- {
- get => !DateUtil.IsDateValid(LastSavedYear, LastSavedMonth, LastSavedDay)
- ? null
- : new DateTime(LastSavedYear, LastSavedMonth, LastSavedDay, LastSavedHour, LastSavedMinute, 0);
- set
- {
- // Only update the properties if a value is provided.
- if (value is { } dt)
- {
- LastSavedYear = dt.Year;
- LastSavedMonth = dt.Month;
- LastSavedDay = dt.Day;
- LastSavedHour = dt.Hour;
- LastSavedMinute = dt.Minute;
- }
- else // Clear the date.
- {
- // If code tries to access MetDate again, null will be returned.
- LastSavedYear = 0;
- LastSavedMonth = 0;
- LastSavedDay = 0;
- LastSavedHour = 0;
- LastSavedMinute = 0;
- }
- }
- }
-}
diff --git a/PKHeX.Core/Saves/Substructures/Time/Epoch1900DateTimeValue.cs b/PKHeX.Core/Saves/Substructures/Time/Epoch1900DateTimeValue.cs
index c0ba0b462..565862627 100644
--- a/PKHeX.Core/Saves/Substructures/Time/Epoch1900DateTimeValue.cs
+++ b/PKHeX.Core/Saves/Substructures/Time/Epoch1900DateTimeValue.cs
@@ -46,7 +46,7 @@ public sealed class Epoch1900DateTimeValue(Memory Data)
}
}
- public string DisplayValue => $"{Timestamp.Year:0000}-{Timestamp.Month:00}-{Timestamp.Day:00} {Timestamp.Hour:00}ː{Timestamp.Minute:00}ː{Timestamp.Second:00}"; // not :
+ public string DisplayValue => $"{Timestamp.Year:0000}-{Timestamp.Month:00}-{Timestamp.Day:00} {Timestamp.Hour:00}ː{Timestamp.Minute:00}" + (HasSeconds ? $"ː{Timestamp.Second:00}" : ""); // not :
///
/// time_t (seconds since 1900 Epoch)
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8a.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8a.cs
index 3d6263488..fc946d1ee 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8a.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8a.cs
@@ -62,11 +62,7 @@ public partial class SAV_Trainer8a : Form
MT_Minutes.Text = SAV.PlayedMinutes.ToString();
MT_Seconds.Text = SAV.PlayedSeconds.ToString();
- if (SAV.LastSaved.LastSavedDate is { } d)
- CAL_LastSavedDate.Value = CAL_LastSavedTime.Value = d;
- else
- CAL_LastSavedDate.Enabled = CAL_LastSavedTime.Enabled = false;
-
+ CAL_LastSavedDate.Value = CAL_LastSavedTime.Value = SAV.LastSaved.Timestamp;
CAL_AdventureStartDate.Value = CAL_AdventureStartTime.Value = SAV.AdventureStart.Timestamp;
LoadClamp(NUD_MeritCurrent, SaveBlockAccessor8LA.KMeritCurrent);
@@ -115,8 +111,7 @@ public partial class SAV_Trainer8a : Form
var advDay = CAL_AdventureStartDate.Value.Date;
SAV.AdventureStart.Timestamp = advDay.AddSeconds(CAL_AdventureStartTime.Value.TimeOfDay.TotalSeconds);
- if (CAL_LastSavedDate.Enabled)
- SAV.LastSaved.LastSavedDate = CAL_LastSavedDate.Value.Date.AddSeconds(CAL_LastSavedTime.Value.TimeOfDay.TotalSeconds);
+ SAV.LastSaved.Timestamp = CAL_LastSavedDate.Value.Date.AddSeconds(CAL_LastSavedTime.Value.TimeOfDay.TotalSeconds);
SAV.Blocks.SetBlockValue(SaveBlockAccessor8LA.KMeritCurrent, (uint)NUD_MeritCurrent.Value);
SAV.Blocks.SetBlockValue(SaveBlockAccessor8LA.KMeritEarnedTotal, (uint)NUD_MeritEarned.Value);