Sfoglia il codice sorgente

Merge pull request #10594 from liamwhite/double-patch

fsp-srv: avoid patching romfs multiple times
bunnei 3 anni fa
parent
commit
e6fce1cbbd
1 ha cambiato i file con 12 aggiunte e 8 eliminazioni
  1. 12 8
      src/core/hle/service/filesystem/fsp_srv.cpp

+ 12 - 8
src/core/hle/service/filesystem/fsp_srv.cpp

@@ -968,16 +968,20 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequ
 void FSP_SRV::OpenDataStorageByCurrentProcess(HLERequestContext& ctx) {
 void FSP_SRV::OpenDataStorageByCurrentProcess(HLERequestContext& ctx) {
     LOG_DEBUG(Service_FS, "called");
     LOG_DEBUG(Service_FS, "called");
 
 
-    auto current_romfs = fsc.OpenRomFSCurrentProcess();
-    if (current_romfs.Failed()) {
-        // TODO (bunnei): Find the right error code to use here
-        LOG_CRITICAL(Service_FS, "no file system interface available!");
-        IPC::ResponseBuilder rb{ctx, 2};
-        rb.Push(ResultUnknown);
-        return;
+    if (!romfs) {
+        auto current_romfs = fsc.OpenRomFSCurrentProcess();
+        if (current_romfs.Failed()) {
+            // TODO (bunnei): Find the right error code to use here
+            LOG_CRITICAL(Service_FS, "no file system interface available!");
+            IPC::ResponseBuilder rb{ctx, 2};
+            rb.Push(ResultUnknown);
+            return;
+        }
+
+        romfs = current_romfs.Unwrap();
     }
     }
 
 
-    auto storage = std::make_shared<IStorage>(system, std::move(current_romfs.Unwrap()));
+    auto storage = std::make_shared<IStorage>(system, romfs);
 
 
     IPC::ResponseBuilder rb{ctx, 2, 0, 1};
     IPC::ResponseBuilder rb{ctx, 2, 0, 1};
     rb.Push(ResultSuccess);
     rb.Push(ResultSuccess);