summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-05-26 17:59:57 +0200
committerGitHub <noreply@github.com>2017-05-26 17:59:57 +0200
commit61decd84cc5308bded75eae62c3247a66b3698d8 (patch)
treebbe05121af1a971bc295cb81baeea63f8c54f407 /src/core/hle/service
parentMerge pull request #2697 from wwylele/proctex (diff)
parentFS: Remove unused result definition (diff)
downloadyuzu-61decd84cc5308bded75eae62c3247a66b3698d8.tar
yuzu-61decd84cc5308bded75eae62c3247a66b3698d8.tar.gz
yuzu-61decd84cc5308bded75eae62c3247a66b3698d8.tar.bz2
yuzu-61decd84cc5308bded75eae62c3247a66b3698d8.tar.lz
yuzu-61decd84cc5308bded75eae62c3247a66b3698d8.tar.xz
yuzu-61decd84cc5308bded75eae62c3247a66b3698d8.tar.zst
yuzu-61decd84cc5308bded75eae62c3247a66b3698d8.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/boss/boss.cpp4
-rw-r--r--src/core/hle/service/cfg/cfg.cpp5
-rw-r--r--src/core/hle/service/dsp_dsp.cpp4
-rw-r--r--src/core/hle/service/fs/archive.cpp33
-rw-r--r--src/core/hle/service/fs/fs_user.cpp9
-rw-r--r--src/core/hle/service/gsp_gpu.cpp37
-rw-r--r--src/core/hle/service/ir/ir_user.cpp3
-rw-r--r--src/core/hle/service/ptm/ptm.cpp3
-rw-r--r--src/core/hle/service/srv.cpp4
9 files changed, 47 insertions, 55 deletions
diff --git a/src/core/hle/service/boss/boss.cpp b/src/core/hle/service/boss/boss.cpp
index e0de037f8..91056189a 100644
--- a/src/core/hle/service/boss/boss.cpp
+++ b/src/core/hle/service/boss/boss.cpp
@@ -24,9 +24,7 @@ void InitializeSession(Service::Interface* self) {
if (translation != IPC::CallingPidDesc()) {
cmd_buff[0] = IPC::MakeHeader(0, 0x1, 0); // 0x40
- cmd_buff[1] = ResultCode(ErrorDescription::OS_InvalidBufferDescriptor, ErrorModule::OS,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent)
- .raw;
+ cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
LOG_ERROR(Service_BOSS, "The translation was invalid, translation=0x%08X", translation);
return;
}
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 8c8c1ec77..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,7 +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 != ErrorDescription::FS_FileNotFound) {
+ if (!res.IsSuccess() && res != FileSys::ERROR_FILE_NOT_FOUND) {
return res;
}
// Delete the old data
@@ -534,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 == 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/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index 39711ea97..79171a0bc 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -289,9 +289,7 @@ static void WriteProcessPipe(Service::Interface* self) {
"size=0x%X, buffer=0x%08X",
cmd_buff[3], pipe_index, size, buffer);
cmd_buff[0] = IPC::MakeHeader(0, 1, 0);
- cmd_buff[1] = ResultCode(ErrorDescription::OS_InvalidBufferDescriptor, ErrorModule::OS,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent)
- .raw;
+ cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
return;
}
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 6cddc1fdb..632712f2c 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"
@@ -50,16 +51,6 @@ static constexpr Kernel::Handle INVALID_HANDLE{};
namespace Service {
namespace FS {
-// TODO: Verify code
-/// Returned when a function is passed an invalid handle.
-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 +275,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 +300,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 +313,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 +325,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 +338,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 +347,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 +356,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 +364,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 +376,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 +390,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 +403,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..e53a970d3 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;
}
@@ -802,9 +801,7 @@ static void InitializeWithSdkVersion(Service::Interface* self) {
cmd_buff[1] = RESULT_SUCCESS.raw;
} else {
LOG_ERROR(Service_FS, "ProcessId Header must be 0x20");
- cmd_buff[1] = ResultCode(ErrorDescription::OS_InvalidBufferDescriptor, ErrorModule::OS,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent)
- .raw;
+ cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
}
}
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index a960778a7..46c4ed01a 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -25,13 +25,24 @@ namespace GSP {
// Beginning address of HW regs
const u32 REGS_BEGIN = 0x1EB00000;
-const ResultCode ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED(
- ErrorDescription::OutofRangeOrMisalignedAddress, ErrorModule::GX, ErrorSummary::InvalidArgument,
- ErrorLevel::Usage); // 0xE0E02A01
-const ResultCode ERR_GSP_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX,
+namespace ErrCodes {
+enum {
+ // TODO(purpasmart): Check if this name fits its actual usage
+ OutofRangeOrMisalignedAddress = 513,
+ FirstInitialization = 519,
+};
+}
+
+constexpr ResultCode RESULT_FIRST_INITIALIZATION(ErrCodes::FirstInitialization, ErrorModule::GX,
+ ErrorSummary::Success, ErrorLevel::Success);
+constexpr ResultCode ERR_REGS_OUTOFRANGE_OR_MISALIGNED(ErrCodes::OutofRangeOrMisalignedAddress,
+ ErrorModule::GX,
+ ErrorSummary::InvalidArgument,
+ ErrorLevel::Usage); // 0xE0E02A01
+constexpr ResultCode ERR_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BF2
-const ResultCode ERR_GSP_REGS_INVALID_SIZE(ErrorDescription::InvalidSize, ErrorModule::GX,
+constexpr ResultCode ERR_REGS_INVALID_SIZE(ErrorDescription::InvalidSize, ErrorModule::GX,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BEC
@@ -93,11 +104,11 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, VAddr data_va
LOG_ERROR(Service_GSP,
"Write address was out of range or misaligned! (address=0x%08x, size=0x%08x)",
base_address, size_in_bytes);
- return ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED;
+ return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
} else if (size_in_bytes <= max_size_in_bytes) {
if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_MISALIGNED;
+ return ERR_REGS_MISALIGNED;
} else {
while (size_in_bytes > 0) {
WriteSingleHWReg(base_address, Memory::Read32(data_vaddr));
@@ -111,7 +122,7 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, VAddr data_va
} else {
LOG_ERROR(Service_GSP, "Out of range size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_INVALID_SIZE;
+ return ERR_REGS_INVALID_SIZE;
}
}
@@ -134,11 +145,11 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, VAddr
LOG_ERROR(Service_GSP,
"Write address was out of range or misaligned! (address=0x%08x, size=0x%08x)",
base_address, size_in_bytes);
- return ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED;
+ return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
} else if (size_in_bytes <= max_size_in_bytes) {
if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_MISALIGNED;
+ return ERR_REGS_MISALIGNED;
} else {
while (size_in_bytes > 0) {
const u32 reg_address = base_address + REGS_BEGIN;
@@ -164,7 +175,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, VAddr
} else {
LOG_ERROR(Service_GSP, "Out of range size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_INVALID_SIZE;
+ return ERR_REGS_INVALID_SIZE;
}
}
@@ -372,9 +383,7 @@ static void RegisterInterruptRelayQueue(Interface* self) {
if (first_initialization) {
// This specific code is required for a successful initialization, rather than 0
first_initialization = false;
- cmd_buff[1] = ResultCode(ErrorDescription::GPU_FirstInitialization, ErrorModule::GX,
- ErrorSummary::Success, ErrorLevel::Success)
- .raw;
+ cmd_buff[1] = RESULT_FIRST_INITIALIZATION.raw;
} else {
cmd_buff[1] = RESULT_SUCCESS.raw;
}
diff --git a/src/core/hle/service/ir/ir_user.cpp b/src/core/hle/service/ir/ir_user.cpp
index 226af0083..369115f09 100644
--- a/src/core/hle/service/ir/ir_user.cpp
+++ b/src/core/hle/service/ir/ir_user.cpp
@@ -267,8 +267,7 @@ static void InitializeIrNopShared(Interface* self) {
shared_memory = Kernel::g_handle_table.Get<Kernel::SharedMemory>(handle);
if (!shared_memory) {
LOG_CRITICAL(Service_IR, "invalid shared memory handle 0x%08X", handle);
- rb.Push(ResultCode(ErrorDescription::InvalidHandle, ErrorModule::OS,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent));
+ rb.Push(IPC::ERR_INVALID_HANDLE);
return;
}
shared_memory->name = "IR_USER: shared memory";
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index 319e8c946..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 == 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);
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index 3bd787147..130c9d25e 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -30,9 +30,7 @@ static void RegisterClient(Interface* self) {
if (cmd_buff[1] != IPC::CallingPidDesc()) {
cmd_buff[0] = IPC::MakeHeader(0x0, 0x1, 0); // 0x40
- cmd_buff[1] = ResultCode(ErrorDescription::OS_InvalidBufferDescriptor, ErrorModule::OS,
- ErrorSummary::WrongArgument, ErrorLevel::Permanent)
- .raw;
+ cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
return;
}
cmd_buff[0] = IPC::MakeHeader(0x1, 0x1, 0); // 0x10040