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

@ -216,6 +216,11 @@ 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;
@ -1274,6 +1279,7 @@ bool GCMemcard::Format(bool sjis, u16 SizeMb)
mc_data_blocks.push_back(b);
}
initDirBatPointers();
m_valid = true;
return Save();

View File

@ -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);