summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-11-25 00:45:20 +0100
committerarchshift <admin@archshift.com>2014-12-04 07:50:44 +0100
commit139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee (patch)
treec30714dea3bff0ac20e171509427fabfec26ba17 /src/core/hle/kernel
parentImplemented RenameDirectory in FS:USER (diff)
downloadyuzu-139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee.tar
yuzu-139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee.tar.gz
yuzu-139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee.tar.bz2
yuzu-139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee.tar.lz
yuzu-139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee.tar.xz
yuzu-139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee.tar.zst
yuzu-139a4d91d9e8482d8ceeef591b08ab20b0f7e8ee.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/archive.cpp87
-rw-r--r--src/core/hle/kernel/archive.h14
2 files changed, 36 insertions, 65 deletions
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp
index bffe59952..647f0dea9 100644
--- a/src/core/hle/kernel/archive.cpp
+++ b/src/core/hle/kernel/archive.cpp
@@ -340,97 +340,68 @@ ResultVal<Handle> OpenFileFromArchive(Handle archive_handle, const FileSys::Path
return MakeResult<Handle>(handle);
}
-/**
- * Delete a File from an Archive
- * @param archive_handle Handle to an open Archive object
- * @param path Path to the File inside of the Archive
- * @return Whether deletion succeeded
- */
-Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path) {
+ResultCode DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path) {
Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
if (archive == nullptr)
- return -1;
+ return InvalidHandle(ErrorModule::FS);
if (archive->backend->DeleteFile(path))
- return 0;
- return -1;
+ return RESULT_SUCCESS;
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
+ ErrorSummary::Canceled, ErrorLevel::Status);
}
-/**
- * Rename a File between two Archives
- * @param src_archive_handle Handle to the source Archive object
- * @param src_path Path to the File inside of the source Archive
- * @param dest_archive_handle Handle to the destination Archive object
- * @param dest_path Path to the File inside of the destination Archive
- * @return Whether rename succeeded
- */
-Result RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
- Handle dest_archive_handle, const FileSys::Path& dest_path) {
+ResultCode RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
+ Handle dest_archive_handle, const FileSys::Path& dest_path) {
Archive* src_archive = Kernel::g_object_pool.GetFast<Archive>(src_archive_handle);
Archive* dest_archive = Kernel::g_object_pool.GetFast<Archive>(dest_archive_handle);
if (src_archive == nullptr || dest_archive == nullptr)
- return -1;
+ return InvalidHandle(ErrorModule::FS);
if (src_archive == dest_archive) {
if (src_archive->backend->RenameFile(src_path, dest_path))
- return 0;
+ return RESULT_SUCCESS;
} else {
// TODO: Implement renaming across archives
- return -1;
+ return UnimplementedFunction(ErrorModule::FS);
}
- return -1;
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
+ ErrorSummary::NothingHappened, ErrorLevel::Status);
}
-/**
- * Delete a Directory from an Archive
- * @param archive_handle Handle to an open Archive object
- * @param path Path to the Directory inside of the Archive
- * @return Whether deletion succeeded
- */
-Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
+ResultCode DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
if (archive == nullptr)
- return -1;
+ return InvalidHandle(ErrorModule::FS);
if (archive->backend->DeleteDirectory(path))
- return 0;
- return -1;
+ return RESULT_SUCCESS;
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
+ ErrorSummary::Canceled, ErrorLevel::Status);
}
-/**
- * Create a Directory from an Archive
- * @param archive_handle Handle to an open Archive object
- * @param path Path to the Directory inside of the Archive
- * @return Whether creation succeeded
- */
-Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
+ResultCode CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
if (archive == nullptr)
- return -1;
+ return InvalidHandle(ErrorModule::FS);
if (archive->backend->CreateDirectory(path))
- return 0;
- return -1;
+ return RESULT_SUCCESS;
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
+ ErrorSummary::Canceled, ErrorLevel::Status);
}
-/**
- * Rename a Directory between two Archives
- * @param src_archive_handle Handle to the source Archive object
- * @param src_path Path to the Directory inside of the source Archive
- * @param dest_archive_handle Handle to the destination Archive object
- * @param dest_path Path to the Directory inside of the destination Archive
- * @return Whether rename succeeded
- */
-Result RenameDirectoryBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
- Handle dest_archive_handle, const FileSys::Path& dest_path) {
+ResultCode RenameDirectoryBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
+ Handle dest_archive_handle, const FileSys::Path& dest_path) {
Archive* src_archive = Kernel::g_object_pool.GetFast<Archive>(src_archive_handle);
Archive* dest_archive = Kernel::g_object_pool.GetFast<Archive>(dest_archive_handle);
if (src_archive == nullptr || dest_archive == nullptr)
- return -1;
+ return InvalidHandle(ErrorModule::FS);
if (src_archive == dest_archive) {
if (src_archive->backend->RenameDirectory(src_path, dest_path))
- return 0;
+ return RESULT_SUCCESS;
} else {
// TODO: Implement renaming across archives
- return -1;
+ return UnimplementedFunction(ErrorModule::FS);
}
- return -1;
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
+ ErrorSummary::NothingHappened, ErrorLevel::Status);
}
/**
diff --git a/src/core/hle/kernel/archive.h b/src/core/hle/kernel/archive.h
index 9d071d315..b50833a2b 100644
--- a/src/core/hle/kernel/archive.h
+++ b/src/core/hle/kernel/archive.h
@@ -50,7 +50,7 @@ ResultVal<Handle> OpenFileFromArchive(Handle archive_handle, const FileSys::Path
* @param path Path to the File inside of the Archive
* @return Whether deletion succeeded
*/
-Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path);
+ResultCode DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path);
/**
* Rename a File between two Archives
@@ -60,8 +60,8 @@ Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path);
* @param dest_path Path to the File inside of the destination Archive
* @return Whether rename succeeded
*/
-Result RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
- Handle dest_archive_handle, const FileSys::Path& dest_path);
+ResultCode RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
+ Handle dest_archive_handle, const FileSys::Path& dest_path);
/**
* Delete a Directory from an Archive
@@ -69,7 +69,7 @@ Result RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path&
* @param path Path to the Directory inside of the Archive
* @return Whether deletion succeeded
*/
-Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
+ResultCode DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
/**
* Create a Directory from an Archive
@@ -77,7 +77,7 @@ Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& pa
* @param path Path to the Directory inside of the Archive
* @return Whether creation of directory succeeded
*/
-Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
+ResultCode CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
/**
* Rename a Directory between two Archives
@@ -87,8 +87,8 @@ Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& pa
* @param dest_path Path to the Directory inside of the destination Archive
* @return Whether rename succeeded
*/
-Result RenameDirectoryBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
- Handle dest_archive_handle, const FileSys::Path& dest_path);
+ResultCode RenameDirectoryBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path,
+ Handle dest_archive_handle, const FileSys::Path& dest_path);
/**
* Open a Directory from an Archive