summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar FearlessTobi2024-02-19 02:17:16 +0100
committerGravatar FearlessTobi2024-02-19 19:06:31 +0100
commitfdf4a5bc90ac9b5812fbaefa4c5451cf6824301a (patch)
treeb1eb01422c8df2feb011ed5ff34fff7651c52a03 /src
parentfsp: Move IMultiCommitManager to a seperate file (diff)
downloadyuzu-fdf4a5bc90ac9b5812fbaefa4c5451cf6824301a.tar.gz
yuzu-fdf4a5bc90ac9b5812fbaefa4c5451cf6824301a.tar.xz
yuzu-fdf4a5bc90ac9b5812fbaefa4c5451cf6824301a.zip
fsp-srv: Migrate to use cmif serialization
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/filesystem/fsp/fsp_srv.cpp384
-rw-r--r--src/core/hle/service/filesystem/fsp/fsp_srv.h82
2 files changed, 203 insertions, 263 deletions
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
index 228e6269e..2f3b01595 100644
--- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
@@ -27,9 +27,10 @@
27#include "core/file_sys/system_archive/system_archive.h" 27#include "core/file_sys/system_archive/system_archive.h"
28#include "core/file_sys/vfs/vfs.h" 28#include "core/file_sys/vfs/vfs.h"
29#include "core/hle/result.h" 29#include "core/hle/result.h"
30#include "core/hle/service/cmif_serialization.h"
30#include "core/hle/service/filesystem/filesystem.h" 31#include "core/hle/service/filesystem/filesystem.h"
31#include "core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h"
32#include "core/hle/service/filesystem/fsp/fs_i_filesystem.h" 32#include "core/hle/service/filesystem/fsp/fs_i_filesystem.h"
33#include "core/hle/service/filesystem/fsp/fs_i_multi_commit_manager.h"
33#include "core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h" 34#include "core/hle/service/filesystem/fsp/fs_i_save_data_info_reader.h"
34#include "core/hle/service/filesystem/fsp/fs_i_storage.h" 35#include "core/hle/service/filesystem/fsp/fs_i_storage.h"
35#include "core/hle/service/filesystem/fsp/fsp_srv.h" 36#include "core/hle/service/filesystem/fsp/fsp_srv.h"
@@ -42,38 +43,26 @@
42 43
43namespace Service::FileSystem { 44namespace Service::FileSystem {
44 45
45enum class FileSystemProxyType : u8 {
46 Code = 0,
47 Rom = 1,
48 Logo = 2,
49 Control = 3,
50 Manual = 4,
51 Meta = 5,
52 Data = 6,
53 Package = 7,
54 RegisteredUpdate = 8,
55};
56
57FSP_SRV::FSP_SRV(Core::System& system_) 46FSP_SRV::FSP_SRV(Core::System& system_)
58 : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()}, 47 : ServiceFramework{system_, "fsp-srv"}, fsc{system.GetFileSystemController()},
59 content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} { 48 content_provider{system.GetContentProvider()}, reporter{system.GetReporter()} {
60 // clang-format off 49 // clang-format off
61 static const FunctionInfo functions[] = { 50 static const FunctionInfo functions[] = {
62 {0, nullptr, "OpenFileSystem"}, 51 {0, nullptr, "OpenFileSystem"},
63 {1, &FSP_SRV::SetCurrentProcess, "SetCurrentProcess"}, 52 {1, D<&FSP_SRV::SetCurrentProcess>, "SetCurrentProcess"},
64 {2, nullptr, "OpenDataFileSystemByCurrentProcess"}, 53 {2, nullptr, "OpenDataFileSystemByCurrentProcess"},
65 {7, &FSP_SRV::OpenFileSystemWithPatch, "OpenFileSystemWithPatch"}, 54 {7, D<&FSP_SRV::OpenFileSystemWithPatch>, "OpenFileSystemWithPatch"},
66 {8, nullptr, "OpenFileSystemWithId"}, 55 {8, nullptr, "OpenFileSystemWithId"},
67 {9, nullptr, "OpenDataFileSystemByApplicationId"}, 56 {9, nullptr, "OpenDataFileSystemByApplicationId"},
68 {11, nullptr, "OpenBisFileSystem"}, 57 {11, nullptr, "OpenBisFileSystem"},
69 {12, nullptr, "OpenBisStorage"}, 58 {12, nullptr, "OpenBisStorage"},
70 {13, nullptr, "InvalidateBisCache"}, 59 {13, nullptr, "InvalidateBisCache"},
71 {17, nullptr, "OpenHostFileSystem"}, 60 {17, nullptr, "OpenHostFileSystem"},
72 {18, &FSP_SRV::OpenSdCardFileSystem, "OpenSdCardFileSystem"}, 61 {18, D<&FSP_SRV::OpenSdCardFileSystem>, "OpenSdCardFileSystem"},
73 {19, nullptr, "FormatSdCardFileSystem"}, 62 {19, nullptr, "FormatSdCardFileSystem"},
74 {21, nullptr, "DeleteSaveDataFileSystem"}, 63 {21, nullptr, "DeleteSaveDataFileSystem"},
75 {22, &FSP_SRV::CreateSaveDataFileSystem, "CreateSaveDataFileSystem"}, 64 {22, D<&FSP_SRV::CreateSaveDataFileSystem>, "CreateSaveDataFileSystem"},
76 {23, &FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId, "CreateSaveDataFileSystemBySystemSaveDataId"}, 65 {23, D<&FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId>, "CreateSaveDataFileSystemBySystemSaveDataId"},
77 {24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"}, 66 {24, nullptr, "RegisterSaveDataFileSystemAtomicDeletion"},
78 {25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"}, 67 {25, nullptr, "DeleteSaveDataFileSystemBySaveDataSpaceId"},
79 {26, nullptr, "FormatSdCardDryRun"}, 68 {26, nullptr, "FormatSdCardDryRun"},
@@ -83,26 +72,26 @@ FSP_SRV::FSP_SRV(Core::System& system_)
83 {31, nullptr, "OpenGameCardFileSystem"}, 72 {31, nullptr, "OpenGameCardFileSystem"},
84 {32, nullptr, "ExtendSaveDataFileSystem"}, 73 {32, nullptr, "ExtendSaveDataFileSystem"},
85 {33, nullptr, "DeleteCacheStorage"}, 74 {33, nullptr, "DeleteCacheStorage"},
86 {34, &FSP_SRV::GetCacheStorageSize, "GetCacheStorageSize"}, 75 {34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"},
87 {35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, 76 {35, nullptr, "CreateSaveDataFileSystemByHashSalt"},
88 {36, nullptr, "OpenHostFileSystemWithOption"}, 77 {36, nullptr, "OpenHostFileSystemWithOption"},
89 {51, &FSP_SRV::OpenSaveDataFileSystem, "OpenSaveDataFileSystem"}, 78 {51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"},
90 {52, &FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId, "OpenSaveDataFileSystemBySystemSaveDataId"}, 79 {52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"},
91 {53, &FSP_SRV::OpenReadOnlySaveDataFileSystem, "OpenReadOnlySaveDataFileSystem"}, 80 {53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"},
92 {57, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, 81 {57, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"},
93 {58, nullptr, "ReadSaveDataFileSystemExtraData"}, 82 {58, nullptr, "ReadSaveDataFileSystemExtraData"},
94 {59, nullptr, "WriteSaveDataFileSystemExtraData"}, 83 {59, nullptr, "WriteSaveDataFileSystemExtraData"},
95 {60, nullptr, "OpenSaveDataInfoReader"}, 84 {60, nullptr, "OpenSaveDataInfoReader"},
96 {61, &FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, 85 {61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"},
97 {62, &FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage, "OpenSaveDataInfoReaderOnlyCacheStorage"}, 86 {62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"},
98 {64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, 87 {64, nullptr, "OpenSaveDataInternalStorageFileSystem"},
99 {65, nullptr, "UpdateSaveDataMacForDebug"}, 88 {65, nullptr, "UpdateSaveDataMacForDebug"},
100 {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, 89 {66, nullptr, "WriteSaveDataFileSystemExtraData2"},
101 {67, nullptr, "FindSaveDataWithFilter"}, 90 {67, nullptr, "FindSaveDataWithFilter"},
102 {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, 91 {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"},
103 {69, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, 92 {69, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"},
104 {70, &FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute, "WriteSaveDataFileSystemExtraDataBySaveDataAttribute"}, 93 {70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataBySaveDataAttribute"},
105 {71, &FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, 94 {71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"},
106 {80, nullptr, "OpenSaveDataMetaFile"}, 95 {80, nullptr, "OpenSaveDataMetaFile"},
107 {81, nullptr, "OpenSaveDataTransferManager"}, 96 {81, nullptr, "OpenSaveDataTransferManager"},
108 {82, nullptr, "OpenSaveDataTransferManagerVersion2"}, 97 {82, nullptr, "OpenSaveDataTransferManagerVersion2"},
@@ -117,12 +106,12 @@ FSP_SRV::FSP_SRV(Core::System& system_)
117 {110, nullptr, "OpenContentStorageFileSystem"}, 106 {110, nullptr, "OpenContentStorageFileSystem"},
118 {120, nullptr, "OpenCloudBackupWorkStorageFileSystem"}, 107 {120, nullptr, "OpenCloudBackupWorkStorageFileSystem"},
119 {130, nullptr, "OpenCustomStorageFileSystem"}, 108 {130, nullptr, "OpenCustomStorageFileSystem"},
120 {200, &FSP_SRV::OpenDataStorageByCurrentProcess, "OpenDataStorageByCurrentProcess"}, 109 {200, D<&FSP_SRV::OpenDataStorageByCurrentProcess>, "OpenDataStorageByCurrentProcess"},
121 {201, nullptr, "OpenDataStorageByProgramId"}, 110 {201, nullptr, "OpenDataStorageByProgramId"},
122 {202, &FSP_SRV::OpenDataStorageByDataId, "OpenDataStorageByDataId"}, 111 {202, D<&FSP_SRV::OpenDataStorageByDataId>, "OpenDataStorageByDataId"},
123 {203, &FSP_SRV::OpenPatchDataStorageByCurrentProcess, "OpenPatchDataStorageByCurrentProcess"}, 112 {203, D<&FSP_SRV::OpenPatchDataStorageByCurrentProcess>, "OpenPatchDataStorageByCurrentProcess"},
124 {204, nullptr, "OpenDataFileSystemByProgramIndex"}, 113 {204, nullptr, "OpenDataFileSystemByProgramIndex"},
125 {205, &FSP_SRV::OpenDataStorageWithProgramIndex, "OpenDataStorageWithProgramIndex"}, 114 {205, D<&FSP_SRV::OpenDataStorageWithProgramIndex>, "OpenDataStorageWithProgramIndex"},
126 {206, nullptr, "OpenDataStorageByPath"}, 115 {206, nullptr, "OpenDataStorageByPath"},
127 {400, nullptr, "OpenDeviceOperator"}, 116 {400, nullptr, "OpenDeviceOperator"},
128 {500, nullptr, "OpenSdCardDetectionEventNotifier"}, 117 {500, nullptr, "OpenSdCardDetectionEventNotifier"},
@@ -162,25 +151,25 @@ FSP_SRV::FSP_SRV(Core::System& system_)
162 {1000, nullptr, "SetBisRootForHost"}, 151 {1000, nullptr, "SetBisRootForHost"},
163 {1001, nullptr, "SetSaveDataSize"}, 152 {1001, nullptr, "SetSaveDataSize"},
164 {1002, nullptr, "SetSaveDataRootPath"}, 153 {1002, nullptr, "SetSaveDataRootPath"},
165 {1003, &FSP_SRV::DisableAutoSaveDataCreation, "DisableAutoSaveDataCreation"}, 154 {1003, D<&FSP_SRV::DisableAutoSaveDataCreation>, "DisableAutoSaveDataCreation"},
166 {1004, &FSP_SRV::SetGlobalAccessLogMode, "SetGlobalAccessLogMode"}, 155 {1004, D<&FSP_SRV::SetGlobalAccessLogMode>, "SetGlobalAccessLogMode"},
167 {1005, &FSP_SRV::GetGlobalAccessLogMode, "GetGlobalAccessLogMode"}, 156 {1005, D<&FSP_SRV::GetGlobalAccessLogMode>, "GetGlobalAccessLogMode"},
168 {1006, &FSP_SRV::OutputAccessLogToSdCard, "OutputAccessLogToSdCard"}, 157 {1006, D<&FSP_SRV::OutputAccessLogToSdCard>, "OutputAccessLogToSdCard"},
169 {1007, nullptr, "RegisterUpdatePartition"}, 158 {1007, nullptr, "RegisterUpdatePartition"},
170 {1008, nullptr, "OpenRegisteredUpdatePartition"}, 159 {1008, nullptr, "OpenRegisteredUpdatePartition"},
171 {1009, nullptr, "GetAndClearMemoryReportInfo"}, 160 {1009, nullptr, "GetAndClearMemoryReportInfo"},
172 {1010, nullptr, "SetDataStorageRedirectTarget"}, 161 {1010, nullptr, "SetDataStorageRedirectTarget"},
173 {1011, &FSP_SRV::GetProgramIndexForAccessLog, "GetProgramIndexForAccessLog"}, 162 {1011, D<&FSP_SRV::GetProgramIndexForAccessLog>, "GetProgramIndexForAccessLog"},
174 {1012, nullptr, "GetFsStackUsage"}, 163 {1012, nullptr, "GetFsStackUsage"},
175 {1013, nullptr, "UnsetSaveDataRootPath"}, 164 {1013, nullptr, "UnsetSaveDataRootPath"},
176 {1014, nullptr, "OutputMultiProgramTagAccessLog"}, 165 {1014, nullptr, "OutputMultiProgramTagAccessLog"},
177 {1016, &FSP_SRV::FlushAccessLogOnSdCard, "FlushAccessLogOnSdCard"}, 166 {1016, D<&FSP_SRV::FlushAccessLogOnSdCard>, "FlushAccessLogOnSdCard"},
178 {1017, nullptr, "OutputApplicationInfoAccessLog"}, 167 {1017, nullptr, "OutputApplicationInfoAccessLog"},
179 {1018, nullptr, "SetDebugOption"}, 168 {1018, nullptr, "SetDebugOption"},
180 {1019, nullptr, "UnsetDebugOption"}, 169 {1019, nullptr, "UnsetDebugOption"},
181 {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, 170 {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"},
182 {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, 171 {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"},
183 {1200, &FSP_SRV::OpenMultiCommitManager, "OpenMultiCommitManager"}, 172 {1200, D<&FSP_SRV::OpenMultiCommitManager>, "OpenMultiCommitManager"},
184 {1300, nullptr, "OpenBisWiper"}, 173 {1300, nullptr, "OpenBisWiper"},
185 }; 174 };
186 // clang-format on 175 // clang-format on
@@ -193,118 +182,77 @@ FSP_SRV::FSP_SRV(Core::System& system_)
193 182
194FSP_SRV::~FSP_SRV() = default; 183FSP_SRV::~FSP_SRV() = default;
195 184
196void FSP_SRV::SetCurrentProcess(HLERequestContext& ctx) { 185Result FSP_SRV::SetCurrentProcess(ClientProcessId pid) {
197 current_process_id = ctx.GetPID(); 186 current_process_id = *pid;
198 187
199 LOG_DEBUG(Service_FS, "called. current_process_id=0x{:016X}", current_process_id); 188 LOG_DEBUG(Service_FS, "called. current_process_id=0x{:016X}", current_process_id);
200 189
201 const auto res = 190 R_RETURN(
202 fsc.OpenProcess(&program_id, &save_data_controller, &romfs_controller, current_process_id); 191 fsc.OpenProcess(&program_id, &save_data_controller, &romfs_controller, current_process_id));
203
204 IPC::ResponseBuilder rb{ctx, 2};
205 rb.Push(res);
206} 192}
207 193
208void FSP_SRV::OpenFileSystemWithPatch(HLERequestContext& ctx) { 194Result FSP_SRV::OpenFileSystemWithPatch(OutInterface<IFileSystem> out_interface,
209 IPC::RequestParser rp{ctx}; 195 FileSystemProxyType type, u64 open_program_id) {
210 196 LOG_ERROR(Service_FS, "(STUBBED) called with type={}, program_id={:016X}", type,
211 struct InputParameters { 197 open_program_id);
212 FileSystemProxyType type;
213 u64 program_id;
214 };
215 static_assert(sizeof(InputParameters) == 0x10, "InputParameters has wrong size");
216
217 const auto params = rp.PopRaw<InputParameters>();
218 LOG_ERROR(Service_FS, "(STUBBED) called with type={}, program_id={:016X}", params.type,
219 params.program_id);
220 198
221 // FIXME: many issues with this 199 // FIXME: many issues with this
222 ASSERT(params.type == FileSystemProxyType::Manual); 200 ASSERT(type == FileSystemProxyType::Manual);
223 const auto manual_romfs = romfs_controller->OpenPatchedRomFS( 201 const auto manual_romfs = romfs_controller->OpenPatchedRomFS(
224 params.program_id, FileSys::ContentRecordType::HtmlDocument); 202 open_program_id, FileSys::ContentRecordType::HtmlDocument);
225 203
226 ASSERT(manual_romfs != nullptr); 204 ASSERT(manual_romfs != nullptr);
227 205
228 const auto extracted_romfs = FileSys::ExtractRomFS(manual_romfs); 206 const auto extracted_romfs = FileSys::ExtractRomFS(manual_romfs);
229 ASSERT(extracted_romfs != nullptr); 207 ASSERT(extracted_romfs != nullptr);
230 208
231 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 209 *out_interface = std::make_shared<IFileSystem>(
232 rb.Push(ResultSuccess); 210 system, extracted_romfs, SizeGetter::FromStorageId(fsc, FileSys::StorageId::NandUser));
233 rb.PushIpcInterface<IFileSystem>(system, extracted_romfs, 211
234 SizeGetter::FromStorageId(fsc, FileSys::StorageId::NandUser)); 212 R_SUCCEED();
235} 213}
236 214
237void FSP_SRV::OpenSdCardFileSystem(HLERequestContext& ctx) { 215Result FSP_SRV::OpenSdCardFileSystem(OutInterface<IFileSystem> out_interface) {
238 LOG_DEBUG(Service_FS, "called"); 216 LOG_DEBUG(Service_FS, "called");
239 217
240 FileSys::VirtualDir sdmc_dir{}; 218 FileSys::VirtualDir sdmc_dir{};
241 fsc.OpenSDMC(&sdmc_dir); 219 fsc.OpenSDMC(&sdmc_dir);
242 220
243 auto filesystem = std::make_shared<IFileSystem>( 221 *out_interface = std::make_shared<IFileSystem>(
244 system, sdmc_dir, SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard)); 222 system, sdmc_dir, SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard));
245 223
246 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 224 R_SUCCEED();
247 rb.Push(ResultSuccess);
248 rb.PushIpcInterface<IFileSystem>(std::move(filesystem));
249} 225}
250 226
251void FSP_SRV::CreateSaveDataFileSystem(HLERequestContext& ctx) { 227Result FSP_SRV::CreateSaveDataFileSystem(std::array<u8, 0x40> save_create_struct,
252 IPC::RequestParser rp{ctx}; 228 FileSys::SaveDataAttribute save_struct, u128 uid) {
253
254 auto save_struct = rp.PopRaw<FileSys::SaveDataAttribute>();
255 [[maybe_unused]] auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>();
256 u128 uid = rp.PopRaw<u128>();
257
258 LOG_DEBUG(Service_FS, "called save_struct = {}, uid = {:016X}{:016X}", save_struct.DebugInfo(), 229 LOG_DEBUG(Service_FS, "called save_struct = {}, uid = {:016X}{:016X}", save_struct.DebugInfo(),
259 uid[1], uid[0]); 230 uid[1], uid[0]);
260 231
261 FileSys::VirtualDir save_data_dir{}; 232 FileSys::VirtualDir save_data_dir{};
262 save_data_controller->CreateSaveData(&save_data_dir, FileSys::SaveDataSpaceId::NandUser, 233 R_RETURN(save_data_controller->CreateSaveData(&save_data_dir,
263 save_struct); 234 FileSys::SaveDataSpaceId::NandUser, save_struct));
264
265 IPC::ResponseBuilder rb{ctx, 2};
266 rb.Push(ResultSuccess);
267} 235}
268 236
269void FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId(HLERequestContext& ctx) { 237Result FSP_SRV::CreateSaveDataFileSystemBySystemSaveDataId(std::array<u8, 0x40> save_create_struct,
270 IPC::RequestParser rp{ctx}; 238 FileSys::SaveDataAttribute save_struct) {
271
272 auto save_struct = rp.PopRaw<FileSys::SaveDataAttribute>();
273 [[maybe_unused]] auto save_create_struct = rp.PopRaw<std::array<u8, 0x40>>();
274
275 LOG_DEBUG(Service_FS, "called save_struct = {}", save_struct.DebugInfo()); 239 LOG_DEBUG(Service_FS, "called save_struct = {}", save_struct.DebugInfo());
276 240
277 FileSys::VirtualDir save_data_dir{}; 241 FileSys::VirtualDir save_data_dir{};
278 save_data_controller->CreateSaveData(&save_data_dir, FileSys::SaveDataSpaceId::NandSystem, 242 R_RETURN(save_data_controller->CreateSaveData(
279 save_struct); 243 &save_data_dir, FileSys::SaveDataSpaceId::NandSystem, save_struct));
280
281 IPC::ResponseBuilder rb{ctx, 2};
282 rb.Push(ResultSuccess);
283} 244}
284 245
285void FSP_SRV::OpenSaveDataFileSystem(HLERequestContext& ctx) { 246Result FSP_SRV::OpenSaveDataFileSystem(OutInterface<IFileSystem> out_interface,
286 IPC::RequestParser rp{ctx}; 247 FileSys::SaveDataSpaceId space_id,
287 248 FileSys::SaveDataAttribute attribute) {
288 struct Parameters {
289 FileSys::SaveDataSpaceId space_id;
290 FileSys::SaveDataAttribute attribute;
291 };
292
293 const auto parameters = rp.PopRaw<Parameters>();
294
295 LOG_INFO(Service_FS, "called."); 249 LOG_INFO(Service_FS, "called.");
296 250
297 FileSys::VirtualDir dir{}; 251 FileSys::VirtualDir dir{};
298 auto result = 252 R_TRY(save_data_controller->OpenSaveData(&dir, space_id, attribute));
299 save_data_controller->OpenSaveData(&dir, parameters.space_id, parameters.attribute);
300 if (result != ResultSuccess) {
301 IPC::ResponseBuilder rb{ctx, 2, 0, 0};
302 rb.Push(FileSys::ResultTargetNotFound);
303 return;
304 }
305 253
306 FileSys::StorageId id{}; 254 FileSys::StorageId id{};
307 switch (parameters.space_id) { 255 switch (space_id) {
308 case FileSys::SaveDataSpaceId::NandUser: 256 case FileSys::SaveDataSpaceId::NandUser:
309 id = FileSys::StorageId::NandUser; 257 id = FileSys::StorageId::NandUser;
310 break; 258 break;
@@ -321,106 +269,90 @@ void FSP_SRV::OpenSaveDataFileSystem(HLERequestContext& ctx) {
321 ASSERT(false); 269 ASSERT(false);
322 } 270 }
323 271
324 auto filesystem = 272 *out_interface =
325 std::make_shared<IFileSystem>(system, std::move(dir), SizeGetter::FromStorageId(fsc, id)); 273 std::make_shared<IFileSystem>(system, std::move(dir), SizeGetter::FromStorageId(fsc, id));
326 274
327 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 275 R_SUCCEED();
328 rb.Push(ResultSuccess);
329 rb.PushIpcInterface<IFileSystem>(std::move(filesystem));
330} 276}
331 277
332void FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId(HLERequestContext& ctx) { 278Result FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId(OutInterface<IFileSystem> out_interface,
279 FileSys::SaveDataSpaceId space_id,
280 FileSys::SaveDataAttribute attribute) {
333 LOG_WARNING(Service_FS, "(STUBBED) called, delegating to 51 OpenSaveDataFilesystem"); 281 LOG_WARNING(Service_FS, "(STUBBED) called, delegating to 51 OpenSaveDataFilesystem");
334 OpenSaveDataFileSystem(ctx); 282 R_RETURN(OpenSaveDataFileSystem(out_interface, space_id, attribute));
335} 283}
336 284
337void FSP_SRV::OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx) { 285Result FSP_SRV::OpenReadOnlySaveDataFileSystem(OutInterface<IFileSystem> out_interface,
286 FileSys::SaveDataSpaceId space_id,
287 FileSys::SaveDataAttribute attribute) {
338 LOG_WARNING(Service_FS, "(STUBBED) called, delegating to 51 OpenSaveDataFilesystem"); 288 LOG_WARNING(Service_FS, "(STUBBED) called, delegating to 51 OpenSaveDataFilesystem");
339 OpenSaveDataFileSystem(ctx); 289 R_RETURN(OpenSaveDataFileSystem(out_interface, space_id, attribute));
340} 290}
341 291
342void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx) { 292Result FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(
343 IPC::RequestParser rp{ctx}; 293 OutInterface<ISaveDataInfoReader> out_interface, FileSys::SaveDataSpaceId space) {
344 const auto space = rp.PopRaw<FileSys::SaveDataSpaceId>();
345 LOG_INFO(Service_FS, "called, space={}", space); 294 LOG_INFO(Service_FS, "called, space={}", space);
346 295
347 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 296 *out_interface = std::make_shared<ISaveDataInfoReader>(system, save_data_controller, space);
348 rb.Push(ResultSuccess); 297
349 rb.PushIpcInterface<ISaveDataInfoReader>( 298 R_SUCCEED();
350 std::make_shared<ISaveDataInfoReader>(system, save_data_controller, space));
351} 299}
352 300
353void FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage(HLERequestContext& ctx) { 301Result FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage(
302 OutInterface<ISaveDataInfoReader> out_interface) {
354 LOG_WARNING(Service_FS, "(STUBBED) called"); 303 LOG_WARNING(Service_FS, "(STUBBED) called");
355 304
356 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 305 *out_interface = std::make_shared<ISaveDataInfoReader>(
357 rb.Push(ResultSuccess); 306 system, save_data_controller, FileSys::SaveDataSpaceId::TemporaryStorage);
358 rb.PushIpcInterface<ISaveDataInfoReader>(system, save_data_controller, 307
359 FileSys::SaveDataSpaceId::TemporaryStorage); 308 R_SUCCEED();
360} 309}
361 310
362void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx) { 311Result FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute() {
363 LOG_WARNING(Service_FS, "(STUBBED) called."); 312 LOG_WARNING(Service_FS, "(STUBBED) called.");
364 313
365 IPC::ResponseBuilder rb{ctx, 2}; 314 R_SUCCEED();
366 rb.Push(ResultSuccess);
367} 315}
368 316
369void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx) { 317Result FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
370 IPC::RequestParser rp{ctx}; 318 FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute,
371 319 InBuffer<BufferAttr_HipcMapAlias> mask_buffer, OutBuffer<BufferAttr_HipcMapAlias> out_buffer) {
372 struct Parameters {
373 FileSys::SaveDataSpaceId space_id;
374 FileSys::SaveDataAttribute attribute;
375 };
376
377 const auto parameters = rp.PopRaw<Parameters>();
378 // Stub this to None for now, backend needs an impl to read/write the SaveDataExtraData 320 // Stub this to None for now, backend needs an impl to read/write the SaveDataExtraData
379 constexpr auto flags = static_cast<u32>(FileSys::SaveDataFlags::None); 321 // In an earlier version of the code, this was returned as an out argument, but this is not
322 // correct
323 [[maybe_unused]] constexpr auto flags = static_cast<u32>(FileSys::SaveDataFlags::None);
380 324
381 LOG_WARNING(Service_FS, 325 LOG_WARNING(Service_FS,
382 "(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n" 326 "(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n"
383 "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n" 327 "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n"
384 "attribute.type={}, attribute.rank={}, attribute.index={}", 328 "attribute.type={}, attribute.rank={}, attribute.index={}",
385 flags, parameters.space_id, parameters.attribute.title_id, 329 flags, space_id, attribute.title_id, attribute.user_id[1], attribute.user_id[0],
386 parameters.attribute.user_id[1], parameters.attribute.user_id[0], 330 attribute.save_id, attribute.type, attribute.rank, attribute.index);
387 parameters.attribute.save_id, parameters.attribute.type, parameters.attribute.rank, 331
388 parameters.attribute.index); 332 R_SUCCEED();
389
390 IPC::ResponseBuilder rb{ctx, 3};
391 rb.Push(ResultSuccess);
392 rb.Push(flags);
393} 333}
394 334
395void FSP_SRV::OpenDataStorageByCurrentProcess(HLERequestContext& ctx) { 335Result FSP_SRV::OpenDataStorageByCurrentProcess(OutInterface<IStorage> out_interface) {
396 LOG_DEBUG(Service_FS, "called"); 336 LOG_DEBUG(Service_FS, "called");
397 337
398 if (!romfs) { 338 if (!romfs) {
399 auto current_romfs = romfs_controller->OpenRomFSCurrentProcess(); 339 auto current_romfs = romfs_controller->OpenRomFSCurrentProcess();
400 if (!current_romfs) { 340 if (!current_romfs) {
401 // TODO (bunnei): Find the right error code to use here 341 // TODO (bunnei): Find the right error code to use here
402 LOG_CRITICAL(Service_FS, "no file system interface available!"); 342 LOG_CRITICAL(Service_FS, "No file system interface available!");
403 IPC::ResponseBuilder rb{ctx, 2}; 343 R_RETURN(ResultUnknown);
404 rb.Push(ResultUnknown);
405 return;
406 } 344 }
407 345
408 romfs = current_romfs; 346 romfs = current_romfs;
409 } 347 }
410 348
411 auto storage = std::make_shared<IStorage>(system, romfs); 349 *out_interface = std::make_shared<IStorage>(system, romfs);
412 350
413 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 351 R_SUCCEED();
414 rb.Push(ResultSuccess);
415 rb.PushIpcInterface<IStorage>(std::move(storage));
416} 352}
417 353
418void FSP_SRV::OpenDataStorageByDataId(HLERequestContext& ctx) { 354Result FSP_SRV::OpenDataStorageByDataId(OutInterface<IStorage> out_interface,
419 IPC::RequestParser rp{ctx}; 355 FileSys::StorageId storage_id, u32 unknown, u64 title_id) {
420 const auto storage_id = rp.PopRaw<FileSys::StorageId>();
421 const auto unknown = rp.PopRaw<u32>();
422 const auto title_id = rp.PopRaw<u64>();
423
424 LOG_DEBUG(Service_FS, "called with storage_id={:02X}, unknown={:08X}, title_id={:016X}", 356 LOG_DEBUG(Service_FS, "called with storage_id={:02X}, unknown={:08X}, title_id={:016X}",
425 storage_id, unknown, title_id); 357 storage_id, unknown, title_id);
426 358
@@ -430,19 +362,15 @@ void FSP_SRV::OpenDataStorageByDataId(HLERequestContext& ctx) {
430 const auto archive = FileSys::SystemArchive::SynthesizeSystemArchive(title_id); 362 const auto archive = FileSys::SystemArchive::SynthesizeSystemArchive(title_id);
431 363
432 if (archive != nullptr) { 364 if (archive != nullptr) {
433 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 365 *out_interface = std::make_shared<IStorage>(system, archive);
434 rb.Push(ResultSuccess); 366 R_SUCCEED();
435 rb.PushIpcInterface(std::make_shared<IStorage>(system, archive));
436 return;
437 } 367 }
438 368
439 // TODO(DarkLordZach): Find the right error code to use here 369 // TODO(DarkLordZach): Find the right error code to use here
440 LOG_ERROR(Service_FS, 370 LOG_ERROR(Service_FS,
441 "could not open data storage with title_id={:016X}, storage_id={:02X}", title_id, 371 "Could not open data storage with title_id={:016X}, storage_id={:02X}", title_id,
442 storage_id); 372 storage_id);
443 IPC::ResponseBuilder rb{ctx, 2}; 373 R_RETURN(ResultUnknown);
444 rb.Push(ResultUnknown);
445 return;
446 } 374 }
447 375
448 const FileSys::PatchManager pm{title_id, fsc, content_provider}; 376 const FileSys::PatchManager pm{title_id, fsc, content_provider};
@@ -452,28 +380,20 @@ void FSP_SRV::OpenDataStorageByDataId(HLERequestContext& ctx) {
452 auto storage = std::make_shared<IStorage>( 380 auto storage = std::make_shared<IStorage>(
453 system, pm.PatchRomFS(base.get(), std::move(data), FileSys::ContentRecordType::Data)); 381 system, pm.PatchRomFS(base.get(), std::move(data), FileSys::ContentRecordType::Data));
454 382
455 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 383 *out_interface = std::move(storage);
456 rb.Push(ResultSuccess); 384 R_SUCCEED();
457 rb.PushIpcInterface<IStorage>(std::move(storage));
458} 385}
459 386
460void FSP_SRV::OpenPatchDataStorageByCurrentProcess(HLERequestContext& ctx) { 387Result FSP_SRV::OpenPatchDataStorageByCurrentProcess(OutInterface<IStorage> out_interface,
461 IPC::RequestParser rp{ctx}; 388 FileSys::StorageId storage_id, u64 title_id) {
389 LOG_WARNING(Service_FS, "(STUBBED) called with storage_id={:02X}, title_id={:016X}", storage_id,
390 title_id);
462 391
463 const auto storage_id = rp.PopRaw<FileSys::StorageId>(); 392 R_RETURN(FileSys::ResultTargetNotFound);
464 const auto title_id = rp.PopRaw<u64>();
465
466 LOG_DEBUG(Service_FS, "called with storage_id={:02X}, title_id={:016X}", storage_id, title_id);
467
468 IPC::ResponseBuilder rb{ctx, 2};
469 rb.Push(FileSys::ResultTargetNotFound);
470} 393}
471 394
472void FSP_SRV::OpenDataStorageWithProgramIndex(HLERequestContext& ctx) { 395Result FSP_SRV::OpenDataStorageWithProgramIndex(OutInterface<IStorage> out_interface,
473 IPC::RequestParser rp{ctx}; 396 u8 program_index) {
474
475 const auto program_index = rp.PopRaw<u8>();
476
477 LOG_DEBUG(Service_FS, "called, program_index={}", program_index); 397 LOG_DEBUG(Service_FS, "called, program_index={}", program_index);
478 398
479 auto patched_romfs = romfs_controller->OpenPatchedRomFSWithProgramIndex( 399 auto patched_romfs = romfs_controller->OpenPatchedRomFSWithProgramIndex(
@@ -481,94 +401,80 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(HLERequestContext& ctx) {
481 401
482 if (!patched_romfs) { 402 if (!patched_romfs) {
483 // TODO: Find the right error code to use here 403 // TODO: Find the right error code to use here
484 LOG_ERROR(Service_FS, "could not open storage with program_index={}", program_index); 404 LOG_ERROR(Service_FS, "Could not open storage with program_index={}", program_index);
485 405 R_RETURN(ResultUnknown);
486 IPC::ResponseBuilder rb{ctx, 2};
487 rb.Push(ResultUnknown);
488 return;
489 } 406 }
490 407
491 auto storage = std::make_shared<IStorage>(system, std::move(patched_romfs)); 408 *out_interface = std::make_shared<IStorage>(system, std::move(patched_romfs));
492 409
493 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 410 R_SUCCEED();
494 rb.Push(ResultSuccess);
495 rb.PushIpcInterface<IStorage>(std::move(storage));
496} 411}
497 412
498void FSP_SRV::DisableAutoSaveDataCreation(HLERequestContext& ctx) { 413Result FSP_SRV::DisableAutoSaveDataCreation() {
499 LOG_DEBUG(Service_FS, "called"); 414 LOG_DEBUG(Service_FS, "called");
500 415
501 save_data_controller->SetAutoCreate(false); 416 save_data_controller->SetAutoCreate(false);
502 417
503 IPC::ResponseBuilder rb{ctx, 2}; 418 R_SUCCEED();
504 rb.Push(ResultSuccess);
505} 419}
506 420
507void FSP_SRV::SetGlobalAccessLogMode(HLERequestContext& ctx) { 421Result FSP_SRV::SetGlobalAccessLogMode(AccessLogMode access_log_mode_) {
508 IPC::RequestParser rp{ctx}; 422 LOG_DEBUG(Service_FS, "called, access_log_mode={}", access_log_mode_);
509 access_log_mode = rp.PopEnum<AccessLogMode>();
510 423
511 LOG_DEBUG(Service_FS, "called, access_log_mode={}", access_log_mode); 424 access_log_mode = access_log_mode_;
512 425
513 IPC::ResponseBuilder rb{ctx, 2}; 426 R_SUCCEED();
514 rb.Push(ResultSuccess);
515} 427}
516 428
517void FSP_SRV::GetGlobalAccessLogMode(HLERequestContext& ctx) { 429Result FSP_SRV::GetGlobalAccessLogMode(Out<AccessLogMode> out_access_log_mode) {
518 LOG_DEBUG(Service_FS, "called"); 430 LOG_DEBUG(Service_FS, "called");
519 431
520 IPC::ResponseBuilder rb{ctx, 3}; 432 *out_access_log_mode = access_log_mode;
521 rb.Push(ResultSuccess);
522 rb.PushEnum(access_log_mode);
523}
524 433
525void FSP_SRV::OutputAccessLogToSdCard(HLERequestContext& ctx) { 434 R_SUCCEED();
526 const auto raw = ctx.ReadBufferCopy(); 435}
527 auto log = Common::StringFromFixedZeroTerminatedBuffer(
528 reinterpret_cast<const char*>(raw.data()), raw.size());
529 436
437Result FSP_SRV::OutputAccessLogToSdCard(InBuffer<BufferAttr_HipcMapAlias> log_message_buffer) {
530 LOG_DEBUG(Service_FS, "called"); 438 LOG_DEBUG(Service_FS, "called");
531 439
440 auto log = Common::StringFromFixedZeroTerminatedBuffer(
441 reinterpret_cast<const char*>(log_message_buffer.data()), log_message_buffer.size());
532 reporter.SaveFSAccessLog(log); 442 reporter.SaveFSAccessLog(log);
533 443
534 IPC::ResponseBuilder rb{ctx, 2}; 444 R_SUCCEED();
535 rb.Push(ResultSuccess);
536} 445}
537 446
538void FSP_SRV::GetProgramIndexForAccessLog(HLERequestContext& ctx) { 447Result FSP_SRV::GetProgramIndexForAccessLog(Out<AccessLogVersion> out_access_log_version,
539 LOG_DEBUG(Service_FS, "called"); 448 Out<u32> out_access_log_program_index) {
449 LOG_DEBUG(Service_FS, "(STUBBED) called");
450
451 *out_access_log_version = AccessLogVersion::Latest;
452 *out_access_log_program_index = access_log_program_index;
540 453
541 IPC::ResponseBuilder rb{ctx, 4}; 454 R_SUCCEED();
542 rb.Push(ResultSuccess);
543 rb.PushEnum(AccessLogVersion::Latest);
544 rb.Push(access_log_program_index);
545} 455}
546 456
547void FSP_SRV::FlushAccessLogOnSdCard(HLERequestContext& ctx) { 457Result FSP_SRV::FlushAccessLogOnSdCard() {
548 LOG_DEBUG(Service_FS, "(STUBBED) called"); 458 LOG_DEBUG(Service_FS, "(STUBBED) called");
549 459
550 IPC::ResponseBuilder rb{ctx, 2}; 460 R_SUCCEED();
551 rb.Push(ResultSuccess);
552} 461}
553 462
554void FSP_SRV::GetCacheStorageSize(HLERequestContext& ctx) { 463Result FSP_SRV::GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size) {
555 IPC::RequestParser rp{ctx};
556 const auto index{rp.Pop<s32>()};
557
558 LOG_WARNING(Service_FS, "(STUBBED) called with index={}", index); 464 LOG_WARNING(Service_FS, "(STUBBED) called with index={}", index);
559 465
560 IPC::ResponseBuilder rb{ctx, 6}; 466 *out_data_size = 0;
561 rb.Push(ResultSuccess); 467 *out_journal_size = 0;
562 rb.Push(s64{0}); 468
563 rb.Push(s64{0}); 469 R_SUCCEED();
564} 470}
565 471
566void FSP_SRV::OpenMultiCommitManager(HLERequestContext& ctx) { 472Result FSP_SRV::OpenMultiCommitManager(OutInterface<IMultiCommitManager> out_interface) {
567 LOG_DEBUG(Service_FS, "called"); 473 LOG_DEBUG(Service_FS, "called");
568 474
569 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 475 *out_interface = std::make_shared<IMultiCommitManager>(system);
570 rb.Push(ResultSuccess); 476
571 rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>(system)); 477 R_SUCCEED();
572} 478}
573 479
574} // namespace Service::FileSystem 480} // namespace Service::FileSystem
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h
index 59406e6f9..0669c4922 100644
--- a/src/core/hle/service/filesystem/fsp/fsp_srv.h
+++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h
@@ -4,6 +4,7 @@
4#pragma once 4#pragma once
5 5
6#include <memory> 6#include <memory>
7#include "core/hle/service/cmif_types.h"
7#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
8 9
9namespace Core { 10namespace Core {
@@ -20,6 +21,11 @@ namespace Service::FileSystem {
20class RomFsController; 21class RomFsController;
21class SaveDataController; 22class SaveDataController;
22 23
24class IFileSystem;
25class ISaveDataInfoReader;
26class IStorage;
27class IMultiCommitManager;
28
23enum class AccessLogVersion : u32 { 29enum class AccessLogVersion : u32 {
24 V7_0_0 = 2, 30 V7_0_0 = 2,
25 31
@@ -32,36 +38,64 @@ enum class AccessLogMode : u32 {
32 SdCard, 38 SdCard,
33}; 39};
34 40
41enum class FileSystemProxyType : u8 {
42 Code = 0,
43 Rom = 1,
44 Logo = 2,
45 Control = 3,
46 Manual = 4,
47 Meta = 5,
48 Data = 6,
49 Package = 7,
50 RegisteredUpdate = 8,
51};
52
35class FSP_SRV final : public ServiceFramework<FSP_SRV> { 53class FSP_SRV final : public ServiceFramework<FSP_SRV> {
36public: 54public:
37 explicit FSP_SRV(Core::System& system_); 55 explicit FSP_SRV(Core::System& system_);
38 ~FSP_SRV() override; 56 ~FSP_SRV() override;
39 57
40private: 58private:
41 void SetCurrentProcess(HLERequestContext& ctx); 59 Result SetCurrentProcess(ClientProcessId pid);
42 void OpenFileSystemWithPatch(HLERequestContext& ctx); 60 Result OpenFileSystemWithPatch(OutInterface<IFileSystem> out_interface,
43 void OpenSdCardFileSystem(HLERequestContext& ctx); 61 FileSystemProxyType type, u64 open_program_id);
44 void CreateSaveDataFileSystem(HLERequestContext& ctx); 62 Result OpenSdCardFileSystem(OutInterface<IFileSystem> out_interface);
45 void CreateSaveDataFileSystemBySystemSaveDataId(HLERequestContext& ctx); 63 Result CreateSaveDataFileSystem(std::array<u8, 0x40> save_create_struct,
46 void OpenSaveDataFileSystem(HLERequestContext& ctx); 64 FileSys::SaveDataAttribute save_struct, u128 uid);
47 void OpenSaveDataFileSystemBySystemSaveDataId(HLERequestContext& ctx); 65 Result CreateSaveDataFileSystemBySystemSaveDataId(std::array<u8, 0x40> save_create_struct,
48 void OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx); 66 FileSys::SaveDataAttribute save_struct);
49 void OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx); 67 Result OpenSaveDataFileSystem(OutInterface<IFileSystem> out_interface,
50 void OpenSaveDataInfoReaderOnlyCacheStorage(HLERequestContext& ctx); 68 FileSys::SaveDataSpaceId space_id,
51 void WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx); 69 FileSys::SaveDataAttribute attribute);
52 void ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx); 70 Result OpenSaveDataFileSystemBySystemSaveDataId(OutInterface<IFileSystem> out_interface,
53 void OpenDataStorageByCurrentProcess(HLERequestContext& ctx); 71 FileSys::SaveDataSpaceId space_id,
54 void OpenDataStorageByDataId(HLERequestContext& ctx); 72 FileSys::SaveDataAttribute attribute);
55 void OpenPatchDataStorageByCurrentProcess(HLERequestContext& ctx); 73 Result OpenReadOnlySaveDataFileSystem(OutInterface<IFileSystem> out_interface,
56 void OpenDataStorageWithProgramIndex(HLERequestContext& ctx); 74 FileSys::SaveDataSpaceId space_id,
57 void DisableAutoSaveDataCreation(HLERequestContext& ctx); 75 FileSys::SaveDataAttribute attribute);
58 void SetGlobalAccessLogMode(HLERequestContext& ctx); 76 Result OpenSaveDataInfoReaderBySaveDataSpaceId(OutInterface<ISaveDataInfoReader> out_interface,
59 void GetGlobalAccessLogMode(HLERequestContext& ctx); 77 FileSys::SaveDataSpaceId space);
60 void OutputAccessLogToSdCard(HLERequestContext& ctx); 78 Result OpenSaveDataInfoReaderOnlyCacheStorage(OutInterface<ISaveDataInfoReader> out_interface);
61 void FlushAccessLogOnSdCard(HLERequestContext& ctx); 79 Result WriteSaveDataFileSystemExtraDataBySaveDataAttribute();
62 void GetProgramIndexForAccessLog(HLERequestContext& ctx); 80 Result ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
63 void OpenMultiCommitManager(HLERequestContext& ctx); 81 FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute,
64 void GetCacheStorageSize(HLERequestContext& ctx); 82 InBuffer<BufferAttr_HipcMapAlias> mask_buffer,
83 OutBuffer<BufferAttr_HipcMapAlias> out_buffer);
84 Result OpenDataStorageByCurrentProcess(OutInterface<IStorage> out_interface);
85 Result OpenDataStorageByDataId(OutInterface<IStorage> out_interface,
86 FileSys::StorageId storage_id, u32 unknown, u64 title_id);
87 Result OpenPatchDataStorageByCurrentProcess(OutInterface<IStorage> out_interface,
88 FileSys::StorageId storage_id, u64 title_id);
89 Result OpenDataStorageWithProgramIndex(OutInterface<IStorage> out_interface, u8 program_index);
90 Result DisableAutoSaveDataCreation();
91 Result SetGlobalAccessLogMode(AccessLogMode access_log_mode_);
92 Result GetGlobalAccessLogMode(Out<AccessLogMode> out_access_log_mode);
93 Result OutputAccessLogToSdCard(InBuffer<BufferAttr_HipcMapAlias> log_message_buffer);
94 Result FlushAccessLogOnSdCard();
95 Result GetProgramIndexForAccessLog(Out<AccessLogVersion> out_access_log_version,
96 Out<u32> out_access_log_program_index);
97 Result OpenMultiCommitManager(OutInterface<IMultiCommitManager> out_interface);
98 Result GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size);
65 99
66 FileSystemController& fsc; 100 FileSystemController& fsc;
67 const FileSys::ContentProvider& content_provider; 101 const FileSys::ContentProvider& content_provider;