GCMemcard: Initialize the current/previous DIR BAT pointers when creating a new memory card fixes issue 6288

This commit is contained in:
LPFaint99 2013-05-01 11:28:02 -07:00
parent 8bcd9a74c8
commit c80309ee1a
2 changed files with 8 additions and 1 deletions

View File

@ -215,7 +215,12 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
} }
mcdFile.Close(); mcdFile.Close();
initDirBatPointers();
}
void GCMemcard::initDirBatPointers()
{
if (BE16(dir.UpdateCounter) > (BE16(dir_backup.UpdateCounter))) if (BE16(dir.UpdateCounter) > (BE16(dir_backup.UpdateCounter)))
{ {
CurrentDir = &dir; CurrentDir = &dir;
@ -1273,7 +1278,8 @@ bool GCMemcard::Format(bool sjis, u16 SizeMb)
GCMBlock b; GCMBlock b;
mc_data_blocks.push_back(b); mc_data_blocks.push_back(b);
} }
initDirBatPointers();
m_valid = true; m_valid = true;
return Save(); return Save();

View File

@ -171,6 +171,7 @@ private:
u32 ImportGciInternal(FILE* gcih, const char *inputFile, const std::string &outputFile); u32 ImportGciInternal(FILE* gcih, const char *inputFile, const std::string &outputFile);
static void FormatInternal(GCMC_Header &GCP); static void FormatInternal(GCMC_Header &GCP);
void initDirBatPointers() ;
public: public:
GCMemcard(const char* fileName, bool forceCreation=false, bool sjis=false); GCMemcard(const char* fileName, bool forceCreation=false, bool sjis=false);