fsp-srv: avoid patching romfs multiple times

This commit is contained in:
Liam 2023-06-03 14:27:08 -04:00
parent 58c54aecb6
commit a75bc759fe

View file

@ -968,6 +968,7 @@ 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");
if (!romfs) {
auto current_romfs = fsc.OpenRomFSCurrentProcess(); auto current_romfs = fsc.OpenRomFSCurrentProcess();
if (current_romfs.Failed()) { if (current_romfs.Failed()) {
// TODO (bunnei): Find the right error code to use here // TODO (bunnei): Find the right error code to use here
@ -977,7 +978,10 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(HLERequestContext& ctx) {
return; return;
} }
auto storage = std::make_shared<IStorage>(system, std::move(current_romfs.Unwrap())); romfs = 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);