Specify binary mode when reopening card file

This commit is contained in:
Jack Andersen 2017-02-03 22:19:36 -10:00
parent 537cceca49
commit bb972f8f36
2 changed files with 7 additions and 2 deletions

View File

@ -524,6 +524,11 @@ public:
*/
void close();
/**
* @brief Access host filename of card
*/
const SystemString& cardFilename() const { return m_filename; }
/**
* @brief Gets card-scope error state
* @return READY, BROKEN, or NOCARD

View File

@ -117,7 +117,7 @@ Card::Card(const SystemString& filename, const char* game, const char* maker) :
/* Close and reopen in read/write mode */
fclose(m_fileHandle);
m_fileHandle = Fopen(m_filename.c_str(), _S("r+"));
m_fileHandle = Fopen(m_filename.c_str(), _S("r+b"));
rewind(m_fileHandle);
}
}
@ -949,7 +949,7 @@ void Card::format(ECardSlot id, ECardSize size, EEncoding encoding)
memset(data.get(), 0xFF, dataLen);
fwrite(data.get(), 1, dataLen, m_fileHandle);
fclose(m_fileHandle);
m_fileHandle = Fopen(m_filename.c_str(), _S("r+"));
m_fileHandle = Fopen(m_filename.c_str(), _S("r+b"));
}
}