summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/fs/fs_user.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index f99d84b2f..4c63269cf 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -397,16 +397,43 @@ static void IsSdmcDetected(Service::Interface* self) {
397} 397}
398 398
399/** 399/**
400 * FS_User::FormatSaveData service function 400 * FS_User::FormatSaveData service function,
401 * formats the SaveData specified by the input path.
401 * Inputs: 402 * Inputs:
403 * 1 : Archive ID
404 * 2 : Archive low path type
405 * 3 : Archive low path size
406 * 10 : (LowPathSize << 14) | 2
407 * 11 : Archive low path
402 * Outputs: 408 * Outputs:
403 * 1 : Result of function, 0 on success, otherwise error code 409 * 1 : Result of function, 0 on success, otherwise error code
404 */ 410 */
405static void FormatSaveData(Service::Interface* self) { 411static void FormatSaveData(Service::Interface* self) {
412 // TODO(Subv): Find out what the other inputs and outputs of this function are
406 u32* cmd_buff = Kernel::GetCommandBuffer(); 413 u32* cmd_buff = Kernel::GetCommandBuffer();
407 LOG_DEBUG(Service_FS, "(STUBBED)"); 414 LOG_DEBUG(Service_FS, "(STUBBED)");
408 415
409 // TODO(Subv): Find out what the inputs and outputs of this function are 416 auto archive_id = static_cast<FS::ArchiveIdCode>(cmd_buff[1]);
417 auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[2]);
418 u32 archivename_size = cmd_buff[3];
419 u32 archivename_ptr = cmd_buff[11];
420 FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
421
422 LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str());
423
424 if (archive_id != FS::ArchiveIdCode::SaveData) {
425 // TODO(Subv): What should happen if somebody attempts to format a different archive?
426 LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u", cmd_buff[1]);
427 cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
428 return;
429 }
430
431 if (archive_path.GetType() != FileSys::LowPathType::Empty) {
432 // TODO(Subv): Implement formatting the SaveData of other games
433 LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported");
434 cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw;
435 return;
436 }
410 437
411 cmd_buff[1] = FormatSaveData().raw; 438 cmd_buff[1] = FormatSaveData().raw;
412} 439}