diff --git a/PKHeX.Core/Saves/Encryption/SwishCrypto/SCBlock.cs b/PKHeX.Core/Saves/Encryption/SwishCrypto/SCBlock.cs
index f4e9ba826..00ff5218c 100644
--- a/PKHeX.Core/Saves/Encryption/SwishCrypto/SCBlock.cs
+++ b/PKHeX.Core/Saves/Encryption/SwishCrypto/SCBlock.cs
@@ -45,6 +45,31 @@ public void ChangeBooleanType(SCTypeCode value)
Type = value;
}
+ ///
+ /// Changes the block's data type. Use with caution.
+ ///
+ /// New data type to set.
+ /// Will throw if the requested block state changes are incorrect.
+ public void ChangeStoredType(SCTypeCode value)
+ {
+ var noData = Data.Length == 0;
+ var isBoolean = value is SCTypeCode.Bool1 or SCTypeCode.Bool2;
+ if (noData != isBoolean)
+ throw new InvalidOperationException($"Cannot change {Type} to {value}.");
+
+ if (value is SCTypeCode.Array)
+ {
+
+ }
+ else if (!isBoolean)
+ {
+ var size = value.GetTypeSize();
+ if (Data.Length != size)
+ throw new InvalidOperationException($"Cannot change {Type} to {value}.");
+ }
+ Type = value;
+ }
+
///
/// Replaces the current with a same-sized array .
///
diff --git a/PKHeX.Core/Saves/SAV9ZA.cs b/PKHeX.Core/Saves/SAV9ZA.cs
index 28b14bbb8..093d6ff54 100644
--- a/PKHeX.Core/Saves/SAV9ZA.cs
+++ b/PKHeX.Core/Saves/SAV9ZA.cs
@@ -21,7 +21,11 @@ public SAV9ZA()
{
AllBlocks = BlankBlocks9a.GetBlankBlocks();
Blocks = new SaveBlockAccessor9ZA(this);
- SaveRevision = BlankBlocks9a.BlankRevision;
+
+ var revision = Blocks.GetBlock(SaveBlockAccessor9ZA.KSaveRevision);
+ revision.ChangeStoredType(SCTypeCode.UInt64);
+ revision.SetValue((ulong)BlankBlocks9a.BlankRevision);
+
Initialize();
ClearBoxes();
}
@@ -38,11 +42,7 @@ public override void CopyChangesFrom(SaveFile sav)
}
- public int SaveRevision
- {
- get => (int)GetValue(SaveBlockAccessor9ZA.KSaveRevision);
- private init => SetValue(SaveBlockAccessor9ZA.KSaveRevision, (ulong)value);
- }
+ public int SaveRevision => (int)GetValue(SaveBlockAccessor9ZA.KSaveRevision);
public string SaveRevisionString => SaveRevision switch
{