From a611ed3930051c463ed36d36d734b6669b7da1bb Mon Sep 17 00:00:00 2001 From: shenweip Date: Sun, 24 Nov 2013 18:46:24 +0800 Subject: [PATCH] Remount all references in Remount func. --- Core/FileSystems/MetaFileSystem.cpp | 9 ++++++--- Core/FileSystems/MetaFileSystem.h | 2 +- Core/HLE/sceUmd.cpp | 5 +---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 6a7ba635b9..b0417ab6d8 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -255,9 +255,12 @@ void MetaFileSystem::Unmount(std::string prefix, IFileSystem *system) fileSystems.erase(std::remove(fileSystems.begin(), fileSystems.end(), x), fileSystems.end()); } -void MetaFileSystem::Remount(std::string prefix, IFileSystem *oldSystem, IFileSystem *newSystem) { - Unmount(prefix, oldSystem); - Mount(prefix, newSystem); +void MetaFileSystem::Remount(IFileSystem *oldSystem, IFileSystem *newSystem) { + for (auto it = fileSystems.begin(); it != fileSystems.end(); ++it) { + if (it->system == oldSystem) { + it->system = newSystem; + } + } } IFileSystem *MetaFileSystem::GetSystem(const std::string &prefix) { diff --git a/Core/FileSystems/MetaFileSystem.h b/Core/FileSystems/MetaFileSystem.h index 1191f0a1e4..130644e58f 100644 --- a/Core/FileSystems/MetaFileSystem.h +++ b/Core/FileSystems/MetaFileSystem.h @@ -51,7 +51,7 @@ public: void Mount(std::string prefix, IFileSystem *system); void Unmount(std::string prefix, IFileSystem *system); - void Remount(std::string prefix, IFileSystem *oldSystem, IFileSystem *newSystem); + void Remount(IFileSystem *oldSystem, IFileSystem *newSystem); IFileSystem *GetSystem(const std::string &prefix); diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 0d2b7c49a6..20bfed0a3f 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -463,10 +463,7 @@ void __UmdReplace(std::string filepath) { return; umd2 = new ISOFileSystem(&pspFileSystem, bd); - pspFileSystem.Remount("umd0:", currentUMD, umd2); - pspFileSystem.Remount("umd1:", currentUMD, umd2); - pspFileSystem.Remount("disc0:", currentUMD, umd2); - pspFileSystem.Remount("umd:", currentUMD, umd2); + pspFileSystem.Remount(currentUMD, umd2); } delete currentUMD;