From 77f0cdfaf4e493c7c7018a006c6098182cfb76b1 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 18 Dec 2014 15:30:28 -0500 Subject: SaveData: Added some documentation to FormatSaveData We still don't know what the other parameters do, but they appear to be very similar to those of FormatThisUserSaveData. Most likely FormatThisUserSaveData is just an alias for FormatSaveData with LowPathType Empty --- src/core/hle/service/fs/fs_user.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service/fs/fs_user.cpp') diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index f99d84b2..4c63269c 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) { } /** - * FS_User::FormatSaveData service function + * FS_User::FormatSaveData service function, + * formats the SaveData specified by the input path. * Inputs: + * 1 : Archive ID + * 2 : Archive low path type + * 3 : Archive low path size + * 10 : (LowPathSize << 14) | 2 + * 11 : Archive low path * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ static void FormatSaveData(Service::Interface* self) { + // TODO(Subv): Find out what the other inputs and outputs of this function are u32* cmd_buff = Kernel::GetCommandBuffer(); LOG_DEBUG(Service_FS, "(STUBBED)"); - // TODO(Subv): Find out what the inputs and outputs of this function are + auto archive_id = static_cast(cmd_buff[1]); + auto archivename_type = static_cast(cmd_buff[2]); + u32 archivename_size = cmd_buff[3]; + u32 archivename_ptr = cmd_buff[11]; + FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr); + + LOG_DEBUG(Service_FS, "archive_path=%s", archive_path.DebugStr().c_str()); + + if (archive_id != FS::ArchiveIdCode::SaveData) { + // TODO(Subv): What should happen if somebody attempts to format a different archive? + LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u", cmd_buff[1]); + cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw; + return; + } + + if (archive_path.GetType() != FileSys::LowPathType::Empty) { + // TODO(Subv): Implement formatting the SaveData of other games + LOG_ERROR(Service_FS, "archive LowPath type other than empty is currently unsupported"); + cmd_buff[1] = UnimplementedFunction(ErrorModule::FS).raw; + return; + } cmd_buff[1] = FormatSaveData().raw; } -- cgit v1.2.3