diff options
| author | 2019-03-13 14:43:14 -0400 | |
|---|---|---|
| committer | 2019-03-13 14:43:14 -0400 | |
| commit | c1ea6a39a06a5d0b067971e94ef869335dd23c11 (patch) | |
| tree | 756c360b7104462ca8f3606586b0e5f3cad4705c | |
| parent | Merge pull request #2187 from FearlessTobi/port-sdl-things (diff) | |
| parent | core/hle/result: Remove now-unnecessary manually defined copy assignment oper... (diff) | |
| download | yuzu-c1ea6a39a06a5d0b067971e94ef869335dd23c11.tar.gz yuzu-c1ea6a39a06a5d0b067971e94ef869335dd23c11.tar.xz yuzu-c1ea6a39a06a5d0b067971e94ef869335dd23c11.zip | |
Merge pull request #2223 from lioncash/error
core/hle/result: Tidy up the base error code result header.
| -rw-r--r-- | src/core/hle/ipc_helpers.h | 3 | ||||
| -rw-r--r-- | src/core/hle/result.h | 18 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 3 |
3 files changed, 5 insertions, 19 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 0d8368546..a1e4be070 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -19,9 +19,12 @@ | |||
| 19 | #include "core/hle/kernel/hle_ipc.h" | 19 | #include "core/hle/kernel/hle_ipc.h" |
| 20 | #include "core/hle/kernel/object.h" | 20 | #include "core/hle/kernel/object.h" |
| 21 | #include "core/hle/kernel/server_session.h" | 21 | #include "core/hle/kernel/server_session.h" |
| 22 | #include "core/hle/result.h" | ||
| 22 | 23 | ||
| 23 | namespace IPC { | 24 | namespace IPC { |
| 24 | 25 | ||
| 26 | constexpr ResultCode ERR_REMOTE_PROCESS_DEAD{ErrorModule::HIPC, 301}; | ||
| 27 | |||
| 25 | class RequestHelperBase { | 28 | class RequestHelperBase { |
| 26 | protected: | 29 | protected: |
| 27 | Kernel::HLERequestContext* context = nullptr; | 30 | Kernel::HLERequestContext* context = nullptr; |
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 1ed144481..ab84f5ddc 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h | |||
| @@ -13,14 +13,6 @@ | |||
| 13 | // All the constants in this file come from http://switchbrew.org/index.php?title=Error_codes | 13 | // All the constants in this file come from http://switchbrew.org/index.php?title=Error_codes |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * Detailed description of the error. Code 0 always means success. | ||
| 17 | */ | ||
| 18 | enum class ErrorDescription : u32 { | ||
| 19 | Success = 0, | ||
| 20 | RemoteProcessDead = 301, | ||
| 21 | }; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Identifies the module which caused the error. Error codes can be propagated through a call | 16 | * Identifies the module which caused the error. Error codes can be propagated through a call |
| 25 | * chain, meaning that this doesn't always correspond to the module where the API call made is | 17 | * chain, meaning that this doesn't always correspond to the module where the API call made is |
| 26 | * contained. | 18 | * contained. |
| @@ -120,7 +112,7 @@ enum class ErrorModule : u32 { | |||
| 120 | ShopN = 811, | 112 | ShopN = 811, |
| 121 | }; | 113 | }; |
| 122 | 114 | ||
| 123 | /// Encapsulates a CTR-OS error code, allowing it to be separated into its constituent fields. | 115 | /// Encapsulates a Horizon OS error code, allowing it to be separated into its constituent fields. |
| 124 | union ResultCode { | 116 | union ResultCode { |
| 125 | u32 raw; | 117 | u32 raw; |
| 126 | 118 | ||
| @@ -133,17 +125,9 @@ union ResultCode { | |||
| 133 | 125 | ||
| 134 | constexpr explicit ResultCode(u32 raw) : raw(raw) {} | 126 | constexpr explicit ResultCode(u32 raw) : raw(raw) {} |
| 135 | 127 | ||
| 136 | constexpr ResultCode(ErrorModule module, ErrorDescription description) | ||
| 137 | : ResultCode(module, static_cast<u32>(description)) {} | ||
| 138 | |||
| 139 | constexpr ResultCode(ErrorModule module_, u32 description_) | 128 | constexpr ResultCode(ErrorModule module_, u32 description_) |
| 140 | : raw(module.FormatValue(module_) | description.FormatValue(description_)) {} | 129 | : raw(module.FormatValue(module_) | description.FormatValue(description_)) {} |
| 141 | 130 | ||
| 142 | constexpr ResultCode& operator=(const ResultCode& o) { | ||
| 143 | raw = o.raw; | ||
| 144 | return *this; | ||
| 145 | } | ||
| 146 | |||
| 147 | constexpr bool IsSuccess() const { | 131 | constexpr bool IsSuccess() const { |
| 148 | return raw == 0; | 132 | return raw == 0; |
| 149 | } | 133 | } |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 576fd6407..00806b0ed 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include "core/hle/ipc.h" | 11 | #include "core/hle/ipc.h" |
| 12 | #include "core/hle/ipc_helpers.h" | 12 | #include "core/hle/ipc_helpers.h" |
| 13 | #include "core/hle/kernel/client_port.h" | 13 | #include "core/hle/kernel/client_port.h" |
| 14 | #include "core/hle/kernel/handle_table.h" | ||
| 15 | #include "core/hle/kernel/kernel.h" | 14 | #include "core/hle/kernel/kernel.h" |
| 16 | #include "core/hle/kernel/process.h" | 15 | #include "core/hle/kernel/process.h" |
| 17 | #include "core/hle/kernel/server_port.h" | 16 | #include "core/hle/kernel/server_port.h" |
| @@ -168,7 +167,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co | |||
| 168 | case IPC::CommandType::Close: { | 167 | case IPC::CommandType::Close: { |
| 169 | IPC::ResponseBuilder rb{context, 2}; | 168 | IPC::ResponseBuilder rb{context, 2}; |
| 170 | rb.Push(RESULT_SUCCESS); | 169 | rb.Push(RESULT_SUCCESS); |
| 171 | return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead); | 170 | return IPC::ERR_REMOTE_PROCESS_DEAD; |
| 172 | } | 171 | } |
| 173 | case IPC::CommandType::ControlWithContext: | 172 | case IPC::CommandType::ControlWithContext: |
| 174 | case IPC::CommandType::Control: { | 173 | case IPC::CommandType::Control: { |