From f53eb4ae0d6e3a828a1e4e4132b1bd6d4ab96dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 27 Jul 2021 22:55:02 +0200 Subject: [PATCH] Fix silly filesystem mounting bug introduced in #14638 Fixes #14650. --- Core/FileSystems/MetaFileSystem.cpp | 9 +++++++++ Core/FileSystems/MetaFileSystem.h | 1 + Core/HLE/sceIo.cpp | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index b8ebc9238e..6ecd36226c 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -298,6 +298,15 @@ void MetaFileSystem::UnmountAll() { currentDir.clear(); } +void MetaFileSystem::Unmount(std::string prefix) { + for (auto iter = fileSystems.begin(); iter != fileSystems.end(); iter++) { + if (iter->prefix == prefix) { + fileSystems.erase(iter); + return; + } + } +} + bool MetaFileSystem::Remount(std::string prefix, std::shared_ptr system) { std::lock_guard guard(lock); for (auto &it : fileSystems) { diff --git a/Core/FileSystems/MetaFileSystem.h b/Core/FileSystems/MetaFileSystem.h index 84ea60a44a..f980fc1900 100644 --- a/Core/FileSystems/MetaFileSystem.h +++ b/Core/FileSystems/MetaFileSystem.h @@ -62,6 +62,7 @@ public: bool Remount(std::string prefix, std::shared_ptr system); void UnmountAll(); + void Unmount(std::string prefix); // The pointer returned from these are for temporary usage only. Do not store. IFileSystem *GetSystem(const std::string &prefix); diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 3b99c2d2d3..c856794110 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -775,7 +775,12 @@ void __IoShutdown() { } asyncDefaultPriority = -1; - pspFileSystem.UnmountAll(); + pspFileSystem.Unmount("ms0:"); + pspFileSystem.Unmount("fatms0:"); + pspFileSystem.Unmount("fatms:"); + pspFileSystem.Unmount("pfat0:"); + pspFileSystem.Unmount("flash0:"); + pspFileSystem.Unmount("exdata0:"); MemoryStick_Shutdown(); memStickCallbacks.clear();