Services/FS: Return the correct error code when trying to mount a nonexistent savedata.

This commit is contained in:
Subv 2018-06-12 13:42:04 -05:00
parent 09b8a16414
commit 5f57a70a7d
2 changed files with 12 additions and 2 deletions

View file

@ -11,6 +11,7 @@ namespace FileSys {
namespace ErrCodes { namespace ErrCodes {
enum { enum {
NotFound = 1, NotFound = 1,
SaveDataNotFound = 1002,
}; };
} }

View file

@ -7,6 +7,7 @@
#include "common/string_util.h" #include "common/string_util.h"
#include "core/core.h" #include "core/core.h"
#include "core/file_sys/directory.h" #include "core/file_sys/directory.h"
#include "core/file_sys/errors.h"
#include "core/file_sys/filesystem.h" #include "core/file_sys/filesystem.h"
#include "core/file_sys/storage.h" #include "core/file_sys/storage.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
@ -531,12 +532,20 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) {
void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_FS, "(STUBBED) called"); NGLOG_WARNING(Service_FS, "(STUBBED) called");
// TODO(Subv): Read the input parameters and mount the requested savedata instead of always
// mounting the current process' savedata.
FileSys::Path unused; FileSys::Path unused;
auto filesystem = OpenFileSystem(Type::SaveData, unused).Unwrap(); auto filesystem = OpenFileSystem(Type::SaveData, unused);
if (filesystem.Failed()) {
IPC::ResponseBuilder rb{ctx, 2, 0, 0};
rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::SaveDataNotFound));
return;
}
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IFileSystem>(std::move(filesystem)); rb.PushIpcInterface<IFileSystem>(std::move(filesystem.Unwrap()));
} }
void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {