diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 6497f7b90..720a63ddd 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -32,7 +32,7 @@ public abstract class SaveFile : ITrainerInfo, IGameValueLimit, IBoxDetailWallpa public SaveFile Clone() { var sav = CloneInternal(); - sav.Metadata = Metadata; + sav.Metadata = Metadata with {SAV = sav}; return sav; } diff --git a/PKHeX.Core/Saves/SaveFileMetadata.cs b/PKHeX.Core/Saves/SaveFileMetadata.cs index ddd6ed69a..be0ff0a43 100644 --- a/PKHeX.Core/Saves/SaveFileMetadata.cs +++ b/PKHeX.Core/Saves/SaveFileMetadata.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; namespace PKHeX.Core; @@ -6,10 +6,9 @@ namespace PKHeX.Core; /// /// Tracks information about where the originated from, and provides logic for saving to a file. /// -public sealed class SaveFileMetadata +public sealed record SaveFileMetadata(SaveFile SAV) { - private readonly SaveFile SAV; - public SaveFileMetadata(SaveFile sav) => SAV = sav; + public SaveFile SAV { private get; init; } = SAV; /// /// Full path where the originated from. diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index d28c6ed14..e7010c93a 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -738,6 +738,7 @@ public partial class Main : Form PKME_Tabs.Focus(); // flush any pending changes StoreLegalSaveGameData(sav); + ParseSettings.InitFromSaveFileData(sav); // physical GB, no longer used in logic RecentTrainerCache.SetRecentTrainer(sav); SpriteUtil.Initialize(sav); // refresh sprite generator dragout.Size = new Size(SpriteUtil.Spriter.Width, SpriteUtil.Spriter.Height); @@ -877,8 +878,6 @@ public partial class Main : Form private static bool SanityCheckSAV(ref SaveFile sav) { - ParseSettings.InitFromSaveFileData(sav); // physical GB, no longer used in logic - if (sav.State.Exportable && sav is SAV3 s3) { if (ModifierKeys == Keys.Control || s3.IsCorruptPokedexFF())