forked from ShuriZma/suyu
1
0
Fork 0

Merge pull request #2223 from lioncash/error

core/hle/result: Tidy up the base error code result header.
This commit is contained in:
bunnei 2019-03-13 14:43:14 -04:00 committed by GitHub
commit c1ea6a39a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 19 deletions

View File

@ -19,9 +19,12 @@
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
#include "core/hle/result.h"
namespace IPC { namespace IPC {
constexpr ResultCode ERR_REMOTE_PROCESS_DEAD{ErrorModule::HIPC, 301};
class RequestHelperBase { class RequestHelperBase {
protected: protected:
Kernel::HLERequestContext* context = nullptr; Kernel::HLERequestContext* context = nullptr;

View File

@ -12,14 +12,6 @@
// All the constants in this file come from http://switchbrew.org/index.php?title=Error_codes // All the constants in this file come from http://switchbrew.org/index.php?title=Error_codes
/**
* Detailed description of the error. Code 0 always means success.
*/
enum class ErrorDescription : u32 {
Success = 0,
RemoteProcessDead = 301,
};
/** /**
* Identifies the module which caused the error. Error codes can be propagated through a call * Identifies the module which caused the error. Error codes can be propagated through a call
* chain, meaning that this doesn't always correspond to the module where the API call made is * chain, meaning that this doesn't always correspond to the module where the API call made is
@ -120,7 +112,7 @@ enum class ErrorModule : u32 {
ShopN = 811, ShopN = 811,
}; };
/// Encapsulates a CTR-OS error code, allowing it to be separated into its constituent fields. /// Encapsulates a Horizon OS error code, allowing it to be separated into its constituent fields.
union ResultCode { union ResultCode {
u32 raw; u32 raw;
@ -133,17 +125,9 @@ union ResultCode {
constexpr explicit ResultCode(u32 raw) : raw(raw) {} constexpr explicit ResultCode(u32 raw) : raw(raw) {}
constexpr ResultCode(ErrorModule module, ErrorDescription description)
: ResultCode(module, static_cast<u32>(description)) {}
constexpr ResultCode(ErrorModule module_, u32 description_) constexpr ResultCode(ErrorModule module_, u32 description_)
: raw(module.FormatValue(module_) | description.FormatValue(description_)) {} : raw(module.FormatValue(module_) | description.FormatValue(description_)) {}
constexpr ResultCode& operator=(const ResultCode& o) {
raw = o.raw;
return *this;
}
constexpr bool IsSuccess() const { constexpr bool IsSuccess() const {
return raw == 0; return raw == 0;
} }

View File

@ -11,7 +11,6 @@
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"
@ -168,7 +167,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co
case IPC::CommandType::Close: { case IPC::CommandType::Close: {
IPC::ResponseBuilder rb{context, 2}; IPC::ResponseBuilder rb{context, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead); return IPC::ERR_REMOTE_PROCESS_DEAD;
} }
case IPC::CommandType::ControlWithContext: case IPC::CommandType::ControlWithContext:
case IPC::CommandType::Control: { case IPC::CommandType::Control: {