Add batrev as a blank sav option via code

This commit is contained in:
Kurt
2021-03-16 18:49:27 -07:00
parent 98a80b4bf1
commit 3b344bd5c3
2 changed files with 7 additions and 2 deletions

View File

@@ -31,9 +31,12 @@ private void InitializeData(byte[] data)
Data = DecryptPBRSaveData(data);
// Detect active save
SaveCount = Math.Max(BigEndian.ToUInt32(Data, 0x1C004C), BigEndian.ToUInt32(Data, 0x4C));
if (BigEndian.ToUInt32(Data, 0x1C004C) > BigEndian.ToUInt32(Data, 0x4C))
var first = BigEndian.ToUInt32(Data, 0x00004C);
var second = BigEndian.ToUInt32(Data, 0x1C004C);
SaveCount = Math.Max(second, first);
if (second > first)
{
// swap halves
byte[] tempData = new byte[0x1C0000];
Array.Copy(Data, 0, tempData, 0, 0x1C0000);
Array.Copy(Data, 0x1C0000, Data, 0, 0x1C0000);
@@ -57,6 +60,7 @@ private void InitializeData(byte[] data)
CurrentSlot = _currentSlot;
}
/// <summary> Amount of times the primary save has been saved </summary>
private uint SaveCount;
protected override byte[] GetFinalData()

View File

@@ -727,6 +727,7 @@ public static SaveFile GetBlankSAV(GameVersion game, string trainerName, Languag
D or P or DP => new SAV4DP(),
Pt or DPPt => new SAV4Pt(),
HG or SS or HGSS => new SAV4HGSS(),
BATREV => new SAV4BR(),
B or W or BW => new SAV5BW(),
B2 or W2 or B2W2 => new SAV5B2W2(),