FolderMemoryCard: Be a bit more paranoid regarding metadata writes and don't allow a flush to assume that a previous flush has already written the metadata of a file.

This commit is contained in:
Admiral H. Curtiss 2015-11-17 22:16:01 +01:00
parent 25064e86b8
commit 5865c030cb
2 changed files with 8 additions and 0 deletions

View File

@ -904,6 +904,7 @@ void FolderMemoryCard::Flush() {
}
m_lastAccessedFile.FlushAll();
m_lastAccessedFile.ClearMetadataWriteState();
m_oldDataCache.clear();
const u64 timeFlushEnd = wxGetLocalTimeMillis().GetValue();
@ -1518,6 +1519,10 @@ void FileAccessHelper::FlushAll() {
}
}
void FileAccessHelper::ClearMetadataWriteState() {
m_lastWrittenFileRef = nullptr;
}
bool FileAccessHelper::CleanMemcardFilename( char* name ) {
// invalid characters for filenames in the PS2 file system: { '/', '?', '*' }
// the following characters are valid in a PS2 memcard file system but invalid in Windows

View File

@ -229,6 +229,9 @@ public:
// Flush the written data of all open files to the file system
void FlushAll();
// Force metadata to be written on next file access, not sure if this is necessary but it can't hurt.
void ClearMetadataWriteState();
// removes characters from a PS2 file name that would be illegal in a Windows file system
// returns true if any changes were made
static bool CleanMemcardFilename( char* name );