aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service/fs
diff options
context:
space:
mode:
authorGravatar Subv <subv2112@gmail.com>2015-01-13 23:56:00 -0500
committerGravatar Subv <subv2112@gmail.com>2015-01-24 15:44:40 -0500
commitc2e9990149fc0b5ef937adf24285eb7cc7526893 (patch)
treea3d8d671f45ef0b17f5c247e03dbf4b13347b4c2 /src/core/hle/service/fs
parent92550013cf316cd4ee631d11429bddb7ee0b5e94 (diff)
Services: Stubbed more services.
Implemented FSUser::CreateExtSaveData
Diffstat (limited to 'src/core/hle/service/fs')
-rw-r--r--src/core/hle/service/fs/archive.cpp22
-rw-r--r--src/core/hle/service/fs/archive.h8
-rw-r--r--src/core/hle/service/fs/fs_user.cpp11
3 files changed, 41 insertions, 0 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 958dd934..1bb4e4b2 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -432,6 +432,28 @@ ResultCode FormatSaveData() {
return archive_itr->second->backend->Format(FileSys::Path());
}
+ResultCode CreateExtSaveData(u32 high, u32 low) {
+ // Construct the binary path to the archive first
+ std::vector<u8> binary_path;
+ binary_path.reserve(12);
+ // The first word is all zero to specify a NAND archive
+ for (unsigned i = 0; i < 4; ++i)
+ binary_path.push_back(0);
+ // Next is the low word
+ for (unsigned i = 0; i < 4; ++i)
+ binary_path.push_back((low >> (8 * i)) & 0xFF);
+ // Next is the high word
+ for (unsigned i = 0; i < 4; ++i)
+ binary_path.push_back((high >> i) & 0xFF);
+ FileSys::Path path(binary_path);
+ std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
+ std::string base_path = FileSys::GetExtDataContainerPath(nand_directory, true);
+ std::string extsavedata_path = FileSys::GetExtSaveDataPath(base_path, path);
+ if (!FileUtil::CreateFullPath(extsavedata_path))
+ return ResultCode(-1); // TODO(Subv): Find the right error code
+ return RESULT_SUCCESS;
+}
+
/// Initialize archives
void ArchiveInit() {
next_handle = 1;
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 2cdfaa7e..ba674d7f 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -131,6 +131,14 @@ ResultVal<Handle> OpenDirectoryFromArchive(ArchiveHandle archive_handle, const F
*/
ResultCode FormatSaveData();
+/**
+ * Creates a blank SharedExtSaveData archive for the specified extdata ID
+ * @param high The high word of the extdata id to create
+ * @param low The low word of the extdata id to create
+ * @return ResultCode 0 on success or the corresponding code on error
+ */
+ResultCode CreateExtSaveData(u32 high, u32 low);
+
/// Initialize archives
void ArchiveInit();
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 56f3117f..c495b6f3 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -484,6 +484,15 @@ static void FormatThisUserSaveData(Service::Interface* self) {
cmd_buff[1] = FormatSaveData().raw;
}
+static void CreateExtSaveData(Service::Interface* self) {
+ // TODO(Subv): Figure out the other parameters.
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+ u32 save_high = cmd_buff[1];
+ u32 save_low = cmd_buff[2];
+ // TODO(Subv): For now it is assumed that only SharedExtSaveData can be created like this
+ cmd_buff[1] = CreateExtSaveData(save_high, save_low).raw;
+}
+
const FSUserInterface::FunctionInfo FunctionTable[] = {
{0x000100C6, nullptr, "Dummy1"},
{0x040100C4, nullptr, "Control"},
@@ -567,6 +576,8 @@ const FSUserInterface::FunctionInfo FunctionTable[] = {
{0x084E0342, nullptr, "UpdateSha256Context"},
{0x084F0102, nullptr, "ReadSpecialFile"},
{0x08500040, nullptr, "GetSpecialFileSize"},
+ {0x08510242, CreateExtSaveData, "CreateExtSaveData"},
+ {0x08520100, nullptr, "DeleteExtSaveData"},
{0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"},
{0x08610042, nullptr, "InitializeWithSdkVersion"},
{0x08620040, nullptr, "SetPriority"},