From d9ee58a3b5c3682d96713067e6cf2bf3ef72ec55 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Apr 2019 21:10:47 -0400 Subject: service/fsp_srv: Update SaveDataInfo and SaveDataDescriptor structs I realized that I updated the documentation on SwitchBrew a while ago, but never actually updated the structs within yuzu. --- src/core/hle/service/filesystem/fsp_srv.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/core/hle/service/filesystem') diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index f03fb629c..06547e063 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -616,7 +616,9 @@ private: u64_le save_id; u64_le title_id; u64_le save_image_size; - INSERT_PADDING_BYTES(0x28); + u16_le index; + FileSys::SaveDataRank rank; + INSERT_PADDING_BYTES(0x25); }; static_assert(sizeof(SaveDataInfo) == 0x60, "SaveDataInfo has incorrect size."); -- cgit v1.2.3 From d0ed3ff4b7c10a2b7e85185f62f5734d2d8329dc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Apr 2019 21:24:20 -0400 Subject: service/fsp_srv: Remove unnecessary unknown member in OpenSaveDataFileSystem The unknown member here is actually padding due to being passed as a struct. We can do the same, and remove the need to pop a padding word. --- src/core/hle/service/filesystem/fsp_srv.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/core/hle/service/filesystem') diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 06547e063..e2bb692c5 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -781,16 +781,17 @@ void FSP_SRV::CreateSaveDataFileSystem(Kernel::HLERequestContext& ctx) { } void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - - auto space_id = rp.PopRaw(); - auto unk = rp.Pop(); - LOG_INFO(Service_FS, "called with unknown={:08X}", unk); + LOG_INFO(Service_FS, "called."); - auto save_struct = rp.PopRaw(); + struct Parameters { + FileSys::SaveDataSpaceId save_data_space_id; + FileSys::SaveDataDescriptor descriptor; + }; - auto dir = OpenSaveData(space_id, save_struct); + IPC::RequestParser rp{ctx}; + const auto parameters = rp.PopRaw(); + auto dir = OpenSaveData(parameters.save_data_space_id, parameters.descriptor); if (dir.Failed()) { IPC::ResponseBuilder rb{ctx, 2, 0, 0}; rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); -- cgit v1.2.3 From c05c8a7a065a60f586fe617bf6af0814064eb903 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Apr 2019 21:29:24 -0400 Subject: service/fsp_srv: Don't pass SaveDataDescriptor instances by value. Passing around a 64 byte data struct by value is kind of wasteful, instead pass a reference to the struct. --- src/core/hle/service/filesystem/filesystem.cpp | 6 +++--- src/core/hle/service/filesystem/filesystem.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/hle/service/filesystem') diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index c6da2df43..605ec5169 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -319,15 +319,15 @@ ResultVal OpenRomFS(u64 title_id, FileSys::StorageId stora } ResultVal OpenSaveData(FileSys::SaveDataSpaceId space, - FileSys::SaveDataDescriptor save_struct) { + const FileSys::SaveDataDescriptor& descriptor) { LOG_TRACE(Service_FS, "Opening Save Data for space_id={:01X}, save_struct={}", - static_cast(space), save_struct.DebugInfo()); + static_cast(space), descriptor.DebugInfo()); if (save_data_factory == nullptr) { return FileSys::ERROR_ENTITY_NOT_FOUND; } - return save_data_factory->Open(space, save_struct); + return save_data_factory->Open(space, descriptor); } ResultVal OpenSaveDataSpace(FileSys::SaveDataSpaceId space) { diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 6fd5e7b23..7cfc0d902 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h @@ -46,7 +46,7 @@ ResultVal OpenRomFSCurrentProcess(); ResultVal OpenRomFS(u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type); ResultVal OpenSaveData(FileSys::SaveDataSpaceId space, - FileSys::SaveDataDescriptor save_struct); + const FileSys::SaveDataDescriptor& descriptor); ResultVal OpenSaveDataSpace(FileSys::SaveDataSpaceId space); ResultVal OpenSDMC(); -- cgit v1.2.3