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