From c80309ee1ad6116cb76c5ee557e0b203c2a3be0f Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Wed, 1 May 2013 11:28:02 -0700 Subject: [PATCH] GCMemcard: Initialize the current/previous DIR BAT pointers when creating a new memory card fixes issue 6288 --- Source/Core/Core/Src/HW/GCMemcard.cpp | 8 +++++++- Source/Core/Core/Src/HW/GCMemcard.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/HW/GCMemcard.cpp b/Source/Core/Core/Src/HW/GCMemcard.cpp index a13cdb4a2c..c51d3221e3 100644 --- a/Source/Core/Core/Src/HW/GCMemcard.cpp +++ b/Source/Core/Core/Src/HW/GCMemcard.cpp @@ -215,7 +215,12 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis) } mcdFile.Close(); + + initDirBatPointers(); +} +void GCMemcard::initDirBatPointers() +{ if (BE16(dir.UpdateCounter) > (BE16(dir_backup.UpdateCounter))) { CurrentDir = &dir; @@ -1273,7 +1278,8 @@ bool GCMemcard::Format(bool sjis, u16 SizeMb) GCMBlock b; mc_data_blocks.push_back(b); } - + + initDirBatPointers(); m_valid = true; return Save(); diff --git a/Source/Core/Core/Src/HW/GCMemcard.h b/Source/Core/Core/Src/HW/GCMemcard.h index a25d8daacb..215402dd10 100644 --- a/Source/Core/Core/Src/HW/GCMemcard.h +++ b/Source/Core/Core/Src/HW/GCMemcard.h @@ -171,6 +171,7 @@ private: u32 ImportGciInternal(FILE* gcih, const char *inputFile, const std::string &outputFile); static void FormatInternal(GCMC_Header &GCP); + void initDirBatPointers() ; public: GCMemcard(const char* fileName, bool forceCreation=false, bool sjis=false);