diff options
author | Subv <subv2112@gmail.com> | 2015-02-07 19:31:34 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-02-10 16:43:46 +0100 |
commit | 1bbf0567b1889ebd57e3bcdf44b091e0ee18d125 (patch) | |
tree | 78354d4084978ce01f469e569306ae1c6b57dcf1 /src/core/hle | |
parent | Archives: Expose the File and Directory classes to HLE (diff) | |
download | yuzu-1bbf0567b1889ebd57e3bcdf44b091e0ee18d125.tar yuzu-1bbf0567b1889ebd57e3bcdf44b091e0ee18d125.tar.gz yuzu-1bbf0567b1889ebd57e3bcdf44b091e0ee18d125.tar.bz2 yuzu-1bbf0567b1889ebd57e3bcdf44b091e0ee18d125.tar.lz yuzu-1bbf0567b1889ebd57e3bcdf44b091e0ee18d125.tar.xz yuzu-1bbf0567b1889ebd57e3bcdf44b091e0ee18d125.tar.zst yuzu-1bbf0567b1889ebd57e3bcdf44b091e0ee18d125.zip |
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/service/fs/archive.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/service/fs/archive.h | 7 | ||||
-rw-r--r-- | src/core/hle/service/fs/fs_user.cpp | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 481715f17..e197d3599 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -383,15 +383,13 @@ ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle a return MakeResult<Kernel::SharedPtr<Directory>>(std::move(directory)); } -ResultCode FormatSaveData() { - // Do not create the archive again if it already exists - auto archive_itr = id_code_map.find(ArchiveIdCode::SaveData); +ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::Path& path) { + auto archive_itr = id_code_map.find(id_code); if (archive_itr == id_code_map.end()) { return UnimplementedFunction(ErrorModule::FS); // TODO(Subv): Find the right error } - // Use an empty path, we do not use it when formatting the savedata - return archive_itr->second->Format(FileSys::Path()); + return archive_itr->second->Format(path); } ResultCode CreateExtSaveData(u32 high, u32 low) { diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index e27ad7d60..c490327d0 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -162,10 +162,13 @@ ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle a const FileSys::Path& path); /** - * Creates a blank SaveData archive. + * Erases the contents of the physical folder that contains the archive + * identified by the specified id code and path + * @param id_code The id of the archive to format + * @param path The path to the archive, if relevant. * @return ResultCode 0 on success or the corresponding code on error */ -ResultCode FormatSaveData(); +ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::Path& path = FileSys::Path()); /** * Creates a blank SharedExtSaveData archive for the specified extdata ID diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index d57dd042b..71ee4ff55 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -468,7 +468,7 @@ static void FormatSaveData(Service::Interface* self) { return; } - cmd_buff[1] = FormatSaveData().raw; + cmd_buff[1] = FormatArchive(ArchiveIdCode::SaveData).raw; } /** @@ -484,7 +484,7 @@ static void FormatThisUserSaveData(Service::Interface* self) { // TODO(Subv): Find out what the inputs and outputs of this function are - cmd_buff[1] = FormatSaveData().raw; + cmd_buff[1] = FormatArchive(ArchiveIdCode::SaveData).raw; } static void CreateExtSaveData(Service::Interface* self) { |