diff options
author | Liam <byteslice@airmail.cc> | 2023-03-07 01:04:12 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-03-07 02:58:42 +0100 |
commit | 1d0fe75e7cca27d79006654dcc56c44cb4096d3a (patch) | |
tree | 3291e0ad973cd3c0e07ded22c968f40c2c6dd955 /src/core/hle | |
parent | Merge pull request #9890 from Kelebek1/reverb_fix (diff) | |
download | yuzu-1d0fe75e7cca27d79006654dcc56c44cb4096d3a.tar yuzu-1d0fe75e7cca27d79006654dcc56c44cb4096d3a.tar.gz yuzu-1d0fe75e7cca27d79006654dcc56c44cb4096d3a.tar.bz2 yuzu-1d0fe75e7cca27d79006654dcc56c44cb4096d3a.tar.lz yuzu-1d0fe75e7cca27d79006654dcc56c44cb4096d3a.tar.xz yuzu-1d0fe75e7cca27d79006654dcc56c44cb4096d3a.tar.zst yuzu-1d0fe75e7cca27d79006654dcc56c44cb4096d3a.zip |
Diffstat (limited to 'src/core/hle')
21 files changed, 105 insertions, 118 deletions
diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h index 09bf2f1d0..549809000 100644 --- a/src/core/hle/kernel/k_process.h +++ b/src/core/hle/kernel/k_process.h @@ -310,10 +310,10 @@ public: /// Clears the signaled state of the process if and only if it's signaled. /// /// @pre The process must not be already terminated. If this is called on a - /// terminated process, then ERR_INVALID_STATE will be returned. + /// terminated process, then ResultInvalidState will be returned. /// /// @pre The process must be in a signaled state. If this is called on a - /// process instance that is not signaled, ERR_INVALID_STATE will be + /// process instance that is not signaled, ResultInvalidState will be /// returned. Result Reset(); diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index ddc3a6dbe..120282aa4 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -30,12 +30,6 @@ namespace Service::Account { -constexpr Result ERR_INVALID_USER_ID{ErrorModule::Account, 20}; -constexpr Result ERR_INVALID_APPLICATION_ID{ErrorModule::Account, 22}; -constexpr Result ERR_INVALID_BUFFER{ErrorModule::Account, 30}; -constexpr Result ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 31}; -constexpr Result ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100}; - // Thumbnails are hard coded to be at least this size constexpr std::size_t THUMBNAIL_SIZE = 0x24000; @@ -384,7 +378,7 @@ protected: if (user_data.size() < sizeof(UserData)) { LOG_ERROR(Service_ACC, "UserData buffer too small!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_BUFFER); + rb.Push(Account::ResultInvalidArrayLength); return; } @@ -394,7 +388,7 @@ protected: if (!profile_manager.SetProfileBaseAndData(user_id, base, data)) { LOG_ERROR(Service_ACC, "Failed to update user data and base!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_FAILED_SAVE_DATA); + rb.Push(Account::ResultAccountUpdateFailed); return; } @@ -417,7 +411,7 @@ protected: if (user_data.size() < sizeof(UserData)) { LOG_ERROR(Service_ACC, "UserData buffer too small!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_BUFFER); + rb.Push(Account::ResultInvalidArrayLength); return; } @@ -432,7 +426,7 @@ protected: !profile_manager.SetProfileBaseAndData(user_id, base, data)) { LOG_ERROR(Service_ACC, "Failed to update profile data, base, and image!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_FAILED_SAVE_DATA); + rb.Push(Account::ResultAccountUpdateFailed); return; } @@ -764,7 +758,7 @@ void Module::Interface::InitializeApplicationInfoRestricted(HLERequestContext& c Result Module::Interface::InitializeApplicationInfoBase() { if (application_info) { LOG_ERROR(Service_ACC, "Application already initialized"); - return ERR_ACCOUNTINFO_ALREADY_INITIALIZED; + return Account::ResultApplicationInfoAlreadyInitialized; } // TODO(ogniK): This should be changed to reflect the target process for when we have multiple @@ -775,7 +769,7 @@ Result Module::Interface::InitializeApplicationInfoBase() { if (launch_property.Failed()) { LOG_ERROR(Service_ACC, "Failed to get launch property"); - return ERR_ACCOUNTINFO_BAD_APPLICATION; + return Account::ResultInvalidApplication; } switch (launch_property->base_game_storage_id) { @@ -791,7 +785,7 @@ Result Module::Interface::InitializeApplicationInfoBase() { default: LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}", launch_property->base_game_storage_id); - return ERR_ACCOUNTINFO_BAD_APPLICATION; + return Account::ResultInvalidApplication; } LOG_WARNING(Service_ACC, "ApplicationInfo init required"); @@ -899,20 +893,20 @@ void Module::Interface::StoreSaveDataThumbnail(HLERequestContext& ctx, const Com if (tid == 0) { LOG_ERROR(Service_ACC, "TitleID is not valid!"); - rb.Push(ERR_INVALID_APPLICATION_ID); + rb.Push(Account::ResultInvalidApplication); return; } if (uuid.IsInvalid()) { LOG_ERROR(Service_ACC, "User ID is not valid!"); - rb.Push(ERR_INVALID_USER_ID); + rb.Push(Account::ResultInvalidUserId); return; } const auto thumbnail_size = ctx.GetReadBufferSize(); if (thumbnail_size != THUMBNAIL_SIZE) { LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size, THUMBNAIL_SIZE); - rb.Push(ERR_INVALID_BUFFER_SIZE); + rb.Push(Account::ResultInvalidArrayLength); return; } diff --git a/src/core/hle/service/acc/errors.h b/src/core/hle/service/acc/errors.h index e9c16b951..433ebfe9d 100644 --- a/src/core/hle/service/acc/errors.h +++ b/src/core/hle/service/acc/errors.h @@ -7,7 +7,13 @@ namespace Service::Account { -constexpr Result ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22}; -constexpr Result ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41}; +constexpr Result ResultCancelledByUser{ErrorModule::Account, 1}; +constexpr Result ResultNoNotifications{ErrorModule::Account, 15}; +constexpr Result ResultInvalidUserId{ErrorModule::Account, 20}; +constexpr Result ResultInvalidApplication{ErrorModule::Account, 22}; +constexpr Result ResultNullptr{ErrorModule::Account, 30}; +constexpr Result ResultInvalidArrayLength{ErrorModule::Account, 32}; +constexpr Result ResultApplicationInfoAlreadyInitialized{ErrorModule::Account, 41}; +constexpr Result ResultAccountUpdateFailed{ErrorModule::Account, 100}; } // namespace Service::Account diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index f74c7b550..f17df5124 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -39,9 +39,9 @@ namespace Service::AM { -constexpr Result ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 2}; -constexpr Result ERR_NO_MESSAGES{ErrorModule::AM, 3}; -constexpr Result ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 503}; +constexpr Result ResultNoDataInChannel{ErrorModule::AM, 2}; +constexpr Result ResultNoMessages{ErrorModule::AM, 3}; +constexpr Result ResultInvalidOffset{ErrorModule::AM, 503}; enum class LaunchParameterKind : u32 { ApplicationSpecific = 1, @@ -758,7 +758,7 @@ void ICommonStateGetter::ReceiveMessage(HLERequestContext& ctx) { if (message == AppletMessageQueue::AppletMessage::None) { LOG_ERROR(Service_AM, "Message queue is empty"); - rb.Push(ERR_NO_MESSAGES); + rb.Push(AM::ResultNoMessages); rb.PushEnum<AppletMessageQueue::AppletMessage>(message); return; } @@ -1028,7 +1028,7 @@ private: LOG_DEBUG(Service_AM, "storage is a nullptr. There is no data in the current normal channel"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); return; } @@ -1059,7 +1059,7 @@ private: LOG_DEBUG(Service_AM, "storage is a nullptr. There is no data in the current interactive channel"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); return; } @@ -1138,7 +1138,7 @@ void IStorageAccessor::Write(HLERequestContext& ctx) { backing.GetSize(), size, offset); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_SIZE_OUT_OF_BOUNDS); + rb.Push(AM::ResultInvalidOffset); return; } @@ -1161,7 +1161,7 @@ void IStorageAccessor::Read(HLERequestContext& ctx) { backing.GetSize(), size, offset); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_SIZE_OUT_OF_BOUNDS); + rb.Push(AM::ResultInvalidOffset); return; } @@ -1502,7 +1502,7 @@ void IApplicationFunctions::PopLaunchParameter(HLERequestContext& ctx) { LOG_ERROR(Service_AM, "Attempted to load launch parameter but none was found!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); } void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx) { @@ -1799,7 +1799,7 @@ void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel(HLERequestC LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); } void IApplicationFunctions::GetNotificationStorageChannelEvent(HLERequestContext& ctx) { diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp index b418031de..58484519b 100644 --- a/src/core/hle/service/am/applets/applet_controller.cpp +++ b/src/core/hle/service/am/applets/applet_controller.cpp @@ -19,10 +19,9 @@ namespace Service::AM::Applets { -// This error code (0x183ACA) is thrown when the applet fails to initialize. -[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3101{ErrorModule::HID, 3101}; -// This error code (0x183CCA) is thrown when the u32 result in ControllerSupportResultInfo is 2. -[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3102{ErrorModule::HID, 3102}; +[[maybe_unused]] constexpr Result ResultControllerSupportCanceled{ErrorModule::HID, 3101}; +[[maybe_unused]] constexpr Result ResultControllerSupportNotSupportedNpadStyle{ErrorModule::HID, + 3102}; static Core::Frontend::ControllerParameters ConvertToFrontendParameters( ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text, 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 c738db028..1d69f5447 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp @@ -7,13 +7,12 @@ #include "common/string_util.h" #include "core/core.h" #include "core/frontend/applets/profile_select.h" +#include "core/hle/service/acc/errors.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applets/applet_profile_select.h" namespace Service::AM::Applets { -constexpr Result ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1}; - ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ProfileSelectApplet& frontend_) : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} @@ -63,8 +62,8 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { output.result = 0; output.uuid_selected = *uuid; } else { - status = ERR_USER_CANCELLED_SELECTION; - output.result = ERR_USER_CANCELLED_SELECTION.raw; + status = Account::ResultCancelledByUser; + output.result = Account::ResultCancelledByUser.raw; output.uuid_selected = Common::InvalidUUID; } diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 0a6830ffa..7086d4750 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -170,7 +170,7 @@ private: if (impl->GetSystem().GetExecutionMode() == AudioCore::ExecutionMode::Manual) { IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NOT_SUPPORTED); + rb.Push(Audio::ResultNotSupported); return; } @@ -448,7 +448,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) { if (impl->GetSessionCount() + 1 > AudioCore::MaxRendererSessions) { LOG_ERROR(Service_Audio, "Too many AudioRenderer sessions open!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_MAXIMUM_SESSIONS_REACHED); + rb.Push(Audio::ResultOutOfSessions); return; } @@ -461,7 +461,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) { if (session_id == -1) { LOG_ERROR(Service_Audio, "Tried to open a session that's already in use!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_MAXIMUM_SESSIONS_REACHED); + rb.Push(Audio::ResultOutOfSessions); return; } diff --git a/src/core/hle/service/audio/errors.h b/src/core/hle/service/audio/errors.h index d706978cb..3d3d3d97a 100644 --- a/src/core/hle/service/audio/errors.h +++ b/src/core/hle/service/audio/errors.h @@ -7,17 +7,17 @@ namespace Service::Audio { -constexpr Result ERR_INVALID_DEVICE_NAME{ErrorModule::Audio, 1}; -constexpr Result ERR_OPERATION_FAILED{ErrorModule::Audio, 2}; -constexpr Result ERR_INVALID_SAMPLE_RATE{ErrorModule::Audio, 3}; -constexpr Result ERR_INSUFFICIENT_BUFFER_SIZE{ErrorModule::Audio, 4}; -constexpr Result ERR_MAXIMUM_SESSIONS_REACHED{ErrorModule::Audio, 5}; -constexpr Result ERR_BUFFER_COUNT_EXCEEDED{ErrorModule::Audio, 8}; -constexpr Result ERR_INVALID_CHANNEL_COUNT{ErrorModule::Audio, 10}; -constexpr Result ERR_INVALID_UPDATE_DATA{ErrorModule::Audio, 41}; -constexpr Result ERR_POOL_MAPPING_FAILED{ErrorModule::Audio, 42}; -constexpr Result ERR_NOT_SUPPORTED{ErrorModule::Audio, 513}; -constexpr Result ERR_INVALID_PROCESS_HANDLE{ErrorModule::Audio, 1536}; -constexpr Result ERR_INVALID_REVISION{ErrorModule::Audio, 1537}; +constexpr Result ResultNotFound{ErrorModule::Audio, 1}; +constexpr Result ResultOperationFailed{ErrorModule::Audio, 2}; +constexpr Result ResultInvalidSampleRate{ErrorModule::Audio, 3}; +constexpr Result ResultInsufficientBuffer{ErrorModule::Audio, 4}; +constexpr Result ResultOutOfSessions{ErrorModule::Audio, 5}; +constexpr Result ResultBufferCountReached{ErrorModule::Audio, 8}; +constexpr Result ResultInvalidChannelCount{ErrorModule::Audio, 10}; +constexpr Result ResultInvalidUpdateInfo{ErrorModule::Audio, 41}; +constexpr Result ResultInvalidAddressInfo{ErrorModule::Audio, 42}; +constexpr Result ResultNotSupported{ErrorModule::Audio, 513}; +constexpr Result ResultInvalidHandle{ErrorModule::Audio, 1536}; +constexpr Result ResultInvalidRevision{ErrorModule::Audio, 1537}; } // namespace Service::Audio diff --git a/src/core/hle/service/friend/errors.h b/src/core/hle/service/friend/errors.h deleted file mode 100644 index ff525d865..000000000 --- a/src/core/hle/service/friend/errors.h +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/result.h" - -namespace Service::Friend { - -constexpr Result ERR_NO_NOTIFICATIONS{ErrorModule::Account, 15}; -} diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 447deab8b..9d05f9801 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -6,7 +6,7 @@ #include "common/uuid.h" #include "core/core.h" #include "core/hle/kernel/k_event.h" -#include "core/hle/service/friend/errors.h" +#include "core/hle/service/acc/errors.h" #include "core/hle/service/friend/friend.h" #include "core/hle/service/friend/friend_interface.h" #include "core/hle/service/ipc_helpers.h" @@ -259,7 +259,7 @@ private: if (notifications.empty()) { LOG_ERROR(Service_Friend, "No notifications in queue!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_NOTIFICATIONS); + rb.Push(Account::ResultNoNotifications); return; } diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 9db136bac..929dcca0d 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp @@ -61,7 +61,7 @@ void ARP_R::GetApplicationLaunchProperty(HLERequestContext& ctx) { if (!title_id.has_value()) { LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NOT_REGISTERED); + rb.Push(Glue::ResultProcessIdNotRegistered); return; } @@ -109,7 +109,7 @@ void ARP_R::GetApplicationControlProperty(HLERequestContext& ctx) { if (!title_id.has_value()) { LOG_ERROR(Service_ARP, "Failed to get title ID for process ID!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NOT_REGISTERED); + rb.Push(Glue::ResultProcessIdNotRegistered); return; } @@ -178,7 +178,7 @@ private: if (process_id == 0) { LOG_ERROR(Service_ARP, "Must have non-zero process ID!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_PROCESS_ID); + rb.Push(Glue::ResultInvalidProcessId); return; } @@ -186,7 +186,7 @@ private: LOG_ERROR(Service_ARP, "Attempted to issue registrar, but registrar is already issued!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_ACCESS); + rb.Push(Glue::ResultAlreadyBound); return; } @@ -205,7 +205,7 @@ private: Service_ARP, "Attempted to set application launch property, but registrar is already issued!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_ACCESS); + rb.Push(Glue::ResultAlreadyBound); return; } @@ -224,7 +224,7 @@ private: Service_ARP, "Attempted to set application control property, but registrar is already issued!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_ACCESS); + rb.Push(Glue::ResultAlreadyBound); return; } @@ -263,7 +263,7 @@ void ARP_W::AcquireRegistrar(HLERequestContext& ctx) { system, [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) { const auto res = GetTitleIDForProcessID(system, process_id); if (!res.has_value()) { - return ERR_NOT_REGISTERED; + return Glue::ResultProcessIdNotRegistered; } return manager.Register(*res, launch, std::move(control)); @@ -283,7 +283,7 @@ void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) { if (process_id == 0) { LOG_ERROR(Service_ARP, "Must have non-zero process ID!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_PROCESS_ID); + rb.Push(Glue::ResultInvalidProcessId); return; } @@ -292,7 +292,7 @@ void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) { if (!title_id.has_value()) { LOG_ERROR(Service_ARP, "No title ID for process ID!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NOT_REGISTERED); + rb.Push(Glue::ResultProcessIdNotRegistered); return; } diff --git a/src/core/hle/service/glue/errors.h b/src/core/hle/service/glue/errors.h index d4ce7f44e..30feaa5c0 100644 --- a/src/core/hle/service/glue/errors.h +++ b/src/core/hle/service/glue/errors.h @@ -7,9 +7,8 @@ namespace Service::Glue { -constexpr Result ERR_INVALID_RESOURCE{ErrorModule::ARP, 30}; -constexpr Result ERR_INVALID_PROCESS_ID{ErrorModule::ARP, 31}; -constexpr Result ERR_INVALID_ACCESS{ErrorModule::ARP, 42}; -constexpr Result ERR_NOT_REGISTERED{ErrorModule::ARP, 102}; +constexpr Result ResultInvalidProcessId{ErrorModule::ARP, 31}; +constexpr Result ResultAlreadyBound{ErrorModule::ARP, 42}; +constexpr Result ResultProcessIdNotRegistered{ErrorModule::ARP, 102}; } // namespace Service::Glue diff --git a/src/core/hle/service/glue/glue_manager.cpp b/src/core/hle/service/glue/glue_manager.cpp index 8a654cdca..4bf67921b 100644 --- a/src/core/hle/service/glue/glue_manager.cpp +++ b/src/core/hle/service/glue/glue_manager.cpp @@ -17,12 +17,12 @@ ARPManager::~ARPManager() = default; ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) const { if (title_id == 0) { - return ERR_INVALID_PROCESS_ID; + return Glue::ResultInvalidProcessId; } const auto iter = entries.find(title_id); if (iter == entries.end()) { - return ERR_NOT_REGISTERED; + return Glue::ResultProcessIdNotRegistered; } return iter->second.launch; @@ -30,12 +30,12 @@ ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id) ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const { if (title_id == 0) { - return ERR_INVALID_PROCESS_ID; + return Glue::ResultInvalidProcessId; } const auto iter = entries.find(title_id); if (iter == entries.end()) { - return ERR_NOT_REGISTERED; + return Glue::ResultProcessIdNotRegistered; } return iter->second.control; @@ -44,12 +44,12 @@ ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const { Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control) { if (title_id == 0) { - return ERR_INVALID_PROCESS_ID; + return Glue::ResultInvalidProcessId; } const auto iter = entries.find(title_id); if (iter != entries.end()) { - return ERR_INVALID_ACCESS; + return Glue::ResultAlreadyBound; } entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)}); @@ -58,12 +58,12 @@ Result ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, Result ARPManager::Unregister(u64 title_id) { if (title_id == 0) { - return ERR_INVALID_PROCESS_ID; + return Glue::ResultInvalidProcessId; } const auto iter = entries.find(title_id); if (iter == entries.end()) { - return ERR_NOT_REGISTERED; + return Glue::ResultProcessIdNotRegistered; } entries.erase(iter); diff --git a/src/core/hle/service/glue/glue_manager.h b/src/core/hle/service/glue/glue_manager.h index cd0b092ac..1cf53d9d9 100644 --- a/src/core/hle/service/glue/glue_manager.h +++ b/src/core/hle/service/glue/glue_manager.h @@ -30,23 +30,23 @@ public: ~ARPManager(); // Returns the ApplicationLaunchProperty corresponding to the provided title ID if it was - // previously registered, otherwise ERR_NOT_REGISTERED if it was never registered or - // ERR_INVALID_PROCESS_ID if the title ID is 0. + // previously registered, otherwise ResultProcessIdNotRegistered if it was never registered or + // ResultInvalidProcessId if the title ID is 0. ResultVal<ApplicationLaunchProperty> GetLaunchProperty(u64 title_id) const; // Returns a vector of the raw bytes of NACP data (necessarily 0x4000 in size) corresponding to - // the provided title ID if it was previously registered, otherwise ERR_NOT_REGISTERED if it was - // never registered or ERR_INVALID_PROCESS_ID if the title ID is 0. + // the provided title ID if it was previously registered, otherwise ResultProcessIdNotRegistered + // if it was never registered or ResultInvalidProcessId if the title ID is 0. ResultVal<std::vector<u8>> GetControlProperty(u64 title_id) const; // Adds a new entry to the internal database with the provided parameters, returning - // ERR_INVALID_ACCESS if attempting to re-register a title ID without an intermediate Unregister - // step, and ERR_INVALID_PROCESS_ID if the title ID is 0. + // ResultProcessIdNotRegistered if attempting to re-register a title ID without an intermediate + // Unregister step, and ResultInvalidProcessId if the title ID is 0. Result Register(u64 title_id, ApplicationLaunchProperty launch, std::vector<u8> control); // Removes the registration for the provided title ID from the database, returning - // ERR_NOT_REGISTERED if it doesn't exist in the database and ERR_INVALID_PROCESS_ID if the - // title ID is 0. + // ResultProcessIdNotRegistered if it doesn't exist in the database and ResultInvalidProcessId + // if the title ID is 0. Result Unregister(u64 title_id); // Removes all entries from the database, always succeeds. Should only be used when resetting diff --git a/src/core/hle/service/ipc_helpers.h b/src/core/hle/service/ipc_helpers.h index 3e67123c7..8703b57ca 100644 --- a/src/core/hle/service/ipc_helpers.h +++ b/src/core/hle/service/ipc_helpers.h @@ -19,7 +19,7 @@ namespace IPC { -constexpr Result ERR_REMOTE_PROCESS_DEAD{ErrorModule::HIPC, 301}; +constexpr Result ResultSessionClosed{ErrorModule::HIPC, 301}; class RequestHelperBase { protected: diff --git a/src/core/hle/service/ns/errors.h b/src/core/hle/service/ns/errors.h index 8a7621798..16d2ea6f7 100644 --- a/src/core/hle/service/ns/errors.h +++ b/src/core/hle/service/ns/errors.h @@ -7,5 +7,6 @@ namespace Service::NS { -constexpr Result ERR_APPLICATION_LANGUAGE_NOT_FOUND{ErrorModule::NS, 300}; -}
\ No newline at end of file +constexpr Result ResultApplicationLanguageNotFound{ErrorModule::NS, 300}; + +} diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index d6f0faea2..376067a95 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -416,14 +416,14 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage( if (application_language == std::nullopt) { LOG_ERROR(Service_NS, "Could not convert application language! language_code={}", language_code); - return ERR_APPLICATION_LANGUAGE_NOT_FOUND; + return Service::NS::ResultApplicationLanguageNotFound; } const auto priority_list = GetApplicationLanguagePriorityList(*application_language); if (!priority_list) { LOG_ERROR(Service_NS, "Could not find application language priorities! application_language={}", *application_language); - return ERR_APPLICATION_LANGUAGE_NOT_FOUND; + return Service::NS::ResultApplicationLanguageNotFound; } // Try to find a valid language. @@ -436,7 +436,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage( LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}", supported_languages); - return ERR_APPLICATION_LANGUAGE_NOT_FOUND; + return Service::NS::ResultApplicationLanguageNotFound; } void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( @@ -461,7 +461,7 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language)); if (language_code == std::nullopt) { LOG_ERROR(Service_NS, "Language not found! application_language={}", application_language); - return ERR_APPLICATION_LANGUAGE_NOT_FOUND; + return Service::NS::ResultApplicationLanguageNotFound; } return static_cast<u64>(*language_code); diff --git a/src/core/hle/service/server_manager.cpp b/src/core/hle/service/server_manager.cpp index c91f6d880..bd04cd023 100644 --- a/src/core/hle/service/server_manager.cpp +++ b/src/core/hle/service/server_manager.cpp @@ -404,7 +404,7 @@ Result ServerManager::CompleteSyncRequest(RequestState&& request) { rc = request.session->SendReplyHLE(); // If the session has been closed, we're done. - if (rc == Kernel::ResultSessionClosed || service_rc == IPC::ERR_REMOTE_PROCESS_DEAD) { + if (rc == Kernel::ResultSessionClosed || service_rc == IPC::ResultSessionClosed) { // Close the session. request.session->Close(); diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index eed615377..69cdb5918 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -176,7 +176,7 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session, case IPC::CommandType::TIPC_Close: { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); - result = IPC::ERR_REMOTE_PROCESS_DEAD; + result = IPC::ResultSessionClosed; break; } case IPC::CommandType::ControlWithContext: diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 88df52331..f5788b481 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 constexpr std::size_t PRE_4_0_0_MAX_ENTRIES = 0xF; constexpr std::size_t POST_4_0_0_MAX_ENTRIES = 0x40; -constexpr Result ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625}; +constexpr Result ResultInvalidLanguage{ErrorModule::Settings, 625}; void PushResponseLanguageCode(HLERequestContext& ctx, std::size_t num_language_codes) { IPC::ResponseBuilder rb{ctx, 3}; @@ -130,7 +130,7 @@ void SET::MakeLanguageCode(HLERequestContext& ctx) { if (index >= available_language_codes.size()) { LOG_ERROR(Service_SET, "Invalid language code index! index={}", index); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_INVALID_LANGUAGE); + rb.Push(Set::ResultInvalidLanguage); return; } diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index a46f47d3e..b4046d3ce 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -18,10 +18,10 @@ namespace Service::SM { -constexpr Result ERR_NOT_INITIALIZED(ErrorModule::SM, 2); -constexpr Result ERR_ALREADY_REGISTERED(ErrorModule::SM, 4); -constexpr Result ERR_INVALID_NAME(ErrorModule::SM, 6); -constexpr Result ERR_SERVICE_NOT_REGISTERED(ErrorModule::SM, 7); +constexpr Result ResultInvalidClient(ErrorModule::SM, 2); +constexpr Result ResultAlreadyRegistered(ErrorModule::SM, 4); +constexpr Result ResultInvalidServiceName(ErrorModule::SM, 6); +constexpr Result ResultNotRegistered(ErrorModule::SM, 7); ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} { controller_interface = std::make_unique<Controller>(kernel.System()); @@ -45,7 +45,7 @@ void ServiceManager::InvokeControlRequest(HLERequestContext& context) { static Result ValidateServiceName(const std::string& name) { if (name.empty() || name.size() > 8) { LOG_ERROR(Service_SM, "Invalid service name! service={}", name); - return ERR_INVALID_NAME; + return Service::SM::ResultInvalidServiceName; } return ResultSuccess; } @@ -58,7 +58,7 @@ Result ServiceManager::RegisterService(std::string name, u32 max_sessions, std::scoped_lock lk{lock}; if (registered_services.find(name) != registered_services.end()) { LOG_ERROR(Service_SM, "Service is already registered! service={}", name); - return ERR_ALREADY_REGISTERED; + return Service::SM::ResultAlreadyRegistered; } auto* port = Kernel::KPort::Create(kernel); @@ -80,7 +80,7 @@ Result ServiceManager::UnregisterService(const std::string& name) { const auto iter = registered_services.find(name); if (iter == registered_services.end()) { LOG_ERROR(Service_SM, "Server is not registered! service={}", name); - return ERR_SERVICE_NOT_REGISTERED; + return Service::SM::ResultNotRegistered; } registered_services.erase(iter); @@ -96,7 +96,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name auto it = service_ports.find(name); if (it == service_ports.end()) { LOG_WARNING(Service_SM, "Server is not registered! service={}", name); - return ERR_SERVICE_NOT_REGISTERED; + return Service::SM::ResultNotRegistered; } return it->second; @@ -160,7 +160,7 @@ static std::string PopServiceName(IPC::RequestParser& rp) { ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) { if (!ctx.GetManager()->GetIsInitializedForSm()) { - return ERR_NOT_INITIALIZED; + return Service::SM::ResultInvalidClient; } IPC::RequestParser rp{ctx}; @@ -168,15 +168,15 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(HLERequestContext& ctx) { // Find the named port. auto port_result = service_manager.GetServicePort(name); - if (port_result.Code() == ERR_INVALID_NAME) { + if (port_result.Code() == Service::SM::ResultInvalidServiceName) { LOG_ERROR(Service_SM, "Invalid service name '{}'", name); - return ERR_INVALID_NAME; + return Service::SM::ResultInvalidServiceName; } if (port_result.Failed()) { LOG_INFO(Service_SM, "Waiting for service {} to become available", name); ctx.SetIsDeferred(); - return ERR_SERVICE_NOT_REGISTERED; + return Service::SM::ResultNotRegistered; } auto& port = port_result.Unwrap(); |