aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service/fs
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2014-12-19 23:20:31 -0500
committerGravatar bunnei <bunneidev@gmail.com>2014-12-19 23:20:31 -0500
commitf1309e6bf0d29cc0f71f9864ea7e2c1dc62eb23b (patch)
treebf0d6783a341cde688aba629b90e2c7f6736ba42 /src/core/hle/service/fs
parenteb394ac0af110a2c1b10901171f4f5303881b147 (diff)
parentfc73bef692c95f6d984aeab10346c524ec71ab04 (diff)
Merge pull request #306 from Subv/even_more_savedata
SaveData: Added some documentation to FormatSaveData
Diffstat (limited to 'src/core/hle/service/fs')
-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 f99d84b2..8b908d69 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) {
}
/**
- * FS_User::FormatSaveData service function
+ * FS_User::FormatSaveData service function,
+ * formats the SaveData specified by the input path.
* Inputs:
+ * 0 : 0x084C0242
+ * 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<FS::ArchiveIdCode>(cmd_buff[1]);
+ auto archivename_type = static_cast<FileSys::LowPathType>(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;
}
@@ -414,6 +442,7 @@ static void FormatSaveData(Service::Interface* self) {
/**
* FS_User::FormatThisUserSaveData service function
* Inputs:
+ * 0: 0x080F0180
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/