summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-05-21 06:41:11 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-05-25 06:06:00 +0200
commit92be29adba56408685e594e5e659f1dc83686cde (patch)
tree09afef886d4eb26e4f752dc9b93c81ea21d87d9c /src/core/hle
parentresult: Make error description a generic integer (diff)
downloadyuzu-92be29adba56408685e594e5e659f1dc83686cde.tar
yuzu-92be29adba56408685e594e5e659f1dc83686cde.tar.gz
yuzu-92be29adba56408685e594e5e659f1dc83686cde.tar.bz2
yuzu-92be29adba56408685e594e5e659f1dc83686cde.tar.lz
yuzu-92be29adba56408685e594e5e659f1dc83686cde.tar.xz
yuzu-92be29adba56408685e594e5e659f1dc83686cde.tar.zst
yuzu-92be29adba56408685e594e5e659f1dc83686cde.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/result.h21
-rw-r--r--src/core/hle/service/cfg/cfg.cpp6
-rw-r--r--src/core/hle/service/fs/archive.cpp28
-rw-r--r--src/core/hle/service/fs/fs_user.cpp5
-rw-r--r--src/core/hle/service/ptm/ptm.cpp3
5 files changed, 19 insertions, 44 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index c44668732..b066b7d4e 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -26,30 +26,9 @@ enum class ErrorDescription : u32 {
OS_InvalidBufferDescriptor = 48,
MaxConnectionsReached = 52,
WrongAddress = 53,
- FS_RomFSNotFound = 100,
- FS_ArchiveNotMounted = 101,
- FS_FileNotFound = 112,
- FS_PathNotFound = 113,
- FS_GameCardNotInserted = 141,
- FS_NotFound = 120,
- FS_FileAlreadyExists = 180,
- FS_DirectoryAlreadyExists = 185,
- FS_AlreadyExists = 190,
- FS_InvalidOpenFlags = 230,
- FS_DirectoryNotEmpty = 240,
- FS_NotAFile = 250,
- FS_NotFormatted = 340, ///< This is used by the FS service when creating a SaveData archive
OutofRangeOrMisalignedAddress =
513, // TODO(purpasmart): Check if this name fits its actual usage
GPU_FirstInitialization = 519,
- FS_ExeFSSectionNotFound = 567,
- FS_CommandNotAllowed = 630,
- FS_InvalidReadFlag = 700,
- FS_InvalidPath = 702,
- FS_WriteBeyondEnd = 705,
- FS_UnsupportedOpenFlags = 760,
- FS_IncorrectExeFSReadSize = 761,
- FS_UnexpectedFileOrDirectory = 770,
// Codes 1000 and above are considered "well-known" and have common values between all modules.
InvalidSection = 1000,
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 14185ae20..caa41ded7 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -11,6 +11,7 @@
#include "common/string_util.h"
#include "common/swap.h"
#include "core/file_sys/archive_systemsavedata.h"
+#include "core/file_sys/errors.h"
#include "core/file_sys/file_backend.h"
#include "core/hle/result.h"
#include "core/hle/service/cfg/cfg.h"
@@ -411,8 +412,7 @@ ResultCode UpdateConfigNANDSavegame() {
ResultCode FormatConfig() {
ResultCode res = DeleteConfigNANDSaveFile();
// The delete command fails if the file doesn't exist, so we have to check that too
- if (!res.IsSuccess() &&
- res.description != static_cast<u32>(ErrorDescription::FS_FileNotFound)) {
+ if (!res.IsSuccess() && res != FileSys::ERROR_FILE_NOT_FOUND) {
return res;
}
// Delete the old data
@@ -535,7 +535,7 @@ ResultCode LoadConfigNANDSaveFile() {
Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SystemSaveData, archive_path);
// If the archive didn't exist, create the files inside
- if (archive_result.Code().description == static_cast<u32>(ErrorDescription::FS_NotFormatted)) {
+ if (archive_result.Code() == FileSys::ERR_NOT_FORMATTED) {
// Format the archive to create the directories
Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SystemSaveData,
FileSys::ArchiveFormatInfo(), archive_path);
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 6cddc1fdb..5c1235f8b 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -22,6 +22,7 @@
#include "core/file_sys/archive_sdmcwriteonly.h"
#include "core/file_sys/archive_systemsavedata.h"
#include "core/file_sys/directory_backend.h"
+#include "core/file_sys/errors.h"
#include "core/file_sys/file_backend.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/result.h"
@@ -55,11 +56,6 @@ namespace FS {
const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::FS,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
-/// Returned when a function is passed an invalid archive handle.
-const ResultCode ERR_INVALID_ARCHIVE_HANDLE(ErrorDescription::FS_ArchiveNotMounted, ErrorModule::FS,
- ErrorSummary::NotFound,
- ErrorLevel::Status); // 0xC8804465
-
// Command to access archive file
enum class FileCommand : u32 {
Dummy1 = 0x000100C6,
@@ -284,7 +280,7 @@ ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archi
ResultCode CloseArchive(ArchiveHandle handle) {
if (handle_map.erase(handle) == 0)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
else
return RESULT_SUCCESS;
}
@@ -309,7 +305,7 @@ ResultVal<std::shared_ptr<File>> OpenFileFromArchive(ArchiveHandle archive_handl
const FileSys::Mode mode) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
auto backend = archive->OpenFile(path, mode);
if (backend.Failed())
@@ -322,7 +318,7 @@ ResultVal<std::shared_ptr<File>> OpenFileFromArchive(ArchiveHandle archive_handl
ResultCode DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
return archive->DeleteFile(path);
}
@@ -334,7 +330,7 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
ArchiveBackend* src_archive = GetArchive(src_archive_handle);
ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
if (src_archive == nullptr || dest_archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
if (src_archive == dest_archive) {
return src_archive->RenameFile(src_path, dest_path);
@@ -347,7 +343,7 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
return archive->DeleteDirectory(path);
}
@@ -356,7 +352,7 @@ ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
return archive->DeleteDirectoryRecursively(path);
}
@@ -365,7 +361,7 @@ ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path
u64 file_size) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
return archive->CreateFile(path, file_size);
}
@@ -373,7 +369,7 @@ ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path
ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
return archive->CreateDirectory(path);
}
@@ -385,7 +381,7 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle,
ArchiveBackend* src_archive = GetArchive(src_archive_handle);
ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
if (src_archive == nullptr || dest_archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
if (src_archive == dest_archive) {
return src_archive->RenameDirectory(src_path, dest_path);
@@ -399,7 +395,7 @@ ResultVal<std::shared_ptr<Directory>> OpenDirectoryFromArchive(ArchiveHandle arc
const FileSys::Path& path) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
auto backend = archive->OpenDirectory(path);
if (backend.Failed())
@@ -412,7 +408,7 @@ ResultVal<std::shared_ptr<Directory>> OpenDirectoryFromArchive(ArchiveHandle arc
ResultVal<u64> GetFreeBytesInArchive(ArchiveHandle archive_handle) {
ArchiveBackend* archive = GetArchive(archive_handle);
if (archive == nullptr)
- return ERR_INVALID_ARCHIVE_HANDLE;
+ return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
return MakeResult<u64>(archive->GetFreeBytes());
}
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 33b290699..ad1aadab5 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -8,6 +8,7 @@
#include "common/logging/log.h"
#include "common/scope_exit.h"
#include "common/string_util.h"
+#include "core/file_sys/errors.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/result.h"
#include "core/hle/service/fs/archive.h"
@@ -539,9 +540,7 @@ static void FormatSaveData(Service::Interface* self) {
if (archive_id != FS::ArchiveIdCode::SaveData) {
LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u",
static_cast<u32>(archive_id));
- cmd_buff[1] = ResultCode(ErrorDescription::FS_InvalidPath, ErrorModule::FS,
- ErrorSummary::InvalidArgument, ErrorLevel::Usage)
- .raw;
+ cmd_buff[1] = FileSys::ERROR_INVALID_PATH.raw;
return;
}
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index b6d6d105a..39382ef09 100644
--- a/src/core/hle/service/ptm/ptm.cpp
+++ b/src/core/hle/service/ptm/ptm.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include "common/logging/log.h"
+#include "core/file_sys/errors.h"
#include "core/file_sys/file_backend.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/ptm/ptm.h"
@@ -134,7 +135,7 @@ void Init() {
auto archive_result =
Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
// If the archive didn't exist, create the files inside
- if (archive_result.Code().description == static_cast<u32>(ErrorDescription::FS_NotFormatted)) {
+ if (archive_result.Code() == FileSys::ERR_NOT_FORMATTED) {
// Format the archive to create the directories
Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData,
FileSys::ArchiveFormatInfo(), archive_path);