diff --git a/pcsx2/gui/MemoryCardFolder.cpp b/pcsx2/gui/MemoryCardFolder.cpp index 604761e1fe..6278036ae4 100644 --- a/pcsx2/gui/MemoryCardFolder.cpp +++ b/pcsx2/gui/MemoryCardFolder.cpp @@ -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 diff --git a/pcsx2/gui/MemoryCardFolder.h b/pcsx2/gui/MemoryCardFolder.h index ace20d96c3..7408934189 100644 --- a/pcsx2/gui/MemoryCardFolder.h +++ b/pcsx2/gui/MemoryCardFolder.h @@ -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 );