summaryrefslogtreecommitdiff
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/acc/acc.cpp14
-rw-r--r--src/core/hle/service/acc/acc.h2
-rw-r--r--src/core/hle/service/acc/async_context.h2
-rw-r--r--src/core/hle/service/acc/errors.h4
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp12
-rw-r--r--src/core/hle/service/acc/profile_manager.h6
-rw-r--r--src/core/hle/service/am/am.cpp8
-rw-r--r--src/core/hle/service/am/applets/applet_controller.cpp6
-rw-r--r--src/core/hle/service/am/applets/applet_controller.h4
-rw-r--r--src/core/hle/service/am/applets/applet_error.cpp18
-rw-r--r--src/core/hle/service/am/applets/applet_error.h4
-rw-r--r--src/core/hle/service/am/applets/applet_general_backend.cpp10
-rw-r--r--src/core/hle/service/am/applets/applet_general_backend.h6
-rw-r--r--src/core/hle/service/am/applets/applet_mii_edit.cpp2
-rw-r--r--src/core/hle/service/am/applets/applet_mii_edit.h2
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.cpp4
-rw-r--r--src/core/hle/service/am/applets/applet_profile_select.h4
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.cpp2
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.h4
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.cpp2
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.h4
-rw-r--r--src/core/hle/service/am/applets/applets.h4
-rw-r--r--src/core/hle/service/audio/errors.h6
-rw-r--r--src/core/hle/service/bcat/backend/backend.cpp2
-rw-r--r--src/core/hle/service/bcat/backend/backend.h4
-rw-r--r--src/core/hle/service/bcat/bcat_module.cpp10
-rw-r--r--src/core/hle/service/es/es.cpp4
-rw-r--r--src/core/hle/service/fatal/fatal.cpp11
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp29
-rw-r--r--src/core/hle/service/filesystem/filesystem.h26
-rw-r--r--src/core/hle/service/friend/errors.h2
-rw-r--r--src/core/hle/service/glue/arp.cpp2
-rw-r--r--src/core/hle/service/glue/errors.h8
-rw-r--r--src/core/hle/service/glue/glue_manager.cpp6
-rw-r--r--src/core/hle/service/glue/glue_manager.h4
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp60
-rw-r--r--src/core/hle/service/hid/controllers/npad.h69
-rw-r--r--src/core/hle/service/hid/errors.h14
-rw-r--r--src/core/hle/service/hid/hidbus.h2
-rw-r--r--src/core/hle/service/hid/hidbus/hidbus_base.h2
-rw-r--r--src/core/hle/service/ldn/errors.h2
-rw-r--r--src/core/hle/service/ldr/ldr.cpp41
-rw-r--r--src/core/hle/service/mii/mii.cpp2
-rw-r--r--src/core/hle/service/mii/mii_manager.cpp4
-rw-r--r--src/core/hle/service/mii/mii_manager.h2
-rw-r--r--src/core/hle/service/nfp/nfp.cpp32
-rw-r--r--src/core/hle/service/nfp/nfp.h28
-rw-r--r--src/core/hle/service/ns/errors.h2
-rw-r--r--src/core/hle/service/pctl/pctl_module.cpp8
-rw-r--r--src/core/hle/service/pm/pm.cpp12
-rw-r--r--src/core/hle/service/service.cpp4
-rw-r--r--src/core/hle/service/service.h4
-rw-r--r--src/core/hle/service/set/set.cpp2
-rw-r--r--src/core/hle/service/set/set_sys.cpp2
-rw-r--r--src/core/hle/service/sm/sm.cpp18
-rw-r--r--src/core/hle/service/sm/sm.h6
-rw-r--r--src/core/hle/service/sm/sm_controller.cpp2
-rw-r--r--src/core/hle/service/spl/spl_results.h32
-rw-r--r--src/core/hle/service/time/clock_types.h8
-rw-r--r--src/core/hle/service/time/errors.h20
-rw-r--r--src/core/hle/service/time/local_system_clock_context_writer.h2
-rw-r--r--src/core/hle/service/time/network_system_clock_context_writer.h2
-rw-r--r--src/core/hle/service/time/standard_user_system_clock_core.cpp22
-rw-r--r--src/core/hle/service/time/standard_user_system_clock_core.h10
-rw-r--r--src/core/hle/service/time/system_clock_context_update_callback.cpp6
-rw-r--r--src/core/hle/service/time/system_clock_context_update_callback.h4
-rw-r--r--src/core/hle/service/time/system_clock_core.cpp14
-rw-r--r--src/core/hle/service/time/system_clock_core.h14
-rw-r--r--src/core/hle/service/time/time.cpp25
-rw-r--r--src/core/hle/service/time/time.h2
-rw-r--r--src/core/hle/service/time/time_zone_content_manager.cpp10
-rw-r--r--src/core/hle/service/time/time_zone_content_manager.h6
-rw-r--r--src/core/hle/service/time/time_zone_manager.cpp46
-rw-r--r--src/core/hle/service/time/time_zone_manager.h20
-rw-r--r--src/core/hle/service/time/time_zone_service.cpp15
-rw-r--r--src/core/hle/service/vi/vi.cpp8
76 files changed, 408 insertions, 414 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 88b74cbb0..b726ac27a 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -28,11 +28,11 @@
28 28
29namespace Service::Account { 29namespace Service::Account {
30 30
31constexpr ResultCode ERR_INVALID_USER_ID{ErrorModule::Account, 20}; 31constexpr Result ERR_INVALID_USER_ID{ErrorModule::Account, 20};
32constexpr ResultCode ERR_INVALID_APPLICATION_ID{ErrorModule::Account, 22}; 32constexpr Result ERR_INVALID_APPLICATION_ID{ErrorModule::Account, 22};
33constexpr ResultCode ERR_INVALID_BUFFER{ErrorModule::Account, 30}; 33constexpr Result ERR_INVALID_BUFFER{ErrorModule::Account, 30};
34constexpr ResultCode ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 31}; 34constexpr Result ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 31};
35constexpr ResultCode ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100}; 35constexpr Result ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100};
36 36
37// Thumbnails are hard coded to be at least this size 37// Thumbnails are hard coded to be at least this size
38constexpr std::size_t THUMBNAIL_SIZE = 0x24000; 38constexpr std::size_t THUMBNAIL_SIZE = 0x24000;
@@ -505,7 +505,7 @@ protected:
505 505
506 void Cancel() override {} 506 void Cancel() override {}
507 507
508 ResultCode GetResult() const override { 508 Result GetResult() const override {
509 return ResultSuccess; 509 return ResultSuccess;
510 } 510 }
511}; 511};
@@ -747,7 +747,7 @@ void Module::Interface::InitializeApplicationInfoRestricted(Kernel::HLERequestCo
747 rb.Push(InitializeApplicationInfoBase()); 747 rb.Push(InitializeApplicationInfoBase());
748} 748}
749 749
750ResultCode Module::Interface::InitializeApplicationInfoBase() { 750Result Module::Interface::InitializeApplicationInfoBase() {
751 if (application_info) { 751 if (application_info) {
752 LOG_ERROR(Service_ACC, "Application already initialized"); 752 LOG_ERROR(Service_ACC, "Application already initialized");
753 return ERR_ACCOUNTINFO_ALREADY_INITIALIZED; 753 return ERR_ACCOUNTINFO_ALREADY_INITIALIZED;
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index fff447fc3..1621e7c0a 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -41,7 +41,7 @@ public:
41 void StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx); 41 void StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx);
42 42
43 private: 43 private:
44 ResultCode InitializeApplicationInfoBase(); 44 Result InitializeApplicationInfoBase();
45 void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::UUID& uuid, 45 void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::UUID& uuid,
46 const u64 tid); 46 const u64 tid);
47 47
diff --git a/src/core/hle/service/acc/async_context.h b/src/core/hle/service/acc/async_context.h
index e4929f7f0..26332d241 100644
--- a/src/core/hle/service/acc/async_context.h
+++ b/src/core/hle/service/acc/async_context.h
@@ -26,7 +26,7 @@ public:
26protected: 26protected:
27 virtual bool IsComplete() const = 0; 27 virtual bool IsComplete() const = 0;
28 virtual void Cancel() = 0; 28 virtual void Cancel() = 0;
29 virtual ResultCode GetResult() const = 0; 29 virtual Result GetResult() const = 0;
30 30
31 void MarkComplete(); 31 void MarkComplete();
32 32
diff --git a/src/core/hle/service/acc/errors.h b/src/core/hle/service/acc/errors.h
index eafb75713..e9c16b951 100644
--- a/src/core/hle/service/acc/errors.h
+++ b/src/core/hle/service/acc/errors.h
@@ -7,7 +7,7 @@
7 7
8namespace Service::Account { 8namespace Service::Account {
9 9
10constexpr ResultCode ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22}; 10constexpr Result ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22};
11constexpr ResultCode ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41}; 11constexpr Result ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41};
12 12
13} // namespace Service::Account 13} // namespace Service::Account
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index 0ef298180..8118ead33 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -33,9 +33,9 @@ struct ProfileDataRaw {
33static_assert(sizeof(ProfileDataRaw) == 0x650, "ProfileDataRaw has incorrect size."); 33static_assert(sizeof(ProfileDataRaw) == 0x650, "ProfileDataRaw has incorrect size.");
34 34
35// TODO(ogniK): Get actual error codes 35// TODO(ogniK): Get actual error codes
36constexpr ResultCode ERROR_TOO_MANY_USERS(ErrorModule::Account, u32(-1)); 36constexpr Result ERROR_TOO_MANY_USERS(ErrorModule::Account, u32(-1));
37constexpr ResultCode ERROR_USER_ALREADY_EXISTS(ErrorModule::Account, u32(-2)); 37constexpr Result ERROR_USER_ALREADY_EXISTS(ErrorModule::Account, u32(-2));
38constexpr ResultCode ERROR_ARGUMENT_IS_NULL(ErrorModule::Account, 20); 38constexpr Result ERROR_ARGUMENT_IS_NULL(ErrorModule::Account, 20);
39 39
40constexpr char ACC_SAVE_AVATORS_BASE_PATH[] = "system/save/8000000000000010/su/avators"; 40constexpr char ACC_SAVE_AVATORS_BASE_PATH[] = "system/save/8000000000000010/su/avators";
41 41
@@ -87,7 +87,7 @@ bool ProfileManager::RemoveProfileAtIndex(std::size_t index) {
87} 87}
88 88
89/// Helper function to register a user to the system 89/// Helper function to register a user to the system
90ResultCode ProfileManager::AddUser(const ProfileInfo& user) { 90Result ProfileManager::AddUser(const ProfileInfo& user) {
91 if (!AddToProfiles(user)) { 91 if (!AddToProfiles(user)) {
92 return ERROR_TOO_MANY_USERS; 92 return ERROR_TOO_MANY_USERS;
93 } 93 }
@@ -96,7 +96,7 @@ ResultCode ProfileManager::AddUser(const ProfileInfo& user) {
96 96
97/// Create a new user on the system. If the uuid of the user already exists, the user is not 97/// Create a new user on the system. If the uuid of the user already exists, the user is not
98/// created. 98/// created.
99ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& username) { 99Result ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& username) {
100 if (user_count == MAX_USERS) { 100 if (user_count == MAX_USERS) {
101 return ERROR_TOO_MANY_USERS; 101 return ERROR_TOO_MANY_USERS;
102 } 102 }
@@ -123,7 +123,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern
123/// Creates a new user on the system. This function allows a much simpler method of registration 123/// Creates a new user on the system. This function allows a much simpler method of registration
124/// specifically by allowing an std::string for the username. This is required specifically since 124/// specifically by allowing an std::string for the username. This is required specifically since
125/// we're loading a string straight from the config 125/// we're loading a string straight from the config
126ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) { 126Result ProfileManager::CreateNewUser(UUID uuid, const std::string& username) {
127 ProfileUsername username_output{}; 127 ProfileUsername username_output{};
128 128
129 if (username.size() > username_output.size()) { 129 if (username.size() > username_output.size()) {
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h
index 955dbd3d6..9940957f1 100644
--- a/src/core/hle/service/acc/profile_manager.h
+++ b/src/core/hle/service/acc/profile_manager.h
@@ -64,9 +64,9 @@ public:
64 ProfileManager(); 64 ProfileManager();
65 ~ProfileManager(); 65 ~ProfileManager();
66 66
67 ResultCode AddUser(const ProfileInfo& user); 67 Result AddUser(const ProfileInfo& user);
68 ResultCode CreateNewUser(Common::UUID uuid, const ProfileUsername& username); 68 Result CreateNewUser(Common::UUID uuid, const ProfileUsername& username);
69 ResultCode CreateNewUser(Common::UUID uuid, const std::string& username); 69 Result CreateNewUser(Common::UUID uuid, const std::string& username);
70 std::optional<Common::UUID> GetUser(std::size_t index) const; 70 std::optional<Common::UUID> GetUser(std::size_t index) const;
71 std::optional<std::size_t> GetUserIndex(const Common::UUID& uuid) const; 71 std::optional<std::size_t> GetUserIndex(const Common::UUID& uuid) const;
72 std::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const; 72 std::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const;
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index c4a93e524..d35644e73 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -40,9 +40,9 @@
40 40
41namespace Service::AM { 41namespace Service::AM {
42 42
43constexpr ResultCode ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 2}; 43constexpr Result ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 2};
44constexpr ResultCode ERR_NO_MESSAGES{ErrorModule::AM, 3}; 44constexpr Result ERR_NO_MESSAGES{ErrorModule::AM, 3};
45constexpr ResultCode ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 503}; 45constexpr Result ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 503};
46 46
47enum class LaunchParameterKind : u32 { 47enum class LaunchParameterKind : u32 {
48 ApplicationSpecific = 1, 48 ApplicationSpecific = 1,
@@ -365,7 +365,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) {
365 // Entry and exit of fatal sections must be balanced. 365 // Entry and exit of fatal sections must be balanced.
366 if (num_fatal_sections_entered == 0) { 366 if (num_fatal_sections_entered == 0) {
367 IPC::ResponseBuilder rb{ctx, 2}; 367 IPC::ResponseBuilder rb{ctx, 2};
368 rb.Push(ResultCode{ErrorModule::AM, 512}); 368 rb.Push(Result{ErrorModule::AM, 512});
369 return; 369 return;
370 } 370 }
371 371
diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp
index 0a5603d18..b418031de 100644
--- a/src/core/hle/service/am/applets/applet_controller.cpp
+++ b/src/core/hle/service/am/applets/applet_controller.cpp
@@ -20,9 +20,9 @@
20namespace Service::AM::Applets { 20namespace Service::AM::Applets {
21 21
22// This error code (0x183ACA) is thrown when the applet fails to initialize. 22// This error code (0x183ACA) is thrown when the applet fails to initialize.
23[[maybe_unused]] constexpr ResultCode ERR_CONTROLLER_APPLET_3101{ErrorModule::HID, 3101}; 23[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3101{ErrorModule::HID, 3101};
24// This error code (0x183CCA) is thrown when the u32 result in ControllerSupportResultInfo is 2. 24// This error code (0x183CCA) is thrown when the u32 result in ControllerSupportResultInfo is 2.
25[[maybe_unused]] constexpr ResultCode ERR_CONTROLLER_APPLET_3102{ErrorModule::HID, 3102}; 25[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3102{ErrorModule::HID, 3102};
26 26
27static Core::Frontend::ControllerParameters ConvertToFrontendParameters( 27static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
28 ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text, 28 ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text,
@@ -173,7 +173,7 @@ bool Controller::TransactionComplete() const {
173 return complete; 173 return complete;
174} 174}
175 175
176ResultCode Controller::GetStatus() const { 176Result Controller::GetStatus() const {
177 return status; 177 return status;
178} 178}
179 179
diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/applets/applet_controller.h
index e1a34853d..1f9adec65 100644
--- a/src/core/hle/service/am/applets/applet_controller.h
+++ b/src/core/hle/service/am/applets/applet_controller.h
@@ -126,7 +126,7 @@ public:
126 void Initialize() override; 126 void Initialize() override;
127 127
128 bool TransactionComplete() const override; 128 bool TransactionComplete() const override;
129 ResultCode GetStatus() const override; 129 Result GetStatus() const override;
130 void ExecuteInteractive() override; 130 void ExecuteInteractive() override;
131 void Execute() override; 131 void Execute() override;
132 132
@@ -143,7 +143,7 @@ private:
143 ControllerUpdateFirmwareArg controller_update_arg; 143 ControllerUpdateFirmwareArg controller_update_arg;
144 ControllerKeyRemappingArg controller_key_remapping_arg; 144 ControllerKeyRemappingArg controller_key_remapping_arg;
145 bool complete{false}; 145 bool complete{false};
146 ResultCode status{ResultSuccess}; 146 Result status{ResultSuccess};
147 bool is_single_mode{false}; 147 bool is_single_mode{false};
148 std::vector<u8> out_data; 148 std::vector<u8> out_data;
149}; 149};
diff --git a/src/core/hle/service/am/applets/applet_error.cpp b/src/core/hle/service/am/applets/applet_error.cpp
index 0b87c60b9..fcf34bf7e 100644
--- a/src/core/hle/service/am/applets/applet_error.cpp
+++ b/src/core/hle/service/am/applets/applet_error.cpp
@@ -25,15 +25,15 @@ struct ErrorCode {
25 }; 25 };
26 } 26 }
27 27
28 static constexpr ErrorCode FromResultCode(ResultCode result) { 28 static constexpr ErrorCode FromResult(Result result) {
29 return { 29 return {
30 .error_category{2000 + static_cast<u32>(result.module.Value())}, 30 .error_category{2000 + static_cast<u32>(result.module.Value())},
31 .error_number{result.description.Value()}, 31 .error_number{result.description.Value()},
32 }; 32 };
33 } 33 }
34 34
35 constexpr ResultCode ToResultCode() const { 35 constexpr Result ToResult() const {
36 return ResultCode{static_cast<ErrorModule>(error_category - 2000), error_number}; 36 return Result{static_cast<ErrorModule>(error_category - 2000), error_number};
37 } 37 }
38}; 38};
39static_assert(sizeof(ErrorCode) == 0x8, "ErrorCode has incorrect size."); 39static_assert(sizeof(ErrorCode) == 0x8, "ErrorCode has incorrect size.");
@@ -97,8 +97,8 @@ void CopyArgumentData(const std::vector<u8>& data, T& variable) {
97 std::memcpy(&variable, data.data(), sizeof(T)); 97 std::memcpy(&variable, data.data(), sizeof(T));
98} 98}
99 99
100ResultCode Decode64BitError(u64 error) { 100Result Decode64BitError(u64 error) {
101 return ErrorCode::FromU64(error).ToResultCode(); 101 return ErrorCode::FromU64(error).ToResult();
102} 102}
103 103
104} // Anonymous namespace 104} // Anonymous namespace
@@ -127,16 +127,16 @@ void Error::Initialize() {
127 if (args->error.use_64bit_error_code) { 127 if (args->error.use_64bit_error_code) {
128 error_code = Decode64BitError(args->error.error_code_64); 128 error_code = Decode64BitError(args->error.error_code_64);
129 } else { 129 } else {
130 error_code = ResultCode(args->error.error_code_32); 130 error_code = Result(args->error.error_code_32);
131 } 131 }
132 break; 132 break;
133 case ErrorAppletMode::ShowSystemError: 133 case ErrorAppletMode::ShowSystemError:
134 CopyArgumentData(data, args->system_error); 134 CopyArgumentData(data, args->system_error);
135 error_code = ResultCode(Decode64BitError(args->system_error.error_code_64)); 135 error_code = Result(Decode64BitError(args->system_error.error_code_64));
136 break; 136 break;
137 case ErrorAppletMode::ShowApplicationError: 137 case ErrorAppletMode::ShowApplicationError:
138 CopyArgumentData(data, args->application_error); 138 CopyArgumentData(data, args->application_error);
139 error_code = ResultCode(args->application_error.error_code); 139 error_code = Result(args->application_error.error_code);
140 break; 140 break;
141 case ErrorAppletMode::ShowErrorRecord: 141 case ErrorAppletMode::ShowErrorRecord:
142 CopyArgumentData(data, args->error_record); 142 CopyArgumentData(data, args->error_record);
@@ -151,7 +151,7 @@ bool Error::TransactionComplete() const {
151 return complete; 151 return complete;
152} 152}
153 153
154ResultCode Error::GetStatus() const { 154Result Error::GetStatus() const {
155 return ResultSuccess; 155 return ResultSuccess;
156} 156}
157 157
diff --git a/src/core/hle/service/am/applets/applet_error.h b/src/core/hle/service/am/applets/applet_error.h
index 43487f647..d78d6f1d1 100644
--- a/src/core/hle/service/am/applets/applet_error.h
+++ b/src/core/hle/service/am/applets/applet_error.h
@@ -31,7 +31,7 @@ public:
31 void Initialize() override; 31 void Initialize() override;
32 32
33 bool TransactionComplete() const override; 33 bool TransactionComplete() const override;
34 ResultCode GetStatus() const override; 34 Result GetStatus() const override;
35 void ExecuteInteractive() override; 35 void ExecuteInteractive() override;
36 void Execute() override; 36 void Execute() override;
37 37
@@ -41,7 +41,7 @@ private:
41 union ErrorArguments; 41 union ErrorArguments;
42 42
43 const Core::Frontend::ErrorApplet& frontend; 43 const Core::Frontend::ErrorApplet& frontend;
44 ResultCode error_code = ResultSuccess; 44 Result error_code = ResultSuccess;
45 ErrorAppletMode mode = ErrorAppletMode::ShowError; 45 ErrorAppletMode mode = ErrorAppletMode::ShowError;
46 std::unique_ptr<ErrorArguments> args; 46 std::unique_ptr<ErrorArguments> args;
47 47
diff --git a/src/core/hle/service/am/applets/applet_general_backend.cpp b/src/core/hle/service/am/applets/applet_general_backend.cpp
index 41c002ef2..c34ef08b3 100644
--- a/src/core/hle/service/am/applets/applet_general_backend.cpp
+++ b/src/core/hle/service/am/applets/applet_general_backend.cpp
@@ -13,7 +13,7 @@
13 13
14namespace Service::AM::Applets { 14namespace Service::AM::Applets {
15 15
16constexpr ResultCode ERROR_INVALID_PIN{ErrorModule::PCTL, 221}; 16constexpr Result ERROR_INVALID_PIN{ErrorModule::PCTL, 221};
17 17
18static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix) { 18static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix) {
19 std::shared_ptr<IStorage> storage = broker.PopNormalDataToApplet(); 19 std::shared_ptr<IStorage> storage = broker.PopNormalDataToApplet();
@@ -71,7 +71,7 @@ bool Auth::TransactionComplete() const {
71 return complete; 71 return complete;
72} 72}
73 73
74ResultCode Auth::GetStatus() const { 74Result Auth::GetStatus() const {
75 return successful ? ResultSuccess : ERROR_INVALID_PIN; 75 return successful ? ResultSuccess : ERROR_INVALID_PIN;
76} 76}
77 77
@@ -136,7 +136,7 @@ void Auth::AuthFinished(bool is_successful) {
136 successful = is_successful; 136 successful = is_successful;
137 137
138 struct Return { 138 struct Return {
139 ResultCode result_code; 139 Result result_code;
140 }; 140 };
141 static_assert(sizeof(Return) == 0x4, "Return (AuthApplet) has incorrect size."); 141 static_assert(sizeof(Return) == 0x4, "Return (AuthApplet) has incorrect size.");
142 142
@@ -170,7 +170,7 @@ bool PhotoViewer::TransactionComplete() const {
170 return complete; 170 return complete;
171} 171}
172 172
173ResultCode PhotoViewer::GetStatus() const { 173Result PhotoViewer::GetStatus() const {
174 return ResultSuccess; 174 return ResultSuccess;
175} 175}
176 176
@@ -223,7 +223,7 @@ bool StubApplet::TransactionComplete() const {
223 return true; 223 return true;
224} 224}
225 225
226ResultCode StubApplet::GetStatus() const { 226Result StubApplet::GetStatus() const {
227 LOG_WARNING(Service_AM, "called (STUBBED)"); 227 LOG_WARNING(Service_AM, "called (STUBBED)");
228 return ResultSuccess; 228 return ResultSuccess;
229} 229}
diff --git a/src/core/hle/service/am/applets/applet_general_backend.h b/src/core/hle/service/am/applets/applet_general_backend.h
index e647d0f41..a9f2535a2 100644
--- a/src/core/hle/service/am/applets/applet_general_backend.h
+++ b/src/core/hle/service/am/applets/applet_general_backend.h
@@ -25,7 +25,7 @@ public:
25 25
26 void Initialize() override; 26 void Initialize() override;
27 bool TransactionComplete() const override; 27 bool TransactionComplete() const override;
28 ResultCode GetStatus() const override; 28 Result GetStatus() const override;
29 void ExecuteInteractive() override; 29 void ExecuteInteractive() override;
30 void Execute() override; 30 void Execute() override;
31 31
@@ -56,7 +56,7 @@ public:
56 56
57 void Initialize() override; 57 void Initialize() override;
58 bool TransactionComplete() const override; 58 bool TransactionComplete() const override;
59 ResultCode GetStatus() const override; 59 Result GetStatus() const override;
60 void ExecuteInteractive() override; 60 void ExecuteInteractive() override;
61 void Execute() override; 61 void Execute() override;
62 62
@@ -77,7 +77,7 @@ public:
77 void Initialize() override; 77 void Initialize() override;
78 78
79 bool TransactionComplete() const override; 79 bool TransactionComplete() const override;
80 ResultCode GetStatus() const override; 80 Result GetStatus() const override;
81 void ExecuteInteractive() override; 81 void ExecuteInteractive() override;
82 void Execute() override; 82 void Execute() override;
83 83
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.cpp b/src/core/hle/service/am/applets/applet_mii_edit.cpp
index 8d847c3f6..ae80ef506 100644
--- a/src/core/hle/service/am/applets/applet_mii_edit.cpp
+++ b/src/core/hle/service/am/applets/applet_mii_edit.cpp
@@ -62,7 +62,7 @@ bool MiiEdit::TransactionComplete() const {
62 return is_complete; 62 return is_complete;
63} 63}
64 64
65ResultCode MiiEdit::GetStatus() const { 65Result MiiEdit::GetStatus() const {
66 return ResultSuccess; 66 return ResultSuccess;
67} 67}
68 68
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.h b/src/core/hle/service/am/applets/applet_mii_edit.h
index 900754e57..d18dd3cf5 100644
--- a/src/core/hle/service/am/applets/applet_mii_edit.h
+++ b/src/core/hle/service/am/applets/applet_mii_edit.h
@@ -22,7 +22,7 @@ public:
22 void Initialize() override; 22 void Initialize() override;
23 23
24 bool TransactionComplete() const override; 24 bool TransactionComplete() const override;
25 ResultCode GetStatus() const override; 25 Result GetStatus() const override;
26 void ExecuteInteractive() override; 26 void ExecuteInteractive() override;
27 void Execute() override; 27 void Execute() override;
28 28
diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp
index 02049fd9f..c738db028 100644
--- a/src/core/hle/service/am/applets/applet_profile_select.cpp
+++ b/src/core/hle/service/am/applets/applet_profile_select.cpp
@@ -12,7 +12,7 @@
12 12
13namespace Service::AM::Applets { 13namespace Service::AM::Applets {
14 14
15constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1}; 15constexpr Result ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
16 16
17ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, 17ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
18 const Core::Frontend::ProfileSelectApplet& frontend_) 18 const Core::Frontend::ProfileSelectApplet& frontend_)
@@ -39,7 +39,7 @@ bool ProfileSelect::TransactionComplete() const {
39 return complete; 39 return complete;
40} 40}
41 41
42ResultCode ProfileSelect::GetStatus() const { 42Result ProfileSelect::GetStatus() const {
43 return status; 43 return status;
44} 44}
45 45
diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h
index 3a6e50eaa..b77f1d205 100644
--- a/src/core/hle/service/am/applets/applet_profile_select.h
+++ b/src/core/hle/service/am/applets/applet_profile_select.h
@@ -39,7 +39,7 @@ public:
39 void Initialize() override; 39 void Initialize() override;
40 40
41 bool TransactionComplete() const override; 41 bool TransactionComplete() const override;
42 ResultCode GetStatus() const override; 42 Result GetStatus() const override;
43 void ExecuteInteractive() override; 43 void ExecuteInteractive() override;
44 void Execute() override; 44 void Execute() override;
45 45
@@ -50,7 +50,7 @@ private:
50 50
51 UserSelectionConfig config; 51 UserSelectionConfig config;
52 bool complete = false; 52 bool complete = false;
53 ResultCode status = ResultSuccess; 53 Result status = ResultSuccess;
54 std::vector<u8> final_data; 54 std::vector<u8> final_data;
55 Core::System& system; 55 Core::System& system;
56}; 56};
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
index 4116fbaa7..faa092957 100644
--- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
@@ -80,7 +80,7 @@ bool SoftwareKeyboard::TransactionComplete() const {
80 return complete; 80 return complete;
81} 81}
82 82
83ResultCode SoftwareKeyboard::GetStatus() const { 83Result SoftwareKeyboard::GetStatus() const {
84 return status; 84 return status;
85} 85}
86 86
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.h b/src/core/hle/service/am/applets/applet_software_keyboard.h
index c36806a72..b01b31c98 100644
--- a/src/core/hle/service/am/applets/applet_software_keyboard.h
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.h
@@ -28,7 +28,7 @@ public:
28 void Initialize() override; 28 void Initialize() override;
29 29
30 bool TransactionComplete() const override; 30 bool TransactionComplete() const override;
31 ResultCode GetStatus() const override; 31 Result GetStatus() const override;
32 void ExecuteInteractive() override; 32 void ExecuteInteractive() override;
33 void Execute() override; 33 void Execute() override;
34 34
@@ -180,7 +180,7 @@ private:
180 bool is_background{false}; 180 bool is_background{false};
181 181
182 bool complete{false}; 182 bool complete{false};
183 ResultCode status{ResultSuccess}; 183 Result status{ResultSuccess};
184}; 184};
185 185
186} // namespace Service::AM::Applets 186} // namespace Service::AM::Applets
diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp
index 7b3f77a51..4b804b78c 100644
--- a/src/core/hle/service/am/applets/applet_web_browser.cpp
+++ b/src/core/hle/service/am/applets/applet_web_browser.cpp
@@ -288,7 +288,7 @@ bool WebBrowser::TransactionComplete() const {
288 return complete; 288 return complete;
289} 289}
290 290
291ResultCode WebBrowser::GetStatus() const { 291Result WebBrowser::GetStatus() const {
292 return status; 292 return status;
293} 293}
294 294
diff --git a/src/core/hle/service/am/applets/applet_web_browser.h b/src/core/hle/service/am/applets/applet_web_browser.h
index 6b602769b..fd727fac8 100644
--- a/src/core/hle/service/am/applets/applet_web_browser.h
+++ b/src/core/hle/service/am/applets/applet_web_browser.h
@@ -32,7 +32,7 @@ public:
32 void Initialize() override; 32 void Initialize() override;
33 33
34 bool TransactionComplete() const override; 34 bool TransactionComplete() const override;
35 ResultCode GetStatus() const override; 35 Result GetStatus() const override;
36 void ExecuteInteractive() override; 36 void ExecuteInteractive() override;
37 void Execute() override; 37 void Execute() override;
38 38
@@ -66,7 +66,7 @@ private:
66 const Core::Frontend::WebBrowserApplet& frontend; 66 const Core::Frontend::WebBrowserApplet& frontend;
67 67
68 bool complete{false}; 68 bool complete{false};
69 ResultCode status{ResultSuccess}; 69 Result status{ResultSuccess};
70 70
71 WebAppletVersion web_applet_version{}; 71 WebAppletVersion web_applet_version{};
72 WebArgHeader web_arg_header{}; 72 WebArgHeader web_arg_header{};
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h
index 2861fed0e..e78a57657 100644
--- a/src/core/hle/service/am/applets/applets.h
+++ b/src/core/hle/service/am/applets/applets.h
@@ -9,7 +9,7 @@
9#include "common/swap.h" 9#include "common/swap.h"
10#include "core/hle/service/kernel_helpers.h" 10#include "core/hle/service/kernel_helpers.h"
11 11
12union ResultCode; 12union Result;
13 13
14namespace Core { 14namespace Core {
15class System; 15class System;
@@ -138,7 +138,7 @@ public:
138 virtual void Initialize(); 138 virtual void Initialize();
139 139
140 virtual bool TransactionComplete() const = 0; 140 virtual bool TransactionComplete() const = 0;
141 virtual ResultCode GetStatus() const = 0; 141 virtual Result GetStatus() const = 0;
142 virtual void ExecuteInteractive() = 0; 142 virtual void ExecuteInteractive() = 0;
143 virtual void Execute() = 0; 143 virtual void Execute() = 0;
144 144
diff --git a/src/core/hle/service/audio/errors.h b/src/core/hle/service/audio/errors.h
index 542fec899..ac6c514af 100644
--- a/src/core/hle/service/audio/errors.h
+++ b/src/core/hle/service/audio/errors.h
@@ -7,8 +7,8 @@
7 7
8namespace Service::Audio { 8namespace Service::Audio {
9 9
10constexpr ResultCode ERR_OPERATION_FAILED{ErrorModule::Audio, 2}; 10constexpr Result ERR_OPERATION_FAILED{ErrorModule::Audio, 2};
11constexpr ResultCode ERR_BUFFER_COUNT_EXCEEDED{ErrorModule::Audio, 8}; 11constexpr Result ERR_BUFFER_COUNT_EXCEEDED{ErrorModule::Audio, 8};
12constexpr ResultCode ERR_NOT_SUPPORTED{ErrorModule::Audio, 513}; 12constexpr Result ERR_NOT_SUPPORTED{ErrorModule::Audio, 513};
13 13
14} // namespace Service::Audio 14} // namespace Service::Audio
diff --git a/src/core/hle/service/bcat/backend/backend.cpp b/src/core/hle/service/bcat/backend/backend.cpp
index 7e6d16230..cd0b405ff 100644
--- a/src/core/hle/service/bcat/backend/backend.cpp
+++ b/src/core/hle/service/bcat/backend/backend.cpp
@@ -74,7 +74,7 @@ void ProgressServiceBackend::CommitDirectory(std::string_view dir_name) {
74 SignalUpdate(); 74 SignalUpdate();
75} 75}
76 76
77void ProgressServiceBackend::FinishDownload(ResultCode result) { 77void ProgressServiceBackend::FinishDownload(Result result) {
78 impl.total_downloaded_bytes = impl.total_bytes; 78 impl.total_downloaded_bytes = impl.total_bytes;
79 impl.status = DeliveryCacheProgressImpl::Status::Done; 79 impl.status = DeliveryCacheProgressImpl::Status::Done;
80 impl.result = result; 80 impl.result = result;
diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h
index 7e8026c75..205ed0702 100644
--- a/src/core/hle/service/bcat/backend/backend.h
+++ b/src/core/hle/service/bcat/backend/backend.h
@@ -49,7 +49,7 @@ struct DeliveryCacheProgressImpl {
49 }; 49 };
50 50
51 Status status; 51 Status status;
52 ResultCode result = ResultSuccess; 52 Result result = ResultSuccess;
53 DirectoryName current_directory; 53 DirectoryName current_directory;
54 FileName current_file; 54 FileName current_file;
55 s64 current_downloaded_bytes; ///< Bytes downloaded on current file. 55 s64 current_downloaded_bytes; ///< Bytes downloaded on current file.
@@ -90,7 +90,7 @@ public:
90 void CommitDirectory(std::string_view dir_name); 90 void CommitDirectory(std::string_view dir_name);
91 91
92 // Notifies the application that the operation completed with result code result. 92 // Notifies the application that the operation completed with result code result.
93 void FinishDownload(ResultCode result); 93 void FinishDownload(Result result);
94 94
95private: 95private:
96 explicit ProgressServiceBackend(Core::System& system, std::string_view event_name); 96 explicit ProgressServiceBackend(Core::System& system, std::string_view event_name);
diff --git a/src/core/hle/service/bcat/bcat_module.cpp b/src/core/hle/service/bcat/bcat_module.cpp
index 076fd79e7..d928e37fb 100644
--- a/src/core/hle/service/bcat/bcat_module.cpp
+++ b/src/core/hle/service/bcat/bcat_module.cpp
@@ -18,15 +18,15 @@
18 18
19namespace Service::BCAT { 19namespace Service::BCAT {
20 20
21constexpr ResultCode ERROR_INVALID_ARGUMENT{ErrorModule::BCAT, 1}; 21constexpr Result ERROR_INVALID_ARGUMENT{ErrorModule::BCAT, 1};
22constexpr ResultCode ERROR_FAILED_OPEN_ENTITY{ErrorModule::BCAT, 2}; 22constexpr Result ERROR_FAILED_OPEN_ENTITY{ErrorModule::BCAT, 2};
23constexpr ResultCode ERROR_ENTITY_ALREADY_OPEN{ErrorModule::BCAT, 6}; 23constexpr Result ERROR_ENTITY_ALREADY_OPEN{ErrorModule::BCAT, 6};
24constexpr ResultCode ERROR_NO_OPEN_ENTITY{ErrorModule::BCAT, 7}; 24constexpr Result ERROR_NO_OPEN_ENTITY{ErrorModule::BCAT, 7};
25 25
26// The command to clear the delivery cache just calls fs IFileSystem DeleteFile on all of the files 26// The command to clear the delivery cache just calls fs IFileSystem DeleteFile on all of the files
27// and if any of them have a non-zero result it just forwards that result. This is the FS error code 27// and if any of them have a non-zero result it just forwards that result. This is the FS error code
28// for permission denied, which is the closest approximation of this scenario. 28// for permission denied, which is the closest approximation of this scenario.
29constexpr ResultCode ERROR_FAILED_CLEAR_CACHE{ErrorModule::FS, 6400}; 29constexpr Result ERROR_FAILED_CLEAR_CACHE{ErrorModule::FS, 6400};
30 30
31using BCATDigest = std::array<u8, 0x10>; 31using BCATDigest = std::array<u8, 0x10>;
32 32
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
index cbe9d5f7c..ff9b0427c 100644
--- a/src/core/hle/service/es/es.cpp
+++ b/src/core/hle/service/es/es.cpp
@@ -8,8 +8,8 @@
8 8
9namespace Service::ES { 9namespace Service::ES {
10 10
11constexpr ResultCode ERROR_INVALID_ARGUMENT{ErrorModule::ETicket, 2}; 11constexpr Result ERROR_INVALID_ARGUMENT{ErrorModule::ETicket, 2};
12constexpr ResultCode ERROR_INVALID_RIGHTS_ID{ErrorModule::ETicket, 3}; 12constexpr Result ERROR_INVALID_RIGHTS_ID{ErrorModule::ETicket, 3};
13 13
14class ETicket final : public ServiceFramework<ETicket> { 14class ETicket final : public ServiceFramework<ETicket> {
15public: 15public:
diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp
index a99c90479..27675615b 100644
--- a/src/core/hle/service/fatal/fatal.cpp
+++ b/src/core/hle/service/fatal/fatal.cpp
@@ -62,8 +62,7 @@ enum class FatalType : u32 {
62 ErrorScreen = 2, 62 ErrorScreen = 2,
63}; 63};
64 64
65static void GenerateErrorReport(Core::System& system, ResultCode error_code, 65static void GenerateErrorReport(Core::System& system, Result error_code, const FatalInfo& info) {
66 const FatalInfo& info) {
67 const auto title_id = system.GetCurrentProcessProgramID(); 66 const auto title_id = system.GetCurrentProcessProgramID();
68 std::string crash_report = fmt::format( 67 std::string crash_report = fmt::format(
69 "Yuzu {}-{} crash report\n" 68 "Yuzu {}-{} crash report\n"
@@ -106,7 +105,7 @@ static void GenerateErrorReport(Core::System& system, ResultCode error_code,
106 info.backtrace_size, info.ArchAsString(), info.unk10); 105 info.backtrace_size, info.ArchAsString(), info.unk10);
107} 106}
108 107
109static void ThrowFatalError(Core::System& system, ResultCode error_code, FatalType fatal_type, 108static void ThrowFatalError(Core::System& system, Result error_code, FatalType fatal_type,
110 const FatalInfo& info) { 109 const FatalInfo& info) {
111 LOG_ERROR(Service_Fatal, "Threw fatal error type {} with error code 0x{:X}", fatal_type, 110 LOG_ERROR(Service_Fatal, "Threw fatal error type {} with error code 0x{:X}", fatal_type,
112 error_code.raw); 111 error_code.raw);
@@ -129,7 +128,7 @@ static void ThrowFatalError(Core::System& system, ResultCode error_code, FatalTy
129void Module::Interface::ThrowFatal(Kernel::HLERequestContext& ctx) { 128void Module::Interface::ThrowFatal(Kernel::HLERequestContext& ctx) {
130 LOG_ERROR(Service_Fatal, "called"); 129 LOG_ERROR(Service_Fatal, "called");
131 IPC::RequestParser rp{ctx}; 130 IPC::RequestParser rp{ctx};
132 const auto error_code = rp.Pop<ResultCode>(); 131 const auto error_code = rp.Pop<Result>();
133 132
134 ThrowFatalError(system, error_code, FatalType::ErrorScreen, {}); 133 ThrowFatalError(system, error_code, FatalType::ErrorScreen, {});
135 IPC::ResponseBuilder rb{ctx, 2}; 134 IPC::ResponseBuilder rb{ctx, 2};
@@ -139,7 +138,7 @@ void Module::Interface::ThrowFatal(Kernel::HLERequestContext& ctx) {
139void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) { 138void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) {
140 LOG_ERROR(Service_Fatal, "called"); 139 LOG_ERROR(Service_Fatal, "called");
141 IPC::RequestParser rp(ctx); 140 IPC::RequestParser rp(ctx);
142 const auto error_code = rp.Pop<ResultCode>(); 141 const auto error_code = rp.Pop<Result>();
143 const auto fatal_type = rp.PopEnum<FatalType>(); 142 const auto fatal_type = rp.PopEnum<FatalType>();
144 143
145 ThrowFatalError(system, error_code, fatal_type, 144 ThrowFatalError(system, error_code, fatal_type,
@@ -151,7 +150,7 @@ void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) {
151void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) { 150void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) {
152 LOG_ERROR(Service_Fatal, "called"); 151 LOG_ERROR(Service_Fatal, "called");
153 IPC::RequestParser rp(ctx); 152 IPC::RequestParser rp(ctx);
154 const auto error_code = rp.Pop<ResultCode>(); 153 const auto error_code = rp.Pop<Result>();
155 const auto fatal_type = rp.PopEnum<FatalType>(); 154 const auto fatal_type = rp.PopEnum<FatalType>();
156 const auto fatal_info = ctx.ReadBuffer(); 155 const auto fatal_info = ctx.ReadBuffer();
157 FatalInfo info{}; 156 FatalInfo info{};
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index f8e7519ca..11c604a0f 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -49,7 +49,7 @@ std::string VfsDirectoryServiceWrapper::GetName() const {
49 return backing->GetName(); 49 return backing->GetName();
50} 50}
51 51
52ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const { 52Result VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const {
53 std::string path(Common::FS::SanitizePath(path_)); 53 std::string path(Common::FS::SanitizePath(path_));
54 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); 54 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
55 if (dir == nullptr) { 55 if (dir == nullptr) {
@@ -73,7 +73,7 @@ ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64
73 return ResultSuccess; 73 return ResultSuccess;
74} 74}
75 75
76ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const { 76Result VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const {
77 std::string path(Common::FS::SanitizePath(path_)); 77 std::string path(Common::FS::SanitizePath(path_));
78 if (path.empty()) { 78 if (path.empty()) {
79 // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but... 79 // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but...
@@ -92,7 +92,7 @@ ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) cons
92 return ResultSuccess; 92 return ResultSuccess;
93} 93}
94 94
95ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const { 95Result VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const {
96 std::string path(Common::FS::SanitizePath(path_)); 96 std::string path(Common::FS::SanitizePath(path_));
97 97
98 // NOTE: This is inaccurate behavior. CreateDirectory is not recursive. 98 // NOTE: This is inaccurate behavior. CreateDirectory is not recursive.
@@ -116,7 +116,7 @@ ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_)
116 return ResultSuccess; 116 return ResultSuccess;
117} 117}
118 118
119ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) const { 119Result VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) const {
120 std::string path(Common::FS::SanitizePath(path_)); 120 std::string path(Common::FS::SanitizePath(path_));
121 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); 121 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
122 if (!dir->DeleteSubdirectory(Common::FS::GetFilename(path))) { 122 if (!dir->DeleteSubdirectory(Common::FS::GetFilename(path))) {
@@ -126,7 +126,7 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_)
126 return ResultSuccess; 126 return ResultSuccess;
127} 127}
128 128
129ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::string& path_) const { 129Result VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::string& path_) const {
130 std::string path(Common::FS::SanitizePath(path_)); 130 std::string path(Common::FS::SanitizePath(path_));
131 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); 131 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
132 if (!dir->DeleteSubdirectoryRecursive(Common::FS::GetFilename(path))) { 132 if (!dir->DeleteSubdirectoryRecursive(Common::FS::GetFilename(path))) {
@@ -136,7 +136,7 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::str
136 return ResultSuccess; 136 return ResultSuccess;
137} 137}
138 138
139ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::string& path) const { 139Result VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::string& path) const {
140 const std::string sanitized_path(Common::FS::SanitizePath(path)); 140 const std::string sanitized_path(Common::FS::SanitizePath(path));
141 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(sanitized_path)); 141 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(sanitized_path));
142 142
@@ -148,8 +148,8 @@ ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::stri
148 return ResultSuccess; 148 return ResultSuccess;
149} 149}
150 150
151ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, 151Result VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_,
152 const std::string& dest_path_) const { 152 const std::string& dest_path_) const {
153 std::string src_path(Common::FS::SanitizePath(src_path_)); 153 std::string src_path(Common::FS::SanitizePath(src_path_));
154 std::string dest_path(Common::FS::SanitizePath(dest_path_)); 154 std::string dest_path(Common::FS::SanitizePath(dest_path_));
155 auto src = backing->GetFileRelative(src_path); 155 auto src = backing->GetFileRelative(src_path);
@@ -183,8 +183,8 @@ ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_,
183 return ResultSuccess; 183 return ResultSuccess;
184} 184}
185 185
186ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_path_, 186Result VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_path_,
187 const std::string& dest_path_) const { 187 const std::string& dest_path_) const {
188 std::string src_path(Common::FS::SanitizePath(src_path_)); 188 std::string src_path(Common::FS::SanitizePath(src_path_));
189 std::string dest_path(Common::FS::SanitizePath(dest_path_)); 189 std::string dest_path(Common::FS::SanitizePath(dest_path_));
190 auto src = GetDirectoryRelativeWrapped(backing, src_path); 190 auto src = GetDirectoryRelativeWrapped(backing, src_path);
@@ -273,28 +273,27 @@ FileSystemController::FileSystemController(Core::System& system_) : system{syste
273 273
274FileSystemController::~FileSystemController() = default; 274FileSystemController::~FileSystemController() = default;
275 275
276ResultCode FileSystemController::RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) { 276Result FileSystemController::RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) {
277 romfs_factory = std::move(factory); 277 romfs_factory = std::move(factory);
278 LOG_DEBUG(Service_FS, "Registered RomFS"); 278 LOG_DEBUG(Service_FS, "Registered RomFS");
279 return ResultSuccess; 279 return ResultSuccess;
280} 280}
281 281
282ResultCode FileSystemController::RegisterSaveData( 282Result FileSystemController::RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory) {
283 std::unique_ptr<FileSys::SaveDataFactory>&& factory) {
284 ASSERT_MSG(save_data_factory == nullptr, "Tried to register a second save data"); 283 ASSERT_MSG(save_data_factory == nullptr, "Tried to register a second save data");
285 save_data_factory = std::move(factory); 284 save_data_factory = std::move(factory);
286 LOG_DEBUG(Service_FS, "Registered save data"); 285 LOG_DEBUG(Service_FS, "Registered save data");
287 return ResultSuccess; 286 return ResultSuccess;
288} 287}
289 288
290ResultCode FileSystemController::RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory) { 289Result FileSystemController::RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory) {
291 ASSERT_MSG(sdmc_factory == nullptr, "Tried to register a second SDMC"); 290 ASSERT_MSG(sdmc_factory == nullptr, "Tried to register a second SDMC");
292 sdmc_factory = std::move(factory); 291 sdmc_factory = std::move(factory);
293 LOG_DEBUG(Service_FS, "Registered SDMC"); 292 LOG_DEBUG(Service_FS, "Registered SDMC");
294 return ResultSuccess; 293 return ResultSuccess;
295} 294}
296 295
297ResultCode FileSystemController::RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) { 296Result FileSystemController::RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) {
298 ASSERT_MSG(bis_factory == nullptr, "Tried to register a second BIS"); 297 ASSERT_MSG(bis_factory == nullptr, "Tried to register a second BIS");
299 bis_factory = std::move(factory); 298 bis_factory = std::move(factory);
300 LOG_DEBUG(Service_FS, "Registered BIS"); 299 LOG_DEBUG(Service_FS, "Registered BIS");
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index 8dd2652fe..5b27de9fa 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -58,10 +58,10 @@ public:
58 explicit FileSystemController(Core::System& system_); 58 explicit FileSystemController(Core::System& system_);
59 ~FileSystemController(); 59 ~FileSystemController();
60 60
61 ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory); 61 Result RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory);
62 ResultCode RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory); 62 Result RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory);
63 ResultCode RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory); 63 Result RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory);
64 ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory); 64 Result RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory);
65 65
66 void SetPackedUpdate(FileSys::VirtualFile update_raw); 66 void SetPackedUpdate(FileSys::VirtualFile update_raw);
67 ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() const; 67 ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() const;
@@ -141,7 +141,7 @@ private:
141 141
142void InstallInterfaces(Core::System& system); 142void InstallInterfaces(Core::System& system);
143 143
144// A class that wraps a VfsDirectory with methods that return ResultVal and ResultCode instead of 144// A class that wraps a VfsDirectory with methods that return ResultVal and Result instead of
145// pointers and booleans. This makes using a VfsDirectory with switch services much easier and 145// pointers and booleans. This makes using a VfsDirectory with switch services much easier and
146// avoids repetitive code. 146// avoids repetitive code.
147class VfsDirectoryServiceWrapper { 147class VfsDirectoryServiceWrapper {
@@ -160,35 +160,35 @@ public:
160 * @param size The size of the new file, filled with zeroes 160 * @param size The size of the new file, filled with zeroes
161 * @return Result of the operation 161 * @return Result of the operation
162 */ 162 */
163 ResultCode CreateFile(const std::string& path, u64 size) const; 163 Result CreateFile(const std::string& path, u64 size) const;
164 164
165 /** 165 /**
166 * Delete a file specified by its path 166 * Delete a file specified by its path
167 * @param path Path relative to the archive 167 * @param path Path relative to the archive
168 * @return Result of the operation 168 * @return Result of the operation
169 */ 169 */
170 ResultCode DeleteFile(const std::string& path) const; 170 Result DeleteFile(const std::string& path) const;
171 171
172 /** 172 /**
173 * Create a directory specified by its path 173 * Create a directory specified by its path
174 * @param path Path relative to the archive 174 * @param path Path relative to the archive
175 * @return Result of the operation 175 * @return Result of the operation
176 */ 176 */
177 ResultCode CreateDirectory(const std::string& path) const; 177 Result CreateDirectory(const std::string& path) const;
178 178
179 /** 179 /**
180 * Delete a directory specified by its path 180 * Delete a directory specified by its path
181 * @param path Path relative to the archive 181 * @param path Path relative to the archive
182 * @return Result of the operation 182 * @return Result of the operation
183 */ 183 */
184 ResultCode DeleteDirectory(const std::string& path) const; 184 Result DeleteDirectory(const std::string& path) const;
185 185
186 /** 186 /**
187 * Delete a directory specified by its path and anything under it 187 * Delete a directory specified by its path and anything under it
188 * @param path Path relative to the archive 188 * @param path Path relative to the archive
189 * @return Result of the operation 189 * @return Result of the operation
190 */ 190 */
191 ResultCode DeleteDirectoryRecursively(const std::string& path) const; 191 Result DeleteDirectoryRecursively(const std::string& path) const;
192 192
193 /** 193 /**
194 * Cleans the specified directory. This is similar to DeleteDirectoryRecursively, 194 * Cleans the specified directory. This is similar to DeleteDirectoryRecursively,
@@ -200,7 +200,7 @@ public:
200 * 200 *
201 * @return Result of the operation. 201 * @return Result of the operation.
202 */ 202 */
203 ResultCode CleanDirectoryRecursively(const std::string& path) const; 203 Result CleanDirectoryRecursively(const std::string& path) const;
204 204
205 /** 205 /**
206 * Rename a File specified by its path 206 * Rename a File specified by its path
@@ -208,7 +208,7 @@ public:
208 * @param dest_path Destination path relative to the archive 208 * @param dest_path Destination path relative to the archive
209 * @return Result of the operation 209 * @return Result of the operation
210 */ 210 */
211 ResultCode RenameFile(const std::string& src_path, const std::string& dest_path) const; 211 Result RenameFile(const std::string& src_path, const std::string& dest_path) const;
212 212
213 /** 213 /**
214 * Rename a Directory specified by its path 214 * Rename a Directory specified by its path
@@ -216,7 +216,7 @@ public:
216 * @param dest_path Destination path relative to the archive 216 * @param dest_path Destination path relative to the archive
217 * @return Result of the operation 217 * @return Result of the operation
218 */ 218 */
219 ResultCode RenameDirectory(const std::string& src_path, const std::string& dest_path) const; 219 Result RenameDirectory(const std::string& src_path, const std::string& dest_path) const;
220 220
221 /** 221 /**
222 * Open a file specified by its path, using the specified mode 222 * Open a file specified by its path, using the specified mode
diff --git a/src/core/hle/service/friend/errors.h b/src/core/hle/service/friend/errors.h
index bc9fe0aca..ff525d865 100644
--- a/src/core/hle/service/friend/errors.h
+++ b/src/core/hle/service/friend/errors.h
@@ -7,5 +7,5 @@
7 7
8namespace Service::Friend { 8namespace Service::Friend {
9 9
10constexpr ResultCode ERR_NO_NOTIFICATIONS{ErrorModule::Account, 15}; 10constexpr Result ERR_NO_NOTIFICATIONS{ErrorModule::Account, 15};
11} 11}
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp
index fec7787ab..49b6d45fe 100644
--- a/src/core/hle/service/glue/arp.cpp
+++ b/src/core/hle/service/glue/arp.cpp
@@ -153,7 +153,7 @@ class IRegistrar final : public ServiceFramework<IRegistrar> {
153 friend class ARP_W; 153 friend class ARP_W;
154 154
155public: 155public:
156 using IssuerFn = std::function<ResultCode(u64, ApplicationLaunchProperty, std::vector<u8>)>; 156 using IssuerFn = std::function<Result(u64, ApplicationLaunchProperty, std::vector<u8>)>;
157 157
158 explicit IRegistrar(Core::System& system_, IssuerFn&& issuer) 158 explicit IRegistrar(Core::System& system_, IssuerFn&& issuer)
159 : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} { 159 : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} {
diff --git a/src/core/hle/service/glue/errors.h b/src/core/hle/service/glue/errors.h
index aefbe1f3e..d4ce7f44e 100644
--- a/src/core/hle/service/glue/errors.h
+++ b/src/core/hle/service/glue/errors.h
@@ -7,9 +7,9 @@
7 7
8namespace Service::Glue { 8namespace Service::Glue {
9 9
10constexpr ResultCode ERR_INVALID_RESOURCE{ErrorModule::ARP, 30}; 10constexpr Result ERR_INVALID_RESOURCE{ErrorModule::ARP, 30};
11constexpr ResultCode ERR_INVALID_PROCESS_ID{ErrorModule::ARP, 31}; 11constexpr Result ERR_INVALID_PROCESS_ID{ErrorModule::ARP, 31};
12constexpr ResultCode ERR_INVALID_ACCESS{ErrorModule::ARP, 42}; 12constexpr Result ERR_INVALID_ACCESS{ErrorModule::ARP, 42};
13constexpr ResultCode ERR_NOT_REGISTERED{ErrorModule::ARP, 102}; 13constexpr Result ERR_NOT_REGISTERED{ErrorModule::ARP, 102};
14 14
15} // namespace Service::Glue 15} // namespace Service::Glue
diff --git a/src/core/hle/service/glue/glue_manager.cpp b/src/core/hle/service/glue/glue_manager.cpp
index f1655b33e..8a654cdca 100644
--- a/src/core/hle/service/glue/glue_manager.cpp
+++ b/src/core/hle/service/glue/glue_manager.cpp
@@ -41,8 +41,8 @@ ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
41 return iter->second.control; 41 return iter->second.control;
42} 42}
43 43
44ResultCode ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, 44Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch,
45 std::vector<u8> control) { 45 std::vector<u8> control) {
46 if (title_id == 0) { 46 if (title_id == 0) {
47 return ERR_INVALID_PROCESS_ID; 47 return ERR_INVALID_PROCESS_ID;
48 } 48 }
@@ -56,7 +56,7 @@ ResultCode ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch,
56 return ResultSuccess; 56 return ResultSuccess;
57} 57}
58 58
59ResultCode ARPManager::Unregister(u64 title_id) { 59Result ARPManager::Unregister(u64 title_id) {
60 if (title_id == 0) { 60 if (title_id == 0) {
61 return ERR_INVALID_PROCESS_ID; 61 return ERR_INVALID_PROCESS_ID;
62 } 62 }
diff --git a/src/core/hle/service/glue/glue_manager.h b/src/core/hle/service/glue/glue_manager.h
index 6246fd2ff..cd0b092ac 100644
--- a/src/core/hle/service/glue/glue_manager.h
+++ b/src/core/hle/service/glue/glue_manager.h
@@ -42,12 +42,12 @@ public:
42 // Adds a new entry to the internal database with the provided parameters, returning 42 // Adds a new entry to the internal database with the provided parameters, returning
43 // ERR_INVALID_ACCESS if attempting to re-register a title ID without an intermediate Unregister 43 // ERR_INVALID_ACCESS if attempting to re-register a title ID without an intermediate Unregister
44 // step, and ERR_INVALID_PROCESS_ID if the title ID is 0. 44 // step, and ERR_INVALID_PROCESS_ID if the title ID is 0.
45 ResultCode Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control); 45 Result Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control);
46 46
47 // Removes the registration for the provided title ID from the database, returning 47 // Removes the registration for the provided title ID from the database, returning
48 // ERR_NOT_REGISTERED if it doesn't exist in the database and ERR_INVALID_PROCESS_ID if the 48 // ERR_NOT_REGISTERED if it doesn't exist in the database and ERR_INVALID_PROCESS_ID if the
49 // title ID is 0. 49 // title ID is 0.
50 ResultCode Unregister(u64 title_id); 50 Result Unregister(u64 title_id);
51 51
52 // Removes all entries from the database, always succeeds. Should only be used when resetting 52 // Removes all entries from the database, always succeeds. Should only be used when resetting
53 // system state. 53 // system state.
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index ac5c38cc6..c08b0a5dc 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -56,7 +56,7 @@ bool Controller_NPad::IsDeviceHandleValid(const Core::HID::VibrationDeviceHandle
56 return npad_id && npad_type && device_index; 56 return npad_id && npad_type && device_index;
57} 57}
58 58
59ResultCode Controller_NPad::VerifyValidSixAxisSensorHandle( 59Result Controller_NPad::VerifyValidSixAxisSensorHandle(
60 const Core::HID::SixAxisSensorHandle& device_handle) { 60 const Core::HID::SixAxisSensorHandle& device_handle) {
61 const auto npad_id = IsNpadIdValid(static_cast<Core::HID::NpadIdType>(device_handle.npad_id)); 61 const auto npad_id = IsNpadIdValid(static_cast<Core::HID::NpadIdType>(device_handle.npad_id));
62 if (!npad_id) { 62 if (!npad_id) {
@@ -720,9 +720,9 @@ Controller_NPad::NpadCommunicationMode Controller_NPad::GetNpadCommunicationMode
720 return communication_mode; 720 return communication_mode;
721} 721}
722 722
723ResultCode Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id, 723Result Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id,
724 NpadJoyDeviceType npad_device_type, 724 NpadJoyDeviceType npad_device_type,
725 NpadJoyAssignmentMode assignment_mode) { 725 NpadJoyAssignmentMode assignment_mode) {
726 if (!IsNpadIdValid(npad_id)) { 726 if (!IsNpadIdValid(npad_id)) {
727 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id); 727 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id);
728 return InvalidNpadId; 728 return InvalidNpadId;
@@ -984,7 +984,7 @@ void Controller_NPad::UpdateControllerAt(Core::HID::NpadStyleIndex type,
984 InitNewlyAddedController(npad_id); 984 InitNewlyAddedController(npad_id);
985} 985}
986 986
987ResultCode Controller_NPad::DisconnectNpad(Core::HID::NpadIdType npad_id) { 987Result Controller_NPad::DisconnectNpad(Core::HID::NpadIdType npad_id) {
988 if (!IsNpadIdValid(npad_id)) { 988 if (!IsNpadIdValid(npad_id)) {
989 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id); 989 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id);
990 return InvalidNpadId; 990 return InvalidNpadId;
@@ -1032,7 +1032,7 @@ ResultCode Controller_NPad::DisconnectNpad(Core::HID::NpadIdType npad_id) {
1032 WriteEmptyEntry(shared_memory); 1032 WriteEmptyEntry(shared_memory);
1033 return ResultSuccess; 1033 return ResultSuccess;
1034} 1034}
1035ResultCode Controller_NPad::SetGyroscopeZeroDriftMode( 1035Result Controller_NPad::SetGyroscopeZeroDriftMode(
1036 const Core::HID::SixAxisSensorHandle& sixaxis_handle, GyroscopeZeroDriftMode drift_mode) { 1036 const Core::HID::SixAxisSensorHandle& sixaxis_handle, GyroscopeZeroDriftMode drift_mode) {
1037 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1037 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1038 if (is_valid.IsError()) { 1038 if (is_valid.IsError()) {
@@ -1046,7 +1046,7 @@ ResultCode Controller_NPad::SetGyroscopeZeroDriftMode(
1046 return ResultSuccess; 1046 return ResultSuccess;
1047} 1047}
1048 1048
1049ResultCode Controller_NPad::GetGyroscopeZeroDriftMode( 1049Result Controller_NPad::GetGyroscopeZeroDriftMode(
1050 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 1050 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
1051 GyroscopeZeroDriftMode& drift_mode) const { 1051 GyroscopeZeroDriftMode& drift_mode) const {
1052 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1052 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
@@ -1061,8 +1061,8 @@ ResultCode Controller_NPad::GetGyroscopeZeroDriftMode(
1061 return ResultSuccess; 1061 return ResultSuccess;
1062} 1062}
1063 1063
1064ResultCode Controller_NPad::IsSixAxisSensorAtRest( 1064Result Controller_NPad::IsSixAxisSensorAtRest(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
1065 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_at_rest) const { 1065 bool& is_at_rest) const {
1066 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1066 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1067 if (is_valid.IsError()) { 1067 if (is_valid.IsError()) {
1068 LOG_ERROR(Service_HID, "Invalid handle, error_code={}", is_valid.raw); 1068 LOG_ERROR(Service_HID, "Invalid handle, error_code={}", is_valid.raw);
@@ -1074,7 +1074,7 @@ ResultCode Controller_NPad::IsSixAxisSensorAtRest(
1074 return ResultSuccess; 1074 return ResultSuccess;
1075} 1075}
1076 1076
1077ResultCode Controller_NPad::IsFirmwareUpdateAvailableForSixAxisSensor( 1077Result Controller_NPad::IsFirmwareUpdateAvailableForSixAxisSensor(
1078 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_firmware_available) const { 1078 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_firmware_available) const {
1079 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1079 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1080 if (is_valid.IsError()) { 1080 if (is_valid.IsError()) {
@@ -1087,7 +1087,7 @@ ResultCode Controller_NPad::IsFirmwareUpdateAvailableForSixAxisSensor(
1087 return ResultSuccess; 1087 return ResultSuccess;
1088} 1088}
1089 1089
1090ResultCode Controller_NPad::EnableSixAxisSensorUnalteredPassthrough( 1090Result Controller_NPad::EnableSixAxisSensorUnalteredPassthrough(
1091 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool is_enabled) { 1091 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool is_enabled) {
1092 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1092 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1093 if (is_valid.IsError()) { 1093 if (is_valid.IsError()) {
@@ -1100,7 +1100,7 @@ ResultCode Controller_NPad::EnableSixAxisSensorUnalteredPassthrough(
1100 return ResultSuccess; 1100 return ResultSuccess;
1101} 1101}
1102 1102
1103ResultCode Controller_NPad::IsSixAxisSensorUnalteredPassthroughEnabled( 1103Result Controller_NPad::IsSixAxisSensorUnalteredPassthroughEnabled(
1104 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_enabled) const { 1104 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_enabled) const {
1105 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1105 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1106 if (is_valid.IsError()) { 1106 if (is_valid.IsError()) {
@@ -1113,7 +1113,7 @@ ResultCode Controller_NPad::IsSixAxisSensorUnalteredPassthroughEnabled(
1113 return ResultSuccess; 1113 return ResultSuccess;
1114} 1114}
1115 1115
1116ResultCode Controller_NPad::LoadSixAxisSensorCalibrationParameter( 1116Result Controller_NPad::LoadSixAxisSensorCalibrationParameter(
1117 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 1117 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
1118 Core::HID::SixAxisSensorCalibrationParameter& calibration) const { 1118 Core::HID::SixAxisSensorCalibrationParameter& calibration) const {
1119 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1119 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
@@ -1128,7 +1128,7 @@ ResultCode Controller_NPad::LoadSixAxisSensorCalibrationParameter(
1128 return ResultSuccess; 1128 return ResultSuccess;
1129} 1129}
1130 1130
1131ResultCode Controller_NPad::GetSixAxisSensorIcInformation( 1131Result Controller_NPad::GetSixAxisSensorIcInformation(
1132 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 1132 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
1133 Core::HID::SixAxisSensorIcInformation& ic_information) const { 1133 Core::HID::SixAxisSensorIcInformation& ic_information) const {
1134 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1134 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
@@ -1143,7 +1143,7 @@ ResultCode Controller_NPad::GetSixAxisSensorIcInformation(
1143 return ResultSuccess; 1143 return ResultSuccess;
1144} 1144}
1145 1145
1146ResultCode Controller_NPad::ResetIsSixAxisSensorDeviceNewlyAssigned( 1146Result Controller_NPad::ResetIsSixAxisSensorDeviceNewlyAssigned(
1147 const Core::HID::SixAxisSensorHandle& sixaxis_handle) { 1147 const Core::HID::SixAxisSensorHandle& sixaxis_handle) {
1148 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1148 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1149 if (is_valid.IsError()) { 1149 if (is_valid.IsError()) {
@@ -1157,8 +1157,8 @@ ResultCode Controller_NPad::ResetIsSixAxisSensorDeviceNewlyAssigned(
1157 return ResultSuccess; 1157 return ResultSuccess;
1158} 1158}
1159 1159
1160ResultCode Controller_NPad::SetSixAxisEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle, 1160Result Controller_NPad::SetSixAxisEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
1161 bool sixaxis_status) { 1161 bool sixaxis_status) {
1162 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1162 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1163 if (is_valid.IsError()) { 1163 if (is_valid.IsError()) {
1164 LOG_ERROR(Service_HID, "Invalid handle, error_code={}", is_valid.raw); 1164 LOG_ERROR(Service_HID, "Invalid handle, error_code={}", is_valid.raw);
@@ -1170,7 +1170,7 @@ ResultCode Controller_NPad::SetSixAxisEnabled(const Core::HID::SixAxisSensorHand
1170 return ResultSuccess; 1170 return ResultSuccess;
1171} 1171}
1172 1172
1173ResultCode Controller_NPad::IsSixAxisSensorFusionEnabled( 1173Result Controller_NPad::IsSixAxisSensorFusionEnabled(
1174 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_fusion_enabled) const { 1174 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_fusion_enabled) const {
1175 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1175 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1176 if (is_valid.IsError()) { 1176 if (is_valid.IsError()) {
@@ -1183,7 +1183,7 @@ ResultCode Controller_NPad::IsSixAxisSensorFusionEnabled(
1183 1183
1184 return ResultSuccess; 1184 return ResultSuccess;
1185} 1185}
1186ResultCode Controller_NPad::SetSixAxisFusionEnabled( 1186Result Controller_NPad::SetSixAxisFusionEnabled(
1187 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool is_fusion_enabled) { 1187 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool is_fusion_enabled) {
1188 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1188 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
1189 if (is_valid.IsError()) { 1189 if (is_valid.IsError()) {
@@ -1197,7 +1197,7 @@ ResultCode Controller_NPad::SetSixAxisFusionEnabled(
1197 return ResultSuccess; 1197 return ResultSuccess;
1198} 1198}
1199 1199
1200ResultCode Controller_NPad::SetSixAxisFusionParameters( 1200Result Controller_NPad::SetSixAxisFusionParameters(
1201 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 1201 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
1202 Core::HID::SixAxisSensorFusionParameters sixaxis_fusion_parameters) { 1202 Core::HID::SixAxisSensorFusionParameters sixaxis_fusion_parameters) {
1203 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1203 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
@@ -1217,7 +1217,7 @@ ResultCode Controller_NPad::SetSixAxisFusionParameters(
1217 return ResultSuccess; 1217 return ResultSuccess;
1218} 1218}
1219 1219
1220ResultCode Controller_NPad::GetSixAxisFusionParameters( 1220Result Controller_NPad::GetSixAxisFusionParameters(
1221 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 1221 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
1222 Core::HID::SixAxisSensorFusionParameters& parameters) const { 1222 Core::HID::SixAxisSensorFusionParameters& parameters) const {
1223 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle); 1223 const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
@@ -1232,8 +1232,8 @@ ResultCode Controller_NPad::GetSixAxisFusionParameters(
1232 return ResultSuccess; 1232 return ResultSuccess;
1233} 1233}
1234 1234
1235ResultCode Controller_NPad::MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1, 1235Result Controller_NPad::MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1,
1236 Core::HID::NpadIdType npad_id_2) { 1236 Core::HID::NpadIdType npad_id_2) {
1237 if (!IsNpadIdValid(npad_id_1) || !IsNpadIdValid(npad_id_2)) { 1237 if (!IsNpadIdValid(npad_id_1) || !IsNpadIdValid(npad_id_2)) {
1238 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id_1:{}, npad_id_2:{}", npad_id_1, 1238 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id_1:{}, npad_id_2:{}", npad_id_1,
1239 npad_id_2); 1239 npad_id_2);
@@ -1304,8 +1304,8 @@ void Controller_NPad::StopLRAssignmentMode() {
1304 is_in_lr_assignment_mode = false; 1304 is_in_lr_assignment_mode = false;
1305} 1305}
1306 1306
1307ResultCode Controller_NPad::SwapNpadAssignment(Core::HID::NpadIdType npad_id_1, 1307Result Controller_NPad::SwapNpadAssignment(Core::HID::NpadIdType npad_id_1,
1308 Core::HID::NpadIdType npad_id_2) { 1308 Core::HID::NpadIdType npad_id_2) {
1309 if (!IsNpadIdValid(npad_id_1) || !IsNpadIdValid(npad_id_2)) { 1309 if (!IsNpadIdValid(npad_id_1) || !IsNpadIdValid(npad_id_2)) {
1310 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id_1:{}, npad_id_2:{}", npad_id_1, 1310 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id_1:{}, npad_id_2:{}", npad_id_1,
1311 npad_id_2); 1311 npad_id_2);
@@ -1336,8 +1336,8 @@ ResultCode Controller_NPad::SwapNpadAssignment(Core::HID::NpadIdType npad_id_1,
1336 return ResultSuccess; 1336 return ResultSuccess;
1337} 1337}
1338 1338
1339ResultCode Controller_NPad::GetLedPattern(Core::HID::NpadIdType npad_id, 1339Result Controller_NPad::GetLedPattern(Core::HID::NpadIdType npad_id,
1340 Core::HID::LedPattern& pattern) const { 1340 Core::HID::LedPattern& pattern) const {
1341 if (!IsNpadIdValid(npad_id)) { 1341 if (!IsNpadIdValid(npad_id)) {
1342 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id); 1342 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id);
1343 return InvalidNpadId; 1343 return InvalidNpadId;
@@ -1347,8 +1347,8 @@ ResultCode Controller_NPad::GetLedPattern(Core::HID::NpadIdType npad_id,
1347 return ResultSuccess; 1347 return ResultSuccess;
1348} 1348}
1349 1349
1350ResultCode Controller_NPad::IsUnintendedHomeButtonInputProtectionEnabled( 1350Result Controller_NPad::IsUnintendedHomeButtonInputProtectionEnabled(Core::HID::NpadIdType npad_id,
1351 Core::HID::NpadIdType npad_id, bool& is_valid) const { 1351 bool& is_valid) const {
1352 if (!IsNpadIdValid(npad_id)) { 1352 if (!IsNpadIdValid(npad_id)) {
1353 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id); 1353 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id);
1354 return InvalidNpadId; 1354 return InvalidNpadId;
@@ -1358,7 +1358,7 @@ ResultCode Controller_NPad::IsUnintendedHomeButtonInputProtectionEnabled(
1358 return ResultSuccess; 1358 return ResultSuccess;
1359} 1359}
1360 1360
1361ResultCode Controller_NPad::SetUnintendedHomeButtonInputProtectionEnabled( 1361Result Controller_NPad::SetUnintendedHomeButtonInputProtectionEnabled(
1362 bool is_protection_enabled, Core::HID::NpadIdType npad_id) { 1362 bool is_protection_enabled, Core::HID::NpadIdType npad_id) {
1363 if (!IsNpadIdValid(npad_id)) { 1363 if (!IsNpadIdValid(npad_id)) {
1364 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id); 1364 LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id);
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 0b662b7f8..8b54724ed 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -29,7 +29,7 @@ namespace Service::KernelHelpers {
29class ServiceContext; 29class ServiceContext;
30} // namespace Service::KernelHelpers 30} // namespace Service::KernelHelpers
31 31
32union ResultCode; 32union Result;
33 33
34namespace Service::HID { 34namespace Service::HID {
35 35
@@ -107,8 +107,8 @@ public:
107 void SetNpadCommunicationMode(NpadCommunicationMode communication_mode_); 107 void SetNpadCommunicationMode(NpadCommunicationMode communication_mode_);
108 NpadCommunicationMode GetNpadCommunicationMode() const; 108 NpadCommunicationMode GetNpadCommunicationMode() const;
109 109
110 ResultCode SetNpadMode(Core::HID::NpadIdType npad_id, NpadJoyDeviceType npad_device_type, 110 Result SetNpadMode(Core::HID::NpadIdType npad_id, NpadJoyDeviceType npad_device_type,
111 NpadJoyAssignmentMode assignment_mode); 111 NpadJoyAssignmentMode assignment_mode);
112 112
113 bool VibrateControllerAtIndex(Core::HID::NpadIdType npad_id, std::size_t device_index, 113 bool VibrateControllerAtIndex(Core::HID::NpadIdType npad_id, std::size_t device_index,
114 const Core::HID::VibrationValue& vibration_value); 114 const Core::HID::VibrationValue& vibration_value);
@@ -141,56 +141,55 @@ public:
141 void UpdateControllerAt(Core::HID::NpadStyleIndex controller, Core::HID::NpadIdType npad_id, 141 void UpdateControllerAt(Core::HID::NpadStyleIndex controller, Core::HID::NpadIdType npad_id,
142 bool connected); 142 bool connected);
143 143
144 ResultCode DisconnectNpad(Core::HID::NpadIdType npad_id); 144 Result DisconnectNpad(Core::HID::NpadIdType npad_id);
145 145
146 ResultCode SetGyroscopeZeroDriftMode(const Core::HID::SixAxisSensorHandle& sixaxis_handle, 146 Result SetGyroscopeZeroDriftMode(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
147 GyroscopeZeroDriftMode drift_mode); 147 GyroscopeZeroDriftMode drift_mode);
148 ResultCode GetGyroscopeZeroDriftMode(const Core::HID::SixAxisSensorHandle& sixaxis_handle, 148 Result GetGyroscopeZeroDriftMode(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
149 GyroscopeZeroDriftMode& drift_mode) const; 149 GyroscopeZeroDriftMode& drift_mode) const;
150 ResultCode IsSixAxisSensorAtRest(const Core::HID::SixAxisSensorHandle& sixaxis_handle, 150 Result IsSixAxisSensorAtRest(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
151 bool& is_at_rest) const; 151 bool& is_at_rest) const;
152 ResultCode IsFirmwareUpdateAvailableForSixAxisSensor( 152 Result IsFirmwareUpdateAvailableForSixAxisSensor(
153 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_firmware_available) const; 153 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_firmware_available) const;
154 ResultCode EnableSixAxisSensorUnalteredPassthrough( 154 Result EnableSixAxisSensorUnalteredPassthrough(
155 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool is_enabled); 155 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool is_enabled);
156 ResultCode IsSixAxisSensorUnalteredPassthroughEnabled( 156 Result IsSixAxisSensorUnalteredPassthroughEnabled(
157 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_enabled) const; 157 const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_enabled) const;
158 ResultCode LoadSixAxisSensorCalibrationParameter( 158 Result LoadSixAxisSensorCalibrationParameter(
159 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 159 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
160 Core::HID::SixAxisSensorCalibrationParameter& calibration) const; 160 Core::HID::SixAxisSensorCalibrationParameter& calibration) const;
161 ResultCode GetSixAxisSensorIcInformation( 161 Result GetSixAxisSensorIcInformation(
162 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 162 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
163 Core::HID::SixAxisSensorIcInformation& ic_information) const; 163 Core::HID::SixAxisSensorIcInformation& ic_information) const;
164 ResultCode ResetIsSixAxisSensorDeviceNewlyAssigned( 164 Result ResetIsSixAxisSensorDeviceNewlyAssigned(
165 const Core::HID::SixAxisSensorHandle& sixaxis_handle); 165 const Core::HID::SixAxisSensorHandle& sixaxis_handle);
166 ResultCode SetSixAxisEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle, 166 Result SetSixAxisEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
167 bool sixaxis_status); 167 bool sixaxis_status);
168 ResultCode IsSixAxisSensorFusionEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle, 168 Result IsSixAxisSensorFusionEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
169 bool& is_fusion_enabled) const; 169 bool& is_fusion_enabled) const;
170 ResultCode SetSixAxisFusionEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle, 170 Result SetSixAxisFusionEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
171 bool is_fusion_enabled); 171 bool is_fusion_enabled);
172 ResultCode SetSixAxisFusionParameters( 172 Result SetSixAxisFusionParameters(
173 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 173 const Core::HID::SixAxisSensorHandle& sixaxis_handle,
174 Core::HID::SixAxisSensorFusionParameters sixaxis_fusion_parameters); 174 Core::HID::SixAxisSensorFusionParameters sixaxis_fusion_parameters);
175 ResultCode GetSixAxisFusionParameters( 175 Result GetSixAxisFusionParameters(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
176 const Core::HID::SixAxisSensorHandle& sixaxis_handle, 176 Core::HID::SixAxisSensorFusionParameters& parameters) const;
177 Core::HID::SixAxisSensorFusionParameters& parameters) const; 177 Result GetLedPattern(Core::HID::NpadIdType npad_id, Core::HID::LedPattern& pattern) const;
178 ResultCode GetLedPattern(Core::HID::NpadIdType npad_id, Core::HID::LedPattern& pattern) const; 178 Result IsUnintendedHomeButtonInputProtectionEnabled(Core::HID::NpadIdType npad_id,
179 ResultCode IsUnintendedHomeButtonInputProtectionEnabled(Core::HID::NpadIdType npad_id, 179 bool& is_enabled) const;
180 bool& is_enabled) const; 180 Result SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled,
181 ResultCode SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, 181 Core::HID::NpadIdType npad_id);
182 Core::HID::NpadIdType npad_id);
183 void SetAnalogStickUseCenterClamp(bool use_center_clamp); 182 void SetAnalogStickUseCenterClamp(bool use_center_clamp);
184 void ClearAllConnectedControllers(); 183 void ClearAllConnectedControllers();
185 void DisconnectAllConnectedControllers(); 184 void DisconnectAllConnectedControllers();
186 void ConnectAllDisconnectedControllers(); 185 void ConnectAllDisconnectedControllers();
187 void ClearAllControllers(); 186 void ClearAllControllers();
188 187
189 ResultCode MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1, 188 Result MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1,
190 Core::HID::NpadIdType npad_id_2); 189 Core::HID::NpadIdType npad_id_2);
191 void StartLRAssignmentMode(); 190 void StartLRAssignmentMode();
192 void StopLRAssignmentMode(); 191 void StopLRAssignmentMode();
193 ResultCode SwapNpadAssignment(Core::HID::NpadIdType npad_id_1, Core::HID::NpadIdType npad_id_2); 192 Result SwapNpadAssignment(Core::HID::NpadIdType npad_id_1, Core::HID::NpadIdType npad_id_2);
194 193
195 // Logical OR for all buttons presses on all controllers 194 // Logical OR for all buttons presses on all controllers
196 // Specifically for cheat engine and other features. 195 // Specifically for cheat engine and other features.
@@ -198,7 +197,7 @@ public:
198 197
199 static bool IsNpadIdValid(Core::HID::NpadIdType npad_id); 198 static bool IsNpadIdValid(Core::HID::NpadIdType npad_id);
200 static bool IsDeviceHandleValid(const Core::HID::VibrationDeviceHandle& device_handle); 199 static bool IsDeviceHandleValid(const Core::HID::VibrationDeviceHandle& device_handle);
201 static ResultCode VerifyValidSixAxisSensorHandle( 200 static Result VerifyValidSixAxisSensorHandle(
202 const Core::HID::SixAxisSensorHandle& device_handle); 201 const Core::HID::SixAxisSensorHandle& device_handle);
203 202
204private: 203private:
diff --git a/src/core/hle/service/hid/errors.h b/src/core/hle/service/hid/errors.h
index 6c8ad04af..615c23b84 100644
--- a/src/core/hle/service/hid/errors.h
+++ b/src/core/hle/service/hid/errors.h
@@ -7,12 +7,12 @@
7 7
8namespace Service::HID { 8namespace Service::HID {
9 9
10constexpr ResultCode NpadInvalidHandle{ErrorModule::HID, 100}; 10constexpr Result NpadInvalidHandle{ErrorModule::HID, 100};
11constexpr ResultCode NpadDeviceIndexOutOfRange{ErrorModule::HID, 107}; 11constexpr Result NpadDeviceIndexOutOfRange{ErrorModule::HID, 107};
12constexpr ResultCode InvalidSixAxisFusionRange{ErrorModule::HID, 423}; 12constexpr Result InvalidSixAxisFusionRange{ErrorModule::HID, 423};
13constexpr ResultCode NpadIsDualJoycon{ErrorModule::HID, 601}; 13constexpr Result NpadIsDualJoycon{ErrorModule::HID, 601};
14constexpr ResultCode NpadIsSameType{ErrorModule::HID, 602}; 14constexpr Result NpadIsSameType{ErrorModule::HID, 602};
15constexpr ResultCode InvalidNpadId{ErrorModule::HID, 709}; 15constexpr Result InvalidNpadId{ErrorModule::HID, 709};
16constexpr ResultCode NpadNotConnected{ErrorModule::HID, 710}; 16constexpr Result NpadNotConnected{ErrorModule::HID, 710};
17 17
18} // namespace Service::HID 18} // namespace Service::HID
diff --git a/src/core/hle/service/hid/hidbus.h b/src/core/hle/service/hid/hidbus.h
index 6b3015a0f..8c687f678 100644
--- a/src/core/hle/service/hid/hidbus.h
+++ b/src/core/hle/service/hid/hidbus.h
@@ -71,7 +71,7 @@ private:
71 struct HidbusStatusManagerEntry { 71 struct HidbusStatusManagerEntry {
72 u8 is_connected{}; 72 u8 is_connected{};
73 INSERT_PADDING_BYTES(0x3); 73 INSERT_PADDING_BYTES(0x3);
74 ResultCode is_connected_result{0}; 74 Result is_connected_result{0};
75 u8 is_enabled{}; 75 u8 is_enabled{};
76 u8 is_in_focus{}; 76 u8 is_in_focus{};
77 u8 is_polling_mode{}; 77 u8 is_polling_mode{};
diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.h b/src/core/hle/service/hid/hidbus/hidbus_base.h
index 01c52051b..d3960f506 100644
--- a/src/core/hle/service/hid/hidbus/hidbus_base.h
+++ b/src/core/hle/service/hid/hidbus/hidbus_base.h
@@ -26,7 +26,7 @@ enum class JoyPollingMode : u32 {
26}; 26};
27 27
28struct DataAccessorHeader { 28struct DataAccessorHeader {
29 ResultCode result{ResultUnknown}; 29 Result result{ResultUnknown};
30 INSERT_PADDING_WORDS(0x1); 30 INSERT_PADDING_WORDS(0x1);
31 std::array<u8, 0x18> unused{}; 31 std::array<u8, 0x18> unused{};
32 u64 latest_entry{}; 32 u64 latest_entry{};
diff --git a/src/core/hle/service/ldn/errors.h b/src/core/hle/service/ldn/errors.h
index fb86b9402..972a74806 100644
--- a/src/core/hle/service/ldn/errors.h
+++ b/src/core/hle/service/ldn/errors.h
@@ -7,6 +7,6 @@
7 7
8namespace Service::LDN { 8namespace Service::LDN {
9 9
10constexpr ResultCode ERROR_DISABLED{ErrorModule::LDN, 22}; 10constexpr Result ERROR_DISABLED{ErrorModule::LDN, 22};
11 11
12} // namespace Service::LDN 12} // namespace Service::LDN
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
index 72e4902cb..becd6d1b9 100644
--- a/src/core/hle/service/ldr/ldr.cpp
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -20,20 +20,20 @@
20 20
21namespace Service::LDR { 21namespace Service::LDR {
22 22
23constexpr ResultCode ERROR_INSUFFICIENT_ADDRESS_SPACE{ErrorModule::RO, 2}; 23constexpr Result ERROR_INSUFFICIENT_ADDRESS_SPACE{ErrorModule::RO, 2};
24 24
25[[maybe_unused]] constexpr ResultCode ERROR_INVALID_MEMORY_STATE{ErrorModule::Loader, 51}; 25[[maybe_unused]] constexpr Result ERROR_INVALID_MEMORY_STATE{ErrorModule::Loader, 51};
26constexpr ResultCode ERROR_INVALID_NRO{ErrorModule::Loader, 52}; 26constexpr Result ERROR_INVALID_NRO{ErrorModule::Loader, 52};
27constexpr ResultCode ERROR_INVALID_NRR{ErrorModule::Loader, 53}; 27constexpr Result ERROR_INVALID_NRR{ErrorModule::Loader, 53};
28constexpr ResultCode ERROR_MISSING_NRR_HASH{ErrorModule::Loader, 54}; 28constexpr Result ERROR_MISSING_NRR_HASH{ErrorModule::Loader, 54};
29constexpr ResultCode ERROR_MAXIMUM_NRO{ErrorModule::Loader, 55}; 29constexpr Result ERROR_MAXIMUM_NRO{ErrorModule::Loader, 55};
30constexpr ResultCode ERROR_MAXIMUM_NRR{ErrorModule::Loader, 56}; 30constexpr Result ERROR_MAXIMUM_NRR{ErrorModule::Loader, 56};
31constexpr ResultCode ERROR_ALREADY_LOADED{ErrorModule::Loader, 57}; 31constexpr Result ERROR_ALREADY_LOADED{ErrorModule::Loader, 57};
32constexpr ResultCode ERROR_INVALID_ALIGNMENT{ErrorModule::Loader, 81}; 32constexpr Result ERROR_INVALID_ALIGNMENT{ErrorModule::Loader, 81};
33constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::Loader, 82}; 33constexpr Result ERROR_INVALID_SIZE{ErrorModule::Loader, 82};
34constexpr ResultCode ERROR_INVALID_NRO_ADDRESS{ErrorModule::Loader, 84}; 34constexpr Result ERROR_INVALID_NRO_ADDRESS{ErrorModule::Loader, 84};
35[[maybe_unused]] constexpr ResultCode ERROR_INVALID_NRR_ADDRESS{ErrorModule::Loader, 85}; 35[[maybe_unused]] constexpr Result ERROR_INVALID_NRR_ADDRESS{ErrorModule::Loader, 85};
36constexpr ResultCode ERROR_NOT_INITIALIZED{ErrorModule::Loader, 87}; 36constexpr Result ERROR_NOT_INITIALIZED{ErrorModule::Loader, 87};
37 37
38constexpr std::size_t MAXIMUM_LOADED_RO{0x40}; 38constexpr std::size_t MAXIMUM_LOADED_RO{0x40};
39constexpr std::size_t MAXIMUM_MAP_RETRIES{0x200}; 39constexpr std::size_t MAXIMUM_MAP_RETRIES{0x200};
@@ -307,7 +307,7 @@ public:
307 return (start + size + padding_size) <= (end_info.GetAddress() + end_info.GetSize()); 307 return (start + size + padding_size) <= (end_info.GetAddress() + end_info.GetSize());
308 } 308 }
309 309
310 ResultCode GetAvailableMapRegion(Kernel::KPageTable& page_table, u64 size, VAddr& out_addr) { 310 Result GetAvailableMapRegion(Kernel::KPageTable& page_table, u64 size, VAddr& out_addr) {
311 size = Common::AlignUp(size, Kernel::PageSize); 311 size = Common::AlignUp(size, Kernel::PageSize);
312 size += page_table.GetNumGuardPages() * Kernel::PageSize * 4; 312 size += page_table.GetNumGuardPages() * Kernel::PageSize * 4;
313 313
@@ -364,7 +364,7 @@ public:
364 for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { 364 for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) {
365 R_TRY(GetAvailableMapRegion(page_table, size, addr)); 365 R_TRY(GetAvailableMapRegion(page_table, size, addr));
366 366
367 const ResultCode result{page_table.MapCodeMemory(addr, base_addr, size)}; 367 const Result result{page_table.MapCodeMemory(addr, base_addr, size)};
368 if (result == Kernel::ResultInvalidCurrentMemory) { 368 if (result == Kernel::ResultInvalidCurrentMemory) {
369 continue; 369 continue;
370 } 370 }
@@ -397,8 +397,7 @@ public:
397 Kernel::KPageTable::ICacheInvalidationStrategy::InvalidateRange); 397 Kernel::KPageTable::ICacheInvalidationStrategy::InvalidateRange);
398 }); 398 });
399 399
400 const ResultCode result{ 400 const Result result{page_table.MapCodeMemory(addr + nro_size, bss_addr, bss_size)};
401 page_table.MapCodeMemory(addr + nro_size, bss_addr, bss_size)};
402 401
403 if (result == Kernel::ResultInvalidCurrentMemory) { 402 if (result == Kernel::ResultInvalidCurrentMemory) {
404 continue; 403 continue;
@@ -419,8 +418,8 @@ public:
419 return ERROR_INSUFFICIENT_ADDRESS_SPACE; 418 return ERROR_INSUFFICIENT_ADDRESS_SPACE;
420 } 419 }
421 420
422 ResultCode LoadNro(Kernel::KProcess* process, const NROHeader& nro_header, VAddr nro_addr, 421 Result LoadNro(Kernel::KProcess* process, const NROHeader& nro_header, VAddr nro_addr,
423 VAddr start) const { 422 VAddr start) const {
424 const VAddr text_start{start + nro_header.segment_headers[TEXT_INDEX].memory_offset}; 423 const VAddr text_start{start + nro_header.segment_headers[TEXT_INDEX].memory_offset};
425 const VAddr ro_start{start + nro_header.segment_headers[RO_INDEX].memory_offset}; 424 const VAddr ro_start{start + nro_header.segment_headers[RO_INDEX].memory_offset};
426 const VAddr data_start{start + nro_header.segment_headers[DATA_INDEX].memory_offset}; 425 const VAddr data_start{start + nro_header.segment_headers[DATA_INDEX].memory_offset};
@@ -569,7 +568,7 @@ public:
569 rb.Push(*map_result); 568 rb.Push(*map_result);
570 } 569 }
571 570
572 ResultCode UnmapNro(const NROInfo& info) { 571 Result UnmapNro(const NROInfo& info) {
573 // Each region must be unmapped separately to validate memory state 572 // Each region must be unmapped separately to validate memory state
574 auto& page_table{system.CurrentProcess()->PageTable()}; 573 auto& page_table{system.CurrentProcess()->PageTable()};
575 574
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp
index 41755bf0b..efb569993 100644
--- a/src/core/hle/service/mii/mii.cpp
+++ b/src/core/hle/service/mii/mii.cpp
@@ -12,7 +12,7 @@
12 12
13namespace Service::Mii { 13namespace Service::Mii {
14 14
15constexpr ResultCode ERROR_INVALID_ARGUMENT{ErrorModule::Mii, 1}; 15constexpr Result ERROR_INVALID_ARGUMENT{ErrorModule::Mii, 1};
16 16
17class IDatabaseService final : public ServiceFramework<IDatabaseService> { 17class IDatabaseService final : public ServiceFramework<IDatabaseService> {
18public: 18public:
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp
index 08300a1a6..544c92a00 100644
--- a/src/core/hle/service/mii/mii_manager.cpp
+++ b/src/core/hle/service/mii/mii_manager.cpp
@@ -16,7 +16,7 @@ namespace Service::Mii {
16 16
17namespace { 17namespace {
18 18
19constexpr ResultCode ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4}; 19constexpr Result ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4};
20 20
21constexpr std::size_t BaseMiiCount{2}; 21constexpr std::size_t BaseMiiCount{2};
22constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()}; 22constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()};
@@ -441,7 +441,7 @@ ResultVal<std::vector<MiiInfoElement>> MiiManager::GetDefault(SourceFlag source_
441 return result; 441 return result;
442} 442}
443 443
444ResultCode MiiManager::GetIndex([[maybe_unused]] const MiiInfo& info, u32& index) { 444Result MiiManager::GetIndex([[maybe_unused]] const MiiInfo& info, u32& index) {
445 constexpr u32 INVALID_INDEX{0xFFFFFFFF}; 445 constexpr u32 INVALID_INDEX{0xFFFFFFFF};
446 446
447 index = INVALID_INDEX; 447 index = INVALID_INDEX;
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h
index db217b9a5..6a286bd96 100644
--- a/src/core/hle/service/mii/mii_manager.h
+++ b/src/core/hle/service/mii/mii_manager.h
@@ -23,7 +23,7 @@ public:
23 MiiInfo BuildRandom(Age age, Gender gender, Race race); 23 MiiInfo BuildRandom(Age age, Gender gender, Race race);
24 MiiInfo BuildDefault(std::size_t index); 24 MiiInfo BuildDefault(std::size_t index);
25 ResultVal<std::vector<MiiInfoElement>> GetDefault(SourceFlag source_flag); 25 ResultVal<std::vector<MiiInfoElement>> GetDefault(SourceFlag source_flag);
26 ResultCode GetIndex(const MiiInfo& info, u32& index); 26 Result GetIndex(const MiiInfo& info, u32& index);
27 27
28private: 28private:
29 const Common::UUID user_id{}; 29 const Common::UUID user_id{};
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp
index 74891da57..6c5b41dd1 100644
--- a/src/core/hle/service/nfp/nfp.cpp
+++ b/src/core/hle/service/nfp/nfp.cpp
@@ -17,10 +17,10 @@
17 17
18namespace Service::NFP { 18namespace Service::NFP {
19namespace ErrCodes { 19namespace ErrCodes {
20constexpr ResultCode DeviceNotFound(ErrorModule::NFP, 64); 20constexpr Result DeviceNotFound(ErrorModule::NFP, 64);
21constexpr ResultCode WrongDeviceState(ErrorModule::NFP, 73); 21constexpr Result WrongDeviceState(ErrorModule::NFP, 73);
22constexpr ResultCode ApplicationAreaIsNotInitialized(ErrorModule::NFP, 128); 22constexpr Result ApplicationAreaIsNotInitialized(ErrorModule::NFP, 128);
23constexpr ResultCode ApplicationAreaExist(ErrorModule::NFP, 168); 23constexpr Result ApplicationAreaExist(ErrorModule::NFP, 168);
24} // namespace ErrCodes 24} // namespace ErrCodes
25 25
26constexpr u32 ApplicationAreaSize = 0xD8; 26constexpr u32 ApplicationAreaSize = 0xD8;
@@ -585,7 +585,7 @@ void Module::Interface::Finalize() {
585 application_area_data.clear(); 585 application_area_data.clear();
586} 586}
587 587
588ResultCode Module::Interface::StartDetection(s32 protocol_) { 588Result Module::Interface::StartDetection(s32 protocol_) {
589 auto npad_device = system.HIDCore().GetEmulatedController(npad_id); 589 auto npad_device = system.HIDCore().GetEmulatedController(npad_id);
590 590
591 // TODO(german77): Add callback for when nfc data is available 591 // TODO(german77): Add callback for when nfc data is available
@@ -601,7 +601,7 @@ ResultCode Module::Interface::StartDetection(s32 protocol_) {
601 return ErrCodes::WrongDeviceState; 601 return ErrCodes::WrongDeviceState;
602} 602}
603 603
604ResultCode Module::Interface::StopDetection() { 604Result Module::Interface::StopDetection() {
605 auto npad_device = system.HIDCore().GetEmulatedController(npad_id); 605 auto npad_device = system.HIDCore().GetEmulatedController(npad_id);
606 npad_device->SetPollingMode(Common::Input::PollingMode::Active); 606 npad_device->SetPollingMode(Common::Input::PollingMode::Active);
607 607
@@ -618,7 +618,7 @@ ResultCode Module::Interface::StopDetection() {
618 return ErrCodes::WrongDeviceState; 618 return ErrCodes::WrongDeviceState;
619} 619}
620 620
621ResultCode Module::Interface::Mount() { 621Result Module::Interface::Mount() {
622 if (device_state == DeviceState::TagFound) { 622 if (device_state == DeviceState::TagFound) {
623 device_state = DeviceState::TagMounted; 623 device_state = DeviceState::TagMounted;
624 return ResultSuccess; 624 return ResultSuccess;
@@ -628,7 +628,7 @@ ResultCode Module::Interface::Mount() {
628 return ErrCodes::WrongDeviceState; 628 return ErrCodes::WrongDeviceState;
629} 629}
630 630
631ResultCode Module::Interface::Unmount() { 631Result Module::Interface::Unmount() {
632 if (device_state == DeviceState::TagMounted) { 632 if (device_state == DeviceState::TagMounted) {
633 is_application_area_initialized = false; 633 is_application_area_initialized = false;
634 application_area_id = 0; 634 application_area_id = 0;
@@ -641,7 +641,7 @@ ResultCode Module::Interface::Unmount() {
641 return ErrCodes::WrongDeviceState; 641 return ErrCodes::WrongDeviceState;
642} 642}
643 643
644ResultCode Module::Interface::GetTagInfo(TagInfo& tag_info) const { 644Result Module::Interface::GetTagInfo(TagInfo& tag_info) const {
645 if (device_state == DeviceState::TagFound || device_state == DeviceState::TagMounted) { 645 if (device_state == DeviceState::TagFound || device_state == DeviceState::TagMounted) {
646 tag_info = { 646 tag_info = {
647 .uuid = tag_data.uuid, 647 .uuid = tag_data.uuid,
@@ -656,7 +656,7 @@ ResultCode Module::Interface::GetTagInfo(TagInfo& tag_info) const {
656 return ErrCodes::WrongDeviceState; 656 return ErrCodes::WrongDeviceState;
657} 657}
658 658
659ResultCode Module::Interface::GetCommonInfo(CommonInfo& common_info) const { 659Result Module::Interface::GetCommonInfo(CommonInfo& common_info) const {
660 if (device_state != DeviceState::TagMounted) { 660 if (device_state != DeviceState::TagMounted) {
661 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); 661 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
662 return ErrCodes::WrongDeviceState; 662 return ErrCodes::WrongDeviceState;
@@ -674,7 +674,7 @@ ResultCode Module::Interface::GetCommonInfo(CommonInfo& common_info) const {
674 return ResultSuccess; 674 return ResultSuccess;
675} 675}
676 676
677ResultCode Module::Interface::GetModelInfo(ModelInfo& model_info) const { 677Result Module::Interface::GetModelInfo(ModelInfo& model_info) const {
678 if (device_state != DeviceState::TagMounted) { 678 if (device_state != DeviceState::TagMounted) {
679 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); 679 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
680 return ErrCodes::WrongDeviceState; 680 return ErrCodes::WrongDeviceState;
@@ -684,7 +684,7 @@ ResultCode Module::Interface::GetModelInfo(ModelInfo& model_info) const {
684 return ResultSuccess; 684 return ResultSuccess;
685} 685}
686 686
687ResultCode Module::Interface::GetRegisterInfo(RegisterInfo& register_info) const { 687Result Module::Interface::GetRegisterInfo(RegisterInfo& register_info) const {
688 if (device_state != DeviceState::TagMounted) { 688 if (device_state != DeviceState::TagMounted) {
689 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); 689 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
690 return ErrCodes::WrongDeviceState; 690 return ErrCodes::WrongDeviceState;
@@ -704,7 +704,7 @@ ResultCode Module::Interface::GetRegisterInfo(RegisterInfo& register_info) const
704 return ResultSuccess; 704 return ResultSuccess;
705} 705}
706 706
707ResultCode Module::Interface::OpenApplicationArea(u32 access_id) { 707Result Module::Interface::OpenApplicationArea(u32 access_id) {
708 if (device_state != DeviceState::TagMounted) { 708 if (device_state != DeviceState::TagMounted) {
709 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); 709 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
710 return ErrCodes::WrongDeviceState; 710 return ErrCodes::WrongDeviceState;
@@ -721,7 +721,7 @@ ResultCode Module::Interface::OpenApplicationArea(u32 access_id) {
721 return ResultSuccess; 721 return ResultSuccess;
722} 722}
723 723
724ResultCode Module::Interface::GetApplicationArea(std::vector<u8>& data) const { 724Result Module::Interface::GetApplicationArea(std::vector<u8>& data) const {
725 if (device_state != DeviceState::TagMounted) { 725 if (device_state != DeviceState::TagMounted) {
726 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); 726 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
727 return ErrCodes::WrongDeviceState; 727 return ErrCodes::WrongDeviceState;
@@ -736,7 +736,7 @@ ResultCode Module::Interface::GetApplicationArea(std::vector<u8>& data) const {
736 return ResultSuccess; 736 return ResultSuccess;
737} 737}
738 738
739ResultCode Module::Interface::SetApplicationArea(const std::vector<u8>& data) { 739Result Module::Interface::SetApplicationArea(const std::vector<u8>& data) {
740 if (device_state != DeviceState::TagMounted) { 740 if (device_state != DeviceState::TagMounted) {
741 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); 741 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
742 return ErrCodes::WrongDeviceState; 742 return ErrCodes::WrongDeviceState;
@@ -750,7 +750,7 @@ ResultCode Module::Interface::SetApplicationArea(const std::vector<u8>& data) {
750 return ResultSuccess; 750 return ResultSuccess;
751} 751}
752 752
753ResultCode Module::Interface::CreateApplicationArea(u32 access_id, const std::vector<u8>& data) { 753Result Module::Interface::CreateApplicationArea(u32 access_id, const std::vector<u8>& data) {
754 if (device_state != DeviceState::TagMounted) { 754 if (device_state != DeviceState::TagMounted) {
755 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state); 755 LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
756 return ErrCodes::WrongDeviceState; 756 return ErrCodes::WrongDeviceState;
diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h
index d307c6a35..0fc808781 100644
--- a/src/core/hle/service/nfp/nfp.h
+++ b/src/core/hle/service/nfp/nfp.h
@@ -178,20 +178,20 @@ public:
178 void Initialize(); 178 void Initialize();
179 void Finalize(); 179 void Finalize();
180 180
181 ResultCode StartDetection(s32 protocol_); 181 Result StartDetection(s32 protocol_);
182 ResultCode StopDetection(); 182 Result StopDetection();
183 ResultCode Mount(); 183 Result Mount();
184 ResultCode Unmount(); 184 Result Unmount();
185 185
186 ResultCode GetTagInfo(TagInfo& tag_info) const; 186 Result GetTagInfo(TagInfo& tag_info) const;
187 ResultCode GetCommonInfo(CommonInfo& common_info) const; 187 Result GetCommonInfo(CommonInfo& common_info) const;
188 ResultCode GetModelInfo(ModelInfo& model_info) const; 188 Result GetModelInfo(ModelInfo& model_info) const;
189 ResultCode GetRegisterInfo(RegisterInfo& register_info) const; 189 Result GetRegisterInfo(RegisterInfo& register_info) const;
190 190
191 ResultCode OpenApplicationArea(u32 access_id); 191 Result OpenApplicationArea(u32 access_id);
192 ResultCode GetApplicationArea(std::vector<u8>& data) const; 192 Result GetApplicationArea(std::vector<u8>& data) const;
193 ResultCode SetApplicationArea(const std::vector<u8>& data); 193 Result SetApplicationArea(const std::vector<u8>& data);
194 ResultCode CreateApplicationArea(u32 access_id, const std::vector<u8>& data); 194 Result CreateApplicationArea(u32 access_id, const std::vector<u8>& data);
195 195
196 u64 GetHandle() const; 196 u64 GetHandle() const;
197 DeviceState GetCurrentState() const; 197 DeviceState GetCurrentState() const;
diff --git a/src/core/hle/service/ns/errors.h b/src/core/hle/service/ns/errors.h
index 3c50c66e0..8a7621798 100644
--- a/src/core/hle/service/ns/errors.h
+++ b/src/core/hle/service/ns/errors.h
@@ -7,5 +7,5 @@
7 7
8namespace Service::NS { 8namespace Service::NS {
9 9
10constexpr ResultCode ERR_APPLICATION_LANGUAGE_NOT_FOUND{ErrorModule::NS, 300}; 10constexpr Result ERR_APPLICATION_LANGUAGE_NOT_FOUND{ErrorModule::NS, 300};
11} \ No newline at end of file 11} \ No newline at end of file
diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp
index 8d5729003..2a123b42d 100644
--- a/src/core/hle/service/pctl/pctl_module.cpp
+++ b/src/core/hle/service/pctl/pctl_module.cpp
@@ -13,10 +13,10 @@ namespace Service::PCTL {
13 13
14namespace Error { 14namespace Error {
15 15
16constexpr ResultCode ResultNoFreeCommunication{ErrorModule::PCTL, 101}; 16constexpr Result ResultNoFreeCommunication{ErrorModule::PCTL, 101};
17constexpr ResultCode ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; 17constexpr Result ResultStereoVisionRestricted{ErrorModule::PCTL, 104};
18constexpr ResultCode ResultNoCapability{ErrorModule::PCTL, 131}; 18constexpr Result ResultNoCapability{ErrorModule::PCTL, 131};
19constexpr ResultCode ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; 19constexpr Result ResultNoRestrictionEnabled{ErrorModule::PCTL, 181};
20 20
21} // namespace Error 21} // namespace Error
22 22
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp
index a8e2a5cbd..b10e86c8f 100644
--- a/src/core/hle/service/pm/pm.cpp
+++ b/src/core/hle/service/pm/pm.cpp
@@ -12,12 +12,12 @@ namespace Service::PM {
12 12
13namespace { 13namespace {
14 14
15constexpr ResultCode ResultProcessNotFound{ErrorModule::PM, 1}; 15constexpr Result ResultProcessNotFound{ErrorModule::PM, 1};
16[[maybe_unused]] constexpr ResultCode ResultAlreadyStarted{ErrorModule::PM, 2}; 16[[maybe_unused]] constexpr Result ResultAlreadyStarted{ErrorModule::PM, 2};
17[[maybe_unused]] constexpr ResultCode ResultNotTerminated{ErrorModule::PM, 3}; 17[[maybe_unused]] constexpr Result ResultNotTerminated{ErrorModule::PM, 3};
18[[maybe_unused]] constexpr ResultCode ResultDebugHookInUse{ErrorModule::PM, 4}; 18[[maybe_unused]] constexpr Result ResultDebugHookInUse{ErrorModule::PM, 4};
19[[maybe_unused]] constexpr ResultCode ResultApplicationRunning{ErrorModule::PM, 5}; 19[[maybe_unused]] constexpr Result ResultApplicationRunning{ErrorModule::PM, 5};
20[[maybe_unused]] constexpr ResultCode ResultInvalidSize{ErrorModule::PM, 6}; 20[[maybe_unused]] constexpr Result ResultInvalidSize{ErrorModule::PM, 6};
21 21
22constexpr u64 NO_PROCESS_FOUND_PID{0}; 22constexpr u64 NO_PROCESS_FOUND_PID{0};
23 23
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 574272b0c..318009e4f 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -190,8 +190,8 @@ void ServiceFrameworkBase::InvokeRequestTipc(Kernel::HLERequestContext& ctx) {
190 handler_invoker(this, info->handler_callback, ctx); 190 handler_invoker(this, info->handler_callback, ctx);
191} 191}
192 192
193ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session, 193Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
194 Kernel::HLERequestContext& ctx) { 194 Kernel::HLERequestContext& ctx) {
195 const auto guard = LockService(); 195 const auto guard = LockService();
196 196
197 switch (ctx.GetCommandType()) { 197 switch (ctx.GetCommandType()) {
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index f23e0cd64..5bf197c51 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -79,8 +79,8 @@ public:
79 Kernel::KClientPort& CreatePort(); 79 Kernel::KClientPort& CreatePort();
80 80
81 /// Handles a synchronization request for the service. 81 /// Handles a synchronization request for the service.
82 ResultCode HandleSyncRequest(Kernel::KServerSession& session, 82 Result HandleSyncRequest(Kernel::KServerSession& session,
83 Kernel::HLERequestContext& context) override; 83 Kernel::HLERequestContext& context) override;
84 84
85protected: 85protected:
86 /// Member-function pointer type of SyncRequest handlers. 86 /// Member-function pointer type of SyncRequest handlers.
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp
index 2839cffcf..f761c2da4 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/set.cpp
@@ -74,7 +74,7 @@ constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_la
74constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; 74constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF;
75constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; 75constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40;
76 76
77constexpr ResultCode ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625}; 77constexpr Result ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625};
78 78
79void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t num_language_codes) { 79void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t num_language_codes) {
80 IPC::ResponseBuilder rb{ctx, 3}; 80 IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index 87c6f7f85..2a0b812c1 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -32,7 +32,7 @@ void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionTy
32 // consistence (currently reports as 5.1.0-0.0) 32 // consistence (currently reports as 5.1.0-0.0)
33 const auto archive = FileSys::SystemArchive::SystemVersion(); 33 const auto archive = FileSys::SystemArchive::SystemVersion();
34 34
35 const auto early_exit_failure = [&ctx](std::string_view desc, ResultCode code) { 35 const auto early_exit_failure = [&ctx](std::string_view desc, Result code) {
36 LOG_ERROR(Service_SET, "General failure while attempting to resolve firmware version ({}).", 36 LOG_ERROR(Service_SET, "General failure while attempting to resolve firmware version ({}).",
37 desc); 37 desc);
38 IPC::ResponseBuilder rb{ctx, 2}; 38 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index 925608875..246c94623 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -17,10 +17,10 @@
17 17
18namespace Service::SM { 18namespace Service::SM {
19 19
20constexpr ResultCode ERR_NOT_INITIALIZED(ErrorModule::SM, 2); 20constexpr Result ERR_NOT_INITIALIZED(ErrorModule::SM, 2);
21constexpr ResultCode ERR_ALREADY_REGISTERED(ErrorModule::SM, 4); 21constexpr Result ERR_ALREADY_REGISTERED(ErrorModule::SM, 4);
22constexpr ResultCode ERR_INVALID_NAME(ErrorModule::SM, 6); 22constexpr Result ERR_INVALID_NAME(ErrorModule::SM, 6);
23constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(ErrorModule::SM, 7); 23constexpr Result ERR_SERVICE_NOT_REGISTERED(ErrorModule::SM, 7);
24 24
25ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} {} 25ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} {}
26ServiceManager::~ServiceManager() = default; 26ServiceManager::~ServiceManager() = default;
@@ -29,7 +29,7 @@ void ServiceManager::InvokeControlRequest(Kernel::HLERequestContext& context) {
29 controller_interface->InvokeRequest(context); 29 controller_interface->InvokeRequest(context);
30} 30}
31 31
32static ResultCode ValidateServiceName(const std::string& name) { 32static Result ValidateServiceName(const std::string& name) {
33 if (name.empty() || name.size() > 8) { 33 if (name.empty() || name.size() > 8) {
34 LOG_ERROR(Service_SM, "Invalid service name! service={}", name); 34 LOG_ERROR(Service_SM, "Invalid service name! service={}", name);
35 return ERR_INVALID_NAME; 35 return ERR_INVALID_NAME;
@@ -43,8 +43,8 @@ Kernel::KClientPort& ServiceManager::InterfaceFactory(ServiceManager& self, Core
43 return self.sm_interface->CreatePort(); 43 return self.sm_interface->CreatePort();
44} 44}
45 45
46ResultCode ServiceManager::RegisterService(std::string name, u32 max_sessions, 46Result ServiceManager::RegisterService(std::string name, u32 max_sessions,
47 Kernel::SessionRequestHandlerPtr handler) { 47 Kernel::SessionRequestHandlerPtr handler) {
48 48
49 CASCADE_CODE(ValidateServiceName(name)); 49 CASCADE_CODE(ValidateServiceName(name));
50 50
@@ -58,7 +58,7 @@ ResultCode ServiceManager::RegisterService(std::string name, u32 max_sessions,
58 return ResultSuccess; 58 return ResultSuccess;
59} 59}
60 60
61ResultCode ServiceManager::UnregisterService(const std::string& name) { 61Result ServiceManager::UnregisterService(const std::string& name) {
62 CASCADE_CODE(ValidateServiceName(name)); 62 CASCADE_CODE(ValidateServiceName(name));
63 63
64 const auto iter = registered_services.find(name); 64 const auto iter = registered_services.find(name);
@@ -94,7 +94,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name
94 * Inputs: 94 * Inputs:
95 * 0: 0x00000000 95 * 0: 0x00000000
96 * Outputs: 96 * Outputs:
97 * 0: ResultCode 97 * 0: Result
98 */ 98 */
99void SM::Initialize(Kernel::HLERequestContext& ctx) { 99void SM::Initialize(Kernel::HLERequestContext& ctx) {
100 LOG_DEBUG(Service_SM, "called"); 100 LOG_DEBUG(Service_SM, "called");
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h
index 43d445e97..878decc6f 100644
--- a/src/core/hle/service/sm/sm.h
+++ b/src/core/hle/service/sm/sm.h
@@ -55,9 +55,9 @@ public:
55 explicit ServiceManager(Kernel::KernelCore& kernel_); 55 explicit ServiceManager(Kernel::KernelCore& kernel_);
56 ~ServiceManager(); 56 ~ServiceManager();
57 57
58 ResultCode RegisterService(std::string name, u32 max_sessions, 58 Result RegisterService(std::string name, u32 max_sessions,
59 Kernel::SessionRequestHandlerPtr handler); 59 Kernel::SessionRequestHandlerPtr handler);
60 ResultCode UnregisterService(const std::string& name); 60 Result UnregisterService(const std::string& name);
61 ResultVal<Kernel::KPort*> GetServicePort(const std::string& name); 61 ResultVal<Kernel::KPort*> GetServicePort(const std::string& name);
62 62
63 template <Common::DerivedFrom<Kernel::SessionRequestHandler> T> 63 template <Common::DerivedFrom<Kernel::SessionRequestHandler> T>
diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp
index a4ed4193e..2a4bd64ab 100644
--- a/src/core/hle/service/sm/sm_controller.cpp
+++ b/src/core/hle/service/sm/sm_controller.cpp
@@ -33,7 +33,7 @@ void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) {
33 33
34 // Create a session. 34 // Create a session.
35 Kernel::KClientSession* session{}; 35 Kernel::KClientSession* session{};
36 const ResultCode result = parent_port.CreateSession(std::addressof(session), session_manager); 36 const Result result = parent_port.CreateSession(std::addressof(session), session_manager);
37 if (result.IsError()) { 37 if (result.IsError()) {
38 LOG_CRITICAL(Service, "CreateSession failed with error 0x{:08X}", result.raw); 38 LOG_CRITICAL(Service, "CreateSession failed with error 0x{:08X}", result.raw);
39 IPC::ResponseBuilder rb{ctx, 2}; 39 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/spl/spl_results.h b/src/core/hle/service/spl/spl_results.h
index 17ef655a9..dd7ba11f3 100644
--- a/src/core/hle/service/spl/spl_results.h
+++ b/src/core/hle/service/spl/spl_results.h
@@ -8,23 +8,23 @@
8namespace Service::SPL { 8namespace Service::SPL {
9 9
10// Description 0 - 99 10// Description 0 - 99
11constexpr ResultCode ResultSecureMonitorError{ErrorModule::SPL, 0}; 11constexpr Result ResultSecureMonitorError{ErrorModule::SPL, 0};
12constexpr ResultCode ResultSecureMonitorNotImplemented{ErrorModule::SPL, 1}; 12constexpr Result ResultSecureMonitorNotImplemented{ErrorModule::SPL, 1};
13constexpr ResultCode ResultSecureMonitorInvalidArgument{ErrorModule::SPL, 2}; 13constexpr Result ResultSecureMonitorInvalidArgument{ErrorModule::SPL, 2};
14constexpr ResultCode ResultSecureMonitorBusy{ErrorModule::SPL, 3}; 14constexpr Result ResultSecureMonitorBusy{ErrorModule::SPL, 3};
15constexpr ResultCode ResultSecureMonitorNoAsyncOperation{ErrorModule::SPL, 4}; 15constexpr Result ResultSecureMonitorNoAsyncOperation{ErrorModule::SPL, 4};
16constexpr ResultCode ResultSecureMonitorInvalidAsyncOperation{ErrorModule::SPL, 5}; 16constexpr Result ResultSecureMonitorInvalidAsyncOperation{ErrorModule::SPL, 5};
17constexpr ResultCode ResultSecureMonitorNotPermitted{ErrorModule::SPL, 6}; 17constexpr Result ResultSecureMonitorNotPermitted{ErrorModule::SPL, 6};
18constexpr ResultCode ResultSecureMonitorNotInitialized{ErrorModule::SPL, 7}; 18constexpr Result ResultSecureMonitorNotInitialized{ErrorModule::SPL, 7};
19 19
20constexpr ResultCode ResultInvalidSize{ErrorModule::SPL, 100}; 20constexpr Result ResultInvalidSize{ErrorModule::SPL, 100};
21constexpr ResultCode ResultUnknownSecureMonitorError{ErrorModule::SPL, 101}; 21constexpr Result ResultUnknownSecureMonitorError{ErrorModule::SPL, 101};
22constexpr ResultCode ResultDecryptionFailed{ErrorModule::SPL, 102}; 22constexpr Result ResultDecryptionFailed{ErrorModule::SPL, 102};
23 23
24constexpr ResultCode ResultOutOfKeySlots{ErrorModule::SPL, 104}; 24constexpr Result ResultOutOfKeySlots{ErrorModule::SPL, 104};
25constexpr ResultCode ResultInvalidKeySlot{ErrorModule::SPL, 105}; 25constexpr Result ResultInvalidKeySlot{ErrorModule::SPL, 105};
26constexpr ResultCode ResultBootReasonAlreadySet{ErrorModule::SPL, 106}; 26constexpr Result ResultBootReasonAlreadySet{ErrorModule::SPL, 106};
27constexpr ResultCode ResultBootReasonNotSet{ErrorModule::SPL, 107}; 27constexpr Result ResultBootReasonNotSet{ErrorModule::SPL, 107};
28constexpr ResultCode ResultInvalidArgument{ErrorModule::SPL, 108}; 28constexpr Result ResultInvalidArgument{ErrorModule::SPL, 108};
29 29
30} // namespace Service::SPL 30} // namespace Service::SPL
diff --git a/src/core/hle/service/time/clock_types.h b/src/core/hle/service/time/clock_types.h
index d0af06d94..ef070f32f 100644
--- a/src/core/hle/service/time/clock_types.h
+++ b/src/core/hle/service/time/clock_types.h
@@ -22,7 +22,7 @@ struct SteadyClockTimePoint {
22 s64 time_point; 22 s64 time_point;
23 Common::UUID clock_source_id; 23 Common::UUID clock_source_id;
24 24
25 ResultCode GetSpanBetween(SteadyClockTimePoint other, s64& span) const { 25 Result GetSpanBetween(SteadyClockTimePoint other, s64& span) const {
26 span = 0; 26 span = 0;
27 27
28 if (clock_source_id != other.clock_source_id) { 28 if (clock_source_id != other.clock_source_id) {
@@ -92,9 +92,9 @@ struct ClockSnapshot {
92 TimeType type; 92 TimeType type;
93 INSERT_PADDING_BYTES_NOINIT(0x2); 93 INSERT_PADDING_BYTES_NOINIT(0x2);
94 94
95 static ResultCode GetCurrentTime(s64& current_time, 95 static Result GetCurrentTime(s64& current_time,
96 const SteadyClockTimePoint& steady_clock_time_point, 96 const SteadyClockTimePoint& steady_clock_time_point,
97 const SystemClockContext& context) { 97 const SystemClockContext& context) {
98 if (steady_clock_time_point.clock_source_id != context.steady_time_point.clock_source_id) { 98 if (steady_clock_time_point.clock_source_id != context.steady_time_point.clock_source_id) {
99 current_time = 0; 99 current_time = 0;
100 return ERROR_TIME_MISMATCH; 100 return ERROR_TIME_MISMATCH;
diff --git a/src/core/hle/service/time/errors.h b/src/core/hle/service/time/errors.h
index 592921f6b..6655d30e1 100644
--- a/src/core/hle/service/time/errors.h
+++ b/src/core/hle/service/time/errors.h
@@ -7,15 +7,15 @@
7 7
8namespace Service::Time { 8namespace Service::Time {
9 9
10constexpr ResultCode ERROR_PERMISSION_DENIED{ErrorModule::Time, 1}; 10constexpr Result ERROR_PERMISSION_DENIED{ErrorModule::Time, 1};
11constexpr ResultCode ERROR_TIME_MISMATCH{ErrorModule::Time, 102}; 11constexpr Result ERROR_TIME_MISMATCH{ErrorModule::Time, 102};
12constexpr ResultCode ERROR_UNINITIALIZED_CLOCK{ErrorModule::Time, 103}; 12constexpr Result ERROR_UNINITIALIZED_CLOCK{ErrorModule::Time, 103};
13constexpr ResultCode ERROR_TIME_NOT_FOUND{ErrorModule::Time, 200}; 13constexpr Result ERROR_TIME_NOT_FOUND{ErrorModule::Time, 200};
14constexpr ResultCode ERROR_OVERFLOW{ErrorModule::Time, 201}; 14constexpr Result ERROR_OVERFLOW{ErrorModule::Time, 201};
15constexpr ResultCode ERROR_LOCATION_NAME_TOO_LONG{ErrorModule::Time, 801}; 15constexpr Result ERROR_LOCATION_NAME_TOO_LONG{ErrorModule::Time, 801};
16constexpr ResultCode ERROR_OUT_OF_RANGE{ErrorModule::Time, 902}; 16constexpr Result ERROR_OUT_OF_RANGE{ErrorModule::Time, 902};
17constexpr ResultCode ERROR_TIME_ZONE_CONVERSION_FAILED{ErrorModule::Time, 903}; 17constexpr Result ERROR_TIME_ZONE_CONVERSION_FAILED{ErrorModule::Time, 903};
18constexpr ResultCode ERROR_TIME_ZONE_NOT_FOUND{ErrorModule::Time, 989}; 18constexpr Result ERROR_TIME_ZONE_NOT_FOUND{ErrorModule::Time, 989};
19constexpr ResultCode ERROR_NOT_IMPLEMENTED{ErrorModule::Time, 990}; 19constexpr Result ERROR_NOT_IMPLEMENTED{ErrorModule::Time, 990};
20 20
21} // namespace Service::Time 21} // namespace Service::Time
diff --git a/src/core/hle/service/time/local_system_clock_context_writer.h b/src/core/hle/service/time/local_system_clock_context_writer.h
index 0977806b3..1639ef2b9 100644
--- a/src/core/hle/service/time/local_system_clock_context_writer.h
+++ b/src/core/hle/service/time/local_system_clock_context_writer.h
@@ -14,7 +14,7 @@ public:
14 : SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {} 14 : SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {}
15 15
16protected: 16protected:
17 ResultCode Update() override { 17 Result Update() override {
18 shared_memory.UpdateLocalSystemClockContext(context); 18 shared_memory.UpdateLocalSystemClockContext(context);
19 return ResultSuccess; 19 return ResultSuccess;
20 } 20 }
diff --git a/src/core/hle/service/time/network_system_clock_context_writer.h b/src/core/hle/service/time/network_system_clock_context_writer.h
index 975089af8..655e4c06d 100644
--- a/src/core/hle/service/time/network_system_clock_context_writer.h
+++ b/src/core/hle/service/time/network_system_clock_context_writer.h
@@ -15,7 +15,7 @@ public:
15 : SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {} 15 : SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {}
16 16
17protected: 17protected:
18 ResultCode Update() override { 18 Result Update() override {
19 shared_memory.UpdateNetworkSystemClockContext(context); 19 shared_memory.UpdateNetworkSystemClockContext(context);
20 return ResultSuccess; 20 return ResultSuccess;
21 } 21 }
diff --git a/src/core/hle/service/time/standard_user_system_clock_core.cpp b/src/core/hle/service/time/standard_user_system_clock_core.cpp
index 508091dc2..b033757ed 100644
--- a/src/core/hle/service/time/standard_user_system_clock_core.cpp
+++ b/src/core/hle/service/time/standard_user_system_clock_core.cpp
@@ -27,9 +27,9 @@ StandardUserSystemClockCore::~StandardUserSystemClockCore() {
27 service_context.CloseEvent(auto_correction_event); 27 service_context.CloseEvent(auto_correction_event);
28} 28}
29 29
30ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::System& system, 30Result StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::System& system,
31 bool value) { 31 bool value) {
32 if (const ResultCode result{ApplyAutomaticCorrection(system, value)}; result != ResultSuccess) { 32 if (const Result result{ApplyAutomaticCorrection(system, value)}; result != ResultSuccess) {
33 return result; 33 return result;
34 } 34 }
35 35
@@ -38,27 +38,27 @@ ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::Syst
38 return ResultSuccess; 38 return ResultSuccess;
39} 39}
40 40
41ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system, 41Result StandardUserSystemClockCore::GetClockContext(Core::System& system,
42 SystemClockContext& ctx) const { 42 SystemClockContext& ctx) const {
43 if (const ResultCode result{ApplyAutomaticCorrection(system, false)}; result != ResultSuccess) { 43 if (const Result result{ApplyAutomaticCorrection(system, false)}; result != ResultSuccess) {
44 return result; 44 return result;
45 } 45 }
46 46
47 return local_system_clock_core.GetClockContext(system, ctx); 47 return local_system_clock_core.GetClockContext(system, ctx);
48} 48}
49 49
50ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext&) { 50Result StandardUserSystemClockCore::Flush(const SystemClockContext&) {
51 UNIMPLEMENTED(); 51 UNIMPLEMENTED();
52 return ERROR_NOT_IMPLEMENTED; 52 return ERROR_NOT_IMPLEMENTED;
53} 53}
54 54
55ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext&) { 55Result StandardUserSystemClockCore::SetClockContext(const SystemClockContext&) {
56 UNIMPLEMENTED(); 56 UNIMPLEMENTED();
57 return ERROR_NOT_IMPLEMENTED; 57 return ERROR_NOT_IMPLEMENTED;
58} 58}
59 59
60ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& system, 60Result StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& system,
61 bool value) const { 61 bool value) const {
62 if (auto_correction_enabled == value) { 62 if (auto_correction_enabled == value) {
63 return ResultSuccess; 63 return ResultSuccess;
64 } 64 }
@@ -68,7 +68,7 @@ ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& s
68 } 68 }
69 69
70 SystemClockContext ctx{}; 70 SystemClockContext ctx{};
71 if (const ResultCode result{network_system_clock_core.GetClockContext(system, ctx)}; 71 if (const Result result{network_system_clock_core.GetClockContext(system, ctx)};
72 result != ResultSuccess) { 72 result != ResultSuccess) {
73 return result; 73 return result;
74 } 74 }
diff --git a/src/core/hle/service/time/standard_user_system_clock_core.h b/src/core/hle/service/time/standard_user_system_clock_core.h
index 22df23b29..ee6e29487 100644
--- a/src/core/hle/service/time/standard_user_system_clock_core.h
+++ b/src/core/hle/service/time/standard_user_system_clock_core.h
@@ -28,9 +28,9 @@ public:
28 28
29 ~StandardUserSystemClockCore() override; 29 ~StandardUserSystemClockCore() override;
30 30
31 ResultCode SetAutomaticCorrectionEnabled(Core::System& system, bool value); 31 Result SetAutomaticCorrectionEnabled(Core::System& system, bool value);
32 32
33 ResultCode GetClockContext(Core::System& system, SystemClockContext& ctx) const override; 33 Result GetClockContext(Core::System& system, SystemClockContext& ctx) const override;
34 34
35 bool IsAutomaticCorrectionEnabled() const { 35 bool IsAutomaticCorrectionEnabled() const {
36 return auto_correction_enabled; 36 return auto_correction_enabled;
@@ -41,11 +41,11 @@ public:
41 } 41 }
42 42
43protected: 43protected:
44 ResultCode Flush(const SystemClockContext&) override; 44 Result Flush(const SystemClockContext&) override;
45 45
46 ResultCode SetClockContext(const SystemClockContext&) override; 46 Result SetClockContext(const SystemClockContext&) override;
47 47
48 ResultCode ApplyAutomaticCorrection(Core::System& system, bool value) const; 48 Result ApplyAutomaticCorrection(Core::System& system, bool value) const;
49 49
50 const SteadyClockTimePoint& GetAutomaticCorrectionUpdatedTime() const { 50 const SteadyClockTimePoint& GetAutomaticCorrectionUpdatedTime() const {
51 return auto_correction_time; 51 return auto_correction_time;
diff --git a/src/core/hle/service/time/system_clock_context_update_callback.cpp b/src/core/hle/service/time/system_clock_context_update_callback.cpp
index 37c140c6f..a649bed3a 100644
--- a/src/core/hle/service/time/system_clock_context_update_callback.cpp
+++ b/src/core/hle/service/time/system_clock_context_update_callback.cpp
@@ -30,8 +30,8 @@ void SystemClockContextUpdateCallback::BroadcastOperationEvent() {
30 } 30 }
31} 31}
32 32
33ResultCode SystemClockContextUpdateCallback::Update(const SystemClockContext& value) { 33Result SystemClockContextUpdateCallback::Update(const SystemClockContext& value) {
34 ResultCode result{ResultSuccess}; 34 Result result{ResultSuccess};
35 35
36 if (NeedUpdate(value)) { 36 if (NeedUpdate(value)) {
37 context = value; 37 context = value;
@@ -47,7 +47,7 @@ ResultCode SystemClockContextUpdateCallback::Update(const SystemClockContext& va
47 return result; 47 return result;
48} 48}
49 49
50ResultCode SystemClockContextUpdateCallback::Update() { 50Result SystemClockContextUpdateCallback::Update() {
51 return ResultSuccess; 51 return ResultSuccess;
52} 52}
53 53
diff --git a/src/core/hle/service/time/system_clock_context_update_callback.h b/src/core/hle/service/time/system_clock_context_update_callback.h
index bee90e329..9c6caf196 100644
--- a/src/core/hle/service/time/system_clock_context_update_callback.h
+++ b/src/core/hle/service/time/system_clock_context_update_callback.h
@@ -28,10 +28,10 @@ public:
28 28
29 void BroadcastOperationEvent(); 29 void BroadcastOperationEvent();
30 30
31 ResultCode Update(const SystemClockContext& value); 31 Result Update(const SystemClockContext& value);
32 32
33protected: 33protected:
34 virtual ResultCode Update(); 34 virtual Result Update();
35 35
36 SystemClockContext context{}; 36 SystemClockContext context{};
37 37
diff --git a/src/core/hle/service/time/system_clock_core.cpp b/src/core/hle/service/time/system_clock_core.cpp
index cb132239c..da078241f 100644
--- a/src/core/hle/service/time/system_clock_core.cpp
+++ b/src/core/hle/service/time/system_clock_core.cpp
@@ -14,13 +14,13 @@ SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core_)
14 14
15SystemClockCore::~SystemClockCore() = default; 15SystemClockCore::~SystemClockCore() = default;
16 16
17ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time) const { 17Result SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time) const {
18 posix_time = 0; 18 posix_time = 0;
19 19
20 const SteadyClockTimePoint current_time_point{steady_clock_core.GetCurrentTimePoint(system)}; 20 const SteadyClockTimePoint current_time_point{steady_clock_core.GetCurrentTimePoint(system)};
21 21
22 SystemClockContext clock_context{}; 22 SystemClockContext clock_context{};
23 if (const ResultCode result{GetClockContext(system, clock_context)}; result != ResultSuccess) { 23 if (const Result result{GetClockContext(system, clock_context)}; result != ResultSuccess) {
24 return result; 24 return result;
25 } 25 }
26 26
@@ -33,26 +33,26 @@ ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time
33 return ResultSuccess; 33 return ResultSuccess;
34} 34}
35 35
36ResultCode SystemClockCore::SetCurrentTime(Core::System& system, s64 posix_time) { 36Result SystemClockCore::SetCurrentTime(Core::System& system, s64 posix_time) {
37 const SteadyClockTimePoint current_time_point{steady_clock_core.GetCurrentTimePoint(system)}; 37 const SteadyClockTimePoint current_time_point{steady_clock_core.GetCurrentTimePoint(system)};
38 const SystemClockContext clock_context{posix_time - current_time_point.time_point, 38 const SystemClockContext clock_context{posix_time - current_time_point.time_point,
39 current_time_point}; 39 current_time_point};
40 40
41 if (const ResultCode result{SetClockContext(clock_context)}; result != ResultSuccess) { 41 if (const Result result{SetClockContext(clock_context)}; result != ResultSuccess) {
42 return result; 42 return result;
43 } 43 }
44 return Flush(clock_context); 44 return Flush(clock_context);
45} 45}
46 46
47ResultCode SystemClockCore::Flush(const SystemClockContext& clock_context) { 47Result SystemClockCore::Flush(const SystemClockContext& clock_context) {
48 if (!system_clock_context_update_callback) { 48 if (!system_clock_context_update_callback) {
49 return ResultSuccess; 49 return ResultSuccess;
50 } 50 }
51 return system_clock_context_update_callback->Update(clock_context); 51 return system_clock_context_update_callback->Update(clock_context);
52} 52}
53 53
54ResultCode SystemClockCore::SetSystemClockContext(const SystemClockContext& clock_context) { 54Result SystemClockCore::SetSystemClockContext(const SystemClockContext& clock_context) {
55 if (const ResultCode result{SetClockContext(clock_context)}; result != ResultSuccess) { 55 if (const Result result{SetClockContext(clock_context)}; result != ResultSuccess) {
56 return result; 56 return result;
57 } 57 }
58 return Flush(clock_context); 58 return Flush(clock_context);
diff --git a/src/core/hle/service/time/system_clock_core.h b/src/core/hle/service/time/system_clock_core.h
index 76d82f976..8cb34126f 100644
--- a/src/core/hle/service/time/system_clock_core.h
+++ b/src/core/hle/service/time/system_clock_core.h
@@ -29,28 +29,28 @@ public:
29 return steady_clock_core; 29 return steady_clock_core;
30 } 30 }
31 31
32 ResultCode GetCurrentTime(Core::System& system, s64& posix_time) const; 32 Result GetCurrentTime(Core::System& system, s64& posix_time) const;
33 33
34 ResultCode SetCurrentTime(Core::System& system, s64 posix_time); 34 Result SetCurrentTime(Core::System& system, s64 posix_time);
35 35
36 virtual ResultCode GetClockContext([[maybe_unused]] Core::System& system, 36 virtual Result GetClockContext([[maybe_unused]] Core::System& system,
37 SystemClockContext& value) const { 37 SystemClockContext& value) const {
38 value = context; 38 value = context;
39 return ResultSuccess; 39 return ResultSuccess;
40 } 40 }
41 41
42 virtual ResultCode SetClockContext(const SystemClockContext& value) { 42 virtual Result SetClockContext(const SystemClockContext& value) {
43 context = value; 43 context = value;
44 return ResultSuccess; 44 return ResultSuccess;
45 } 45 }
46 46
47 virtual ResultCode Flush(const SystemClockContext& clock_context); 47 virtual Result Flush(const SystemClockContext& clock_context);
48 48
49 void SetUpdateCallbackInstance(std::shared_ptr<SystemClockContextUpdateCallback> callback) { 49 void SetUpdateCallbackInstance(std::shared_ptr<SystemClockContextUpdateCallback> callback) {
50 system_clock_context_update_callback = std::move(callback); 50 system_clock_context_update_callback = std::move(callback);
51 } 51 }
52 52
53 ResultCode SetSystemClockContext(const SystemClockContext& context); 53 Result SetSystemClockContext(const SystemClockContext& context);
54 54
55 bool IsInitialized() const { 55 bool IsInitialized() const {
56 return is_initialized; 56 return is_initialized;
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 095fa021c..f77cdbb43 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -43,8 +43,7 @@ private:
43 } 43 }
44 44
45 s64 posix_time{}; 45 s64 posix_time{};
46 if (const ResultCode result{clock_core.GetCurrentTime(system, posix_time)}; 46 if (const Result result{clock_core.GetCurrentTime(system, posix_time)}; result.IsError()) {
47 result.IsError()) {
48 IPC::ResponseBuilder rb{ctx, 2}; 47 IPC::ResponseBuilder rb{ctx, 2};
49 rb.Push(result); 48 rb.Push(result);
50 return; 49 return;
@@ -65,7 +64,7 @@ private:
65 } 64 }
66 65
67 Clock::SystemClockContext system_clock_context{}; 66 Clock::SystemClockContext system_clock_context{};
68 if (const ResultCode result{clock_core.GetClockContext(system, system_clock_context)}; 67 if (const Result result{clock_core.GetClockContext(system, system_clock_context)};
69 result.IsError()) { 68 result.IsError()) {
70 IPC::ResponseBuilder rb{ctx, 2}; 69 IPC::ResponseBuilder rb{ctx, 2};
71 rb.Push(result); 70 rb.Push(result);
@@ -116,7 +115,7 @@ private:
116 Clock::SteadyClockCore& clock_core; 115 Clock::SteadyClockCore& clock_core;
117}; 116};
118 117
119ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( 118Result Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
120 Kernel::KThread* thread, Clock::SystemClockContext user_context, 119 Kernel::KThread* thread, Clock::SystemClockContext user_context,
121 Clock::SystemClockContext network_context, Clock::TimeType type, 120 Clock::SystemClockContext network_context, Clock::TimeType type,
122 Clock::ClockSnapshot& clock_snapshot) { 121 Clock::ClockSnapshot& clock_snapshot) {
@@ -129,7 +128,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
129 time_manager.GetStandardUserSystemClockCore().IsAutomaticCorrectionEnabled(); 128 time_manager.GetStandardUserSystemClockCore().IsAutomaticCorrectionEnabled();
130 clock_snapshot.type = type; 129 clock_snapshot.type = type;
131 130
132 if (const ResultCode result{ 131 if (const Result result{
133 time_manager.GetTimeZoneContentManager().GetTimeZoneManager().GetDeviceLocationName( 132 time_manager.GetTimeZoneContentManager().GetTimeZoneManager().GetDeviceLocationName(
134 clock_snapshot.location_name)}; 133 clock_snapshot.location_name)};
135 result != ResultSuccess) { 134 result != ResultSuccess) {
@@ -138,7 +137,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
138 137
139 clock_snapshot.user_context = user_context; 138 clock_snapshot.user_context = user_context;
140 139
141 if (const ResultCode result{Clock::ClockSnapshot::GetCurrentTime( 140 if (const Result result{Clock::ClockSnapshot::GetCurrentTime(
142 clock_snapshot.user_time, clock_snapshot.steady_clock_time_point, 141 clock_snapshot.user_time, clock_snapshot.steady_clock_time_point,
143 clock_snapshot.user_context)}; 142 clock_snapshot.user_context)};
144 result != ResultSuccess) { 143 result != ResultSuccess) {
@@ -146,7 +145,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
146 } 145 }
147 146
148 TimeZone::CalendarInfo userCalendarInfo{}; 147 TimeZone::CalendarInfo userCalendarInfo{};
149 if (const ResultCode result{ 148 if (const Result result{
150 time_manager.GetTimeZoneContentManager().GetTimeZoneManager().ToCalendarTimeWithMyRules( 149 time_manager.GetTimeZoneContentManager().GetTimeZoneManager().ToCalendarTimeWithMyRules(
151 clock_snapshot.user_time, userCalendarInfo)}; 150 clock_snapshot.user_time, userCalendarInfo)};
152 result != ResultSuccess) { 151 result != ResultSuccess) {
@@ -165,7 +164,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
165 } 164 }
166 165
167 TimeZone::CalendarInfo networkCalendarInfo{}; 166 TimeZone::CalendarInfo networkCalendarInfo{};
168 if (const ResultCode result{ 167 if (const Result result{
169 time_manager.GetTimeZoneContentManager().GetTimeZoneManager().ToCalendarTimeWithMyRules( 168 time_manager.GetTimeZoneContentManager().GetTimeZoneManager().ToCalendarTimeWithMyRules(
170 clock_snapshot.network_time, networkCalendarInfo)}; 169 clock_snapshot.network_time, networkCalendarInfo)};
171 result != ResultSuccess) { 170 result != ResultSuccess) {
@@ -262,7 +261,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
262 LOG_DEBUG(Service_Time, "called, type={}", type); 261 LOG_DEBUG(Service_Time, "called, type={}", type);
263 262
264 Clock::SystemClockContext user_context{}; 263 Clock::SystemClockContext user_context{};
265 if (const ResultCode result{ 264 if (const Result result{
266 system.GetTimeManager().GetStandardUserSystemClockCore().GetClockContext(system, 265 system.GetTimeManager().GetStandardUserSystemClockCore().GetClockContext(system,
267 user_context)}; 266 user_context)};
268 result.IsError()) { 267 result.IsError()) {
@@ -272,7 +271,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
272 } 271 }
273 272
274 Clock::SystemClockContext network_context{}; 273 Clock::SystemClockContext network_context{};
275 if (const ResultCode result{ 274 if (const Result result{
276 system.GetTimeManager().GetStandardNetworkSystemClockCore().GetClockContext( 275 system.GetTimeManager().GetStandardNetworkSystemClockCore().GetClockContext(
277 system, network_context)}; 276 system, network_context)};
278 result.IsError()) { 277 result.IsError()) {
@@ -282,7 +281,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
282 } 281 }
283 282
284 Clock::ClockSnapshot clock_snapshot{}; 283 Clock::ClockSnapshot clock_snapshot{};
285 if (const ResultCode result{GetClockSnapshotFromSystemClockContextInternal( 284 if (const Result result{GetClockSnapshotFromSystemClockContextInternal(
286 &ctx.GetThread(), user_context, network_context, type, clock_snapshot)}; 285 &ctx.GetThread(), user_context, network_context, type, clock_snapshot)};
287 result.IsError()) { 286 result.IsError()) {
288 IPC::ResponseBuilder rb{ctx, 2}; 287 IPC::ResponseBuilder rb{ctx, 2};
@@ -308,7 +307,7 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques
308 LOG_DEBUG(Service_Time, "called, type={}", type); 307 LOG_DEBUG(Service_Time, "called, type={}", type);
309 308
310 Clock::ClockSnapshot clock_snapshot{}; 309 Clock::ClockSnapshot clock_snapshot{};
311 if (const ResultCode result{GetClockSnapshotFromSystemClockContextInternal( 310 if (const Result result{GetClockSnapshotFromSystemClockContextInternal(
312 &ctx.GetThread(), user_context, network_context, type, clock_snapshot)}; 311 &ctx.GetThread(), user_context, network_context, type, clock_snapshot)};
313 result != ResultSuccess) { 312 result != ResultSuccess) {
314 IPC::ResponseBuilder rb{ctx, 2}; 313 IPC::ResponseBuilder rb{ctx, 2};
@@ -365,7 +364,7 @@ void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) {
365 Clock::TimeSpanType time_span_type{}; 364 Clock::TimeSpanType time_span_type{};
366 s64 span{}; 365 s64 span{};
367 366
368 if (const ResultCode result{snapshot_a.steady_clock_time_point.GetSpanBetween( 367 if (const Result result{snapshot_a.steady_clock_time_point.GetSpanBetween(
369 snapshot_b.steady_clock_time_point, span)}; 368 snapshot_b.steady_clock_time_point, span)};
370 result != ResultSuccess) { 369 result != ResultSuccess) {
371 if (snapshot_a.network_time && snapshot_b.network_time) { 370 if (snapshot_a.network_time && snapshot_b.network_time) {
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 017f20a23..76a46cfc7 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -36,7 +36,7 @@ public:
36 void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); 36 void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx);
37 37
38 private: 38 private:
39 ResultCode GetClockSnapshotFromSystemClockContextInternal( 39 Result GetClockSnapshotFromSystemClockContextInternal(
40 Kernel::KThread* thread, Clock::SystemClockContext user_context, 40 Kernel::KThread* thread, Clock::SystemClockContext user_context,
41 Clock::SystemClockContext network_context, Clock::TimeType type, 41 Clock::SystemClockContext network_context, Clock::TimeType type,
42 Clock::ClockSnapshot& cloc_snapshot); 42 Clock::ClockSnapshot& cloc_snapshot);
diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp
index 80818eb70..afbfe9715 100644
--- a/src/core/hle/service/time/time_zone_content_manager.cpp
+++ b/src/core/hle/service/time/time_zone_content_manager.cpp
@@ -90,10 +90,10 @@ void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
90 } 90 }
91} 91}
92 92
93ResultCode TimeZoneContentManager::LoadTimeZoneRule(TimeZoneRule& rules, 93Result TimeZoneContentManager::LoadTimeZoneRule(TimeZoneRule& rules,
94 const std::string& location_name) const { 94 const std::string& location_name) const {
95 FileSys::VirtualFile vfs_file; 95 FileSys::VirtualFile vfs_file;
96 if (const ResultCode result{GetTimeZoneInfoFile(location_name, vfs_file)}; 96 if (const Result result{GetTimeZoneInfoFile(location_name, vfs_file)};
97 result != ResultSuccess) { 97 result != ResultSuccess) {
98 return result; 98 return result;
99 } 99 }
@@ -106,8 +106,8 @@ bool TimeZoneContentManager::IsLocationNameValid(const std::string& location_nam
106 location_name_cache.end(); 106 location_name_cache.end();
107} 107}
108 108
109ResultCode TimeZoneContentManager::GetTimeZoneInfoFile(const std::string& location_name, 109Result TimeZoneContentManager::GetTimeZoneInfoFile(const std::string& location_name,
110 FileSys::VirtualFile& vfs_file) const { 110 FileSys::VirtualFile& vfs_file) const {
111 if (!IsLocationNameValid(location_name)) { 111 if (!IsLocationNameValid(location_name)) {
112 return ERROR_TIME_NOT_FOUND; 112 return ERROR_TIME_NOT_FOUND;
113 } 113 }
diff --git a/src/core/hle/service/time/time_zone_content_manager.h b/src/core/hle/service/time/time_zone_content_manager.h
index c6c94bcc0..3d94b6428 100644
--- a/src/core/hle/service/time/time_zone_content_manager.h
+++ b/src/core/hle/service/time/time_zone_content_manager.h
@@ -32,12 +32,12 @@ public:
32 return time_zone_manager; 32 return time_zone_manager;
33 } 33 }
34 34
35 ResultCode LoadTimeZoneRule(TimeZoneRule& rules, const std::string& location_name) const; 35 Result LoadTimeZoneRule(TimeZoneRule& rules, const std::string& location_name) const;
36 36
37private: 37private:
38 bool IsLocationNameValid(const std::string& location_name) const; 38 bool IsLocationNameValid(const std::string& location_name) const;
39 ResultCode GetTimeZoneInfoFile(const std::string& location_name, 39 Result GetTimeZoneInfoFile(const std::string& location_name,
40 FileSys::VirtualFile& vfs_file) const; 40 FileSys::VirtualFile& vfs_file) const;
41 41
42 Core::System& system; 42 Core::System& system;
43 TimeZoneManager time_zone_manager; 43 TimeZoneManager time_zone_manager;
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp
index fee05ec7a..2aa675df9 100644
--- a/src/core/hle/service/time/time_zone_manager.cpp
+++ b/src/core/hle/service/time/time_zone_manager.cpp
@@ -666,8 +666,8 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi
666 return true; 666 return true;
667} 667}
668 668
669static ResultCode CreateCalendarTime(s64 time, int gmt_offset, CalendarTimeInternal& calendar_time, 669static Result CreateCalendarTime(s64 time, int gmt_offset, CalendarTimeInternal& calendar_time,
670 CalendarAdditionalInfo& calendar_additional_info) { 670 CalendarAdditionalInfo& calendar_additional_info) {
671 s64 year{epoch_year}; 671 s64 year{epoch_year};
672 s64 time_days{time / seconds_per_day}; 672 s64 time_days{time / seconds_per_day};
673 s64 remaining_seconds{time % seconds_per_day}; 673 s64 remaining_seconds{time % seconds_per_day};
@@ -741,9 +741,9 @@ static ResultCode CreateCalendarTime(s64 time, int gmt_offset, CalendarTimeInter
741 return ResultSuccess; 741 return ResultSuccess;
742} 742}
743 743
744static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time, 744static Result ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time,
745 CalendarTimeInternal& calendar_time, 745 CalendarTimeInternal& calendar_time,
746 CalendarAdditionalInfo& calendar_additional_info) { 746 CalendarAdditionalInfo& calendar_additional_info) {
747 if ((rules.go_ahead && time < rules.ats[0]) || 747 if ((rules.go_ahead && time < rules.ats[0]) ||
748 (rules.go_back && time > rules.ats[rules.time_count - 1])) { 748 (rules.go_back && time > rules.ats[rules.time_count - 1])) {
749 s64 seconds{}; 749 s64 seconds{};
@@ -766,7 +766,7 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time,
766 if (new_time < rules.ats[0] && new_time > rules.ats[rules.time_count - 1]) { 766 if (new_time < rules.ats[0] && new_time > rules.ats[rules.time_count - 1]) {
767 return ERROR_TIME_NOT_FOUND; 767 return ERROR_TIME_NOT_FOUND;
768 } 768 }
769 if (const ResultCode result{ 769 if (const Result result{
770 ToCalendarTimeInternal(rules, new_time, calendar_time, calendar_additional_info)}; 770 ToCalendarTimeInternal(rules, new_time, calendar_time, calendar_additional_info)};
771 result != ResultSuccess) { 771 result != ResultSuccess) {
772 return result; 772 return result;
@@ -797,8 +797,8 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time,
797 tti_index = rules.types[low - 1]; 797 tti_index = rules.types[low - 1];
798 } 798 }
799 799
800 if (const ResultCode result{CreateCalendarTime(time, rules.ttis[tti_index].gmt_offset, 800 if (const Result result{CreateCalendarTime(time, rules.ttis[tti_index].gmt_offset,
801 calendar_time, calendar_additional_info)}; 801 calendar_time, calendar_additional_info)};
802 result != ResultSuccess) { 802 result != ResultSuccess) {
803 return result; 803 return result;
804 } 804 }
@@ -811,9 +811,9 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time,
811 return ResultSuccess; 811 return ResultSuccess;
812} 812}
813 813
814static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) { 814static Result ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) {
815 CalendarTimeInternal calendar_time{}; 815 CalendarTimeInternal calendar_time{};
816 const ResultCode result{ 816 const Result result{
817 ToCalendarTimeInternal(rules, time, calendar_time, calendar.additional_info)}; 817 ToCalendarTimeInternal(rules, time, calendar_time, calendar.additional_info)};
818 calendar.time.year = static_cast<s16>(calendar_time.year); 818 calendar.time.year = static_cast<s16>(calendar_time.year);
819 819
@@ -830,13 +830,13 @@ static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, Calend
830TimeZoneManager::TimeZoneManager() = default; 830TimeZoneManager::TimeZoneManager() = default;
831TimeZoneManager::~TimeZoneManager() = default; 831TimeZoneManager::~TimeZoneManager() = default;
832 832
833ResultCode TimeZoneManager::ToCalendarTime(const TimeZoneRule& rules, s64 time, 833Result TimeZoneManager::ToCalendarTime(const TimeZoneRule& rules, s64 time,
834 CalendarInfo& calendar) const { 834 CalendarInfo& calendar) const {
835 return ToCalendarTimeImpl(rules, time, calendar); 835 return ToCalendarTimeImpl(rules, time, calendar);
836} 836}
837 837
838ResultCode TimeZoneManager::SetDeviceLocationNameWithTimeZoneRule(const std::string& location_name, 838Result TimeZoneManager::SetDeviceLocationNameWithTimeZoneRule(const std::string& location_name,
839 FileSys::VirtualFile& vfs_file) { 839 FileSys::VirtualFile& vfs_file) {
840 TimeZoneRule rule{}; 840 TimeZoneRule rule{};
841 if (ParseTimeZoneBinary(rule, vfs_file)) { 841 if (ParseTimeZoneBinary(rule, vfs_file)) {
842 device_location_name = location_name; 842 device_location_name = location_name;
@@ -846,12 +846,12 @@ ResultCode TimeZoneManager::SetDeviceLocationNameWithTimeZoneRule(const std::str
846 return ERROR_TIME_ZONE_CONVERSION_FAILED; 846 return ERROR_TIME_ZONE_CONVERSION_FAILED;
847} 847}
848 848
849ResultCode TimeZoneManager::SetUpdatedTime(const Clock::SteadyClockTimePoint& value) { 849Result TimeZoneManager::SetUpdatedTime(const Clock::SteadyClockTimePoint& value) {
850 time_zone_update_time_point = value; 850 time_zone_update_time_point = value;
851 return ResultSuccess; 851 return ResultSuccess;
852} 852}
853 853
854ResultCode TimeZoneManager::ToCalendarTimeWithMyRules(s64 time, CalendarInfo& calendar) const { 854Result TimeZoneManager::ToCalendarTimeWithMyRules(s64 time, CalendarInfo& calendar) const {
855 if (is_initialized) { 855 if (is_initialized) {
856 return ToCalendarTime(time_zone_rule, time, calendar); 856 return ToCalendarTime(time_zone_rule, time, calendar);
857 } else { 857 } else {
@@ -859,16 +859,16 @@ ResultCode TimeZoneManager::ToCalendarTimeWithMyRules(s64 time, CalendarInfo& ca
859 } 859 }
860} 860}
861 861
862ResultCode TimeZoneManager::ParseTimeZoneRuleBinary(TimeZoneRule& rules, 862Result TimeZoneManager::ParseTimeZoneRuleBinary(TimeZoneRule& rules,
863 FileSys::VirtualFile& vfs_file) const { 863 FileSys::VirtualFile& vfs_file) const {
864 if (!ParseTimeZoneBinary(rules, vfs_file)) { 864 if (!ParseTimeZoneBinary(rules, vfs_file)) {
865 return ERROR_TIME_ZONE_CONVERSION_FAILED; 865 return ERROR_TIME_ZONE_CONVERSION_FAILED;
866 } 866 }
867 return ResultSuccess; 867 return ResultSuccess;
868} 868}
869 869
870ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules, 870Result TimeZoneManager::ToPosixTime(const TimeZoneRule& rules, const CalendarTime& calendar_time,
871 const CalendarTime& calendar_time, s64& posix_time) const { 871 s64& posix_time) const {
872 posix_time = 0; 872 posix_time = 0;
873 873
874 CalendarTimeInternal internal_time{ 874 CalendarTimeInternal internal_time{
@@ -1020,8 +1020,8 @@ ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules,
1020 return ResultSuccess; 1020 return ResultSuccess;
1021} 1021}
1022 1022
1023ResultCode TimeZoneManager::ToPosixTimeWithMyRule(const CalendarTime& calendar_time, 1023Result TimeZoneManager::ToPosixTimeWithMyRule(const CalendarTime& calendar_time,
1024 s64& posix_time) const { 1024 s64& posix_time) const {
1025 if (is_initialized) { 1025 if (is_initialized) {
1026 return ToPosixTime(time_zone_rule, calendar_time, posix_time); 1026 return ToPosixTime(time_zone_rule, calendar_time, posix_time);
1027 } 1027 }
@@ -1029,7 +1029,7 @@ ResultCode TimeZoneManager::ToPosixTimeWithMyRule(const CalendarTime& calendar_t
1029 return ERROR_UNINITIALIZED_CLOCK; 1029 return ERROR_UNINITIALIZED_CLOCK;
1030} 1030}
1031 1031
1032ResultCode TimeZoneManager::GetDeviceLocationName(LocationName& value) const { 1032Result TimeZoneManager::GetDeviceLocationName(LocationName& value) const {
1033 if (!is_initialized) { 1033 if (!is_initialized) {
1034 return ERROR_UNINITIALIZED_CLOCK; 1034 return ERROR_UNINITIALIZED_CLOCK;
1035 } 1035 }
diff --git a/src/core/hle/service/time/time_zone_manager.h b/src/core/hle/service/time/time_zone_manager.h
index 8c1b19f81..5ebd4035e 100644
--- a/src/core/hle/service/time/time_zone_manager.h
+++ b/src/core/hle/service/time/time_zone_manager.h
@@ -29,16 +29,16 @@ public:
29 is_initialized = true; 29 is_initialized = true;
30 } 30 }
31 31
32 ResultCode SetDeviceLocationNameWithTimeZoneRule(const std::string& location_name, 32 Result SetDeviceLocationNameWithTimeZoneRule(const std::string& location_name,
33 FileSys::VirtualFile& vfs_file); 33 FileSys::VirtualFile& vfs_file);
34 ResultCode SetUpdatedTime(const Clock::SteadyClockTimePoint& value); 34 Result SetUpdatedTime(const Clock::SteadyClockTimePoint& value);
35 ResultCode GetDeviceLocationName(TimeZone::LocationName& value) const; 35 Result GetDeviceLocationName(TimeZone::LocationName& value) const;
36 ResultCode ToCalendarTime(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) const; 36 Result ToCalendarTime(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) const;
37 ResultCode ToCalendarTimeWithMyRules(s64 time, CalendarInfo& calendar) const; 37 Result ToCalendarTimeWithMyRules(s64 time, CalendarInfo& calendar) const;
38 ResultCode ParseTimeZoneRuleBinary(TimeZoneRule& rules, FileSys::VirtualFile& vfs_file) const; 38 Result ParseTimeZoneRuleBinary(TimeZoneRule& rules, FileSys::VirtualFile& vfs_file) const;
39 ResultCode ToPosixTime(const TimeZoneRule& rules, const CalendarTime& calendar_time, 39 Result ToPosixTime(const TimeZoneRule& rules, const CalendarTime& calendar_time,
40 s64& posix_time) const; 40 s64& posix_time) const;
41 ResultCode ToPosixTimeWithMyRule(const CalendarTime& calendar_time, s64& posix_time) const; 41 Result ToPosixTimeWithMyRule(const CalendarTime& calendar_time, s64& posix_time) const;
42 42
43private: 43private:
44 bool is_initialized{}; 44 bool is_initialized{};
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp
index cbf0ef6fa..961040bfc 100644
--- a/src/core/hle/service/time/time_zone_service.cpp
+++ b/src/core/hle/service/time/time_zone_service.cpp
@@ -32,7 +32,7 @@ void ITimeZoneService::GetDeviceLocationName(Kernel::HLERequestContext& ctx) {
32 LOG_DEBUG(Service_Time, "called"); 32 LOG_DEBUG(Service_Time, "called");
33 33
34 TimeZone::LocationName location_name{}; 34 TimeZone::LocationName location_name{};
35 if (const ResultCode result{ 35 if (const Result result{
36 time_zone_content_manager.GetTimeZoneManager().GetDeviceLocationName(location_name)}; 36 time_zone_content_manager.GetTimeZoneManager().GetDeviceLocationName(location_name)};
37 result != ResultSuccess) { 37 result != ResultSuccess) {
38 IPC::ResponseBuilder rb{ctx, 2}; 38 IPC::ResponseBuilder rb{ctx, 2};
@@ -61,7 +61,7 @@ void ITimeZoneService::LoadTimeZoneRule(Kernel::HLERequestContext& ctx) {
61 LOG_DEBUG(Service_Time, "called, location_name={}", location_name); 61 LOG_DEBUG(Service_Time, "called, location_name={}", location_name);
62 62
63 TimeZone::TimeZoneRule time_zone_rule{}; 63 TimeZone::TimeZoneRule time_zone_rule{};
64 if (const ResultCode result{ 64 if (const Result result{
65 time_zone_content_manager.LoadTimeZoneRule(time_zone_rule, location_name)}; 65 time_zone_content_manager.LoadTimeZoneRule(time_zone_rule, location_name)};
66 result != ResultSuccess) { 66 result != ResultSuccess) {
67 IPC::ResponseBuilder rb{ctx, 2}; 67 IPC::ResponseBuilder rb{ctx, 2};
@@ -88,7 +88,7 @@ void ITimeZoneService::ToCalendarTime(Kernel::HLERequestContext& ctx) {
88 std::memcpy(&time_zone_rule, buffer.data(), buffer.size()); 88 std::memcpy(&time_zone_rule, buffer.data(), buffer.size());
89 89
90 TimeZone::CalendarInfo calendar_info{}; 90 TimeZone::CalendarInfo calendar_info{};
91 if (const ResultCode result{time_zone_content_manager.GetTimeZoneManager().ToCalendarTime( 91 if (const Result result{time_zone_content_manager.GetTimeZoneManager().ToCalendarTime(
92 time_zone_rule, posix_time, calendar_info)}; 92 time_zone_rule, posix_time, calendar_info)};
93 result != ResultSuccess) { 93 result != ResultSuccess) {
94 IPC::ResponseBuilder rb{ctx, 2}; 94 IPC::ResponseBuilder rb{ctx, 2};
@@ -108,7 +108,7 @@ void ITimeZoneService::ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx)
108 LOG_DEBUG(Service_Time, "called, posix_time=0x{:016X}", posix_time); 108 LOG_DEBUG(Service_Time, "called, posix_time=0x{:016X}", posix_time);
109 109
110 TimeZone::CalendarInfo calendar_info{}; 110 TimeZone::CalendarInfo calendar_info{};
111 if (const ResultCode result{ 111 if (const Result result{
112 time_zone_content_manager.GetTimeZoneManager().ToCalendarTimeWithMyRules( 112 time_zone_content_manager.GetTimeZoneManager().ToCalendarTimeWithMyRules(
113 posix_time, calendar_info)}; 113 posix_time, calendar_info)};
114 result != ResultSuccess) { 114 result != ResultSuccess) {
@@ -131,7 +131,7 @@ void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) {
131 std::memcpy(&time_zone_rule, ctx.ReadBuffer().data(), sizeof(TimeZone::TimeZoneRule)); 131 std::memcpy(&time_zone_rule, ctx.ReadBuffer().data(), sizeof(TimeZone::TimeZoneRule));
132 132
133 s64 posix_time{}; 133 s64 posix_time{};
134 if (const ResultCode result{time_zone_content_manager.GetTimeZoneManager().ToPosixTime( 134 if (const Result result{time_zone_content_manager.GetTimeZoneManager().ToPosixTime(
135 time_zone_rule, calendar_time, posix_time)}; 135 time_zone_rule, calendar_time, posix_time)};
136 result != ResultSuccess) { 136 result != ResultSuccess) {
137 IPC::ResponseBuilder rb{ctx, 2}; 137 IPC::ResponseBuilder rb{ctx, 2};
@@ -154,9 +154,8 @@ void ITimeZoneService::ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) {
154 const auto calendar_time{rp.PopRaw<TimeZone::CalendarTime>()}; 154 const auto calendar_time{rp.PopRaw<TimeZone::CalendarTime>()};
155 155
156 s64 posix_time{}; 156 s64 posix_time{};
157 if (const ResultCode result{ 157 if (const Result result{time_zone_content_manager.GetTimeZoneManager().ToPosixTimeWithMyRule(
158 time_zone_content_manager.GetTimeZoneManager().ToPosixTimeWithMyRule(calendar_time, 158 calendar_time, posix_time)};
159 posix_time)};
160 result != ResultSuccess) { 159 result != ResultSuccess) {
161 IPC::ResponseBuilder rb{ctx, 2}; 160 IPC::ResponseBuilder rb{ctx, 2};
162 rb.Push(result); 161 rb.Push(result);
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index a7b53d7dc..546879648 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -34,10 +34,10 @@
34 34
35namespace Service::VI { 35namespace Service::VI {
36 36
37constexpr ResultCode ERR_OPERATION_FAILED{ErrorModule::VI, 1}; 37constexpr Result ERR_OPERATION_FAILED{ErrorModule::VI, 1};
38constexpr ResultCode ERR_PERMISSION_DENIED{ErrorModule::VI, 5}; 38constexpr Result ERR_PERMISSION_DENIED{ErrorModule::VI, 5};
39constexpr ResultCode ERR_UNSUPPORTED{ErrorModule::VI, 6}; 39constexpr Result ERR_UNSUPPORTED{ErrorModule::VI, 6};
40constexpr ResultCode ERR_NOT_FOUND{ErrorModule::VI, 7}; 40constexpr Result ERR_NOT_FOUND{ErrorModule::VI, 7};
41 41
42struct DisplayInfo { 42struct DisplayInfo {
43 /// The name of this particular display. 43 /// The name of this particular display.