From edc9bb7046e1a5fb0b9f665ee1e10e06eb8c77d7 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Mon, 4 Jul 2016 23:52:37 -0700 Subject: [PATCH] Fix SAV3 party & info loading forgot 0x1000 --- Saves/SAV3.cs | 13 +++++-------- Saves/SaveFile.cs | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Saves/SAV3.cs b/Saves/SAV3.cs index 0d1eef9a9..c1b2ee61b 100644 --- a/Saves/SAV3.cs +++ b/Saves/SAV3.cs @@ -53,11 +53,7 @@ public SAV3(byte[] data = null, GameVersion versionOverride = GameVersion.Any) for (int i = 0; i < 14; i++) BlockOrder[i] = BitConverter.ToInt16(Data, ABO + i*0x1000 + 0xFF4); for (int i = 0; i < 14; i++) - BlockOfs[i] = Array.IndexOf(BlockOrder, i) + ABO; - - // Detect RS/E/FRLG - // Section 0 stores Game Code @ 0x00AC; 0 for RS, 1 for FRLG, else for Emerald - + BlockOfs[i] = Array.IndexOf(BlockOrder, i)*0x1000 + ABO; // Set up PC data buffer beyond end of save file. Box = Data.Length; @@ -113,11 +109,10 @@ public SAV3(byte[] data = null, GameVersion versionOverride = GameVersion.Any) resetBoxes(); } - private readonly int[] BlockOfs; - private readonly int ActiveSAV; private int ABO => ActiveSAV*0xE000; private readonly int[] BlockOrder; + private readonly int[] BlockOfs; // Configuration public override SaveFile Clone() { return new SAV3(Data.Take(Box).ToArray(), Version); } @@ -140,7 +135,9 @@ public SAV3(byte[] data = null, GameVersion versionOverride = GameVersion.Any) protected override int GiftCountMax => 1; public override int OTLength => 8; public override int NickLength => 10; - + + public override bool HasParty => true; + // Checksums protected override void setChecksums() { diff --git a/Saves/SaveFile.cs b/Saves/SaveFile.cs index 62e4dcf57..8f0d36abe 100644 --- a/Saves/SaveFile.cs +++ b/Saves/SaveFile.cs @@ -68,7 +68,7 @@ public byte[] Write(bool DSV) public bool HasOPower => OPower > -1; public bool HasJPEG => JPEGData != null; public bool HasBox => Box > -1; - public bool HasParty => Party > -1; + public virtual bool HasParty => Party > -1; public bool HasBattleBox => BattleBox > -1; public bool HasFused => Fused > -1; public bool HasGTS => GTS > -1;