diff options
Diffstat (limited to '')
172 files changed, 1712 insertions, 1311 deletions
diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp index ae2201c36..80ffddb10 100644 --- a/src/audio_core/audio_renderer.cpp +++ b/src/audio_core/audio_renderer.cpp @@ -197,7 +197,7 @@ ResultCode AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_param ReleaseAndQueueBuffers(); - return RESULT_SUCCESS; + return ResultSuccess; } void AudioRenderer::QueueMixedBuffer(Buffer::Tag tag) { diff --git a/src/audio_core/info_updater.cpp b/src/audio_core/info_updater.cpp index d3ac90827..4a5b1b4ab 100644 --- a/src/audio_core/info_updater.cpp +++ b/src/audio_core/info_updater.cpp @@ -407,7 +407,7 @@ ResultCode InfoUpdater::UpdateMixes(MixContext& mix_context, std::size_t mix_buf // TODO(ogniK): Sort when splitter is suppoorted - return RESULT_SUCCESS; + return ResultSuccess; } bool InfoUpdater::UpdateSinks(SinkContext& sink_context) { diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 7a4d9e354..2d403d471 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -21,14 +21,14 @@ find_package(Git QUIET) add_custom_command(OUTPUT scm_rev.cpp COMMAND ${CMAKE_COMMAND} - -DSRC_DIR="${CMAKE_SOURCE_DIR}" - -DBUILD_REPOSITORY="${BUILD_REPOSITORY}" - -DTITLE_BAR_FORMAT_IDLE="${TITLE_BAR_FORMAT_IDLE}" - -DTITLE_BAR_FORMAT_RUNNING="${TITLE_BAR_FORMAT_RUNNING}" - -DBUILD_TAG="${BUILD_TAG}" - -DBUILD_ID="${DISPLAY_VERSION}" - -DGIT_EXECUTABLE="${GIT_EXECUTABLE}" - -P "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake" + -DSRC_DIR=${CMAKE_SOURCE_DIR} + -DBUILD_REPOSITORY=${BUILD_REPOSITORY} + -DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE} + -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING} + -DBUILD_TAG=${BUILD_TAG} + -DBUILD_ID=${DISPLAY_VERSION} + -DGIT_EXECUTABLE=${GIT_EXECUTABLE} + -P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake DEPENDS # WARNING! It was too much work to try and make a common location for this list, # so if you need to change it, please update CMakeModules/GenerateSCMRev.cmake as well @@ -92,6 +92,7 @@ add_custom_command(OUTPUT scm_rev.cpp "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h" # technically we should regenerate if the git version changed, but its not worth the effort imo "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake" + VERBATIM ) add_library(common STATIC diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h index 14e8c35d7..f956ac9a2 100644 --- a/src/common/fs/path_util.h +++ b/src/common/fs/path_util.h @@ -209,7 +209,7 @@ void SetYuzuPath(YuzuPath yuzu_path, const std::filesystem::path& new_path); #ifdef _WIN32 template <typename Path> -[[nodiscard]] void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) { +void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) { if constexpr (IsChar<typename Path::value_type>) { SetYuzuPath(yuzu_path, ToU8String(new_path)); } else { diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 83b83a044..01ae1a567 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp @@ -150,7 +150,9 @@ void ProgramMetadata::Print() const { LOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO"); LOG_DEBUG(Service_FS, "Title ID Min: 0x{:016X}", acid_header.title_id_min); LOG_DEBUG(Service_FS, "Title ID Max: 0x{:016X}", acid_header.title_id_max); - LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", acid_file_access.permissions); + u64_le permissions_l; // local copy to fix alignment error + std::memcpy(&permissions_l, &acid_file_access.permissions, sizeof(permissions_l)); + LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", permissions_l); // Begin ACI0 printing (actual perms, unsigned) LOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data()); diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index aa7f3072f..638c6cea8 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp @@ -53,7 +53,7 @@ ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecor if (nca == nullptr) { // TODO: Find the right error code to use here - return RESULT_UNKNOWN; + return ResultUnknown; } const PatchManager patch_manager{title_id, filesystem_controller, content_provider}; @@ -74,13 +74,13 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, const std::shared_ptr<NCA> res = GetEntry(title_id, storage, type); if (res == nullptr) { // TODO(DarkLordZach): Find the right error code to use here - return RESULT_UNKNOWN; + return ResultUnknown; } const auto romfs = res->GetRomFS(); if (romfs == nullptr) { // TODO(DarkLordZach): Find the right error code to use here - return RESULT_UNKNOWN; + return ResultUnknown; } return MakeResult<VirtualFile>(romfs); diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index f973d1d21..b5254dd75 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -91,7 +91,7 @@ ResultVal<VirtualDir> SaveDataFactory::Create(SaveDataSpaceId space, // Return an error if the save data doesn't actually exist. if (out == nullptr) { // TODO(DarkLordZach): Find out correct error code. - return RESULT_UNKNOWN; + return ResultUnknown; } return MakeResult<VirtualDir>(std::move(out)); @@ -105,14 +105,14 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space, auto out = dir->GetDirectoryRelative(save_directory); - if (out == nullptr && ShouldSaveDataBeAutomaticallyCreated(space, meta)) { + if (out == nullptr && (ShouldSaveDataBeAutomaticallyCreated(space, meta) && auto_create)) { return Create(space, meta); } // Return an error if the save data doesn't actually exist. if (out == nullptr) { // TODO(Subv): Find out correct error code. - return RESULT_UNKNOWN; + return ResultUnknown; } return MakeResult<VirtualDir>(std::move(out)); @@ -199,4 +199,8 @@ void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 us size_file->WriteObject(new_value); } +void SaveDataFactory::SetAutoCreate(bool state) { + auto_create = state; +} + } // namespace FileSys diff --git a/src/core/file_sys/savedata_factory.h b/src/core/file_sys/savedata_factory.h index 86c9f5350..1d8dc981f 100644 --- a/src/core/file_sys/savedata_factory.h +++ b/src/core/file_sys/savedata_factory.h @@ -104,9 +104,12 @@ public: void WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id, SaveDataSize new_value) const; + void SetAutoCreate(bool state); + private: VirtualDir dir; Core::System& system; + bool auto_create{true}; }; } // namespace FileSys diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h index 0c5d2b3b0..7a047803e 100644 --- a/src/core/frontend/input.h +++ b/src/core/frontend/input.h @@ -27,6 +27,10 @@ struct AnalogProperties { float range; float threshold; }; +template <typename StatusType> +struct InputCallback { + std::function<void(StatusType)> on_change; +}; /// An abstract class template for an input device (a button, an analog input, etc.). template <typename StatusType> @@ -50,6 +54,17 @@ public: [[maybe_unused]] f32 freq_high) const { return {}; } + void SetCallback(InputCallback<StatusType> callback_) { + callback = std::move(callback_); + } + void TriggerOnChange() { + if (callback.on_change) { + callback.on_change(GetStatus()); + } + } + +private: + InputCallback<StatusType> callback; }; /// An abstract class template for a factory that can create input devices. diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 9d069a78f..28ed6265a 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -30,16 +30,38 @@ namespace Kernel { -SessionRequestHandler::SessionRequestHandler() = default; +SessionRequestHandler::SessionRequestHandler(KernelCore& kernel_, const char* service_name_) + : kernel{kernel_}, service_thread{kernel.CreateServiceThread(service_name_)} {} -SessionRequestHandler::~SessionRequestHandler() = default; +SessionRequestHandler::~SessionRequestHandler() { + kernel.ReleaseServiceThread(service_thread); +} + +SessionRequestManager::SessionRequestManager(KernelCore& kernel_) : kernel{kernel_} {} + +SessionRequestManager::~SessionRequestManager() = default; + +bool SessionRequestManager::HasSessionRequestHandler(const HLERequestContext& context) const { + if (IsDomain() && context.HasDomainMessageHeader()) { + const auto& message_header = context.GetDomainMessageHeader(); + const auto object_id = message_header.object_id; + + if (object_id > DomainHandlerCount()) { + LOG_CRITICAL(IPC, "object_id {} is too big!", object_id); + return false; + } + return DomainHandler(object_id - 1) != nullptr; + } else { + return session_handler != nullptr; + } +} void SessionRequestHandler::ClientConnected(KServerSession* session) { - session->SetSessionHandler(shared_from_this()); + session->ClientConnected(shared_from_this()); } void SessionRequestHandler::ClientDisconnected(KServerSession* session) { - session->SetSessionHandler(nullptr); + session->ClientDisconnected(); } HLERequestContext::HLERequestContext(KernelCore& kernel_, Core::Memory::Memory& memory_, @@ -169,12 +191,12 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const KHandleTab if (command_header->IsCloseCommand()) { // Close does not populate the rest of the IPC header - return RESULT_SUCCESS; + return ResultSuccess; } std::copy_n(src_cmdbuf, IPC::COMMAND_BUFFER_LENGTH, cmd_buf.begin()); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_thread) { @@ -216,7 +238,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_t memory.WriteBlock(owner_process, requesting_thread.GetTLSAddress(), cmd_buf.data(), write_size * sizeof(u32)); - return RESULT_SUCCESS; + return ResultSuccess; } std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index b47e363cc..a61870f8b 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -46,6 +46,7 @@ class KThread; class KReadableEvent; class KSession; class KWritableEvent; +class ServiceThread; enum class ThreadWakeupReason; @@ -56,7 +57,7 @@ enum class ThreadWakeupReason; */ class SessionRequestHandler : public std::enable_shared_from_this<SessionRequestHandler> { public: - SessionRequestHandler(); + SessionRequestHandler(KernelCore& kernel, const char* service_name_); virtual ~SessionRequestHandler(); /** @@ -83,6 +84,14 @@ public: * @param server_session ServerSession associated with the connection. */ void ClientDisconnected(KServerSession* session); + + std::weak_ptr<ServiceThread> GetServiceThread() const { + return service_thread; + } + +protected: + KernelCore& kernel; + std::weak_ptr<ServiceThread> service_thread; }; using SessionRequestHandlerPtr = std::shared_ptr<SessionRequestHandler>; @@ -94,7 +103,8 @@ using SessionRequestHandlerPtr = std::shared_ptr<SessionRequestHandler>; */ class SessionRequestManager final { public: - SessionRequestManager() = default; + explicit SessionRequestManager(KernelCore& kernel); + ~SessionRequestManager(); bool IsDomain() const { return is_domain; @@ -142,10 +152,19 @@ public: session_handler = std::move(handler); } + std::weak_ptr<ServiceThread> GetServiceThread() const { + return session_handler->GetServiceThread(); + } + + bool HasSessionRequestHandler(const HLERequestContext& context) const; + private: bool is_domain{}; SessionRequestHandlerPtr session_handler; std::vector<SessionRequestHandlerPtr> domain_handlers; + +private: + KernelCore& kernel; }; /** diff --git a/src/core/hle/kernel/k_address_arbiter.cpp b/src/core/hle/kernel/k_address_arbiter.cpp index 7018f56da..1b429bc1e 100644 --- a/src/core/hle/kernel/k_address_arbiter.cpp +++ b/src/core/hle/kernel/k_address_arbiter.cpp @@ -97,7 +97,7 @@ ResultCode KAddressArbiter::Signal(VAddr addr, s32 count) { while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) && (it->GetAddressArbiterKey() == addr)) { KThread* target_thread = std::addressof(*it); - target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS); + target_thread->SetSyncedObject(nullptr, ResultSuccess); ASSERT(target_thread->IsWaitingForAddressArbiter()); target_thread->Wakeup(); @@ -107,7 +107,7 @@ ResultCode KAddressArbiter::Signal(VAddr addr, s32 count) { ++num_waiters; } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32 count) { @@ -130,7 +130,7 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32 while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) && (it->GetAddressArbiterKey() == addr)) { KThread* target_thread = std::addressof(*it); - target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS); + target_thread->SetSyncedObject(nullptr, ResultSuccess); ASSERT(target_thread->IsWaitingForAddressArbiter()); target_thread->Wakeup(); @@ -140,7 +140,7 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32 ++num_waiters; } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 value, s32 count) { @@ -198,7 +198,7 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) && (it->GetAddressArbiterKey() == addr)) { KThread* target_thread = std::addressof(*it); - target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS); + target_thread->SetSyncedObject(nullptr, ResultSuccess); ASSERT(target_thread->IsWaitingForAddressArbiter()); target_thread->Wakeup(); @@ -208,7 +208,7 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 ++num_waiters; } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KAddressArbiter::WaitIfLessThan(VAddr addr, s32 value, bool decrement, s64 timeout) { diff --git a/src/core/hle/kernel/k_address_arbiter.h b/src/core/hle/kernel/k_address_arbiter.h index 8d379b524..bf8b46665 100644 --- a/src/core/hle/kernel/k_address_arbiter.h +++ b/src/core/hle/kernel/k_address_arbiter.h @@ -37,7 +37,7 @@ public: return SignalAndModifyByWaitingCountIfEqual(addr, value, count); } UNREACHABLE(); - return RESULT_UNKNOWN; + return ResultUnknown; } [[nodiscard]] ResultCode WaitForAddress(VAddr addr, Svc::ArbitrationType type, s32 value, @@ -51,7 +51,7 @@ public: return WaitIfEqual(addr, value, timeout); } UNREACHABLE(); - return RESULT_UNKNOWN; + return ResultUnknown; } private: diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h index bc18582be..88a052f65 100644 --- a/src/core/hle/kernel/k_auto_object.h +++ b/src/core/hle/kernel/k_auto_object.h @@ -7,10 +7,11 @@ #include <atomic> #include <string> +#include <boost/intrusive/rbtree.hpp> + #include "common/assert.h" #include "common/common_funcs.h" #include "common/common_types.h" -#include "common/intrusive_red_black_tree.h" #include "core/hle/kernel/k_class_token.h" namespace Kernel { @@ -175,7 +176,7 @@ private: class KAutoObjectWithListContainer; -class KAutoObjectWithList : public KAutoObject { +class KAutoObjectWithList : public KAutoObject, public boost::intrusive::set_base_hook<> { public: explicit KAutoObjectWithList(KernelCore& kernel_) : KAutoObject(kernel_) {} @@ -192,6 +193,10 @@ public: } } + friend bool operator<(const KAutoObjectWithList& left, const KAutoObjectWithList& right) { + return &left < &right; + } + public: virtual u64 GetId() const { return reinterpret_cast<u64>(this); @@ -203,8 +208,6 @@ public: private: friend class KAutoObjectWithListContainer; - - Common::IntrusiveRedBlackTreeNode list_node; }; template <typename T> diff --git a/src/core/hle/kernel/k_auto_object_container.cpp b/src/core/hle/kernel/k_auto_object_container.cpp index fc0c28874..010006bb7 100644 --- a/src/core/hle/kernel/k_auto_object_container.cpp +++ b/src/core/hle/kernel/k_auto_object_container.cpp @@ -9,13 +9,13 @@ namespace Kernel { void KAutoObjectWithListContainer::Register(KAutoObjectWithList* obj) { KScopedLightLock lk(m_lock); - m_object_list.insert(*obj); + m_object_list.insert_unique(*obj); } void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) { KScopedLightLock lk(m_lock); - m_object_list.erase(m_object_list.iterator_to(*obj)); + m_object_list.erase(*obj); } size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) { diff --git a/src/core/hle/kernel/k_auto_object_container.h b/src/core/hle/kernel/k_auto_object_container.h index ff40cf5a7..459953450 100644 --- a/src/core/hle/kernel/k_auto_object_container.h +++ b/src/core/hle/kernel/k_auto_object_container.h @@ -6,6 +6,8 @@ #include <atomic> +#include <boost/intrusive/rbtree.hpp> + #include "common/assert.h" #include "common/common_funcs.h" #include "common/common_types.h" @@ -23,8 +25,7 @@ class KAutoObjectWithListContainer { YUZU_NON_MOVEABLE(KAutoObjectWithListContainer); public: - using ListType = Common::IntrusiveRedBlackTreeMemberTraits< - &KAutoObjectWithList::list_node>::TreeType<KAutoObjectWithList>; + using ListType = boost::intrusive::rbtree<KAutoObjectWithList>; public: class ListAccessor : public KScopedLightLock { diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp index 4a12dee10..ef168fe87 100644 --- a/src/core/hle/kernel/k_client_port.cpp +++ b/src/core/hle/kernel/k_client_port.cpp @@ -16,11 +16,11 @@ namespace Kernel { KClientPort::KClientPort(KernelCore& kernel_) : KSynchronizationObject{kernel_} {} KClientPort::~KClientPort() = default; -void KClientPort::Initialize(KPort* parent_, s32 max_sessions_, std::string&& name_) { +void KClientPort::Initialize(KPort* parent_port_, s32 max_sessions_, std::string&& name_) { // Set member variables. num_sessions = 0; peak_sessions = 0; - parent = parent_; + parent = parent_port_; max_sessions = max_sessions_; name = std::move(name_); } @@ -28,6 +28,9 @@ void KClientPort::Initialize(KPort* parent_, s32 max_sessions_, std::string&& na void KClientPort::OnSessionFinalized() { KScopedSchedulerLock sl{kernel}; + // This might happen if a session was improperly used with this port. + ASSERT_MSG(num_sessions > 0, "num_sessions is invalid"); + const auto prev = num_sessions--; if (prev == max_sessions) { this->NotifyAvailable(); @@ -56,7 +59,8 @@ bool KClientPort::IsSignaled() const { return num_sessions < max_sessions; } -ResultCode KClientPort::CreateSession(KClientSession** out) { +ResultCode KClientPort::CreateSession(KClientSession** out, + std::shared_ptr<SessionRequestManager> session_manager) { // Reserve a new session from the resource limit. KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(), LimitableResource::Sessions); @@ -65,7 +69,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) { // Update the session counts. { // Atomically increment the number of sessions. - s32 new_sessions; + s32 new_sessions{}; { const auto max = max_sessions; auto cur_sessions = num_sessions.load(std::memory_order_acquire); @@ -101,7 +105,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) { } // Initialize the session. - session->Initialize(this, parent->GetName()); + session->Initialize(this, parent->GetName(), session_manager); // Commit the session reservation. session_reservation.Commit(); @@ -119,7 +123,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) { // We succeeded, so set the output. session_guard.Cancel(); *out = std::addressof(session->GetClientSession()); - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Kernel diff --git a/src/core/hle/kernel/k_client_port.h b/src/core/hle/kernel/k_client_port.h index f2fff3b01..54bb05e20 100644 --- a/src/core/hle/kernel/k_client_port.h +++ b/src/core/hle/kernel/k_client_port.h @@ -16,6 +16,7 @@ namespace Kernel { class KClientSession; class KernelCore; class KPort; +class SessionRequestManager; class KClientPort final : public KSynchronizationObject { KERNEL_AUTOOBJECT_TRAITS(KClientPort, KSynchronizationObject); @@ -52,7 +53,8 @@ public: void Destroy() override; bool IsSignaled() const override; - ResultCode CreateSession(KClientSession** out); + ResultCode CreateSession(KClientSession** out, + std::shared_ptr<SessionRequestManager> session_manager = nullptr); private: std::atomic<s32> num_sessions{}; diff --git a/src/core/hle/kernel/k_client_session.h b/src/core/hle/kernel/k_client_session.h index b11d5b4e3..230e3b6b8 100644 --- a/src/core/hle/kernel/k_client_session.h +++ b/src/core/hle/kernel/k_client_session.h @@ -36,9 +36,9 @@ public: explicit KClientSession(KernelCore& kernel_); ~KClientSession() override; - void Initialize(KSession* parent_, std::string&& name_) { + void Initialize(KSession* parent_session_, std::string&& name_) { // Set member variables. - parent = parent_; + parent = parent_session_; name = std::move(name_); } diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp index ce3bade60..ef14ad1d2 100644 --- a/src/core/hle/kernel/k_condition_variable.cpp +++ b/src/core/hle/kernel/k_condition_variable.cpp @@ -86,7 +86,7 @@ ResultCode KConditionVariable::SignalToAddress(VAddr addr) { next_value |= Svc::HandleWaitMask; } - next_owner_thread->SetSyncedObject(nullptr, RESULT_SUCCESS); + next_owner_thread->SetSyncedObject(nullptr, ResultSuccess); next_owner_thread->Wakeup(); } @@ -100,7 +100,7 @@ ResultCode KConditionVariable::SignalToAddress(VAddr addr) { } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 value) { @@ -112,7 +112,7 @@ ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 val ASSERT(owner_thread.IsNull()); { KScopedSchedulerLock sl(kernel); - cur_thread->SetSyncedObject(nullptr, RESULT_SUCCESS); + cur_thread->SetSyncedObject(nullptr, ResultSuccess); // Check if the thread should terminate. R_UNLESS(!cur_thread->IsTerminationRequested(), ResultTerminationRequested); @@ -124,7 +124,7 @@ ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 val ResultInvalidCurrentMemory); // If the tag isn't the handle (with wait mask), we're done. - R_UNLESS(test_tag == (handle | Svc::HandleWaitMask), RESULT_SUCCESS); + R_UNLESS(test_tag == (handle | Svc::HandleWaitMask), ResultSuccess); // Get the lock owner thread. owner_thread = @@ -181,7 +181,7 @@ KThread* KConditionVariable::SignalImpl(KThread* thread) { if (can_access) { if (prev_tag == Svc::InvalidHandle) { // If nobody held the lock previously, we're all good. - thread->SetSyncedObject(nullptr, RESULT_SUCCESS); + thread->SetSyncedObject(nullptr, ResultSuccess); thread->Wakeup(); } else { // Get the previous owner. @@ -292,7 +292,7 @@ ResultCode KConditionVariable::Wait(VAddr addr, u64 key, u32 value, s64 timeout) } // Wake up the next owner. - next_owner_thread->SetSyncedObject(nullptr, RESULT_SUCCESS); + next_owner_thread->SetSyncedObject(nullptr, ResultSuccess); next_owner_thread->Wakeup(); } diff --git a/src/core/hle/kernel/k_handle_table.cpp b/src/core/hle/kernel/k_handle_table.cpp index 0378447f6..6a420d5b0 100644 --- a/src/core/hle/kernel/k_handle_table.cpp +++ b/src/core/hle/kernel/k_handle_table.cpp @@ -25,7 +25,7 @@ ResultCode KHandleTable::Finalize() { } } - return RESULT_SUCCESS; + return ResultSuccess; } bool KHandleTable::Remove(Handle handle) { @@ -79,7 +79,7 @@ ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) { *out_handle = EncodeHandle(static_cast<u16>(index), linear_id); } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KHandleTable::Reserve(Handle* out_handle) { @@ -89,7 +89,7 @@ ResultCode KHandleTable::Reserve(Handle* out_handle) { R_UNLESS(m_count < m_table_size, ResultOutOfHandles); *out_handle = EncodeHandle(static_cast<u16>(this->AllocateEntry()), this->AllocateLinearId()); - return RESULT_SUCCESS; + return ResultSuccess; } void KHandleTable::Unreserve(Handle handle) { diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h index ba9dd061d..2ff6aa160 100644 --- a/src/core/hle/kernel/k_handle_table.h +++ b/src/core/hle/kernel/k_handle_table.h @@ -50,7 +50,7 @@ public: m_free_head_index = i; } - return RESULT_SUCCESS; + return ResultSuccess; } size_t GetTableSize() const { diff --git a/src/core/hle/kernel/k_memory_manager.cpp b/src/core/hle/kernel/k_memory_manager.cpp index aa71697b2..0166df0a5 100644 --- a/src/core/hle/kernel/k_memory_manager.cpp +++ b/src/core/hle/kernel/k_memory_manager.cpp @@ -86,7 +86,7 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_ // Early return if we're allocating no pages if (num_pages == 0) { - return RESULT_SUCCESS; + return ResultSuccess; } // Lock the pool that we're allocating from @@ -146,14 +146,14 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_ // We succeeded! group_guard.Cancel(); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KMemoryManager::Free(KPageLinkedList& page_list, std::size_t num_pages, Pool pool, Direction dir) { // Early return if we're freeing no pages if (!num_pages) { - return RESULT_SUCCESS; + return ResultSuccess; } // Lock the pool that we're freeing from @@ -170,7 +170,7 @@ ResultCode KMemoryManager::Free(KPageLinkedList& page_list, std::size_t num_page chosen_manager.Free(it.GetAddress(), min_num_pages); } - return RESULT_SUCCESS; + return ResultSuccess; } std::size_t KMemoryManager::Impl::CalculateManagementOverheadSize(std::size_t region_size) { diff --git a/src/core/hle/kernel/k_page_linked_list.h b/src/core/hle/kernel/k_page_linked_list.h index dfdac5321..3362fb236 100644 --- a/src/core/hle/kernel/k_page_linked_list.h +++ b/src/core/hle/kernel/k_page_linked_list.h @@ -71,7 +71,7 @@ public: ResultCode AddBlock(u64 address, u64 num_pages) { if (!num_pages) { - return RESULT_SUCCESS; + return ResultSuccess; } if (!nodes.empty()) { const auto node = nodes.back(); @@ -82,7 +82,7 @@ public: } } nodes.push_back({address, num_pages}); - return RESULT_SUCCESS; + return ResultSuccess; } private: diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index 27dbf0ebc..66d260635 100644 --- a/src/core/hle/kernel/k_page_table.cpp +++ b/src/core/hle/kernel/k_page_table.cpp @@ -292,7 +292,7 @@ ResultCode KPageTable::MapProcessCode(VAddr addr, std::size_t num_pages, KMemory block_manager->Update(addr, num_pages, state, perm); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) { @@ -329,14 +329,14 @@ ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std: KMemoryAttribute::Locked); block_manager->Update(dst_addr, num_pages, KMemoryState::AliasCode); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) { std::lock_guard lock{page_table_lock}; if (!size) { - return RESULT_SUCCESS; + return ResultSuccess; } const std::size_t num_pages{size / PageSize}; @@ -360,7 +360,7 @@ ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, st block_manager->Update(src_addr, num_pages, KMemoryState::Normal, KMemoryPermission::ReadAndWrite); - return RESULT_SUCCESS; + return ResultSuccess; } void KPageTable::MapPhysicalMemory(KPageLinkedList& page_linked_list, VAddr start, VAddr end) { @@ -408,7 +408,7 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) { }); if (mapped_size == size) { - return RESULT_SUCCESS; + return ResultSuccess; } const std::size_t remaining_size{size - mapped_size}; @@ -440,14 +440,14 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) { KMemoryAttribute::None, KMemoryState::Normal, KMemoryPermission::ReadAndWrite, KMemoryAttribute::None); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) { std::lock_guard lock{page_table_lock}; const VAddr end_addr{addr + size}; - ResultCode result{RESULT_SUCCESS}; + ResultCode result{ResultSuccess}; std::size_t mapped_size{}; // Verify that the region can be unmapped @@ -468,7 +468,7 @@ ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) { } if (!mapped_size) { - return RESULT_SUCCESS; + return ResultSuccess; } CASCADE_CODE(UnmapMemory(addr, size)); @@ -477,14 +477,14 @@ ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) { process->GetResourceLimit()->Release(LimitableResource::PhysicalMemory, mapped_size); physical_memory_usage -= mapped_size; - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::UnmapMemory(VAddr addr, std::size_t size) { std::lock_guard lock{page_table_lock}; const VAddr end_addr{addr + size}; - ResultCode result{RESULT_SUCCESS}; + ResultCode result{ResultSuccess}; KPageLinkedList page_linked_list; // Unmap each region within the range @@ -513,7 +513,7 @@ ResultCode KPageTable::UnmapMemory(VAddr addr, std::size_t size) { block_manager->Update(addr, num_pages, KMemoryState::Free); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::Map(VAddr dst_addr, VAddr src_addr, std::size_t size) { @@ -552,7 +552,7 @@ ResultCode KPageTable::Map(VAddr dst_addr, VAddr src_addr, std::size_t size) { block_manager->Update(dst_addr, num_pages, KMemoryState::Stack, KMemoryPermission::ReadAndWrite); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::Unmap(VAddr dst_addr, VAddr src_addr, std::size_t size) { @@ -594,7 +594,7 @@ ResultCode KPageTable::Unmap(VAddr dst_addr, VAddr src_addr, std::size_t size) { block_manager->Update(src_addr, num_pages, src_state, KMemoryPermission::ReadAndWrite); block_manager->Update(dst_addr, num_pages, KMemoryState::Free); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::MapPages(VAddr addr, const KPageLinkedList& page_linked_list, @@ -616,7 +616,7 @@ ResultCode KPageTable::MapPages(VAddr addr, const KPageLinkedList& page_linked_l cur_addr += node.GetNumPages() * PageSize; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::MapPages(VAddr addr, KPageLinkedList& page_linked_list, KMemoryState state, @@ -638,7 +638,7 @@ ResultCode KPageTable::MapPages(VAddr addr, KPageLinkedList& page_linked_list, K block_manager->Update(addr, num_pages, state, perm); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::UnmapPages(VAddr addr, const KPageLinkedList& page_linked_list) { @@ -655,7 +655,7 @@ ResultCode KPageTable::UnmapPages(VAddr addr, const KPageLinkedList& page_linked cur_addr += node.GetNumPages() * PageSize; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::UnmapPages(VAddr addr, KPageLinkedList& page_linked_list, @@ -677,7 +677,7 @@ ResultCode KPageTable::UnmapPages(VAddr addr, KPageLinkedList& page_linked_list, block_manager->Update(addr, num_pages, state, KMemoryPermission::None); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size, @@ -708,7 +708,7 @@ ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size, // Return early if there is nothing to change if (state == prev_state && perm == prev_perm) { - return RESULT_SUCCESS; + return ResultSuccess; } if ((prev_perm & KMemoryPermission::Execute) != (perm & KMemoryPermission::Execute)) { @@ -725,7 +725,7 @@ ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size, block_manager->Update(addr, num_pages, state, perm); - return RESULT_SUCCESS; + return ResultSuccess; } KMemoryInfo KPageTable::QueryInfoImpl(VAddr addr) { @@ -758,7 +758,7 @@ ResultCode KPageTable::ReserveTransferMemory(VAddr addr, std::size_t size, KMemo block_manager->Update(addr, size / PageSize, state, perm, attribute | KMemoryAttribute::Locked); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::ResetTransferMemory(VAddr addr, std::size_t size) { @@ -775,7 +775,7 @@ ResultCode KPageTable::ResetTransferMemory(VAddr addr, std::size_t size) { block_manager->Update(addr, size / PageSize, state, KMemoryPermission::ReadAndWrite); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::SetMemoryAttribute(VAddr addr, std::size_t size, KMemoryAttribute mask, @@ -797,13 +797,13 @@ ResultCode KPageTable::SetMemoryAttribute(VAddr addr, std::size_t size, KMemoryA block_manager->Update(addr, size / PageSize, state, perm, attribute); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::SetHeapCapacity(std::size_t new_heap_capacity) { std::lock_guard lock{page_table_lock}; heap_capacity = new_heap_capacity; - return RESULT_SUCCESS; + return ResultSuccess; } ResultVal<VAddr> KPageTable::SetHeapSize(std::size_t size) { @@ -911,7 +911,7 @@ ResultCode KPageTable::LockForDeviceAddressSpace(VAddr addr, std::size_t size) { }, perm); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size) { @@ -934,13 +934,13 @@ ResultCode KPageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size) }, perm); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::InitializeMemoryLayout(VAddr start, VAddr end) { block_manager = std::make_unique<KMemoryBlockManager>(start, end); - return RESULT_SUCCESS; + return ResultSuccess; } bool KPageTable::IsRegionMapped(VAddr address, u64 size) { @@ -1006,7 +1006,7 @@ ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, const KPageLin addr += size; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, KMemoryPermission perm, @@ -1033,7 +1033,7 @@ ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, KMemoryPermiss default: UNREACHABLE(); } - return RESULT_SUCCESS; + return ResultSuccess; } constexpr VAddr KPageTable::GetRegionAddress(KMemoryState state) const { @@ -1164,7 +1164,7 @@ constexpr ResultCode KPageTable::CheckMemoryState(const KMemoryInfo& info, KMemo return ResultInvalidCurrentMemory; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KPageTable::CheckMemoryState(KMemoryState* out_state, KMemoryPermission* out_perm, @@ -1223,7 +1223,7 @@ ResultCode KPageTable::CheckMemoryState(KMemoryState* out_state, KMemoryPermissi *out_attr = first_attr & static_cast<KMemoryAttribute>(~ignore_attr); } - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Kernel diff --git a/src/core/hle/kernel/k_port.cpp b/src/core/hle/kernel/k_port.cpp index 223c0b205..a8ba09c4a 100644 --- a/src/core/hle/kernel/k_port.cpp +++ b/src/core/hle/kernel/k_port.cpp @@ -59,7 +59,7 @@ ResultCode KPort::EnqueueSession(KServerSession* session) { server.EnqueueSession(session); server.GetSessionRequestHandler()->ClientConnected(server.AcceptSession()); - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Kernel diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index bdcbaeeaa..06b8ce151 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -142,7 +142,7 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st // Open a reference to the resource limit. process->resource_limit->Open(); - return RESULT_SUCCESS; + return ResultSuccess; } KResourceLimit* KProcess::GetResourceLimit() const { @@ -258,7 +258,7 @@ ResultCode KProcess::AddSharedMemory(KSharedMemory* shmem, [[maybe_unused]] VAdd // Open a reference to the shared memory. shmem->Open(); - return RESULT_SUCCESS; + return ResultSuccess; } void KProcess::RemoveSharedMemory(KSharedMemory* shmem, [[maybe_unused]] VAddr address, @@ -291,7 +291,7 @@ ResultCode KProcess::Reset() { // Clear signaled. is_signaled = false; - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, @@ -524,7 +524,7 @@ ResultCode KProcess::AllocateMainThreadStack(std::size_t stack_size) { main_thread_stack_top += main_thread_stack_size; - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Kernel diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h index c0656b9af..a03c074fb 100644 --- a/src/core/hle/kernel/k_process.h +++ b/src/core/hle/kernel/k_process.h @@ -310,7 +310,7 @@ public: * * @param metadata The provided metadata to load process specific info from. * - * @returns RESULT_SUCCESS if all relevant metadata was able to be + * @returns ResultSuccess if all relevant metadata was able to be * loaded and parsed. Otherwise, an error code is returned. */ ResultCode LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size); diff --git a/src/core/hle/kernel/k_readable_event.cpp b/src/core/hle/kernel/k_readable_event.cpp index 0ea2d0275..bf1db10d4 100644 --- a/src/core/hle/kernel/k_readable_event.cpp +++ b/src/core/hle/kernel/k_readable_event.cpp @@ -36,13 +36,13 @@ ResultCode KReadableEvent::Signal() { NotifyAvailable(); } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KReadableEvent::Clear() { Reset(); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KReadableEvent::Reset() { @@ -53,7 +53,7 @@ ResultCode KReadableEvent::Reset() { } is_signaled = false; - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Kernel diff --git a/src/core/hle/kernel/k_readable_event.h b/src/core/hle/kernel/k_readable_event.h index b2850ac7b..149fa78dd 100644 --- a/src/core/hle/kernel/k_readable_event.h +++ b/src/core/hle/kernel/k_readable_event.h @@ -21,9 +21,9 @@ public: explicit KReadableEvent(KernelCore& kernel_); ~KReadableEvent() override; - void Initialize(KEvent* parent_, std::string&& name_) { + void Initialize(KEvent* parent_event_, std::string&& name_) { is_signaled = false; - parent = parent_; + parent = parent_event_; name = std::move(name_); } diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp index bf20bf7d0..f91cb65dc 100644 --- a/src/core/hle/kernel/k_resource_limit.cpp +++ b/src/core/hle/kernel/k_resource_limit.cpp @@ -80,7 +80,7 @@ ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) { limit_values[index] = value; - return RESULT_SUCCESS; + return ResultSuccess; } bool KResourceLimit::Reserve(LimitableResource which, s64 value) { diff --git a/src/core/hle/kernel/k_server_port.cpp b/src/core/hle/kernel/k_server_port.cpp index 8cbde177a..c5dc58387 100644 --- a/src/core/hle/kernel/k_server_port.cpp +++ b/src/core/hle/kernel/k_server_port.cpp @@ -17,9 +17,9 @@ namespace Kernel { KServerPort::KServerPort(KernelCore& kernel_) : KSynchronizationObject{kernel_} {} KServerPort::~KServerPort() = default; -void KServerPort::Initialize(KPort* parent_, std::string&& name_) { +void KServerPort::Initialize(KPort* parent_port_, std::string&& name_) { // Set member variables. - parent = parent_; + parent = parent_port_; name = std::move(name_); } diff --git a/src/core/hle/kernel/k_server_port.h b/src/core/hle/kernel/k_server_port.h index 55481d63f..67a36da40 100644 --- a/src/core/hle/kernel/k_server_port.h +++ b/src/core/hle/kernel/k_server_port.h @@ -29,7 +29,7 @@ public: explicit KServerPort(KernelCore& kernel_); ~KServerPort() override; - void Initialize(KPort* parent_, std::string&& name_); + void Initialize(KPort* parent_port_, std::string&& name_); /// Whether or not this server port has an HLE handler available. bool HasSessionRequestHandler() const { diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp index 457fdfd60..5c3c13ce6 100644 --- a/src/core/hle/kernel/k_server_session.cpp +++ b/src/core/hle/kernel/k_server_session.cpp @@ -8,13 +8,16 @@ #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" +#include "common/scope_exit.h" #include "core/core_timing.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/k_client_port.h" #include "core/hle/kernel/k_handle_table.h" +#include "core/hle/kernel/k_port.h" #include "core/hle/kernel/k_process.h" #include "core/hle/kernel/k_scheduler.h" +#include "core/hle/kernel/k_server_port.h" #include "core/hle/kernel/k_server_session.h" #include "core/hle/kernel/k_session.h" #include "core/hle/kernel/k_thread.h" @@ -23,18 +26,21 @@ namespace Kernel { -KServerSession::KServerSession(KernelCore& kernel_) - : KSynchronizationObject{kernel_}, manager{std::make_shared<SessionRequestManager>()} {} +KServerSession::KServerSession(KernelCore& kernel_) : KSynchronizationObject{kernel_} {} -KServerSession::~KServerSession() { - kernel.ReleaseServiceThread(service_thread); -} +KServerSession::~KServerSession() {} -void KServerSession::Initialize(KSession* parent_, std::string&& name_) { +void KServerSession::Initialize(KSession* parent_session_, std::string&& name_, + std::shared_ptr<SessionRequestManager> manager_) { // Set member variables. - parent = parent_; + parent = parent_session_; name = std::move(name_); - service_thread = kernel.CreateServiceThread(name); + + if (manager_) { + manager = manager_; + } else { + manager = std::make_shared<SessionRequestManager>(kernel); + } } void KServerSession::Destroy() { @@ -71,7 +77,7 @@ std::size_t KServerSession::NumDomainRequestHandlers() const { ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) { if (!context.HasDomainMessageHeader()) { - return RESULT_SUCCESS; + return ResultSuccess; } // Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs @@ -88,7 +94,7 @@ ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& co "to {} needed to return a new interface!", object_id, name); UNREACHABLE(); - return RESULT_SUCCESS; // Ignore error if asserts are off + return ResultSuccess; // Ignore error if asserts are off } return manager->DomainHandler(object_id - 1)->HandleSyncRequest(*this, context); @@ -98,14 +104,14 @@ ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& co manager->CloseDomainHandler(object_id - 1); IPC::ResponseBuilder rb{context, 2}; - rb.Push(RESULT_SUCCESS); - return RESULT_SUCCESS; + rb.Push(ResultSuccess); + return ResultSuccess; } } LOG_CRITICAL(IPC, "Unknown domain command={}", domain_message_header.command.Value()); ASSERT(false); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KServerSession::QueueSyncRequest(KThread* thread, Core::Memory::Memory& memory) { @@ -114,23 +120,46 @@ ResultCode KServerSession::QueueSyncRequest(KThread* thread, Core::Memory::Memor context->PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf); - if (auto strong_ptr = service_thread.lock()) { - strong_ptr->QueueSyncRequest(*parent, std::move(context)); - return RESULT_SUCCESS; + // In the event that something fails here, stub a result to prevent the game from crashing. + // This is a work-around in the event that somehow we process a service request after the + // session has been closed by the game. This has been observed to happen rarely in Pokemon + // Sword/Shield and is likely a result of us using host threads/scheduling for services. + // TODO(bunnei): Find a better solution here. + auto error_guard = SCOPE_GUARD({ CompleteSyncRequest(*context); }); + + // Ensure we have a session request handler + if (manager->HasSessionRequestHandler(*context)) { + if (auto strong_ptr = manager->GetServiceThread().lock()) { + strong_ptr->QueueSyncRequest(*parent, std::move(context)); + + // We succeeded. + error_guard.Cancel(); + } else { + ASSERT_MSG(false, "strong_ptr is nullptr!"); + } + } else { + ASSERT_MSG(false, "handler is invalid!"); } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KServerSession::CompleteSyncRequest(HLERequestContext& context) { - ResultCode result = RESULT_SUCCESS; + ResultCode result = ResultSuccess; + // If the session has been converted to a domain, handle the domain request - if (IsDomain() && context.HasDomainMessageHeader()) { - result = HandleDomainSyncRequest(context); - // If there is no domain header, the regular session handler is used - } else if (manager->HasSessionHandler()) { - // If this ServerSession has an associated HLE handler, forward the request to it. - result = manager->SessionHandler().HandleSyncRequest(*this, context); + if (manager->HasSessionRequestHandler(context)) { + if (IsDomain() && context.HasDomainMessageHeader()) { + result = HandleDomainSyncRequest(context); + // If there is no domain header, the regular session handler is used + } else if (manager->HasSessionHandler()) { + // If this ServerSession has an associated HLE handler, forward the request to it. + result = manager->SessionHandler().HandleSyncRequest(*this, context); + } + } else { + ASSERT_MSG(false, "Session handler is invalid, stubbing response!"); + IPC::ResponseBuilder rb(context, 2); + rb.Push(ResultSuccess); } if (convert_to_domain) { diff --git a/src/core/hle/kernel/k_server_session.h b/src/core/hle/kernel/k_server_session.h index 27b757ad2..d44bc9d4f 100644 --- a/src/core/hle/kernel/k_server_session.h +++ b/src/core/hle/kernel/k_server_session.h @@ -32,6 +32,7 @@ class HLERequestContext; class KernelCore; class KSession; class SessionRequestHandler; +class SessionRequestManager; class KThread; class KServerSession final : public KSynchronizationObject, @@ -46,7 +47,8 @@ public: void Destroy() override; - void Initialize(KSession* parent_, std::string&& name_); + void Initialize(KSession* parent_session_, std::string&& name_, + std::shared_ptr<SessionRequestManager> manager_); KSession* GetParent() { return parent; @@ -60,15 +62,14 @@ public: void OnClientClosed(); - /** - * Sets the HLE handler for the session. This handler will be called to service IPC requests - * instead of the regular IPC machinery. (The regular IPC machinery is currently not - * implemented.) - */ - void SetSessionHandler(SessionRequestHandlerPtr handler) { + void ClientConnected(SessionRequestHandlerPtr handler) { manager->SetSessionHandler(std::move(handler)); } + void ClientDisconnected() { + manager = nullptr; + } + /** * Handle a sync request from the emulated application. * @@ -104,16 +105,6 @@ public: return manager; } - /// Gets the session request manager, which forwards requests to the underlying service - const std::shared_ptr<SessionRequestManager>& GetSessionRequestManager() const { - return manager; - } - - /// Sets the session request manager, which forwards requests to the underlying service - void SetSessionRequestManager(std::shared_ptr<SessionRequestManager> manager_) { - manager = std::move(manager_); - } - private: /// Queues a sync request from the emulated application. ResultCode QueueSyncRequest(KThread* thread, Core::Memory::Memory& memory); @@ -131,9 +122,6 @@ private: /// When set to True, converts the session to a domain at the end of the command bool convert_to_domain{}; - /// Thread to dispatch service requests - std::weak_ptr<ServiceThread> service_thread; - /// KSession that owns this KServerSession KSession* parent{}; }; diff --git a/src/core/hle/kernel/k_session.cpp b/src/core/hle/kernel/k_session.cpp index 025b8b555..940878e03 100644 --- a/src/core/hle/kernel/k_session.cpp +++ b/src/core/hle/kernel/k_session.cpp @@ -15,7 +15,8 @@ KSession::KSession(KernelCore& kernel_) : KAutoObjectWithSlabHeapAndContainer{kernel_}, server{kernel_}, client{kernel_} {} KSession::~KSession() = default; -void KSession::Initialize(KClientPort* port_, const std::string& name_) { +void KSession::Initialize(KClientPort* port_, const std::string& name_, + std::shared_ptr<SessionRequestManager> manager_) { // Increment reference count. // Because reference count is one on creation, this will result // in a reference count of two. Thus, when both server and client are closed @@ -27,7 +28,7 @@ void KSession::Initialize(KClientPort* port_, const std::string& name_) { KAutoObject::Create(std::addressof(client)); // Initialize our sub sessions. - server.Initialize(this, name_ + ":Server"); + server.Initialize(this, name_ + ":Server", manager_); client.Initialize(this, name_ + ":Client"); // Set state and name. diff --git a/src/core/hle/kernel/k_session.h b/src/core/hle/kernel/k_session.h index 4ddd080d2..62c328a68 100644 --- a/src/core/hle/kernel/k_session.h +++ b/src/core/hle/kernel/k_session.h @@ -13,6 +13,8 @@ namespace Kernel { +class SessionRequestManager; + class KSession final : public KAutoObjectWithSlabHeapAndContainer<KSession, KAutoObjectWithList> { KERNEL_AUTOOBJECT_TRAITS(KSession, KAutoObject); @@ -20,7 +22,8 @@ public: explicit KSession(KernelCore& kernel_); ~KSession() override; - void Initialize(KClientPort* port_, const std::string& name_); + void Initialize(KClientPort* port_, const std::string& name_, + std::shared_ptr<SessionRequestManager> manager_ = nullptr); void Finalize() override; diff --git a/src/core/hle/kernel/k_shared_memory.cpp b/src/core/hle/kernel/k_shared_memory.cpp index 7770b1868..51d7538ca 100644 --- a/src/core/hle/kernel/k_shared_memory.cpp +++ b/src/core/hle/kernel/k_shared_memory.cpp @@ -55,7 +55,7 @@ ResultCode KSharedMemory::Initialize(Core::DeviceMemory& device_memory_, KProces // Clear all pages in the memory. std::memset(device_memory_.GetPointer(physical_address_), 0, size_); - return RESULT_SUCCESS; + return ResultSuccess; } void KSharedMemory::Finalize() { diff --git a/src/core/hle/kernel/k_synchronization_object.cpp b/src/core/hle/kernel/k_synchronization_object.cpp index 45380dea0..f168b4f21 100644 --- a/src/core/hle/kernel/k_synchronization_object.cpp +++ b/src/core/hle/kernel/k_synchronization_object.cpp @@ -38,7 +38,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index, if (objects[i]->IsSignaled()) { *out_index = i; slp.CancelSleep(); - return RESULT_SUCCESS; + return ResultSuccess; } } @@ -97,7 +97,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index, kernel_ctx.TimeManager().UnscheduleTimeEvent(thread); // Get the wait result. - ResultCode wait_result{RESULT_SUCCESS}; + ResultCode wait_result{ResultSuccess}; s32 sync_index = -1; { KScopedSchedulerLock lock(kernel_ctx); diff --git a/src/core/hle/kernel/k_synchronization_object.h b/src/core/hle/kernel/k_synchronization_object.h index 3d4ce1fbc..898e58e16 100644 --- a/src/core/hle/kernel/k_synchronization_object.h +++ b/src/core/hle/kernel/k_synchronization_object.h @@ -43,7 +43,7 @@ protected: void NotifyAvailable(ResultCode result); void NotifyAvailable() { - return this->NotifyAvailable(RESULT_SUCCESS); + return this->NotifyAvailable(ResultSuccess); } private: diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 3cf43d290..9f1d3156b 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp @@ -205,7 +205,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg, @@ -219,7 +219,7 @@ ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uint thread->host_context = std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KThread::InitializeDummyThread(KThread* thread) { @@ -460,7 +460,7 @@ ResultCode KThread::GetCoreMask(s32* out_ideal_core, u64* out_affinity_mask) { *out_ideal_core = virtual_ideal_core_id; *out_affinity_mask = virtual_affinity_mask; - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KThread::GetPhysicalCoreMask(s32* out_ideal_core, u64* out_affinity_mask) { @@ -476,7 +476,7 @@ ResultCode KThread::GetPhysicalCoreMask(s32* out_ideal_core, u64* out_affinity_m *out_affinity_mask = original_physical_affinity_mask.GetAffinityMask(); } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KThread::SetCoreMask(s32 cpu_core_id, u64 v_affinity_mask) { @@ -599,7 +599,7 @@ ResultCode KThread::SetCoreMask(s32 cpu_core_id, u64 v_affinity_mask) { } } - return RESULT_SUCCESS; + return ResultSuccess; } void KThread::SetBasePriority(s32 value) { @@ -778,7 +778,7 @@ ResultCode KThread::SetActivity(Svc::ThreadActivity activity) { } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode KThread::GetThreadContext3(std::vector<u8>& out) { @@ -813,7 +813,7 @@ ResultCode KThread::GetThreadContext3(std::vector<u8>& out) { } } - return RESULT_SUCCESS; + return ResultSuccess; } void KThread::AddWaiterImpl(KThread* thread) { @@ -970,7 +970,7 @@ ResultCode KThread::Run() { // Set our state and finish. SetState(ThreadState::Runnable); - return RESULT_SUCCESS; + return ResultSuccess; } } @@ -1020,7 +1020,7 @@ ResultCode KThread::Sleep(s64 timeout) { // Cancel the timer. kernel.TimeManager().UnscheduleTimeEvent(this); - return RESULT_SUCCESS; + return ResultSuccess; } void KThread::SetState(ThreadState state) { diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 01eebb165..c77f44ad4 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -684,7 +684,7 @@ private: u32 address_key_value{}; u32 suspend_request_flags{}; u32 suspend_allowed_flags{}; - ResultCode wait_result{RESULT_SUCCESS}; + ResultCode wait_result{ResultSuccess}; s32 base_priority{}; s32 physical_ideal_core_id{}; s32 virtual_ideal_core_id{}; diff --git a/src/core/hle/kernel/k_transfer_memory.cpp b/src/core/hle/kernel/k_transfer_memory.cpp index 5bc33706d..1732925c9 100644 --- a/src/core/hle/kernel/k_transfer_memory.cpp +++ b/src/core/hle/kernel/k_transfer_memory.cpp @@ -28,7 +28,7 @@ ResultCode KTransferMemory::Initialize(VAddr address_, std::size_t size_, size = size_; is_initialized = true; - return RESULT_SUCCESS; + return ResultSuccess; } void KTransferMemory::Finalize() { diff --git a/src/core/hle/kernel/k_writable_event.cpp b/src/core/hle/kernel/k_writable_event.cpp index b7b83c151..bdb1db6d5 100644 --- a/src/core/hle/kernel/k_writable_event.cpp +++ b/src/core/hle/kernel/k_writable_event.cpp @@ -13,8 +13,8 @@ KWritableEvent::KWritableEvent(KernelCore& kernel_) KWritableEvent::~KWritableEvent() = default; -void KWritableEvent::Initialize(KEvent* parent_, std::string&& name_) { - parent = parent_; +void KWritableEvent::Initialize(KEvent* parent_event_, std::string&& name_) { + parent = parent_event_; name = std::move(name_); parent->GetReadableEvent().Open(); } diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 0ffb78d51..2ceeaeb5f 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -63,8 +63,6 @@ struct KernelCore::Impl { global_scheduler_context = std::make_unique<Kernel::GlobalSchedulerContext>(kernel); global_handle_table = std::make_unique<Kernel::KHandleTable>(kernel); - service_thread_manager = - std::make_unique<Common::ThreadWorker>(1, "yuzu:ServiceThreadManager"); is_phantom_mode_for_singlecore = false; InitializePhysicalCores(); @@ -96,7 +94,6 @@ struct KernelCore::Impl { process_list.clear(); // Ensures all service threads gracefully shutdown - service_thread_manager.reset(); service_threads.clear(); next_object_id = 0; @@ -680,10 +677,6 @@ struct KernelCore::Impl { // Threads used for services std::unordered_set<std::shared_ptr<Kernel::ServiceThread>> service_threads; - // Service threads are managed by a worker thread, so that a calling service thread can queue up - // the release of itself - std::unique_ptr<Common::ThreadWorker> service_thread_manager; - std::array<KThread*, Core::Hardware::NUM_CPU_CORES> suspend_threads; std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{}; std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{}; @@ -986,17 +979,14 @@ void KernelCore::ExitSVCProfile() { std::weak_ptr<Kernel::ServiceThread> KernelCore::CreateServiceThread(const std::string& name) { auto service_thread = std::make_shared<Kernel::ServiceThread>(*this, 1, name); - impl->service_thread_manager->QueueWork( - [this, service_thread] { impl->service_threads.emplace(service_thread); }); + impl->service_threads.emplace(service_thread); return service_thread; } void KernelCore::ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) { - impl->service_thread_manager->QueueWork([this, service_thread] { - if (auto strong_ptr = service_thread.lock()) { - impl->service_threads.erase(strong_ptr); - } - }); + if (auto strong_ptr = service_thread.lock()) { + impl->service_threads.erase(strong_ptr); + } } Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() { diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index b2ceeceb3..31a0867d3 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp @@ -153,7 +153,7 @@ ResultCode ProcessCapabilities::ParseCapabilities(const u32* capabilities, } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits, @@ -167,7 +167,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s // Bail early on ignorable entries, as one would expect, // ignorable descriptors can be ignored. if (type == CapabilityType::Ignorable) { - return RESULT_SUCCESS; + return ResultSuccess; } // Ensure that the give flag hasn't already been initialized before. @@ -264,7 +264,7 @@ ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) { core_mask = make_mask(core_num_min, core_num_max); priority_mask = make_mask(priority_min, priority_max); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags) { @@ -288,23 +288,23 @@ ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags) svc_capabilities[svc_number] = true; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleMapPhysicalFlags(u32 flags, u32 size_flags, KPageTable& page_table) { // TODO(Lioncache): Implement once the memory manager can handle this. - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleMapIOFlags(u32 flags, KPageTable& page_table) { // TODO(Lioncache): Implement once the memory manager can handle this. - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_table) { // TODO(Lioncache): Implement once the memory manager can handle this. - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) { @@ -331,7 +331,7 @@ ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) { interrupt_capabilities[interrupt] = true; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) { @@ -342,7 +342,7 @@ ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) { } program_type = static_cast<ProgramType>((flags >> 14) & 0b111); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) { @@ -362,7 +362,7 @@ ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) { } kernel_version = flags; - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) { @@ -373,7 +373,7 @@ ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) { } handle_table_size = static_cast<s32>((flags >> 16) & 0x3FF); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) { @@ -385,7 +385,7 @@ ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) { is_debuggable = (flags & 0x20000) != 0; can_force_debug = (flags & 0x40000) != 0; - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Kernel diff --git a/src/core/hle/kernel/process_capability.h b/src/core/hle/kernel/process_capability.h index 2a7bf5505..a9b44325b 100644 --- a/src/core/hle/kernel/process_capability.h +++ b/src/core/hle/kernel/process_capability.h @@ -84,7 +84,7 @@ public: /// @param page_table The memory manager to use for handling any mapping-related /// operations (such as mapping IO memory, etc). /// - /// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized, + /// @returns ResultSuccess if this capabilities instance was able to be initialized, /// otherwise, an error code upon failure. /// ResultCode InitializeForKernelProcess(const u32* capabilities, std::size_t num_capabilities, @@ -97,7 +97,7 @@ public: /// @param page_table The memory manager to use for handling any mapping-related /// operations (such as mapping IO memory, etc). /// - /// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized, + /// @returns ResultSuccess if this capabilities instance was able to be initialized, /// otherwise, an error code upon failure. /// ResultCode InitializeForUserProcess(const u32* capabilities, std::size_t num_capabilities, @@ -184,7 +184,7 @@ private: /// @param page_table The memory manager that will perform any memory /// mapping if necessary. /// - /// @return RESULT_SUCCESS if no errors occur, otherwise an error code. + /// @return ResultSuccess if no errors occur, otherwise an error code. /// ResultCode ParseCapabilities(const u32* capabilities, std::size_t num_capabilities, KPageTable& page_table); @@ -199,7 +199,7 @@ private: /// @param page_table The memory manager that will perform any memory /// mapping if necessary. /// - /// @return RESULT_SUCCESS if no errors occurred, otherwise an error code. + /// @return ResultSuccess if no errors occurred, otherwise an error code. /// ResultCode ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits, u32 flag, KPageTable& page_table); diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 81e23f700..8339e11a0 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -132,7 +132,7 @@ ResultCode MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr, return ResultInvalidMemoryRegion; } - return RESULT_SUCCESS; + return ResultSuccess; } enum class ResourceLimitValueType { @@ -164,7 +164,7 @@ static ResultCode SetHeapSize(Core::System& system, VAddr* heap_addr, u64 heap_s CASCADE_RESULT(*heap_addr, page_table.SetHeapSize(heap_size)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode SetHeapSize32(Core::System& system, u32* heap_addr, u32 heap_size) { @@ -305,7 +305,7 @@ static ResultCode ConnectToNamedPort(Core::System& system, Handle* out, VAddr po // We succeeded. handle_guard.Cancel(); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode ConnectToNamedPort32(Core::System& system, Handle* out_handle, @@ -349,7 +349,7 @@ static ResultCode GetThreadId(Core::System& system, u64* out_thread_id, Handle t // Get the thread's id. *out_thread_id = thread->GetId(); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetThreadId32(Core::System& system, u32* out_thread_id_low, @@ -449,12 +449,12 @@ static ResultCode CancelSynchronization(Core::System& system, Handle handle) { // Get the thread from its handle. KScopedAutoObject thread = - system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>( - static_cast<Handle>(handle)); + system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle); + R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); // Cancel the thread's wait. thread->WaitCancel(); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode CancelSynchronization32(Core::System& system, Handle handle) { @@ -715,76 +715,76 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle switch (info_id_type) { case GetInfoType::AllowedCPUCoreMask: *result = process->GetCoreMask(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::AllowedThreadPriorityMask: *result = process->GetPriorityMask(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::MapRegionBaseAddr: *result = process->PageTable().GetAliasRegionStart(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::MapRegionSize: *result = process->PageTable().GetAliasRegionSize(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::HeapRegionBaseAddr: *result = process->PageTable().GetHeapRegionStart(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::HeapRegionSize: *result = process->PageTable().GetHeapRegionSize(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::ASLRRegionBaseAddr: *result = process->PageTable().GetAliasCodeRegionStart(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::ASLRRegionSize: *result = process->PageTable().GetAliasCodeRegionSize(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::StackRegionBaseAddr: *result = process->PageTable().GetStackRegionStart(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::StackRegionSize: *result = process->PageTable().GetStackRegionSize(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::TotalPhysicalMemoryAvailable: *result = process->GetTotalPhysicalMemoryAvailable(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::TotalPhysicalMemoryUsed: *result = process->GetTotalPhysicalMemoryUsed(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::SystemResourceSize: *result = process->GetSystemResourceSize(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::SystemResourceUsage: LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query system resource usage"); *result = process->GetSystemResourceUsage(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::TitleId: *result = process->GetTitleID(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::UserExceptionContextAddr: *result = process->GetTLSRegionAddress(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::TotalPhysicalMemoryAvailableWithoutSystemResource: *result = process->GetTotalPhysicalMemoryAvailableWithoutSystemResource(); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::TotalPhysicalMemoryUsedWithoutSystemResource: *result = process->GetTotalPhysicalMemoryUsedWithoutSystemResource(); - return RESULT_SUCCESS; + return ResultSuccess; default: break; @@ -796,7 +796,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle case GetInfoType::IsCurrentProcessBeingDebugged: *result = 0; - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::RegisterResourceLimit: { if (handle != 0) { @@ -816,14 +816,14 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle if (!resource_limit) { *result = Svc::InvalidHandle; // Yes, the kernel considers this a successful operation. - return RESULT_SUCCESS; + return ResultSuccess; } Handle resource_handle{}; R_TRY(handle_table.Add(&resource_handle, resource_limit)); *result = resource_handle; - return RESULT_SUCCESS; + return ResultSuccess; } case GetInfoType::RandomEntropy: @@ -840,13 +840,13 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle } *result = system.Kernel().CurrentProcess()->GetRandomEntropy(info_sub_id); - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::PrivilegedProcessId: LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query privileged process id bounds, returned 0"); *result = 0; - return RESULT_SUCCESS; + return ResultSuccess; case GetInfoType::ThreadTickCount: { constexpr u64 num_cpus = 4; @@ -881,7 +881,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle } *result = out_ticks; - return RESULT_SUCCESS; + return ResultSuccess; } default: @@ -1034,7 +1034,7 @@ static ResultCode SetThreadActivity(Core::System& system, Handle thread_handle, // Set the activity. R_TRY(thread->SetActivity(thread_activity)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode SetThreadActivity32(Core::System& system, Handle thread_handle, @@ -1094,10 +1094,10 @@ static ResultCode GetThreadContext(Core::System& system, VAddr out_context, Hand // Copy the thread context to user space. system.Memory().WriteBlock(out_context, context.data(), context.size()); - return RESULT_SUCCESS; + return ResultSuccess; } - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetThreadContext32(Core::System& system, u32 out_context, Handle thread_handle) { @@ -1115,7 +1115,7 @@ static ResultCode GetThreadPriority(Core::System& system, u32* out_priority, Han // Get the thread's priority. *out_priority = thread->GetPriority(); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetThreadPriority32(Core::System& system, u32* out_priority, Handle handle) { @@ -1138,7 +1138,7 @@ static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, // Set the thread priority. thread->SetBasePriority(priority); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode SetThreadPriority32(Core::System& system, Handle thread_handle, u32 priority) { @@ -1207,7 +1207,7 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shmem_handle, VAd // We succeeded. guard.Cancel(); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode MapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, @@ -1240,7 +1240,7 @@ static ResultCode UnmapSharedMemory(Core::System& system, Handle shmem_handle, V // Remove the shared memory from the process. process.RemoveSharedMemory(shmem.GetPointerUnsafe(), address, size); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode UnmapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, @@ -1276,7 +1276,7 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add // Page info appears to be currently unused by the kernel and is always set to zero. memory.Write32(page_info_address, 0); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode QueryMemory(Core::System& system, VAddr memory_info_address, @@ -1524,7 +1524,7 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e // Add the thread to the handle table. R_TRY(process.GetHandleTable().Add(out_handle, thread)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode CreateThread32(Core::System& system, Handle* out_handle, u32 priority, @@ -1547,7 +1547,7 @@ static ResultCode StartThread(Core::System& system, Handle thread_handle) { // If we succeeded, persist a reference to the thread. thread->Open(); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode StartThread32(Core::System& system, Handle thread_handle) { @@ -1796,7 +1796,7 @@ static ResultCode CloseHandle(Core::System& system, Handle handle) { R_UNLESS(system.Kernel().CurrentProcess()->GetHandleTable().Remove(handle), ResultInvalidHandle); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode CloseHandle32(Core::System& system, Handle handle) { @@ -1891,7 +1891,7 @@ static ResultCode CreateTransferMemory(Core::System& system, Handle* out, VAddr // Add the transfer memory to the handle table. R_TRY(handle_table.Add(out, trmem)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode CreateTransferMemory32(Core::System& system, Handle* out, u32 address, u32 size, @@ -1911,7 +1911,7 @@ static ResultCode GetThreadCoreMask(Core::System& system, Handle thread_handle, // Get the core mask. R_TRY(thread->GetCoreMask(out_core_id, out_affinity_mask)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetThreadCoreMask32(Core::System& system, Handle thread_handle, s32* out_core_id, @@ -1952,7 +1952,7 @@ static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle, // Set the core mask. R_TRY(thread->SetCoreMask(core_id, affinity_mask)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle, s32 core_id, @@ -2051,7 +2051,7 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o // We succeeded. handle_guard.Cancel(); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode CreateEvent32(Core::System& system, Handle* out_write, Handle* out_read) { @@ -2081,7 +2081,7 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_ } *out = static_cast<u64>(process->GetStatus()); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle) { @@ -2104,7 +2104,7 @@ static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle) // Add the limit to the handle table. R_TRY(kernel.CurrentProcess()->GetHandleTable().Add(out_handle, resource_limit)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limit_value, @@ -2125,7 +2125,7 @@ static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limi // Get the limit value. *out_limit_value = resource_limit->GetLimitValue(which); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_current_value, @@ -2146,7 +2146,7 @@ static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_cu // Get the current value. *out_current_value = resource_limit->GetCurrentValue(which); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_handle, @@ -2166,7 +2166,7 @@ static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resour // Set the limit value. R_TRY(resource_limit->SetLimitValue(which, limit_value)); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetProcessList(Core::System& system, u32* out_num_processes, @@ -2203,7 +2203,7 @@ static ResultCode GetProcessList(Core::System& system, u32* out_num_processes, } *out_num_processes = static_cast<u32>(num_processes); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAddr out_thread_ids, @@ -2243,7 +2243,7 @@ static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAdd } *out_num_threads = static_cast<u32>(num_threads); - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode FlushProcessDataCache32([[maybe_unused]] Core::System& system, @@ -2253,7 +2253,7 @@ static ResultCode FlushProcessDataCache32([[maybe_unused]] Core::System& system, // as all emulation is done in the same cache level in host architecture, thus data cache // does not need flushing. LOG_DEBUG(Kernel_SVC, "called"); - return RESULT_SUCCESS; + return ResultSuccess; } namespace { diff --git a/src/core/hle/result.h b/src/core/hle/result.h index df3283fe3..a755008d5 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -124,27 +124,27 @@ union ResultCode { constexpr ResultCode(ErrorModule module_, u32 description_) : raw(module.FormatValue(module_) | description.FormatValue(description_)) {} - constexpr bool IsSuccess() const { + [[nodiscard]] constexpr bool IsSuccess() const { return raw == 0; } - constexpr bool IsError() const { - return raw != 0; + [[nodiscard]] constexpr bool IsError() const { + return !IsSuccess(); } }; -constexpr bool operator==(const ResultCode& a, const ResultCode& b) { +[[nodiscard]] constexpr bool operator==(const ResultCode& a, const ResultCode& b) { return a.raw == b.raw; } -constexpr bool operator!=(const ResultCode& a, const ResultCode& b) { - return a.raw != b.raw; +[[nodiscard]] constexpr bool operator!=(const ResultCode& a, const ResultCode& b) { + return !operator==(a, b); } // Convenience functions for creating some common kinds of errors: /// The default success `ResultCode`. -constexpr ResultCode RESULT_SUCCESS(0); +constexpr ResultCode ResultSuccess(0); /** * Placeholder result code used for unknown error codes. @@ -152,7 +152,7 @@ constexpr ResultCode RESULT_SUCCESS(0); * @note This should only be used when a particular error code * is not known yet. */ -constexpr ResultCode RESULT_UNKNOWN(UINT32_MAX); +constexpr ResultCode ResultUnknown(UINT32_MAX); /** * This is an optional value type. It holds a `ResultCode` and, if that code is a success code, @@ -191,7 +191,7 @@ class ResultVal { public: /// Constructs an empty `ResultVal` with the given error code. The code must not be a success /// code. - ResultVal(ResultCode error_code = RESULT_UNKNOWN) : result_code(error_code) { + ResultVal(ResultCode error_code = ResultUnknown) : result_code(error_code) { ASSERT(error_code.IsError()); } @@ -200,7 +200,7 @@ public: * specify the success code. `success_code` must not be an error code. */ template <typename... Args> - static ResultVal WithCode(ResultCode success_code, Args&&... args) { + [[nodiscard]] static ResultVal WithCode(ResultCode success_code, Args&&... args) { ResultVal<T> result; result.emplace(success_code, std::forward<Args>(args)...); return result; @@ -259,49 +259,49 @@ public: } /// Returns true if the `ResultVal` contains an error code and no value. - bool empty() const { + [[nodiscard]] bool empty() const { return result_code.IsError(); } /// Returns true if the `ResultVal` contains a return value. - bool Succeeded() const { + [[nodiscard]] bool Succeeded() const { return result_code.IsSuccess(); } /// Returns true if the `ResultVal` contains an error code and no value. - bool Failed() const { + [[nodiscard]] bool Failed() const { return empty(); } - ResultCode Code() const { + [[nodiscard]] ResultCode Code() const { return result_code; } - const T& operator*() const { + [[nodiscard]] const T& operator*() const { return object; } - T& operator*() { + [[nodiscard]] T& operator*() { return object; } - const T* operator->() const { + [[nodiscard]] const T* operator->() const { return &object; } - T* operator->() { + [[nodiscard]] T* operator->() { return &object; } /// Returns the value contained in this `ResultVal`, or the supplied default if it is missing. template <typename U> - T ValueOr(U&& value) const { + [[nodiscard]] T ValueOr(U&& value) const { return !empty() ? object : std::move(value); } /// Asserts that the result succeeded and returns a reference to it. - T& Unwrap() & { + [[nodiscard]] T& Unwrap() & { ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal"); return **this; } - T&& Unwrap() && { + [[nodiscard]] T&& Unwrap() && { ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal"); return std::move(**this); } @@ -320,8 +320,8 @@ private: * `T` with and creates a success `ResultVal` contained the constructed value. */ template <typename T, typename... Args> -ResultVal<T> MakeResult(Args&&... args) { - return ResultVal<T>::WithCode(RESULT_SUCCESS, std::forward<Args>(args)...); +[[nodiscard]] ResultVal<T> MakeResult(Args&&... args) { + return ResultVal<T>::WithCode(ResultSuccess, std::forward<Args>(args)...); } /** @@ -329,9 +329,8 @@ ResultVal<T> MakeResult(Args&&... args) { * copy or move constructing. */ template <typename Arg> -ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) { - return ResultVal<std::remove_reference_t<Arg>>::WithCode(RESULT_SUCCESS, - std::forward<Arg>(arg)); +[[nodiscard]] ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) { + return ResultVal<std::remove_reference_t<Arg>>::WithCode(ResultSuccess, std::forward<Arg>(arg)); } /** @@ -362,7 +361,7 @@ ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) { #define R_SUCCEEDED(res) (res.IsSuccess()) /// Evaluates a boolean expression, and succeeds if that expression is true. -#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), RESULT_SUCCESS) +#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), ResultSuccess) /// Evaluates a boolean expression, and returns a result unless that expression is true. #define R_UNLESS(expr, res) \ diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 39cd1efc1..d1c1fb71d 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -298,13 +298,13 @@ protected: if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { ctx.WriteBuffer(data); IPC::ResponseBuilder rb{ctx, 16}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(profile_base); } else { LOG_ERROR(Service_ACC, "Failed to get profile base and data for user={}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); // TODO(ogniK): Get actual error code + rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code } } @@ -313,12 +313,12 @@ protected: ProfileBase profile_base{}; if (profile_manager.GetProfileBase(user_id, profile_base)) { IPC::ResponseBuilder rb{ctx, 16}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(profile_base); } else { LOG_ERROR(Service_ACC, "Failed to get profile base for user={}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); // TODO(ogniK): Get actual error code + rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code } } @@ -326,7 +326,7 @@ protected: LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); const Common::FS::IOFile image(GetImagePath(user_id), Common::FS::FileAccessMode::Read, Common::FS::FileType::BinaryFile); @@ -352,7 +352,7 @@ protected: void GetImageSize(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); const Common::FS::IOFile image(GetImagePath(user_id), Common::FS::FileAccessMode::Read, Common::FS::FileType::BinaryFile); @@ -395,7 +395,7 @@ protected: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void StoreWithImage(Kernel::HLERequestContext& ctx) { @@ -433,7 +433,7 @@ protected: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } ProfileManager& profile_manager; @@ -528,7 +528,7 @@ private: void CheckAvailability(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(false); // TODO: Check when this is supposed to return true and when not } @@ -536,7 +536,7 @@ private: LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u64>(user_id.GetNintendoID()); } @@ -552,14 +552,14 @@ private: } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u64>(user_id.GetNintendoID()); } void StoreOpenContext(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } Common::UUID user_id{Common::INVALID_UUID}; @@ -655,7 +655,7 @@ public: void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(profile_manager->GetUserCount())); } @@ -665,7 +665,7 @@ void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(profile_manager->UserExists(user_id)); } @@ -673,20 +673,20 @@ void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); ctx.WriteBuffer(profile_manager->GetAllUsers()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); ctx.WriteBuffer(profile_manager->GetOpenUsers()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<Common::UUID>(profile_manager->GetLastOpenedUser()); } @@ -696,14 +696,14 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IProfile>(system, user_id, *profile_manager); } void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(profile_manager->CanSystemRegisterUser()); } @@ -761,13 +761,13 @@ ResultCode Module::Interface::InitializeApplicationInfoBase() { LOG_WARNING(Service_ACC, "ApplicationInfo init required"); // TODO(ogniK): Actual initalization here - return RESULT_SUCCESS; + return ResultSuccess; } void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser()); } @@ -794,7 +794,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx } IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(is_locked); } @@ -805,7 +805,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called, user_id={}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IProfileEditor>(system, user_id, *profile_manager); } @@ -817,7 +817,7 @@ void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) { // the game regardless of parental control settings. ctx.WriteBuffer(profile_manager->GetAllUsers()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) { @@ -827,7 +827,7 @@ void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) { // This command is used concurrently with ListOpenContextStoredUsers // TODO: Find the differences between this and GetBaasAccountManagerForApplication IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser()); } @@ -837,7 +837,7 @@ void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ct // TODO(ogniK): Handle open contexts ctx.WriteBuffer(profile_manager->GetOpenUsers()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx) { @@ -886,7 +886,7 @@ void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, } // TODO(ogniK): Construct save data thumbnail - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { @@ -895,7 +895,7 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex // access to use the network or not by the looks of it IPC::ResponseBuilder rb{ctx, 6}; if (profile_manager->GetUserCount() != 1) { - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u128>(Common::INVALID_UUID); return; } @@ -903,13 +903,13 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex const auto user_list = profile_manager->GetAllUsers(); if (std::all_of(user_list.begin(), user_list.end(), [](const auto& user) { return user.uuid == Common::INVALID_UUID; })) { - rb.Push(RESULT_UNKNOWN); // TODO(ogniK): Find the correct error code + rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code rb.PushRaw<u128>(Common::INVALID_UUID); return; } // Select the first user we have - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid); } diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 77510489c..f72d5d561 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -91,7 +91,7 @@ ResultCode ProfileManager::AddUser(const ProfileInfo& user) { if (!AddToProfiles(user)) { return ERROR_TOO_MANY_USERS; } - return RESULT_SUCCESS; + return ResultSuccess; } /// Create a new user on the system. If the uuid of the user already exists, the user is not diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 234173297..b578153d3 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -91,14 +91,14 @@ void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(process_id); } void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } IAudioController::IAudioController(Core::System& system_) @@ -132,20 +132,20 @@ void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) { std::clamp(library_applet_volume_tmp, min_allowed_volume, max_allowed_volume); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called. main_applet_volume={}", main_applet_volume); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(main_applet_volume); } void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called. library_applet_volume={}", library_applet_volume); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(library_applet_volume); } @@ -166,7 +166,7 @@ void IAudioController::ChangeMainAppletMasterVolume(Kernel::HLERequestContext& c fade_time_ns = std::chrono::nanoseconds{parameters.fade_time_ns}; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) { @@ -180,7 +180,7 @@ void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) { std::clamp(transparent_volume_rate_tmp, min_allowed_volume, max_allowed_volume); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } IDisplayController::IDisplayController(Core::System& system_) @@ -332,7 +332,7 @@ void ISelfController::Exit(Kernel::HLERequestContext& ctx) { system.Shutdown(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { @@ -341,7 +341,7 @@ void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { system.SetExitLock(true); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { @@ -350,7 +350,7 @@ void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { system.SetExitLock(false); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) { @@ -358,7 +358,7 @@ void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called. Num fatal sections entered: {}", num_fatal_sections_entered); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { @@ -374,7 +374,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { --num_fatal_sections_entered; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { @@ -383,7 +383,7 @@ void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& launchable_event.GetWritableEvent().Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(launchable_event.GetReadableEvent()); } @@ -395,7 +395,7 @@ void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { screenshot_permission = permission; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) { @@ -405,7 +405,7 @@ void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestCont LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { @@ -415,7 +415,7 @@ void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestCo LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { @@ -434,14 +434,14 @@ void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { flags.unknown0, flags.unknown1, flags.unknown2); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { @@ -453,14 +453,14 @@ void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::SetAlbumImageOrientation(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) { @@ -472,7 +472,7 @@ void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) const auto layer_id = nvflinger.CreateLayer(*display_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(*layer_id); } @@ -490,7 +490,7 @@ void ISelfController::CreateManagedDisplaySeparableLayer(Kernel::HLERequestConte const auto layer_id = nvflinger.CreateLayer(*display_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(*layer_id); } @@ -498,7 +498,7 @@ void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { @@ -508,14 +508,14 @@ void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& c idle_time_detection_extension); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(idle_time_detection_extension); } @@ -536,14 +536,14 @@ void ISelfController::SetAutoSleepDisabled(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called. is_auto_sleep_disabled={}", is_auto_sleep_disabled); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ISelfController::IsAutoSleepDisabled(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called."); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(is_auto_sleep_disabled); } @@ -554,7 +554,7 @@ void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext // where the game was suspended. Since Yuzu doesn't implement game suspension, this command // can just always return 0 ticks. IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(0); } @@ -562,7 +562,7 @@ void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequest LOG_DEBUG(Service_AM, "called."); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(accumulated_suspended_tick_changed_event.GetReadableEvent()); } @@ -578,7 +578,7 @@ void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestCo album_image_taken_notification_enabled); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel) @@ -704,7 +704,7 @@ void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u8>(static_cast<u8>(Service::PM::SystemBootMode::Normal)); // Normal boot mode } @@ -712,7 +712,7 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(msg_queue->GetMessageReceiveEvent()); } @@ -729,7 +729,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { return; } - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum<AppletMessageQueue::AppletMessage>(message); } @@ -737,7 +737,7 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u8>(FocusState::InFocus)); } @@ -745,7 +745,7 @@ void ICommonStateGetter::IsVrModeEnabled(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(vr_mode_state); } @@ -756,7 +756,7 @@ void ICommonStateGetter::SetVrModeEnabled(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "VR Mode is {}", vr_mode_state ? "on" : "off"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx) { @@ -767,28 +767,28 @@ void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx is_lcd_backlight_off_enabled); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ICommonStateGetter::BeginVrModeEx(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ICommonStateGetter::EndVrModeEx(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(msg_queue->GetOperationModeChangedEvent()); } @@ -796,7 +796,7 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); if (Settings::values.use_docked_mode.GetValue()) { rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * @@ -826,7 +826,7 @@ void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnable LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } IStorageImpl::~IStorageImpl() = default; @@ -875,7 +875,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorageAccessor>(system, *this); } @@ -884,7 +884,7 @@ void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld)); } @@ -892,7 +892,7 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(system.GetAPMController().GetCurrentPerformanceMode()); } @@ -932,7 +932,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent()); } @@ -940,7 +940,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(applet->TransactionComplete()); } @@ -955,7 +955,7 @@ private: LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Start(Kernel::HLERequestContext& ctx) { @@ -967,7 +967,7 @@ private: applet->Execute(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void PushInData(Kernel::HLERequestContext& ctx) { @@ -977,7 +977,7 @@ private: applet->GetBroker().PushNormalDataFromGame(rp.PopIpcInterface<IStorage>()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void PopOutData(Kernel::HLERequestContext& ctx) { @@ -993,7 +993,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } @@ -1008,7 +1008,7 @@ private: applet->Execute(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void PopInteractiveOutData(Kernel::HLERequestContext& ctx) { @@ -1024,7 +1024,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } @@ -1032,7 +1032,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent()); } @@ -1040,7 +1040,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); } @@ -1052,7 +1052,7 @@ private: constexpr u64 handle = 0xdeadbeef; IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(handle); } @@ -1079,7 +1079,7 @@ void IStorageAccessor::GetSize(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u64>(backing.GetSize())); } @@ -1105,7 +1105,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { std::memcpy(backing.GetData().data() + offset, data.data(), size); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { @@ -1128,7 +1128,7 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(backing.GetData().data() + offset, size); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_) @@ -1162,13 +1162,13 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet); } @@ -1182,14 +1182,14 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { if (size <= 0) { LOG_ERROR(Service_AM, "size is less than or equal to 0"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } std::vector<u8> buffer(size); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(system, std::move(buffer)); } @@ -1210,7 +1210,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex if (parameters.size <= 0) { LOG_ERROR(Service_AM, "size is less than or equal to 0"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -1220,7 +1220,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex if (transfer_mem.IsNull()) { LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -1229,7 +1229,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex std::vector<u8> memory{mem_begin, mem_end}; IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(system, std::move(memory)); } @@ -1244,7 +1244,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) if (size <= 0) { LOG_ERROR(Service_AM, "size is less than or equal to 0"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -1254,7 +1254,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) if (transfer_mem.IsNull()) { LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -1263,7 +1263,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) std::vector<u8> memory{mem_begin, mem_end}; IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(system, std::move(memory)); } @@ -1355,7 +1355,7 @@ void IApplicationFunctions::EnableApplicationCrashReport(Kernel::HLERequestConte LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer( @@ -1363,14 +1363,14 @@ void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer( LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::SetApplicationCopyrightImage(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequestContext& ctx) { @@ -1380,7 +1380,7 @@ void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequest LOG_WARNING(Service_AM, "(STUBBED) called, is_visible={}", is_visible); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed( @@ -1388,7 +1388,7 @@ void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed( LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed( @@ -1396,21 +1396,21 @@ void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed( LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::BeginBlockingHomeButton(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::EndBlockingHomeButton(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { @@ -1430,7 +1430,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { auto data = backend->GetLaunchParameter({system.CurrentProcess()->GetTitleID(), build_id}); if (data.has_value()) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(system, std::move(*data)); launch_popped_application_specific = true; return; @@ -1449,7 +1449,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); std::vector<u8> buffer(sizeof(LaunchParameterAccountPreselectedUser)); std::memcpy(buffer.data(), ¶ms, buffer.size()); @@ -1469,7 +1469,7 @@ void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest( LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { @@ -1500,7 +1500,7 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { @@ -1533,7 +1533,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(version_string); } @@ -1589,7 +1589,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "got desired_language={:016X}", *res_code); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(*res_code); } @@ -1599,7 +1599,7 @@ void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestConte constexpr bool gameplay_recording_supported = false; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(gameplay_recording_supported); } @@ -1607,21 +1607,21 @@ void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContex LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u8>(0); // Unknown, seems to be ignored by official processes } @@ -1629,7 +1629,7 @@ void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // Returns a 128-bit UUID rb.Push<u64>(0); @@ -1657,7 +1657,7 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { type, system.CurrentProcess()->GetTitleID(), user_id, {new_normal_size, new_journal_size}); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // The following value is used upon failure to help the system recover. // Since we always succeed, this should be 0. @@ -1681,7 +1681,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { type, system.CurrentProcess()->GetTitleID(), user_id); IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(size.normal); rb.Push(size.journal); } @@ -1690,7 +1690,7 @@ void IApplicationFunctions::QueryApplicationPlayStatistics(Kernel::HLERequestCon LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(0); } @@ -1698,7 +1698,7 @@ void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(Kernel::HLEReque LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(0); } @@ -1711,7 +1711,7 @@ void IApplicationFunctions::ExecuteProgram(Kernel::HLERequestContext& ctx) { const auto program_index = rp.Pop<u64>(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); system.ExecuteProgram(program_index); } @@ -1720,21 +1720,21 @@ void IApplicationFunctions::ClearUserChannel(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::UnpopToUserChannel(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IApplicationFunctions::GetPreviousProgramIndex(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(previous_program_index); } @@ -1742,7 +1742,7 @@ void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestCon LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(gpu_error_detected_event.GetReadableEvent()); } @@ -1750,7 +1750,7 @@ void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERe LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(friend_invitation_storage_channel_event.GetReadableEvent()); } @@ -1766,7 +1766,7 @@ void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERe LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(health_warning_disappeared_system_event.GetReadableEvent()); } @@ -1817,14 +1817,14 @@ void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(pop_from_general_channel_event.GetReadableEvent()); } diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index 5421e0da0..0ec4fd4ca 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -41,7 +41,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); } @@ -49,7 +49,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISelfController>(system, nvflinger); } @@ -57,7 +57,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IWindowController>(system); } @@ -65,7 +65,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAudioController>(system); } @@ -73,7 +73,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDisplayController>(system); } @@ -81,7 +81,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IProcessWindingController>(system); } @@ -89,7 +89,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDebugFunctions>(system); } @@ -97,7 +97,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ILibraryAppletCreator>(system); } @@ -105,7 +105,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IApplicationFunctions>(system); } @@ -145,7 +145,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); } @@ -153,7 +153,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISelfController>(system, nvflinger); } @@ -161,7 +161,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IWindowController>(system); } @@ -169,7 +169,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAudioController>(system); } @@ -177,7 +177,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDisplayController>(system); } @@ -185,7 +185,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDebugFunctions>(system); } @@ -193,7 +193,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ILibraryAppletCreator>(system); } @@ -201,7 +201,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IHomeMenuFunctions>(system); } @@ -209,7 +209,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IGlobalStateController>(system); } @@ -217,7 +217,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IApplicationCreator>(system); } @@ -229,7 +229,7 @@ void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystemAppletProxy>(nvflinger, msg_queue, system); } @@ -237,7 +237,7 @@ void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); } @@ -245,7 +245,7 @@ void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); } diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp index f9eba8f52..b8859f4e6 100644 --- a/src/core/hle/service/am/applet_oe.cpp +++ b/src/core/hle/service/am/applet_oe.cpp @@ -39,7 +39,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAudioController>(system); } @@ -47,7 +47,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDisplayController>(system); } @@ -55,7 +55,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDebugFunctions>(system); } @@ -63,7 +63,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IWindowController>(system); } @@ -71,7 +71,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISelfController>(system, nvflinger); } @@ -79,7 +79,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); } @@ -87,7 +87,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ILibraryAppletCreator>(system); } @@ -95,7 +95,7 @@ private: LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IApplicationFunctions>(system); } @@ -107,7 +107,7 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system); } diff --git a/src/core/hle/service/am/applets/controller.h b/src/core/hle/service/am/applets/controller.h index 2d4dae0bd..20617e91f 100644 --- a/src/core/hle/service/am/applets/controller.h +++ b/src/core/hle/service/am/applets/controller.h @@ -129,7 +129,7 @@ private: ControllerSupportArgNew controller_user_arg_new; ControllerUpdateFirmwareArg controller_update_arg; bool complete{false}; - ResultCode status{RESULT_SUCCESS}; + ResultCode status{ResultSuccess}; bool is_single_mode{false}; std::vector<u8> out_data; }; diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp index 08348b180..c724e5d5b 100644 --- a/src/core/hle/service/am/applets/error.cpp +++ b/src/core/hle/service/am/applets/error.cpp @@ -135,7 +135,7 @@ bool Error::TransactionComplete() const { } ResultCode Error::GetStatus() const { - return RESULT_SUCCESS; + return ResultSuccess; } void Error::ExecuteInteractive() { diff --git a/src/core/hle/service/am/applets/error.h b/src/core/hle/service/am/applets/error.h index e606d12ce..8aa9046a5 100644 --- a/src/core/hle/service/am/applets/error.h +++ b/src/core/hle/service/am/applets/error.h @@ -42,7 +42,7 @@ private: union ErrorArguments; const Core::Frontend::ErrorApplet& frontend; - ResultCode error_code = RESULT_SUCCESS; + ResultCode error_code = ResultSuccess; ErrorAppletMode mode = ErrorAppletMode::ShowError; std::unique_ptr<ErrorArguments> args; diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp index e95499edd..9fcb9f95b 100644 --- a/src/core/hle/service/am/applets/general_backend.cpp +++ b/src/core/hle/service/am/applets/general_backend.cpp @@ -76,7 +76,7 @@ bool Auth::TransactionComplete() const { } ResultCode Auth::GetStatus() const { - return successful ? RESULT_SUCCESS : ERROR_INVALID_PIN; + return successful ? ResultSuccess : ERROR_INVALID_PIN; } void Auth::ExecuteInteractive() { @@ -175,7 +175,7 @@ bool PhotoViewer::TransactionComplete() const { } ResultCode PhotoViewer::GetStatus() const { - return RESULT_SUCCESS; + return ResultSuccess; } void PhotoViewer::ExecuteInteractive() { @@ -229,7 +229,7 @@ bool StubApplet::TransactionComplete() const { ResultCode StubApplet::GetStatus() const { LOG_WARNING(Service_AM, "called (STUBBED)"); - return RESULT_SUCCESS; + return ResultSuccess; } void StubApplet::ExecuteInteractive() { diff --git a/src/core/hle/service/am/applets/profile_select.cpp b/src/core/hle/service/am/applets/profile_select.cpp index c91a9776a..37048be26 100644 --- a/src/core/hle/service/am/applets/profile_select.cpp +++ b/src/core/hle/service/am/applets/profile_select.cpp @@ -23,7 +23,7 @@ ProfileSelect::~ProfileSelect() = default; void ProfileSelect::Initialize() { complete = false; - status = RESULT_SUCCESS; + status = ResultSuccess; final_data.clear(); Applet::Initialize(); diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/profile_select.h index f0dd6c1f3..8fb76e6c4 100644 --- a/src/core/hle/service/am/applets/profile_select.h +++ b/src/core/hle/service/am/applets/profile_select.h @@ -51,7 +51,7 @@ private: UserSelectionConfig config; bool complete = false; - ResultCode status = RESULT_SUCCESS; + ResultCode status = ResultSuccess; std::vector<u8> final_data; Core::System& system; }; diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index b1a81810b..00dfe1675 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp @@ -658,7 +658,7 @@ void SoftwareKeyboard::InlineTextChanged() { void SoftwareKeyboard::ExitKeyboard() { complete = true; - status = RESULT_SUCCESS; + status = ResultSuccess; frontend.ExitKeyboard(); diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/software_keyboard.h index 7bdef78a7..e3fc733d0 100644 --- a/src/core/hle/service/am/applets/software_keyboard.h +++ b/src/core/hle/service/am/applets/software_keyboard.h @@ -160,7 +160,7 @@ private: bool is_background{false}; bool complete{false}; - ResultCode status{RESULT_SUCCESS}; + ResultCode status{ResultSuccess}; }; } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/web_browser.h b/src/core/hle/service/am/applets/web_browser.h index cdeaf2c40..9f81214b6 100644 --- a/src/core/hle/service/am/applets/web_browser.h +++ b/src/core/hle/service/am/applets/web_browser.h @@ -68,7 +68,7 @@ private: const Core::Frontend::WebBrowserApplet& frontend; bool complete{false}; - ResultCode status{RESULT_SUCCESS}; + ResultCode status{ResultSuccess}; WebAppletVersion web_applet_version{}; WebArgHeader web_arg_header{}; diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 1863260f1..fec704c65 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -76,7 +76,7 @@ private: LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetDeliveryTarget(Kernel::HLERequestContext& ctx) { @@ -88,14 +88,14 @@ private: LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetPurchasedEventReadableHandle(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AOC, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(purchased_event.GetReadableEvent()); } @@ -144,7 +144,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); const auto current = system.CurrentProcess()->GetTitleID(); @@ -190,7 +190,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { if (out.size() < offset) { IPC::ResponseBuilder rb{ctx, 2}; // TODO(DarkLordZach): Find the correct error code. - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -201,7 +201,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(out); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(out_count); } @@ -217,7 +217,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); const auto title_id = system.CurrentProcess()->GetTitleID(); const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), @@ -246,14 +246,14 @@ void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) { process_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void AOC_U::GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AOC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(aoc_change_event.GetReadableEvent()); } @@ -261,7 +261,7 @@ void AOC_U::CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AOC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IPurchaseEventManager>(system); } @@ -269,7 +269,7 @@ void AOC_U::CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ct LOG_WARNING(Service_AOC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IPurchaseEventManager>(system); } diff --git a/src/core/hle/service/apm/interface.cpp b/src/core/hle/service/apm/interface.cpp index 0bff97a37..d69ddd135 100644 --- a/src/core/hle/service/apm/interface.cpp +++ b/src/core/hle/service/apm/interface.cpp @@ -33,7 +33,7 @@ private: controller.SetPerformanceConfiguration(mode, config); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { @@ -43,7 +43,7 @@ private: LOG_DEBUG(Service_APM, "called mode={}", mode); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(controller.GetCurrentPerformanceConfiguration(mode)); } @@ -67,7 +67,7 @@ void APM::OpenSession(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_APM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISession>(system, controller); } @@ -82,7 +82,7 @@ void APM::IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_APM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(false); } @@ -110,7 +110,7 @@ void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_APM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISession>(system, controller); } @@ -123,14 +123,14 @@ void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { controller.SetFromCpuBoostMode(mode); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void APM_Sys::GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_APM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum( controller.GetCurrentPerformanceConfiguration(controller.GetCurrentPerformanceMode())); } diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 84890be72..8c4c49b85 100644 --- a/src/core/hle/service/audio/audctl.cpp +++ b/src/core/hle/service/audio/audctl.cpp @@ -57,7 +57,7 @@ void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) { constexpr s32 target_min_volume = 0; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(target_min_volume); } @@ -69,7 +69,7 @@ void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) { constexpr s32 target_max_volume = 15; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(target_max_volume); } diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index ecd05e4a6..3e7fd6024 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp @@ -70,7 +70,7 @@ void AudInU::ListAudioIns(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(device_names); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(device_names.size())); } @@ -82,7 +82,7 @@ void AudInU::ListAudioInsAutoFiltered(Kernel::HLERequestContext& ctx) { // device listing just omits the default input device IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(device_count)); } @@ -94,7 +94,7 @@ void AudInU::OpenInOutImpl(Kernel::HLERequestContext& ctx) { params.state = State::Started; IPC::ResponseBuilder rb{ctx, 6, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<AudInOutParams>(params); rb.PushIpcInterface<IAudioIn>(system); } diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index e1ae726f5..804c6b10c 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -91,7 +91,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(stream->IsPlaying() ? AudioState::Started : AudioState::Stopped)); } @@ -107,7 +107,7 @@ private: audio_core.StartStream(stream); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void StopAudioOut(Kernel::HLERequestContext& ctx) { @@ -118,14 +118,14 @@ private: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void RegisterBufferEvent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(buffer_event.GetReadableEvent()); } @@ -150,7 +150,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetReleasedAudioOutBufferImpl(Kernel::HLERequestContext& ctx) { @@ -164,7 +164,7 @@ private: ctx.WriteBuffer(tags); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(released_buffers.size())); } @@ -174,7 +174,7 @@ private: IPC::RequestParser rp{ctx}; const u64 tag{rp.Pop<u64>()}; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(stream->ContainsBuffer(tag)); } @@ -182,7 +182,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(stream->GetQueueSize())); } @@ -190,7 +190,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(stream->Flush()); } @@ -202,14 +202,14 @@ private: stream->SetVolume(volume); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetAudioOutVolume(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(stream->GetVolume()); } @@ -246,7 +246,7 @@ void AudOutU::ListAudioOutsImpl(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(DefaultDevice); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(1); // Amount of audio devices } @@ -279,7 +279,7 @@ void AudOutU::OpenAudioOutImpl(Kernel::HLERequestContext& ctx) { system, params, *audio_core, std::move(device_name), std::move(unique_name)); IPC::ResponseBuilder rb{ctx, 6, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(DefaultSampleRate); rb.Push<u32>(params.channel_count); rb.Push<u32>(static_cast<u32>(AudioCore::Codec::PcmFormat::Int16)); diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index ae4284adf..800feba6e 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -65,7 +65,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(renderer->GetSampleRate()); } @@ -73,7 +73,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(renderer->GetSampleCount()); } @@ -81,7 +81,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(renderer->GetStreamState())); } @@ -89,7 +89,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(renderer->GetMixBufferCount()); } @@ -112,7 +112,7 @@ private: IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Stop(Kernel::HLERequestContext& ctx) { @@ -120,14 +120,14 @@ private: IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void QuerySystemEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(system_event.GetReadableEvent()); } @@ -140,14 +140,14 @@ private: ASSERT(rendering_time_limit_percent <= 100); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetRenderingTimeLimit(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(rendering_time_limit_percent); } @@ -230,7 +230,7 @@ private: ctx.WriteBuffer(name_buffer); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(name_buffer.size())); } @@ -244,7 +244,7 @@ private: LOG_WARNING(Service_Audio, "(STUBBED) called. name={}, volume={}", name, volume); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) { @@ -254,7 +254,7 @@ private: LOG_WARNING(Service_Audio, "(STUBBED) called. name={}", name); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(1.0f); } @@ -270,7 +270,7 @@ private: ctx.WriteBuffer(out_device_name); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) { @@ -279,7 +279,7 @@ private: buffer_event.GetWritableEvent().Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(buffer_event.GetReadableEvent()); } @@ -287,7 +287,7 @@ private: LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(1); } @@ -296,7 +296,7 @@ private: LOG_WARNING(Service_Audio, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(buffer_event.GetReadableEvent()); } @@ -304,7 +304,7 @@ private: LOG_DEBUG(Service_Audio, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(buffer_event.GetReadableEvent()); } @@ -636,7 +636,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { size = Common::AlignUp(size, 4096); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(size); LOG_DEBUG(Service_Audio, "buffer_size=0x{:X}", size); @@ -651,7 +651,7 @@ void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) { // Revisionless variant of GetAudioDeviceServiceWithRevisionInfo that // always assumes the initial release revision (REV1). IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAudioDevice>(system, buffer_event, Common::MakeMagic('R', 'E', 'V', '1')); } @@ -673,7 +673,7 @@ void AudRenU::GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& c LOG_DEBUG(Service_Audio, "called. revision={:08X}, aruid={:016X}", revision, aruid); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAudioDevice>(system, buffer_event, revision); } @@ -682,7 +682,7 @@ void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) { const auto params = rp.PopRaw<AudioCommon::AudioRendererParameter>(); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAudioRenderer>(system, params, audren_instance_count++); } diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index ee5ec8cd6..10e6f7a64 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp @@ -80,13 +80,13 @@ private: LOG_ERROR(Audio, "Failed to decode opus data"); IPC::ResponseBuilder rb{ctx, 2}; // TODO(ogniK): Use correct error code - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } const u32 param_size = performance != nullptr ? 6 : 4; IPC::ResponseBuilder rb{ctx, param_size}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(consumed); rb.Push<u32>(sample_count); if (performance) { @@ -249,7 +249,7 @@ void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Audio, "worker_buffer_sz={}", worker_buffer_sz); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(worker_buffer_sz); } @@ -281,12 +281,12 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) { LOG_ERROR(Audio, "Failed to create Opus decoder (error={}).", error); IPC::ResponseBuilder rb{ctx, 2}; // TODO(ogniK): Use correct error code - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IHardwareOpusDecoderManager>( system, OpusDecoderState{std::move(decoder), sample_rate, channel_count}); } diff --git a/src/core/hle/service/bcat/backend/backend.cpp b/src/core/hle/service/bcat/backend/backend.cpp index 0e935bfa6..a78544c88 100644 --- a/src/core/hle/service/bcat/backend/backend.cpp +++ b/src/core/hle/service/bcat/backend/backend.cpp @@ -106,7 +106,7 @@ bool NullBackend::Synchronize(TitleIDVersion title, ProgressServiceBackend& prog LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, build_id={:016X}", title.title_id, title.build_id); - progress.FinishDownload(RESULT_SUCCESS); + progress.FinishDownload(ResultSuccess); return true; } @@ -115,7 +115,7 @@ bool NullBackend::SynchronizeDirectory(TitleIDVersion title, std::string name, LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, build_id={:016X}, name={}", title.title_id, title.build_id, name); - progress.FinishDownload(RESULT_SUCCESS); + progress.FinishDownload(ResultSuccess); return true; } diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h index f591a362a..e79a9c2ad 100644 --- a/src/core/hle/service/bcat/backend/backend.h +++ b/src/core/hle/service/bcat/backend/backend.h @@ -51,7 +51,7 @@ struct DeliveryCacheProgressImpl { }; Status status; - ResultCode result = RESULT_SUCCESS; + ResultCode result = ResultSuccess; DirectoryName current_directory; FileName current_file; s64 current_downloaded_bytes; ///< Bytes downloaded on current file. diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 3cc397604..d9fdc2dca 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -121,7 +121,7 @@ void HandleDownloadDisplayResult(const AM::Applets::AppletManager& applet_manage const auto& frontend{applet_manager.GetAppletFrontendSet()}; frontend.error->ShowCustomErrorText( - RESULT_UNKNOWN, "There was an error while attempting to use Boxcat.", + ResultUnknown, "There was an error while attempting to use Boxcat.", DOWNLOAD_RESULT_LOG_MESSAGES[static_cast<std::size_t>(res)], [] {}); } @@ -300,7 +300,7 @@ void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGe const auto dir = dir_getter(title.title_id); if (dir) progress.SetTotalSize(dir->GetSize()); - progress.FinishDownload(RESULT_SUCCESS); + progress.FinishDownload(ResultSuccess); return; } @@ -383,7 +383,7 @@ void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGe } } - progress.FinishDownload(RESULT_SUCCESS); + progress.FinishDownload(ResultSuccess); } bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) { diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 0206cbb6a..44e4d0509 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp @@ -106,7 +106,7 @@ private: LOG_DEBUG(Service_BCAT, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(event); } @@ -116,7 +116,7 @@ private: ctx.WriteBuffer(impl); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } Kernel::KReadableEvent& event; @@ -185,7 +185,7 @@ private: GetProgressBackend(SyncType::Normal)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface(CreateProgressService(SyncType::Normal)); } @@ -202,7 +202,7 @@ private: name, GetProgressBackend(SyncType::Directory)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface(CreateProgressService(SyncType::Directory)); } @@ -235,7 +235,7 @@ private: backend.SetPassphrase(title_id, passphrase); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ClearDeliveryCacheStorage(Kernel::HLERequestContext& ctx) { @@ -259,7 +259,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } ProgressServiceBackend& GetProgressBackend(SyncType type) { @@ -278,7 +278,7 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_BCAT, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IBcatService>(system, *backend); } @@ -340,7 +340,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Read(Kernel::HLERequestContext& ctx) { @@ -362,7 +362,7 @@ private: ctx.WriteBuffer(buffer); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(buffer.size()); } @@ -376,7 +376,7 @@ private: } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(current_file->GetSize()); } @@ -390,7 +390,7 @@ private: } IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(DigestFile(current_file)); } @@ -443,7 +443,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Read(Kernel::HLERequestContext& ctx) { @@ -472,7 +472,7 @@ private: ctx.WriteBuffer(entries); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(write_size * sizeof(DeliveryCacheDirectoryEntry))); } @@ -489,7 +489,7 @@ private: const auto files = current_dir->GetFiles(); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(files.size())); } @@ -524,7 +524,7 @@ private: LOG_DEBUG(Service_BCAT, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDeliveryCacheFileService>(system, root); } @@ -532,7 +532,7 @@ private: LOG_DEBUG(Service_BCAT, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDeliveryCacheDirectoryService>(system, root); } @@ -546,7 +546,7 @@ private: next_read_index += size; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(size)); } @@ -560,7 +560,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont const auto title_id = system.CurrentProcess()->GetTitleID(); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id)); } @@ -572,7 +572,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", title_id); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id)); } diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index fd97a822c..46da438ef 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp @@ -44,7 +44,7 @@ private: LOG_WARNING(Service_BTM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(register_event.GetReadableEvent()); } diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 3b5ef69e1..3ab29036a 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -76,7 +76,7 @@ private: LOG_WARNING(Service_BTM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(scan_event.GetReadableEvent()); } @@ -84,7 +84,7 @@ private: LOG_WARNING(Service_BTM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(connection_event.GetReadableEvent()); } @@ -92,7 +92,7 @@ private: LOG_WARNING(Service_BTM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(service_discovery.GetReadableEvent()); } @@ -100,7 +100,7 @@ private: LOG_WARNING(Service_BTM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(config_event.GetReadableEvent()); } @@ -126,7 +126,7 @@ private: LOG_DEBUG(Service_BTM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IBtmUserCore>(system); } }; @@ -273,7 +273,7 @@ private: LOG_DEBUG(Service_BTM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IBtmSystemCore>(system); } }; diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp index 45c1c9d30..a9ad5c8b1 100644 --- a/src/core/hle/service/caps/caps_c.cpp +++ b/src/core/hle/service/caps/caps_c.cpp @@ -84,7 +84,7 @@ void CAPS_C::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) { library_version, applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp index eae39eb7b..45b705950 100644 --- a/src/core/hle/service/caps/caps_su.cpp +++ b/src/core/hle/service/caps/caps_su.cpp @@ -33,7 +33,7 @@ void CAPS_SU::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) { library_version, applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp index 10b8d54b1..8f8ee2bb4 100644 --- a/src/core/hle/service/caps/caps_u.cpp +++ b/src/core/hle/service/caps/caps_u.cpp @@ -62,7 +62,7 @@ void CAPS_U::SetShimLibraryVersion(Kernel::HLERequestContext& ctx) { library_version, applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& ctx) { @@ -89,7 +89,7 @@ void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& c total_entries_1, total_entries_2); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(total_entries_1); rb.Push(total_entries_2); } diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index 26d1e3306..110c7cb1c 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp @@ -137,7 +137,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetTitleKey(Kernel::HLERequestContext& ctx) { @@ -163,7 +163,7 @@ private: ctx.WriteBuffer(key); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void CountCommonTicket(Kernel::HLERequestContext& ctx) { @@ -172,7 +172,7 @@ private: const u32 count = static_cast<u32>(keys.GetCommonTickets().size()); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(count); } @@ -182,7 +182,7 @@ private: const u32 count = static_cast<u32>(keys.GetPersonalizedTickets().size()); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(count); } @@ -205,7 +205,7 @@ private: ctx.WriteBuffer(ids.data(), out_entries * sizeof(u128)); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(out_entries); } @@ -228,7 +228,7 @@ private: ctx.WriteBuffer(ids.data(), out_entries * sizeof(u128)); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(out_entries); } @@ -244,7 +244,7 @@ private: const auto ticket = keys.GetCommonTickets().at(rights_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(ticket.GetSize()); } @@ -260,7 +260,7 @@ private: const auto ticket = keys.GetPersonalizedTickets().at(rights_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(ticket.GetSize()); } @@ -279,7 +279,7 @@ private: ctx.WriteBuffer(&ticket, write_size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(write_size); } @@ -298,7 +298,7 @@ private: ctx.WriteBuffer(&ticket, write_size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(write_size); } diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index b7666e95a..2c2619a7d 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp @@ -135,7 +135,7 @@ void Module::Interface::ThrowFatal(Kernel::HLERequestContext& ctx) { ThrowFatalError(system, error_code, FatalType::ErrorScreen, {}); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) { @@ -147,7 +147,7 @@ void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) { ThrowFatalError(system, error_code, fatal_type, {}); // No info is passed with ThrowFatalWithPolicy IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) { @@ -163,7 +163,7 @@ void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx) ThrowFatalError(system, error_code, fatal_type, info); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp index 9dc1bc52e..25c6c0194 100644 --- a/src/core/hle/service/fgm/fgm.cpp +++ b/src/core/hle/service/fgm/fgm.cpp @@ -45,7 +45,7 @@ private: LOG_DEBUG(Service_FGM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IRequest>(system); } }; diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 78664439d..3c16fe6c7 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -60,27 +60,27 @@ ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 } const auto entry_type = GetEntryType(path); - if (entry_type.Code() == RESULT_SUCCESS) { + if (entry_type.Code() == ResultSuccess) { return FileSys::ERROR_PATH_ALREADY_EXISTS; } auto file = dir->CreateFile(Common::FS::GetFilename(path)); if (file == nullptr) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } if (!file->Resize(size)) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const { std::string path(Common::FS::SanitizePath(path_)); if (path.empty()) { // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but... - return RESULT_SUCCESS; + return ResultSuccess; } auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); @@ -89,10 +89,10 @@ ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) cons } if (!dir->DeleteFile(Common::FS::GetFilename(path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const { @@ -104,9 +104,9 @@ ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) auto new_dir = dir->CreateSubdirectory(Common::FS::GetFilename(path)); if (new_dir == nullptr) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) const { @@ -114,9 +114,9 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); if (!dir->DeleteSubdirectory(Common::FS::GetFilename(path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::string& path_) const { @@ -124,9 +124,9 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::str auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); if (!dir->DeleteSubdirectoryRecursive(Common::FS::GetFilename(path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::string& path) const { @@ -135,10 +135,10 @@ ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::stri if (!dir->CleanSubdirectoryRecursive(Common::FS::GetFilename(sanitized_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, @@ -152,14 +152,14 @@ ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, return FileSys::ERROR_PATH_NOT_FOUND; if (!src->Rename(Common::FS::GetFilename(dest_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } // Move by hand -- TODO(DarkLordZach): Optimize auto c_res = CreateFile(dest_path, src->GetSize()); - if (c_res != RESULT_SUCCESS) + if (c_res != ResultSuccess) return c_res; auto dest = backing->GetFileRelative(dest_path); @@ -170,10 +170,10 @@ ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, if (!src->GetContainingDirectory()->DeleteFile(Common::FS::GetFilename(src_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_path_, @@ -187,9 +187,9 @@ ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_pa return FileSys::ERROR_PATH_NOT_FOUND; if (!src->Rename(Common::FS::GetFilename(dest_path))) { // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } - return RESULT_SUCCESS; + return ResultSuccess; } // TODO(DarkLordZach): Implement renaming across the tree (move). @@ -199,7 +199,7 @@ ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_pa src_path, dest_path); // TODO(DarkLordZach): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } ResultVal<FileSys::VirtualFile> VfsDirectoryServiceWrapper::OpenFile(const std::string& path_, @@ -258,7 +258,7 @@ FileSystemController::~FileSystemController() = default; ResultCode FileSystemController::RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) { romfs_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered RomFS"); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode FileSystemController::RegisterSaveData( @@ -266,21 +266,21 @@ ResultCode FileSystemController::RegisterSaveData( ASSERT_MSG(save_data_factory == nullptr, "Tried to register a second save data"); save_data_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered save data"); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode FileSystemController::RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory) { ASSERT_MSG(sdmc_factory == nullptr, "Tried to register a second SDMC"); sdmc_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered SDMC"); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode FileSystemController::RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) { ASSERT_MSG(bis_factory == nullptr, "Tried to register a second BIS"); bis_factory = std::move(factory); LOG_DEBUG(Service_FS, "Registered BIS"); - return RESULT_SUCCESS; + return ResultSuccess; } void FileSystemController::SetPackedUpdate(FileSys::VirtualFile update_raw) { @@ -297,7 +297,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess() if (romfs_factory == nullptr) { // TODO(bunnei): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->OpenCurrentProcess(system.CurrentProcess()->GetTitleID()); @@ -309,7 +309,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFS( if (romfs_factory == nullptr) { // TODO: Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->OpenPatchedRomFS(title_id, type); @@ -322,7 +322,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFSWithProgra if (romfs_factory == nullptr) { // TODO: Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->OpenPatchedRomFSWithProgramIndex(title_id, program_index, type); @@ -335,7 +335,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( if (romfs_factory == nullptr) { // TODO(bunnei): Find a better error code for this - return RESULT_UNKNOWN; + return ResultUnknown; } return romfs_factory->Open(title_id, storage_id, type); @@ -721,6 +721,10 @@ FileSys::VirtualDir FileSystemController::GetBCATDirectory(u64 title_id) const { return bis_factory->GetBCATDirectory(title_id); } +void FileSystemController::SetAutoSaveDataCreation(bool enable) { + save_data_factory->SetAutoCreate(enable); +} + void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { if (overwrite) { bis_factory = nullptr; diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 7102d3f9a..b6b1b9220 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h @@ -120,6 +120,8 @@ public: FileSys::VirtualDir GetBCATDirectory(u64 title_id) const; + void SetAutoSaveDataCreation(bool enable); + // Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function // above is called. void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite = true); diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 92ea27074..3af9881c2 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -100,7 +100,7 @@ private: ctx.WriteBuffer(output); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetSize(Kernel::HLERequestContext& ctx) { @@ -108,7 +108,7 @@ private: LOG_DEBUG(Service_FS, "called, size={}", size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(size); } }; @@ -162,7 +162,7 @@ private: ctx.WriteBuffer(output); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u64>(output.size())); } @@ -206,7 +206,7 @@ private: written); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Flush(Kernel::HLERequestContext& ctx) { @@ -215,7 +215,7 @@ private: // Exists for SDK compatibiltity -- No need to flush file. IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetSize(Kernel::HLERequestContext& ctx) { @@ -226,7 +226,7 @@ private: backend->Resize(size); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetSize(Kernel::HLERequestContext& ctx) { @@ -234,7 +234,7 @@ private: LOG_DEBUG(Service_FS, "called, size={}", size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(size); } }; @@ -290,7 +290,7 @@ private: ctx.WriteBuffer(begin, range_size); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(actual_entries); } @@ -300,7 +300,7 @@ private: u64 count = entries.size() - next_entry_index; IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(count); } }; @@ -430,7 +430,7 @@ public: auto file = std::make_shared<IFile>(system, result.Unwrap()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IFile>(std::move(file)); } @@ -455,7 +455,7 @@ public: auto directory = std::make_shared<IDirectory>(system, result.Unwrap()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDirectory>(std::move(directory)); } @@ -473,7 +473,7 @@ public: } IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(*result)); } @@ -481,14 +481,14 @@ public: LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetFreeSpaceSize(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(size.get_free_size()); } @@ -496,7 +496,7 @@ public: LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(size.get_total_size()); } @@ -538,7 +538,7 @@ public: ctx.WriteBuffer(begin, range_size); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(actual_entries)); } @@ -764,7 +764,7 @@ FSP_SRV::FSP_SRV(Core::System& system_) {1000, nullptr, "SetBisRootForHost"}, {1001, nullptr, "SetSaveDataSize"}, {1002, nullptr, "SetSaveDataRootPath"}, - {1003, nullptr, "DisableAutoSaveDataCreation"}, + {1003, &FSP_SRV::DisableAutoSaveDataCreation, "DisableAutoSaveDataCreation"}, {1004, &FSP_SRV::SetGlobalAccessLogMode, "SetGlobalAccessLogMode"}, {1005, &FSP_SRV::GetGlobalAccessLogMode, "GetGlobalAccessLogMode"}, {1006, &FSP_SRV::OutputAccessLogToSdCard, "OutputAccessLogToSdCard"}, @@ -796,7 +796,7 @@ void FSP_SRV::SetCurrentProcess(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called. current_process_id=0x{:016X}", current_process_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) { @@ -807,7 +807,7 @@ void FSP_SRV::OpenFileSystemWithPatch(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_FS, "(STUBBED) called with type={}, title_id={:016X}", type, title_id); IPC::ResponseBuilder rb{ctx, 2, 0, 0}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); } void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { @@ -818,7 +818,7 @@ void FSP_SRV::OpenSdCardFileSystem(Kernel::HLERequestContext& ctx) { SizeGetter::FromStorageId(fsc, FileSys::StorageId::SdCard)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IFileSystem>(std::move(filesystem)); } @@ -835,7 +835,7 @@ void FSP_SRV::CreateSaveDataFileSystem(Kernel::HLERequestContext& ctx) { fsc.CreateSaveData(FileSys::SaveDataSpaceId::NandUser, save_struct); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) { @@ -879,7 +879,7 @@ void FSP_SRV::OpenSaveDataFileSystem(Kernel::HLERequestContext& ctx) { SizeGetter::FromStorageId(fsc, id)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IFileSystem>(std::move(filesystem)); } @@ -894,7 +894,7 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(Kernel::HLERequestContext& LOG_INFO(Service_FS, "called, space={}", space); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISaveDataInfoReader>( std::make_shared<ISaveDataInfoReader>(system, space, fsc)); } @@ -903,7 +903,7 @@ void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(Kernel::HLEReq LOG_WARNING(Service_FS, "(STUBBED) called."); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( @@ -929,7 +929,7 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( parameters.attribute.index); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(flags); } @@ -941,14 +941,14 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) { // TODO (bunnei): Find the right error code to use here LOG_CRITICAL(Service_FS, "no file system interface available!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } auto storage = std::make_shared<IStorage>(system, std::move(current_romfs.Unwrap())); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } @@ -968,7 +968,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { if (archive != nullptr) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface(std::make_shared<IStorage>(system, archive)); return; } @@ -978,7 +978,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { "could not open data storage with title_id={:016X}, storage_id={:02X}", title_id, storage_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -988,7 +988,7 @@ void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) { system, pm.PatchRomFS(std::move(data.Unwrap()), 0, FileSys::ContentRecordType::Data)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } @@ -1019,17 +1019,26 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) { LOG_ERROR(Service_FS, "could not open storage with program_index={}", program_index); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } auto storage = std::make_shared<IStorage>(system, std::move(patched_romfs.Unwrap())); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(std::move(storage)); } +void FSP_SRV::DisableAutoSaveDataCreation(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_FS, "called"); + + fsc.SetAutoSaveDataCreation(false); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; log_mode = rp.PopEnum<LogMode>(); @@ -1037,14 +1046,14 @@ void FSP_SRV::SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called, log_mode={:08X}", log_mode); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(log_mode); } @@ -1058,14 +1067,14 @@ void FSP_SRV::OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx) { reporter.SaveFilesystemAccessReport(log_mode, std::move(log)); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FSP_SRV::GetProgramIndexForAccessLog(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(AccessLogVersion::Latest); rb.Push(access_log_program_index); } @@ -1088,14 +1097,14 @@ private: LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Commit(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_FS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } }; @@ -1103,7 +1112,7 @@ void FSP_SRV::OpenMultiCommitManager(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>(system)); } diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h index b01b924eb..ff7455a20 100644 --- a/src/core/hle/service/filesystem/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp_srv.h @@ -50,6 +50,7 @@ private: void OpenDataStorageByDataId(Kernel::HLERequestContext& ctx); void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); void OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx); + void DisableAutoSaveDataCreation(Kernel::HLERequestContext& ctx); void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 91c202952..c5f88bce7 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -135,7 +135,7 @@ private: // blocked users. LOG_WARNING(Service_Friend, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(0); // Indicates there are no blocked users } @@ -143,14 +143,14 @@ private: // Stub used by Splatoon 2 LOG_WARNING(Service_Friend, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void UpdateUserPresence(Kernel::HLERequestContext& ctx) { // Stub used by Retro City Rampage LOG_WARNING(Service_Friend, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) { @@ -162,7 +162,7 @@ private: uuid.Format()); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetFriendList(Kernel::HLERequestContext& ctx) { @@ -175,7 +175,7 @@ private: uuid.Format(), pid); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(0); // Friend count // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId" @@ -206,7 +206,7 @@ private: LOG_DEBUG(Service_Friend, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(notification_event.GetReadableEvent()); } @@ -218,7 +218,7 @@ private: std::memset(&states, 0, sizeof(States)); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Pop(Kernel::HLERequestContext& ctx) { @@ -249,7 +249,7 @@ private: } IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<SizedNotificationInfo>(notification); } @@ -280,7 +280,7 @@ private: void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IFriendService>(system); LOG_DEBUG(Service_Friend, "called"); } @@ -292,7 +292,7 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx LOG_DEBUG(Service_Friend, "called, uuid={}", uuid.Format()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<INotificationService>(uuid, system); } diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 6ad62ee5a..ca25df67e 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp @@ -79,7 +79,7 @@ void ARP_R::GetApplicationLaunchProperty(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(*res); } @@ -99,7 +99,7 @@ void ARP_R::GetApplicationLaunchPropertyWithApplicationId(Kernel::HLERequestCont } IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(*res); } @@ -129,7 +129,7 @@ void ARP_R::GetApplicationControlProperty(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(*res); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ARP_R::GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestContext& ctx) { @@ -150,7 +150,7 @@ void ARP_R::GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestCon ctx.WriteBuffer(*res); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } class IRegistrar final : public ServiceFramework<IRegistrar> { @@ -198,7 +198,7 @@ private: issued = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetApplicationLaunchProperty(Kernel::HLERequestContext& ctx) { @@ -217,7 +217,7 @@ private: launch = rp.PopRaw<ApplicationLaunchProperty>(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetApplicationControlProperty(Kernel::HLERequestContext& ctx) { @@ -235,7 +235,7 @@ private: control = ctx.ReadBuffer(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } IssuerFn issue_process_id; @@ -273,7 +273,7 @@ void ARP_W::AcquireRegistrar(Kernel::HLERequestContext& ctx) { }); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface(registrar); } diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp index daecfff15..564c3b750 100644 --- a/src/core/hle/service/glue/bgtc.cpp +++ b/src/core/hle/service/glue/bgtc.cpp @@ -25,7 +25,7 @@ void BGTC_T::OpenTaskService(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_BGTC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ITaskService>(system); } diff --git a/src/core/hle/service/glue/manager.cpp b/src/core/hle/service/glue/manager.cpp index 6da52d2d6..9b1754cf8 100644 --- a/src/core/hle/service/glue/manager.cpp +++ b/src/core/hle/service/glue/manager.cpp @@ -54,7 +54,7 @@ ResultCode ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch, } entries.insert_or_assign(title_id, MapEntry{launch, std::move(control)}); - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode ARPManager::Unregister(u64 title_id) { @@ -68,7 +68,7 @@ ResultCode ARPManager::Unregister(u64 title_id) { } entries.erase(iter); - return RESULT_SUCCESS; + return ResultSuccess; } void ARPManager::ResetAll() { diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index df0fe1c8e..fa6213d3c 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -114,7 +114,7 @@ void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(&system.Kernel().GetHidSharedMem()); } @@ -183,7 +183,7 @@ private: vibration_device_handle.device_index); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } std::shared_ptr<IAppletResource> applet_resource; @@ -351,7 +351,7 @@ void Hid::CreateAppletResource(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAppletResource>(applet_resource); } @@ -364,7 +364,7 @@ void Hid::ActivateDebugPad(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::ActivateTouchScreen(Kernel::HLERequestContext& ctx) { @@ -376,7 +376,7 @@ void Hid::ActivateTouchScreen(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::ActivateMouse(Kernel::HLERequestContext& ctx) { @@ -388,7 +388,7 @@ void Hid::ActivateMouse(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::ActivateKeyboard(Kernel::HLERequestContext& ctx) { @@ -400,7 +400,7 @@ void Hid::ActivateKeyboard(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { @@ -410,7 +410,7 @@ void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::ActivateXpad(Kernel::HLERequestContext& ctx) { @@ -429,7 +429,7 @@ void Hid::ActivateXpad(Kernel::HLERequestContext& ctx) { parameters.basic_xpad_id, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetXpadIDs(Kernel::HLERequestContext& ctx) { @@ -439,7 +439,7 @@ void Hid::GetXpadIDs(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "(STUBBED) called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(0); } @@ -461,7 +461,7 @@ void Hid::ActivateSixAxisSensor(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::DeactivateSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -482,7 +482,7 @@ void Hid::DeactivateSixAxisSensor(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StartSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -503,7 +503,7 @@ void Hid::StartSixAxisSensor(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -524,7 +524,7 @@ void Hid::StopSixAxisSensor(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) { @@ -547,7 +547,7 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) { parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { @@ -573,7 +573,7 @@ void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { parameters.parameter2, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { @@ -599,7 +599,7 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(parameter1); rb.Push(parameter2); } @@ -624,7 +624,7 @@ void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { @@ -643,7 +643,7 @@ void Hid::SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { drift_mode, applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { @@ -662,7 +662,7 @@ void Hid::GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad) .GetGyroscopeZeroDriftMode()); } @@ -686,7 +686,7 @@ void Hid::ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx) { @@ -705,7 +705,7 @@ void Hid::IsSixAxisSensorAtRest(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(applet_resource->GetController<Controller_NPad>(HidController::NPad) .IsSixAxisSensorAtRest()); } @@ -726,7 +726,7 @@ void Hid::ActivateGesture(Kernel::HLERequestContext& ctx) { parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { @@ -739,7 +739,7 @@ void Hid::SetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, supported_styleset={}", supported_styleset); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { @@ -749,7 +749,7 @@ void Hid::GetSupportedNpadStyleSet(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(applet_resource->GetController<Controller_NPad>(HidController::NPad) .GetSupportedStyleSet() .raw); @@ -765,7 +765,7 @@ void Hid::SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::ActivateNpad(Kernel::HLERequestContext& ctx) { @@ -777,7 +777,7 @@ void Hid::ActivateNpad(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::DeactivateNpad(Kernel::HLERequestContext& ctx) { @@ -789,7 +789,7 @@ void Hid::DeactivateNpad(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) { @@ -807,7 +807,7 @@ void Hid::AcquireNpadStyleSetUpdateEventHandle(Kernel::HLERequestContext& ctx) { parameters.npad_id, parameters.applet_resource_user_id, parameters.unknown); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(applet_resource->GetController<Controller_NPad>(HidController::NPad) .GetStyleSetChangedEvent(parameters.npad_id)); } @@ -829,7 +829,7 @@ void Hid::DisconnectNpad(Kernel::HLERequestContext& ctx) { parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetPlayerLedPattern(Kernel::HLERequestContext& ctx) { @@ -839,7 +839,7 @@ void Hid::GetPlayerLedPattern(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, npad_id={}", npad_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(applet_resource->GetController<Controller_NPad>(HidController::NPad) .GetLedPattern(npad_id) .raw); @@ -862,7 +862,7 @@ void Hid::ActivateNpadWithRevision(Kernel::HLERequestContext& ctx) { parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { @@ -876,7 +876,7 @@ void Hid::SetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { applet_resource_user_id, hold_type); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { @@ -886,7 +886,7 @@ void Hid::GetNpadJoyHoldType(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad).GetHoldType()); } @@ -907,7 +907,7 @@ void Hid::SetNpadJoyAssignmentModeSingleByDefault(Kernel::HLERequestContext& ctx parameters.npad_id, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetNpadJoyAssignmentModeSingle(Kernel::HLERequestContext& ctx) { @@ -931,7 +931,7 @@ void Hid::SetNpadJoyAssignmentModeSingle(Kernel::HLERequestContext& ctx) { parameters.npad_joy_device_type); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) { @@ -951,7 +951,7 @@ void Hid::SetNpadJoyAssignmentModeDual(Kernel::HLERequestContext& ctx) { parameters.npad_id, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) { @@ -967,7 +967,7 @@ void Hid::MergeSingleJoyAsDualJoy(Kernel::HLERequestContext& ctx) { npad_id_1, npad_id_2, applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StartLrAssignmentMode(Kernel::HLERequestContext& ctx) { @@ -979,7 +979,7 @@ void Hid::StartLrAssignmentMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StopLrAssignmentMode(Kernel::HLERequestContext& ctx) { @@ -991,7 +991,7 @@ void Hid::StopLrAssignmentMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { @@ -1006,7 +1006,7 @@ void Hid::SetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { applet_resource_user_id, activation_mode); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { @@ -1016,7 +1016,7 @@ void Hid::GetNpadHandheldActivationMode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad) .GetNpadHandheldActivationMode()); } @@ -1035,7 +1035,7 @@ void Hid::SwapNpadAssignment(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; if (res) { - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } else { LOG_ERROR(Service_HID, "Npads are not connected!"); rb.Push(ERR_NPAD_NOT_CONNECTED); @@ -1056,7 +1056,7 @@ void Hid::IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext parameters.npad_id, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(applet_resource->GetController<Controller_NPad>(HidController::NPad) .IsUnintendedHomeButtonInputProtectionEnabled(parameters.npad_id)); } @@ -1083,7 +1083,7 @@ void Hid::EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& c parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx) { @@ -1104,7 +1104,7 @@ void Hid::SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx) { parameters.analog_stick_use_center_clamp, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { @@ -1148,7 +1148,7 @@ void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { vibration_device_info.type, vibration_device_info.position); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(vibration_device_info); } @@ -1173,7 +1173,7 @@ void Hid::SendVibrationValue(Kernel::HLERequestContext& ctx) { parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetActualVibrationValue(Kernel::HLERequestContext& ctx) { @@ -1193,7 +1193,7 @@ void Hid::GetActualVibrationValue(Kernel::HLERequestContext& ctx) { parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(applet_resource->GetController<Controller_NPad>(HidController::NPad) .GetLastVibration(parameters.vibration_device_handle)); } @@ -1202,7 +1202,7 @@ void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IActiveVibrationDeviceList>(system, applet_resource); } @@ -1215,14 +1215,14 @@ void Hid::PermitVibration(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::IsVibrationPermitted(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(Settings::values.vibration_enabled.GetValue()); } @@ -1247,7 +1247,7 @@ void Hid::SendVibrationValues(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SendVibrationGcErmCommand(Kernel::HLERequestContext& ctx) { @@ -1307,7 +1307,7 @@ void Hid::SendVibrationGcErmCommand(Kernel::HLERequestContext& ctx) { parameters.gc_erm_command); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetActualVibrationGcErmCommand(Kernel::HLERequestContext& ctx) { @@ -1348,7 +1348,7 @@ void Hid::GetActualVibrationGcErmCommand(Kernel::HLERequestContext& ctx) { parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(gc_erm_command); } @@ -1362,7 +1362,7 @@ void Hid::BeginPermitVibrationSession(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::EndPermitVibrationSession(Kernel::HLERequestContext& ctx) { @@ -1372,7 +1372,7 @@ void Hid::EndPermitVibrationSession(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_HID, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::IsVibrationDeviceMounted(Kernel::HLERequestContext& ctx) { @@ -1392,7 +1392,7 @@ void Hid::IsVibrationDeviceMounted(Kernel::HLERequestContext& ctx) { parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(applet_resource->GetController<Controller_NPad>(HidController::NPad) .IsVibrationDeviceMounted(parameters.vibration_device_handle)); } @@ -1406,7 +1406,7 @@ void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -1426,7 +1426,7 @@ void Hid::StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StopConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -1446,7 +1446,7 @@ void Hid::StopConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -1458,7 +1458,7 @@ void Hid::ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StartSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -1469,7 +1469,7 @@ void Hid::StartSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -1480,7 +1480,7 @@ void Hid::StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -1500,7 +1500,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { if (t_mem_1.IsNull()) { LOG_ERROR(Service_HID, "t_mem_1 is a nullptr for handle=0x{:08X}", t_mem_1_handle); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -1510,7 +1510,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { if (t_mem_2.IsNull()) { LOG_ERROR(Service_HID, "t_mem_2 is a nullptr for handle=0x{:08X}", t_mem_2_handle); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -1530,7 +1530,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { t_mem_1_handle, t_mem_2_handle, applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::FinalizeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { @@ -1541,7 +1541,7 @@ void Hid::FinalizeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx) { @@ -1554,7 +1554,7 @@ void Hid::ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) { @@ -1567,7 +1567,7 @@ void Hid::SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) { applet_resource_user_id, is_palma_all_connectable); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { @@ -1577,7 +1577,7 @@ void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_HID, "(STUBBED) called, palma_boost_mode={}", palma_boost_mode); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::SetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { @@ -1592,7 +1592,7 @@ void Hid::SetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { applet_resource_user_id, communication_mode); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Hid::GetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { @@ -1603,7 +1603,7 @@ void Hid::GetNpadCommunicationMode(Kernel::HLERequestContext& ctx) { applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad) .GetNpadCommunicationMode()); } @@ -1956,7 +1956,7 @@ private: LOG_WARNING(Service_HID, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } }; diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 3c6085990..4a92c6234 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp @@ -43,21 +43,21 @@ void IRS::ActivateIrsensor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::DeactivateIrsensor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::GetIrsensorSharedMemoryHandle(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_IRS, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(&system.Kernel().GetIrsSharedMem()); } @@ -65,35 +65,35 @@ void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::GetImageTransferProcessorState(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 5}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u64>(system.CoreTiming().GetCPUTicks()); rb.PushRaw<u32>(0); } @@ -102,14 +102,14 @@ void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::GetNpadIrCameraHandle(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u32>(device_handle); } @@ -117,56 +117,56 @@ void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::SuspendImageProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::CheckFirmwareVersion(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::SetFunctionLevel(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IRS::ActivateIrsensorWithFunctionLevel(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_IRS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } IRS::~IRS() = default; diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index 3a5a2f4f5..24890c830 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp @@ -75,7 +75,7 @@ private: update_instantly = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetCurrentBrightnessSetting(Kernel::HLERequestContext& ctx) { @@ -88,7 +88,7 @@ private: LOG_DEBUG(Service_LBL, "called brightness={}", brightness); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(brightness); } @@ -100,7 +100,7 @@ private: backlight_enabled = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SwitchBacklightOff(Kernel::HLERequestContext& ctx) { @@ -111,14 +111,14 @@ private: backlight_enabled = false; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetBacklightSwitchStatus(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum<BacklightSwitchStatus>(backlight_enabled ? BacklightSwitchStatus::On : BacklightSwitchStatus::Off); } @@ -129,7 +129,7 @@ private: dimming = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void DisableDimming(Kernel::HLERequestContext& ctx) { @@ -138,14 +138,14 @@ private: dimming = false; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IsDimmingEnabled(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(dimming); } @@ -155,7 +155,7 @@ private: update_instantly = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void DisableAutoBrightnessControl(Kernel::HLERequestContext& ctx) { @@ -163,14 +163,14 @@ private: auto_brightness = false; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IsAutoBrightnessControlEnabled(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(auto_brightness); } @@ -183,14 +183,14 @@ private: ambient_light_value = light_value; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetAmbientLightSensorValue(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(ambient_light_value); } @@ -199,7 +199,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetBrightnessReflectionDelayLevel(Kernel::HLERequestContext& ctx) { @@ -207,7 +207,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(0.0f); } @@ -216,7 +216,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetCurrentBrightnessMapping(Kernel::HLERequestContext& ctx) { @@ -224,7 +224,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // This function is suppose to return something but it seems like it doesn't } @@ -233,7 +233,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetCurrentAmbientLightSensorMapping(Kernel::HLERequestContext& ctx) { @@ -241,14 +241,14 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // This function is suppose to return something but it seems like it doesn't } void IsAmbientLightSensorAvailable(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_LBL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // TODO(ogniK): Only return true if there's no device error rb.Push(true); } @@ -267,7 +267,7 @@ private: current_vr_brightness = brightness; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetCurrentBrightnessSettingForVrMode(Kernel::HLERequestContext& ctx) { @@ -280,7 +280,7 @@ private: LOG_DEBUG(Service_LBL, "called brightness={}", brightness); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(brightness); } @@ -288,7 +288,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); vr_mode_enabled = true; } @@ -297,7 +297,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); vr_mode_enabled = false; } @@ -306,7 +306,7 @@ private: LOG_DEBUG(Service_LBL, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(vr_mode_enabled); } diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index c709a8028..6ccbe9623 100644 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp @@ -48,7 +48,7 @@ public: LOG_DEBUG(Service_LDN, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IMonitorService>(system); } }; @@ -147,7 +147,7 @@ public: // Indicate a network error, as we do not actually emulate LDN rb.Push(static_cast<u32>(State::Error)); - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Initialize2(Kernel::HLERequestContext& ctx) { @@ -189,7 +189,7 @@ public: LOG_DEBUG(Service_LDN, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystemLocalCommunicationService>(system); } }; @@ -210,7 +210,7 @@ public: LOG_DEBUG(Service_LDN, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IUserLocalCommunicationService>(system); } }; @@ -300,7 +300,7 @@ public: input); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<INetworkService>(system); } @@ -311,7 +311,7 @@ public: LOG_WARNING(Service_LDN, "(STUBBED) called reserved_input={}", reserved_input); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<INetworkServiceMonitor>(system); } }; @@ -338,7 +338,7 @@ public: input); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<INetworkService>(system); } @@ -349,7 +349,7 @@ public: LOG_WARNING(Service_LDN, "(STUBBED) called reserved_input={}", reserved_input); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<INetworkServiceMonitor>(system); } }; diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index c3948eb8e..24b7e4435 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp @@ -270,7 +270,7 @@ public: nrr.insert_or_assign(nrr_address, std::move(hashes)); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void UnregisterModuleInfo(Kernel::HLERequestContext& ctx) { @@ -284,7 +284,7 @@ public: IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } bool ValidateRegionForMap(Kernel::KPageTable& page_table, VAddr start, std::size_t size) const { @@ -524,7 +524,7 @@ public: header.segment_headers[DATA_INDEX].memory_size, nro_address}); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(*map_result); } @@ -541,7 +541,7 @@ public: info.nro_address + info.text_size, info.src_addr + info.text_size, info.ro_size)); CASCADE_CODE( page_table.UnmapProcessCodeMemory(info.nro_address, info.src_addr, info.text_size)); - return RESULT_SUCCESS; + return ResultSuccess; } void UnloadModule(Kernel::HLERequestContext& ctx) { @@ -596,7 +596,7 @@ public: initialized = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } private: diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 9bcf8870d..311e4fb2d 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -84,7 +84,7 @@ private: // This function only succeeds - Get that out of the way IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); if (data.size() < sizeof(LogPacketHeader)) { LOG_ERROR(Service_LM, "Data size is too small for header! size={}", data.size()); @@ -141,7 +141,7 @@ private: destination = log_destination; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } u64 ReadLeb128(const std::vector<u8>& data, std::size_t& offset) { @@ -357,7 +357,7 @@ private: LOG_DEBUG(Service_LM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ILogger>(system); } }; diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index 81f150a88..bbd81a88a 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp @@ -74,7 +74,7 @@ private: LOG_DEBUG(Service_Mii, "called with source_flag={}", source_flag); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(manager.CheckAndResetUpdateCounter(source_flag, current_update_counter)); } @@ -82,7 +82,7 @@ private: LOG_DEBUG(Service_Mii, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(manager.IsFullDatabase()); } @@ -93,7 +93,7 @@ private: LOG_DEBUG(Service_Mii, "called with source_flag={}", source_flag); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(manager.GetCount(source_flag)); } @@ -115,7 +115,7 @@ private: } IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(result->size())); } @@ -140,7 +140,7 @@ private: ctx.WriteBuffer(SerializeArray(values)); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(result->size())); } @@ -159,7 +159,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2 + sizeof(MiiInfo) / sizeof(u32)}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<MiiInfo>(*result); } @@ -194,7 +194,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2 + sizeof(MiiInfo) / sizeof(u32)}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<MiiInfo>(manager.BuildRandom(age, gender, race)); } @@ -213,7 +213,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2 + sizeof(MiiInfo) / sizeof(u32)}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<MiiInfo>(manager.BuildDefault(index)); } @@ -238,7 +238,7 @@ private: UNIMPLEMENTED_IF(current_interface_version != 1); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } constexpr bool IsInterfaceVersionSupported(u32 interface_version) const { @@ -267,7 +267,7 @@ public: private: void GetDatabaseService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IDatabaseService>(system); LOG_DEBUG(Service_Mii, "called"); diff --git a/src/core/hle/service/mm/mm_u.cpp b/src/core/hle/service/mm/mm_u.cpp index c8519e2db..0ccfe91cd 100644 --- a/src/core/hle/service/mm/mm_u.cpp +++ b/src/core/hle/service/mm/mm_u.cpp @@ -33,14 +33,14 @@ private: LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void FinalizeOld(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetAndWaitOld(Kernel::HLERequestContext& ctx) { @@ -51,14 +51,14 @@ private: current = min; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetOld(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(current); } @@ -66,7 +66,7 @@ private: LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(id); // Any non zero value } @@ -74,7 +74,7 @@ private: LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetAndWait(Kernel::HLERequestContext& ctx) { @@ -87,14 +87,14 @@ private: current = min; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Get(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_MM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(current); } diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index 44a5d5789..b014ea826 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -46,7 +46,7 @@ private: LOG_DEBUG(Service_NFC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IAm>(system); } }; @@ -94,7 +94,7 @@ private: LOG_DEBUG(Service_NFC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<MFIUser>(system); } }; @@ -141,7 +141,7 @@ private: LOG_DEBUG(Service_NFC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // We don't deal with hardware initialization so we can just stub this. } @@ -149,7 +149,7 @@ private: LOG_DEBUG(Service_NFC, "IsNfcEnabledOld"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u8>(true); } @@ -157,7 +157,7 @@ private: LOG_WARNING(Service_NFC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(NfcStates::Finalized); // TODO(ogniK): Figure out if this matches nfp } @@ -165,7 +165,7 @@ private: LOG_WARNING(Service_NFC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } }; @@ -186,7 +186,7 @@ private: LOG_DEBUG(Service_NFC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IUser>(system); } }; @@ -245,7 +245,7 @@ private: LOG_DEBUG(Service_NFC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystem>(system); } }; diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index d25b20ab5..5f1ca029d 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -113,7 +113,7 @@ private: LOG_DEBUG(Service_NFC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); state = State::Initialized; } @@ -122,7 +122,7 @@ private: LOG_DEBUG(Service_NFC, "called"); IPC::ResponseBuilder rb{ctx, 3, 0}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u32>(static_cast<u32>(state)); } @@ -134,7 +134,7 @@ private: ctx.WriteBuffer(device_handle); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(1); } @@ -144,7 +144,7 @@ private: LOG_DEBUG(Service_NFP, "called, dev_handle=0x{:X}", dev_handle); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(npad_id); } @@ -154,7 +154,7 @@ private: LOG_DEBUG(Service_NFP, "called, dev_handle=0x{:X}", dev_handle); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(nfp_interface.GetNFCEvent()); has_attached_handle = true; } @@ -165,7 +165,7 @@ private: LOG_DEBUG(Service_NFP, "called, dev_handle=0x{:X}", dev_handle); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(deactivate_event.GetReadableEvent()); } @@ -186,14 +186,14 @@ private: break; } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetDeviceState(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NFP, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(device_state)); } @@ -204,7 +204,7 @@ private: device_state = DeviceState::SearchingForTag; } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetTagInfo(Kernel::HLERequestContext& ctx) { @@ -221,7 +221,7 @@ private: .padding_2 = {}, }; ctx.WriteBuffer(tag_info); - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Mount(Kernel::HLERequestContext& ctx) { @@ -229,7 +229,7 @@ private: device_state = DeviceState::TagNearby; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetModelInfo(Kernel::HLERequestContext& ctx) { @@ -238,7 +238,7 @@ private: IPC::ResponseBuilder rb{ctx, 2}; const auto& amiibo = nfp_interface.GetAmiiboBuffer(); ctx.WriteBuffer(amiibo.model_info); - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Unmount(Kernel::HLERequestContext& ctx) { @@ -247,7 +247,7 @@ private: device_state = DeviceState::TagFound; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Finalize(Kernel::HLERequestContext& ctx) { @@ -256,14 +256,14 @@ private: device_state = DeviceState::Finalized; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NFP, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(availability_change_event.GetReadableEvent()); } @@ -273,7 +273,7 @@ private: // TODO(ogniK): Pull Mii and owner data from amiibo IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetCommonInfo(Kernel::HLERequestContext& ctx) { @@ -286,7 +286,7 @@ private: ctx.WriteBuffer(common_info); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void OpenApplicationArea(Kernel::HLERequestContext& ctx) { @@ -299,7 +299,7 @@ private: LOG_WARNING(Service_NFP, "(STUBBED) called"); // We don't need to worry about this since we can just open the file IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u32>(0); // This is from the GetCommonInfo stub } @@ -309,7 +309,7 @@ private: // TODO(ogniK): Pull application area from amiibo IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u32>(0); // This is from the GetCommonInfo stub } @@ -327,7 +327,7 @@ void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NFP, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IUser>(*this, system); } diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 76e3832df..f03b2666a 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -170,14 +170,14 @@ private: LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetRequestState(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); if (Settings::values.bcat_backend == "none") { rb.PushEnum(RequestState::NotSubmitted); @@ -190,14 +190,14 @@ private: LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(event1.GetReadableEvent(), event2.GetReadableEvent()); } @@ -205,14 +205,14 @@ private: LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetConnectionConfirmationOption(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetAppletInfo(Kernel::HLERequestContext& ctx) { @@ -223,7 +223,7 @@ private: ctx.WriteBuffer(out_buffer); IPC::ResponseBuilder rb{ctx, 5}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(0); rb.Push<u32>(0); rb.Push<u32>(0); @@ -254,7 +254,7 @@ private: LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(client_id); // Client ID needs to be non zero otherwise it's considered invalid } void CreateScanRequest(Kernel::HLERequestContext& ctx) { @@ -262,7 +262,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IScanRequest>(system); } void CreateRequest(Kernel::HLERequestContext& ctx) { @@ -270,7 +270,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IRequest>(system); } void GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { @@ -311,13 +311,13 @@ private: ctx.WriteBuffer(network_profile_data); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetCurrentIpAddress(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); @@ -326,7 +326,7 @@ private: UNIMPLEMENTED_IF(error != Network::Errno::SUCCESS); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(ipv4); } void CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) { @@ -340,7 +340,7 @@ private: IPC::ResponseBuilder rb{ctx, 6, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<INetworkProfile>(system); rb.PushRaw<u128>(uuid); } @@ -369,21 +369,21 @@ private: }; IPC::ResponseBuilder rb{ctx, 2 + (sizeof(IpConfigInfo) + 3) / sizeof(u32)}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<IpConfigInfo>(ip_config_info); } void IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u8>(0); } void IsEthernetCommunicationEnabled(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); if (Settings::values.bcat_backend == "none") { rb.Push<u8>(0); } else { @@ -394,7 +394,7 @@ private: LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); if (Settings::values.bcat_backend == "none") { rb.Push<u8>(0); } else { @@ -471,7 +471,7 @@ private: LOG_DEBUG(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IGeneralService>(system); } @@ -479,7 +479,7 @@ private: LOG_DEBUG(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IGeneralService>(system); } }; diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index 420a5a075..7447cc38f 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -52,7 +52,7 @@ private: void CreateAsyncInterface(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IShopServiceAsync>(system); } }; @@ -74,7 +74,7 @@ private: void CreateAccessorInterface(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IShopServiceAccessor>(system); } }; @@ -240,7 +240,7 @@ private: void CreateServerInterface(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IShopServiceAccessServer>(system); } @@ -252,7 +252,7 @@ private: LOG_INFO(Service_NIM, "(STUBBED) called, unknown={}", unknown); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(false); } }; @@ -325,14 +325,14 @@ private: LOG_DEBUG(Service_NIM, "called"); finished_event.GetWritableEvent().Signal(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetFinishNotificationEvent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NIM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(finished_event.GetReadableEvent()); } @@ -340,21 +340,21 @@ private: LOG_DEBUG(Service_NIM, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Cancel(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NIM, "called"); finished_event.GetWritableEvent().Clear(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IsProcessing(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NIM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u32>(0); // We instantly process the request } @@ -365,7 +365,7 @@ private: std::chrono::system_clock::now().time_since_epoch()) .count()}; IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<s64>(server_time); } }; @@ -389,7 +389,7 @@ private: LOG_DEBUG(Service_NIM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IEnsureNetworkClockAvailabilityService>(system); } @@ -398,14 +398,14 @@ private: LOG_WARNING(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ResumeAutonomicTimeCorrection(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } }; diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index e373609a1..8ce1f3296 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -335,7 +335,7 @@ void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestC "output buffer is too small! (actual={:016X}, expected_min=0x4000)", size); IPC::ResponseBuilder rb{ctx, 2}; // TODO(DarkLordZach): Find a better error code for this. - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -355,7 +355,7 @@ void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestC 0x4000 + control.second->GetSize()); IPC::ResponseBuilder rb{ctx, 2}; // TODO(DarkLordZach): Find a better error code for this. - rb.Push(RESULT_UNKNOWN); + rb.Push(ResultUnknown); return; } @@ -369,7 +369,7 @@ void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestC ctx.WriteBuffer(out); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(out.size())); } @@ -380,7 +380,7 @@ void IApplicationManagerInterface::GetApplicationDesiredLanguage(Kernel::HLERequ const auto res = GetApplicationDesiredLanguage(supported_languages); if (res.Succeeded()) { IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(*res); } else { IPC::ResponseBuilder rb{ctx, 2}; @@ -432,7 +432,7 @@ void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( const auto res = ConvertApplicationLanguageToLanguageCode(application_language); if (res.Succeeded()) { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(*res); } else { IPC::ResponseBuilder rb{ctx, 2}; @@ -697,7 +697,7 @@ private: LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystemUpdateControl>(system); } }; @@ -721,7 +721,7 @@ private: LOG_WARNING(Service_NS, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(false); } }; diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 991271f3e..218eec3ec 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -87,7 +87,7 @@ private: LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<T>(system); } @@ -95,7 +95,7 @@ private: LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IApplicationManagerInterface>(system); } diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 90ba5c752..74cc45f1e 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp @@ -216,7 +216,7 @@ void PL_U::RequestLoad(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called, shared_font_type={}", shared_font_type); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void PL_U::GetLoadState(Kernel::HLERequestContext& ctx) { @@ -225,7 +225,7 @@ void PL_U::GetLoadState(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called, font_id={}", font_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(static_cast<u32>(LoadState::Done)); } @@ -235,7 +235,7 @@ void PL_U::GetSize(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called, font_id={}", font_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(impl->GetSharedFontRegion(font_id).size); } @@ -245,7 +245,7 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called, font_id={}", font_id); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(impl->GetSharedFontRegion(font_id).offset); } @@ -254,13 +254,11 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called"); // Create shared font memory object - auto& kernel = system.Kernel(); - std::memcpy(kernel.GetFontSharedMem().GetPointer(), impl->shared_font->data(), impl->shared_font->size()); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(&kernel.GetFontSharedMem()); } @@ -294,7 +292,7 @@ void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(font_offsets, 1); ctx.WriteBuffer(font_sizes, 2); - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u8>(static_cast<u8>(LoadState::Done)); // Fonts Loaded rb.Push<u32>(static_cast<u32>(font_codes.size())); } diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index dc9b9341f..e4d495000 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -23,7 +23,7 @@ void NVDRV::SignalGPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) { void NVDRV::Open(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NVDRV, "called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); if (!is_initialized) { rb.Push<DeviceFD>(0); @@ -52,7 +52,7 @@ void NVDRV::Open(Kernel::HLERequestContext& ctx) { void NVDRV::ServiceError(Kernel::HLERequestContext& ctx, NvResult result) { IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(result); } @@ -78,7 +78,7 @@ void NVDRV::Ioctl1(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(nv_result); } @@ -105,7 +105,7 @@ void NVDRV::Ioctl2(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(nv_result); } @@ -133,7 +133,7 @@ void NVDRV::Ioctl3(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(nv_result); } @@ -151,7 +151,7 @@ void NVDRV::Close(Kernel::HLERequestContext& ctx) { const auto result = nvdrv->Close(fd); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(result); } @@ -161,7 +161,7 @@ void NVDRV::Initialize(Kernel::HLERequestContext& ctx) { is_initialized = true; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(NvResult::Success); } @@ -186,14 +186,14 @@ void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) { if (event_id < MaxNvEvents) { IPC::ResponseBuilder rb{ctx, 3, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); auto& event = nvdrv->GetEvent(event_id); event.Clear(); rb.PushCopyObjects(event); rb.PushEnum(NvResult::Success); } else { IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(NvResult::BadParameter); } } @@ -204,7 +204,7 @@ void NVDRV::SetAruid(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x{:X}", pid); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(NvResult::Success); } @@ -212,14 +212,14 @@ void NVDRV::SetGraphicsFirmwareMemoryMarginEnabled(Kernel::HLERequestContext& ct LOG_WARNING(Service_NVDRV, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void NVDRV::GetStatus(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_NVDRV, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(NvResult::Success); } @@ -229,7 +229,7 @@ void NVDRV::DumpGraphicsMemoryInfo(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NVDRV, "called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } NVDRV::NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name) diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index b066c3417..3bbe1bfe2 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp @@ -50,7 +50,7 @@ private: initialized = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetSaveDataBackupSetting(Kernel::HLERequestContext& ctx) { @@ -60,7 +60,7 @@ private: constexpr u64 backup_setting = 0; IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(backup_setting); } @@ -68,7 +68,7 @@ private: LOG_WARNING(Service_OLSC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } bool initialized{}; diff --git a/src/core/hle/service/pctl/module.cpp b/src/core/hle/service/pctl/module.cpp index 1c3d81143..1e31d05a6 100644 --- a/src/core/hle/service/pctl/module.cpp +++ b/src/core/hle/service/pctl/module.cpp @@ -213,7 +213,7 @@ private: } } - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void CheckFreeCommunicationPermission(Kernel::HLERequestContext& ctx) { @@ -223,7 +223,7 @@ private: if (!CheckFreeCommunicationPermissionImpl()) { rb.Push(Error::ResultNoFreeCommunication); } else { - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } states.free_communication = true; @@ -234,7 +234,7 @@ private: states.stereo_vision = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IsFreeCommunicationAvailable(Kernel::HLERequestContext& ctx) { @@ -244,7 +244,7 @@ private: if (!CheckFreeCommunicationPermissionImpl()) { rb.Push(Error::ResultNoFreeCommunication); } else { - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } } @@ -278,7 +278,7 @@ private: return; } - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void IsStereoVisionPermitted(Kernel::HLERequestContext& ctx) { @@ -289,7 +289,7 @@ private: rb.Push(Error::ResultStereoVisionRestricted); rb.Push(false); } else { - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(true); } } @@ -307,7 +307,7 @@ private: } SetStereoVisionRestrictionImpl(can_use); - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetStereoVisionRestriction(Kernel::HLERequestContext& ctx) { @@ -321,7 +321,7 @@ private: return; } - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(settings.is_stero_vision_restricted); } @@ -331,7 +331,7 @@ private: states.stereo_vision = false; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } struct ApplicationInfo { @@ -368,7 +368,7 @@ void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_PCTL, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // TODO(ogniK): Get TID from process rb.PushIpcInterface<IParentalControlService>(system, capability); @@ -378,7 +378,7 @@ void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext LOG_DEBUG(Service_PCTL, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IParentalControlService>(system, capability); } diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index a43185c44..f675740b4 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp @@ -36,7 +36,7 @@ void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx, }); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(process.has_value() ? (*process)->GetProcessID() : NO_PROCESS_FOUND_PID); } @@ -57,7 +57,7 @@ private: LOG_DEBUG(Service_PM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(boot_mode); } @@ -67,7 +67,7 @@ private: boot_mode = SystemBootMode::Maintenance; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } SystemBootMode boot_mode = SystemBootMode::Normal; @@ -111,7 +111,7 @@ private: } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push((*process)->GetProcessID()); } @@ -151,7 +151,7 @@ private: } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push((*process)->GetTitleID()); } diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index c914f8145..32db6834c 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp @@ -77,7 +77,7 @@ private: process_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } template <Core::Reporter::PlayReportType Type> @@ -105,14 +105,14 @@ private: process_id, user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void RequestImmediateTransmission(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_PREPO, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetTransmissionStatus(Kernel::HLERequestContext& ctx) { @@ -121,7 +121,7 @@ private: constexpr s32 status = 0; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(status); } @@ -130,7 +130,7 @@ private: constexpr u64 system_session_id = 0; IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(system_session_id); } @@ -154,7 +154,7 @@ private: reporter.SavePlayReport(Core::Reporter::PlayReportType::System, title_id, {data1, data2}); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SaveSystemReportWithUser(Kernel::HLERequestContext& ctx) { @@ -181,7 +181,7 @@ private: std::nullopt, user_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } }; diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp index 5a52b2b05..f8ea02b58 100644 --- a/src/core/hle/service/psc/psc.cpp +++ b/src/core/hle/service/psc/psc.cpp @@ -67,7 +67,7 @@ private: LOG_DEBUG(Service_PSC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IPmModule>(system); } }; diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp index bb7af9217..d9897c5c5 100644 --- a/src/core/hle/service/ptm/psm.cpp +++ b/src/core/hle/service/ptm/psm.cpp @@ -64,7 +64,7 @@ private: should_signal = true; IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(state_change_event.GetReadableEvent()); } @@ -74,7 +74,7 @@ private: should_signal = false; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetChargerTypeChangeEventEnabled(Kernel::HLERequestContext& ctx) { @@ -85,7 +85,7 @@ private: should_signal_charger_type = state; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetPowerSupplyChangeEventEnabled(Kernel::HLERequestContext& ctx) { @@ -96,7 +96,7 @@ private: should_signal_power_supply = state; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetBatteryVoltageStateChangeEventEnabled(Kernel::HLERequestContext& ctx) { @@ -107,7 +107,7 @@ private: should_signal_battery_voltage = state; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } bool should_signal_charger_type{}; @@ -154,7 +154,7 @@ private: LOG_DEBUG(Service_PSM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(battery_charge_percentage); } @@ -162,7 +162,7 @@ private: LOG_DEBUG(Service_PSM, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(charger_type); } @@ -170,7 +170,7 @@ private: LOG_DEBUG(Service_PSM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IPsmSession>(system); } diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index fa61a5c7b..4e1541630 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -93,8 +93,8 @@ namespace Service { ServiceFrameworkBase::ServiceFrameworkBase(Core::System& system_, const char* service_name_, u32 max_sessions_, InvokerFn* handler_invoker_) - : system{system_}, service_name{service_name_}, max_sessions{max_sessions_}, - handler_invoker{handler_invoker_} {} + : SessionRequestHandler(system_.Kernel(), service_name_), system{system_}, + service_name{service_name_}, max_sessions{max_sessions_}, handler_invoker{handler_invoker_} {} ServiceFrameworkBase::~ServiceFrameworkBase() { // Wait for other threads to release access before destroying @@ -111,7 +111,7 @@ void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager) port_installed = true; } -Kernel::KClientPort& ServiceFrameworkBase::CreatePort(Kernel::KernelCore& kernel) { +Kernel::KClientPort& ServiceFrameworkBase::CreatePort() { const auto guard = LockService(); ASSERT(!port_installed); @@ -162,7 +162,7 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext if (Settings::values.use_auto_stub) { LOG_WARNING(Service, "Using auto stub fallback!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } } @@ -200,7 +200,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& sessi case IPC::CommandType::TIPC_Close: { session.Close(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); return IPC::ERR_REMOTE_PROCESS_DEAD; } case IPC::CommandType::ControlWithContext: @@ -228,7 +228,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& sessi ctx.WriteToOutgoingCommandBuffer(ctx.GetThread()); } - return RESULT_SUCCESS; + return ResultSuccess; } /// Initialize Services diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 4c048173b..e078ac176 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -23,6 +23,7 @@ namespace Kernel { class HLERequestContext; class KClientPort; class KServerSession; +class ServiceThread; } // namespace Kernel namespace Service { @@ -39,9 +40,11 @@ namespace SM { class ServiceManager; } -static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters) -/// Arbitrary default number of maximum connections to an HLE service. -static const u32 DefaultMaxSessions = 10; +/// Default number of maximum connections to a server session. +static constexpr u32 ServerSessionCountMax = 0x40; +static_assert(ServerSessionCountMax == 0x40, + "ServerSessionCountMax isn't 0x40 somehow, this assert is a reminder that this will " + "break lots of things"); /** * This is an non-templated base of ServiceFramework to reduce code bloat and compilation times, it @@ -74,7 +77,7 @@ public: void InvokeRequestTipc(Kernel::HLERequestContext& ctx); /// Creates a port pair and registers it on the kernel's global port registry. - Kernel::KClientPort& CreatePort(Kernel::KernelCore& kernel); + Kernel::KClientPort& CreatePort(); /// Handles a synchronization request for the service. ResultCode HandleSyncRequest(Kernel::KServerSession& session, @@ -177,7 +180,7 @@ protected: * connected to this service at the same time. */ explicit ServiceFramework(Core::System& system_, const char* service_name_, - u32 max_sessions_ = DefaultMaxSessions) + u32 max_sessions_ = ServerSessionCountMax) : ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) {} /// Registers handlers in the service. diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index fbdc4793d..ece2a74c6 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -77,7 +77,7 @@ constexpr ResultCode ERR_INVALID_LANGUAGE{ErrorModule::Settings, 625}; void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t num_language_codes) { IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(num_language_codes)); } @@ -107,7 +107,7 @@ void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(layout); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } } // Anonymous namespace @@ -133,7 +133,7 @@ void SET::MakeLanguageCode(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(available_language_codes[index]); } @@ -159,7 +159,7 @@ void SET::GetQuestFlag(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_SET, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(static_cast<u32>(Settings::values.quest_flag)); } @@ -167,7 +167,7 @@ void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue()); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(available_language_codes[Settings::values.language_index.GetValue()]); } @@ -175,7 +175,7 @@ void SET::GetRegionCode(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_SET, "called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(Settings::values.region_index.GetValue()); } diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index 4f1ffe55f..8299c6b68 100644 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp @@ -70,7 +70,7 @@ void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionTy ctx.WriteBuffer(data); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } } // Anonymous namespace @@ -89,7 +89,7 @@ void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(color_set); } @@ -100,7 +100,7 @@ void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) { color_set = rp.PopEnum<ColorSet>(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { diff --git a/src/core/hle/service/sm/controller.cpp b/src/core/hle/service/sm/controller.cpp index 147f12147..8b9418e0f 100644 --- a/src/core/hle/service/sm/controller.cpp +++ b/src/core/hle/service/sm/controller.cpp @@ -23,47 +23,30 @@ void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) { ctx.Session()->ConvertToDomain(); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(1); // Converted sessions start with 1 request handler } void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) { - // TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong - // and that we probably want to actually make an entirely new Session, but we still need to - // verify this on hardware. - LOG_DEBUG(Service, "called"); - auto& kernel = system.Kernel(); - auto* session = ctx.Session()->GetParent(); - auto* port = session->GetParent()->GetParent(); + auto& parent_session = *ctx.Session()->GetParent(); + auto& parent_port = parent_session.GetParent()->GetParent()->GetClientPort(); + auto& session_manager = parent_session.GetServerSession().GetSessionRequestManager(); - // Reserve a new session from the process resource limit. - Kernel::KScopedResourceReservation session_reservation( - kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions); - if (!session_reservation.Succeeded()) { + // Create a session. + Kernel::KClientSession* session{}; + const ResultCode result = parent_port.CreateSession(std::addressof(session), session_manager); + if (result.IsError()) { + LOG_CRITICAL(Service, "CreateSession failed with error 0x{:08X}", result.raw); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(Kernel::ResultLimitReached); + rb.Push(result); } - // Create a new session. - auto* clone = Kernel::KSession::Create(kernel); - clone->Initialize(&port->GetClientPort(), session->GetName()); - - // Commit the session reservation. - session_reservation.Commit(); - - // Enqueue the session with the named port. - port->EnqueueSession(&clone->GetServerSession()); - - // Set the session request manager. - clone->GetServerSession().SetSessionRequestManager( - session->GetServerSession().GetSessionRequestManager()); - // We succeeded. IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(clone->GetClientSession()); + rb.Push(ResultSuccess); + rb.PushMoveObjects(session); } void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) { @@ -76,7 +59,7 @@ void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u16>(0x8000); } diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index a9bc7da74..c7828c3bd 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -36,7 +36,7 @@ static ResultCode ValidateServiceName(const std::string& name) { LOG_ERROR(Service_SM, "Invalid service name! service={}", name); return ERR_INVALID_NAME; } - return RESULT_SUCCESS; + return ResultSuccess; } Kernel::KClientPort& ServiceManager::InterfaceFactory(ServiceManager& self, Core::System& system) { @@ -46,7 +46,7 @@ Kernel::KClientPort& ServiceManager::InterfaceFactory(ServiceManager& self, Core self.sm_interface = sm; self.controller_interface = std::make_unique<Controller>(system); - return sm->CreatePort(system.Kernel()); + return sm->CreatePort(); } ResultVal<Kernel::KServerPort*> ServiceManager::RegisterService(std::string name, @@ -79,7 +79,7 @@ ResultCode ServiceManager::UnregisterService(const std::string& name) { iter->second->Close(); registered_services.erase(iter); - return RESULT_SUCCESS; + return ResultSuccess; } ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name) { @@ -109,7 +109,7 @@ void SM::Initialize(Kernel::HLERequestContext& ctx) { is_initialized = true; IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SM::GetService(Kernel::HLERequestContext& ctx) { @@ -151,31 +151,23 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext& std::string name(PopServiceName(rp)); // Find the named port. - auto result = service_manager.GetServicePort(name); - if (result.Failed()) { - LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, result.Code().raw); - return result.Code(); + auto port_result = service_manager.GetServicePort(name); + if (port_result.Failed()) { + LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, port_result.Code().raw); + return port_result.Code(); } - auto* port = result.Unwrap(); - - // Reserve a new session from the process resource limit. - Kernel::KScopedResourceReservation session_reservation( - kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions); - R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached); + auto& port = port_result.Unwrap()->GetClientPort(); // Create a new session. - auto* session = Kernel::KSession::Create(kernel); - session->Initialize(&port->GetClientPort(), std::move(name)); - - // Commit the session reservation. - session_reservation.Commit(); - - // Enqueue the session with the named port. - port->EnqueueSession(&session->GetServerSession()); + Kernel::KClientSession* session{}; + if (const auto result = port.CreateSession(std::addressof(session)); result.IsError()) { + LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, result.raw); + return result; + } LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId()); - return MakeResult(&session->GetClientSession()); + return MakeResult(session); } void SM::RegisterService(Kernel::HLERequestContext& ctx) { diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 5fcd91f68..7d85ecb6a 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -47,7 +47,7 @@ void BSD::PollWork::Response(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(ret); rb.PushEnum(bsd_errno); } @@ -62,7 +62,7 @@ void BSD::AcceptWork::Response(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 5}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(ret); rb.PushEnum(bsd_errno); rb.Push<u32>(static_cast<u32>(write_buffer.size())); @@ -74,7 +74,7 @@ void BSD::ConnectWork::Execute(BSD* bsd) { void BSD::ConnectWork::Response(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(bsd_errno == Errno::SUCCESS ? 0 : -1); rb.PushEnum(bsd_errno); } @@ -87,7 +87,7 @@ void BSD::RecvWork::Response(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(message); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(ret); rb.PushEnum(bsd_errno); } @@ -103,7 +103,7 @@ void BSD::RecvFromWork::Response(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, 5}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(ret); rb.PushEnum(bsd_errno); rb.Push<u32>(static_cast<u32>(addr.size())); @@ -115,7 +115,7 @@ void BSD::SendWork::Execute(BSD* bsd) { void BSD::SendWork::Response(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(ret); rb.PushEnum(bsd_errno); } @@ -126,7 +126,7 @@ void BSD::SendToWork::Execute(BSD* bsd) { void BSD::SendToWork::Response(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(ret); rb.PushEnum(bsd_errno); } @@ -136,7 +136,7 @@ void BSD::RegisterClient(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(0); // bsd errno } @@ -145,7 +145,7 @@ void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void BSD::Socket(Kernel::HLERequestContext& ctx) { @@ -160,7 +160,7 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) { static_cast<Protocol>(protocol)); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(fd); rb.PushEnum(bsd_errno); } @@ -170,7 +170,7 @@ void BSD::Select(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(0); // ret rb.Push<u32>(0); // bsd errno } @@ -235,7 +235,7 @@ void BSD::GetPeerName(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(write_buffer); IPC::ResponseBuilder rb{ctx, 5}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(bsd_errno != Errno::SUCCESS ? -1 : 0); rb.PushEnum(bsd_errno); rb.Push<u32>(static_cast<u32>(write_buffer.size())); @@ -253,7 +253,7 @@ void BSD::GetSockName(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(write_buffer); IPC::ResponseBuilder rb{ctx, 5}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(bsd_errno != Errno::SUCCESS ? -1 : 0); rb.PushEnum(bsd_errno); rb.Push<u32>(static_cast<u32>(write_buffer.size())); @@ -272,7 +272,7 @@ void BSD::GetSockOpt(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(optval); IPC::ResponseBuilder rb{ctx, 5}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(-1); rb.PushEnum(Errno::NOTCONN); rb.Push<u32>(static_cast<u32>(optval.size())); @@ -299,7 +299,7 @@ void BSD::Fcntl(Kernel::HLERequestContext& ctx) { const auto [ret, bsd_errno] = FcntlImpl(fd, static_cast<FcntlCmd>(cmd), arg); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(ret); rb.PushEnum(bsd_errno); } @@ -822,7 +822,7 @@ bool BSD::IsFileDescriptorValid(s32 fd) const noexcept { void BSD::BuildErrnoResponse(Kernel::HLERequestContext& ctx, Errno bsd_errno) const noexcept { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s32>(bsd_errno == Errno::SUCCESS ? 0 : -1); rb.PushEnum(bsd_errno); } diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index 5c71f423c..fb6142c49 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp @@ -46,7 +46,7 @@ void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) { parameters.use_nsd_resolve, parameters.unknown, parameters.process_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } } // namespace Service::Sockets diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index b1552c3f0..0b5e2b7c3 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp @@ -36,7 +36,7 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(data); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 3b072f6bc..921f4d776 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -89,14 +89,14 @@ private: parameters.option); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void CreateConnection(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_SSL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISslConnection>(system); } @@ -110,7 +110,7 @@ private: LOG_WARNING(Service_SSL, "(STUBBED) called, certificate_format={}", certificate_format); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(server_id); } @@ -129,7 +129,7 @@ private: LOG_WARNING(Service_SSL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(client_id); } }; @@ -160,7 +160,7 @@ private: LOG_WARNING(Service_SSL, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISslContext>(system); } @@ -171,7 +171,7 @@ private: ssl_version = rp.Pop<u32>(); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } }; diff --git a/src/core/hle/service/time/clock_types.h b/src/core/hle/service/time/clock_types.h index a9cfe3eb0..392e16863 100644 --- a/src/core/hle/service/time/clock_types.h +++ b/src/core/hle/service/time/clock_types.h @@ -32,7 +32,7 @@ struct SteadyClockTimePoint { span = other.time_point - time_point; - return RESULT_SUCCESS; + return ResultSuccess; } static SteadyClockTimePoint GetRandom() { @@ -101,7 +101,7 @@ struct ClockSnapshot { return ERROR_TIME_MISMATCH; } current_time = steady_clock_time_point.time_point + context.offset; - return RESULT_SUCCESS; + return ResultSuccess; } }; static_assert(sizeof(ClockSnapshot) == 0xD0, "ClockSnapshot is incorrect size"); 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 490d0ef3e..6be617392 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 @@ -18,7 +18,7 @@ public: protected: ResultCode Update() override { shared_memory.UpdateLocalSystemClockContext(context); - return RESULT_SUCCESS; + return ResultSuccess; } private: 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 e2920b8eb..a54fd7fe1 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 @@ -18,7 +18,7 @@ public: protected: ResultCode Update() override { shared_memory.UpdateNetworkSystemClockContext(context); - return RESULT_SUCCESS; + return ResultSuccess; } private: diff --git a/src/core/hle/service/time/standard_network_system_clock_core.h b/src/core/hle/service/time/standard_network_system_clock_core.h index 9d0aeaedb..95923a27b 100644 --- a/src/core/hle/service/time/standard_network_system_clock_core.h +++ b/src/core/hle/service/time/standard_network_system_clock_core.h @@ -25,13 +25,13 @@ public: bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const { SystemClockContext clock_ctx{}; - if (GetClockContext(system, clock_ctx) != RESULT_SUCCESS) { + if (GetClockContext(system, clock_ctx) != ResultSuccess) { return {}; } s64 span{}; if (clock_ctx.steady_time_point.GetSpanBetween( - GetSteadyClockCore().GetCurrentTimePoint(system), span) != RESULT_SUCCESS) { + GetSteadyClockCore().GetCurrentTimePoint(system), span) != ResultSuccess) { return {}; } 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 41bc01abd..ef79ab917 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 @@ -24,20 +24,18 @@ StandardUserSystemClockCore::StandardUserSystemClockCore( ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::System& system, bool value) { - if (const ResultCode result{ApplyAutomaticCorrection(system, value)}; - result != RESULT_SUCCESS) { + if (const ResultCode result{ApplyAutomaticCorrection(system, value)}; result != ResultSuccess) { return result; } auto_correction_enabled = value; - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system, SystemClockContext& ctx) const { - if (const ResultCode result{ApplyAutomaticCorrection(system, false)}; - result != RESULT_SUCCESS) { + if (const ResultCode result{ApplyAutomaticCorrection(system, false)}; result != ResultSuccess) { return result; } @@ -57,7 +55,7 @@ ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& system, bool value) const { if (auto_correction_enabled == value) { - return RESULT_SUCCESS; + return ResultSuccess; } if (!network_system_clock_core.IsClockSetup(system)) { @@ -66,13 +64,13 @@ ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& s SystemClockContext ctx{}; if (const ResultCode result{network_system_clock_core.GetClockContext(system, ctx)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } local_system_clock_core.SetClockContext(ctx); - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Service::Time::Clock 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 bca7d869e..f656fab1c 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 @@ -32,7 +32,7 @@ void SystemClockContextUpdateCallback::BroadcastOperationEvent() { } ResultCode SystemClockContextUpdateCallback::Update(const SystemClockContext& value) { - ResultCode result{RESULT_SUCCESS}; + ResultCode result{ResultSuccess}; if (NeedUpdate(value)) { context = value; @@ -40,7 +40,7 @@ ResultCode SystemClockContextUpdateCallback::Update(const SystemClockContext& va result = Update(); - if (result == RESULT_SUCCESS) { + if (result == ResultSuccess) { BroadcastOperationEvent(); } } @@ -49,7 +49,7 @@ ResultCode SystemClockContextUpdateCallback::Update(const SystemClockContext& va } ResultCode SystemClockContextUpdateCallback::Update() { - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Service::Time::Clock diff --git a/src/core/hle/service/time/system_clock_core.cpp b/src/core/hle/service/time/system_clock_core.cpp index 2ef442b56..bd334bbef 100644 --- a/src/core/hle/service/time/system_clock_core.cpp +++ b/src/core/hle/service/time/system_clock_core.cpp @@ -21,7 +21,7 @@ ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time const SteadyClockTimePoint current_time_point{steady_clock_core.GetCurrentTimePoint(system)}; SystemClockContext clock_context{}; - if (const ResultCode result{GetClockContext(system, clock_context)}; result != RESULT_SUCCESS) { + if (const ResultCode result{GetClockContext(system, clock_context)}; result != ResultSuccess) { return result; } @@ -31,7 +31,7 @@ ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time posix_time = clock_context.offset + current_time_point.time_point; - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode SystemClockCore::SetCurrentTime(Core::System& system, s64 posix_time) { @@ -39,7 +39,7 @@ ResultCode SystemClockCore::SetCurrentTime(Core::System& system, s64 posix_time) const SystemClockContext clock_context{posix_time - current_time_point.time_point, current_time_point}; - if (const ResultCode result{SetClockContext(clock_context)}; result != RESULT_SUCCESS) { + if (const ResultCode result{SetClockContext(clock_context)}; result != ResultSuccess) { return result; } return Flush(clock_context); @@ -47,13 +47,13 @@ ResultCode SystemClockCore::SetCurrentTime(Core::System& system, s64 posix_time) ResultCode SystemClockCore::Flush(const SystemClockContext& clock_context) { if (!system_clock_context_update_callback) { - return RESULT_SUCCESS; + return ResultSuccess; } return system_clock_context_update_callback->Update(clock_context); } ResultCode SystemClockCore::SetSystemClockContext(const SystemClockContext& clock_context) { - if (const ResultCode result{SetClockContext(clock_context)}; result != RESULT_SUCCESS) { + if (const ResultCode result{SetClockContext(clock_context)}; result != ResultSuccess) { return result; } return Flush(clock_context); @@ -61,7 +61,7 @@ ResultCode SystemClockCore::SetSystemClockContext(const SystemClockContext& cloc bool SystemClockCore::IsClockSetup(Core::System& system) const { SystemClockContext value{}; - if (GetClockContext(system, value) == RESULT_SUCCESS) { + if (GetClockContext(system, value) == ResultSuccess) { const SteadyClockTimePoint steady_clock_time_point{ steady_clock_core.GetCurrentTimePoint(system)}; return steady_clock_time_point.clock_source_id == value.steady_time_point.clock_source_id; diff --git a/src/core/hle/service/time/system_clock_core.h b/src/core/hle/service/time/system_clock_core.h index b8e6122bf..83d0e5d62 100644 --- a/src/core/hle/service/time/system_clock_core.h +++ b/src/core/hle/service/time/system_clock_core.h @@ -35,12 +35,12 @@ public: virtual ResultCode GetClockContext([[maybe_unused]] Core::System& system, SystemClockContext& value) const { value = context; - return RESULT_SUCCESS; + return ResultSuccess; } virtual ResultCode SetClockContext(const SystemClockContext& value) { context = value; - return RESULT_SUCCESS; + return ResultSuccess; } virtual ResultCode Flush(const SystemClockContext& clock_context); diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index e7991012b..d6f710eba 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -54,7 +54,7 @@ private: } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<s64>(posix_time); } @@ -76,7 +76,7 @@ private: } IPC::ResponseBuilder rb{ctx, sizeof(Clock::SystemClockContext) / 4 + 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(system_clock_context); } @@ -112,7 +112,7 @@ private: const Clock::SteadyClockTimePoint time_point{clock_core.GetCurrentTimePoint(system)}; IPC::ResponseBuilder rb{ctx, (sizeof(Clock::SteadyClockTimePoint) / 4) + 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(time_point); } @@ -135,7 +135,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( if (const ResultCode result{ time_manager.GetTimeZoneContentManager().GetTimeZoneManager().GetDeviceLocationName( clock_snapshot.location_name)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } @@ -144,7 +144,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( if (const ResultCode result{Clock::ClockSnapshot::GetCurrentTime( clock_snapshot.user_time, clock_snapshot.steady_clock_time_point, clock_snapshot.user_context)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } @@ -152,7 +152,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( if (const ResultCode result{ time_manager.GetTimeZoneContentManager().GetTimeZoneManager().ToCalendarTimeWithMyRules( clock_snapshot.user_time, userCalendarInfo)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } @@ -163,7 +163,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( if (Clock::ClockSnapshot::GetCurrentTime(clock_snapshot.network_time, clock_snapshot.steady_clock_time_point, - clock_snapshot.network_context) != RESULT_SUCCESS) { + clock_snapshot.network_context) != ResultSuccess) { clock_snapshot.network_time = 0; } @@ -171,20 +171,20 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( if (const ResultCode result{ time_manager.GetTimeZoneContentManager().GetTimeZoneManager().ToCalendarTimeWithMyRules( clock_snapshot.network_time, networkCalendarInfo)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } clock_snapshot.network_calendar_time = networkCalendarInfo.time; clock_snapshot.network_calendar_additional_time = networkCalendarInfo.additional_info; - return RESULT_SUCCESS; + return ResultSuccess; } void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystemClock>(system.GetTimeManager().GetStandardUserSystemClockCore(), system); } @@ -192,7 +192,7 @@ void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ct void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystemClock>(system.GetTimeManager().GetStandardNetworkSystemClockCore(), system); } @@ -200,14 +200,14 @@ void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISteadyClock>(system.GetTimeManager().GetStandardSteadyClockCore(), system); } void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ITimeZoneService>(system, system.GetTimeManager().GetTimeZoneContentManager()); } @@ -215,7 +215,7 @@ void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystemClock>(system.GetTimeManager().GetStandardLocalSystemClockCore(), system); } @@ -225,7 +225,7 @@ void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient( LOG_DEBUG(Service_Time, "called"); auto& clock_core{system.GetTimeManager().GetStandardNetworkSystemClockCore()}; IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u32>(clock_core.IsStandardNetworkSystemClockAccuracySufficient(system)); } @@ -249,7 +249,7 @@ void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERe const s64 base_time_point{context.offset + current_time_point.time_point - ticks.ToSeconds()}; IPC::ResponseBuilder rb{ctx, (sizeof(s64) / 4) + 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(base_time_point); return; } @@ -296,7 +296,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(clock_snapshot); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) { @@ -313,7 +313,7 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques Clock::ClockSnapshot clock_snapshot{}; if (const ResultCode result{GetClockSnapshotFromSystemClockContextInternal( &ctx.GetThread(), user_context, network_context, type, clock_snapshot)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); return; @@ -322,7 +322,7 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques ctx.WriteBuffer(clock_snapshot); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( @@ -349,7 +349,7 @@ void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( } IPC::ResponseBuilder rb{ctx, (sizeof(s64) / 4) + 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(time_span_type.nanoseconds); } @@ -370,7 +370,7 @@ void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { if (const ResultCode result{snapshot_a.steady_clock_time_point.GetSpanBetween( snapshot_b.steady_clock_time_point, span)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { if (snapshot_a.network_time && snapshot_b.network_time) { time_span_type = Clock::TimeSpanType::FromSeconds(snapshot_b.network_time - snapshot_a.network_time); @@ -384,14 +384,14 @@ void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { } IPC::ResponseBuilder rb{ctx, (sizeof(s64) / 4) + 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(time_span_type.nanoseconds); } void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(&system.Kernel().GetTimeSharedMem()); } diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 4f9684de8..4bbc606a1 100644 --- a/src/core/hle/service/time/time_manager.cpp +++ b/src/core/hle/service/time/time_manager.cpp @@ -108,7 +108,7 @@ struct TimeManager::Impl final { std::size_t total_location_name_count, u128 time_zone_rule_version, FileSys::VirtualFile& vfs_file) { if (time_zone_content_manager.GetTimeZoneManager().SetDeviceLocationNameWithTimeZoneRule( - location_name, vfs_file) != RESULT_SUCCESS) { + location_name, vfs_file) != ResultSuccess) { UNREACHABLE(); return; } @@ -152,7 +152,7 @@ struct TimeManager::Impl final { standard_local_system_clock_core.SetSystemClockContext(clock_context); } else { if (standard_local_system_clock_core.SetCurrentTime(system_, posix_time) != - RESULT_SUCCESS) { + ResultSuccess) { UNREACHABLE(); return; } @@ -167,7 +167,7 @@ struct TimeManager::Impl final { network_system_clock_context_writer); if (standard_network_system_clock_core.SetSystemClockContext(clock_context) != - RESULT_SUCCESS) { + ResultSuccess) { UNREACHABLE(); return; } @@ -180,7 +180,7 @@ struct TimeManager::Impl final { void SetupStandardUserSystemClock(Core::System& system_, bool is_automatic_correction_enabled, Clock::SteadyClockTimePoint steady_clock_time_point) { if (standard_user_system_clock_core.SetAutomaticCorrectionEnabled( - system_, is_automatic_correction_enabled) != RESULT_SUCCESS) { + system_, is_automatic_correction_enabled) != ResultSuccess) { UNREACHABLE(); return; } 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 57f71e6f0..bf4402308 100644 --- a/src/core/hle/service/time/time_zone_content_manager.cpp +++ b/src/core/hle/service/time/time_zone_content_manager.cpp @@ -81,7 +81,7 @@ void TimeZoneContentManager::Initialize(TimeManager& time_manager) { } if (FileSys::VirtualFile vfs_file; - GetTimeZoneInfoFile(location_name, vfs_file) == RESULT_SUCCESS) { + GetTimeZoneInfoFile(location_name, vfs_file) == ResultSuccess) { const auto time_point{ time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)}; time_manager.SetupTimeZoneManager(location_name, time_point, location_name_cache.size(), {}, @@ -95,7 +95,7 @@ ResultCode TimeZoneContentManager::LoadTimeZoneRule(TimeZoneRule& rules, const std::string& location_name) const { FileSys::VirtualFile vfs_file; if (const ResultCode result{GetTimeZoneInfoFile(location_name, vfs_file)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } @@ -138,7 +138,7 @@ ResultCode TimeZoneContentManager::GetTimeZoneInfoFile(const std::string& locati return ERROR_TIME_NOT_FOUND; } - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Service::Time::TimeZone diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index 3032ca193..6da893790 100644 --- a/src/core/hle/service/time/time_zone_manager.cpp +++ b/src/core/hle/service/time/time_zone_manager.cpp @@ -742,7 +742,7 @@ static ResultCode CreateCalendarTime(s64 time, int gmt_offset, CalendarTimeInter calendar_additional_info.is_dst = false; calendar_additional_info.gmt_offset = gmt_offset; - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time, @@ -772,7 +772,7 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time, } if (const ResultCode result{ ToCalendarTimeInternal(rules, new_time, calendar_time, calendar_additional_info)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } if (time < rules.ats[0]) { @@ -781,7 +781,7 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time, calendar_time.year += years; } - return RESULT_SUCCESS; + return ResultSuccess; } s32 tti_index{}; @@ -803,7 +803,7 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time, if (const ResultCode result{CreateCalendarTime(time, rules.ttis[tti_index].gmt_offset, calendar_time, calendar_additional_info)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { return result; } @@ -812,7 +812,7 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time, for (int index{}; time_zone[index] != '\0'; ++index) { calendar_additional_info.timezone_name[index] = time_zone[index]; } - return RESULT_SUCCESS; + return ResultSuccess; } static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) { @@ -845,14 +845,14 @@ ResultCode TimeZoneManager::SetDeviceLocationNameWithTimeZoneRule(const std::str if (ParseTimeZoneBinary(rule, vfs_file)) { device_location_name = location_name; time_zone_rule = rule; - return RESULT_SUCCESS; + return ResultSuccess; } return ERROR_TIME_ZONE_CONVERSION_FAILED; } ResultCode TimeZoneManager::SetUpdatedTime(const Clock::SteadyClockTimePoint& value) { time_zone_update_time_point = value; - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode TimeZoneManager::ToCalendarTimeWithMyRules(s64 time, CalendarInfo& calendar) const { @@ -868,7 +868,7 @@ ResultCode TimeZoneManager::ParseTimeZoneRuleBinary(TimeZoneRule& rules, if (!ParseTimeZoneBinary(rules, vfs_file)) { return ERROR_TIME_ZONE_CONVERSION_FAILED; } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules, @@ -981,7 +981,7 @@ ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules, CalendarTimeInternal candidate_calendar_time{}; CalendarAdditionalInfo unused{}; if (ToCalendarTimeInternal(rules, pivot, candidate_calendar_time, unused) != - RESULT_SUCCESS) { + ResultSuccess) { if (pivot > 0) { direction = 1; } else { @@ -1021,7 +1021,7 @@ ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules, } } } - return RESULT_SUCCESS; + return ResultSuccess; } ResultCode TimeZoneManager::ToPosixTimeWithMyRule(const CalendarTime& calendar_time, @@ -1038,7 +1038,7 @@ ResultCode TimeZoneManager::GetDeviceLocationName(LocationName& value) const { return ERROR_UNINITIALIZED_CLOCK; } std::memcpy(value.data(), device_location_name.c_str(), device_location_name.size()); - return RESULT_SUCCESS; + return ResultSuccess; } } // namespace Service::Time::TimeZone diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp index 19d7a1a0c..5c3108768 100644 --- a/src/core/hle/service/time/time_zone_service.cpp +++ b/src/core/hle/service/time/time_zone_service.cpp @@ -35,14 +35,14 @@ void ITimeZoneService::GetDeviceLocationName(Kernel::HLERequestContext& ctx) { TimeZone::LocationName location_name{}; if (const ResultCode result{ time_zone_content_manager.GetTimeZoneManager().GetDeviceLocationName(location_name)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); return; } IPC::ResponseBuilder rb{ctx, (sizeof(location_name) / 4) + 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(location_name); } @@ -64,7 +64,7 @@ void ITimeZoneService::LoadTimeZoneRule(Kernel::HLERequestContext& ctx) { TimeZone::TimeZoneRule time_zone_rule{}; if (const ResultCode result{ time_zone_content_manager.LoadTimeZoneRule(time_zone_rule, location_name)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); return; @@ -75,7 +75,7 @@ void ITimeZoneService::LoadTimeZoneRule(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(time_zone_rule_outbuffer); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ITimeZoneService::ToCalendarTime(Kernel::HLERequestContext& ctx) { @@ -91,14 +91,14 @@ void ITimeZoneService::ToCalendarTime(Kernel::HLERequestContext& ctx) { TimeZone::CalendarInfo calendar_info{}; if (const ResultCode result{time_zone_content_manager.GetTimeZoneManager().ToCalendarTime( time_zone_rule, posix_time, calendar_info)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); return; } IPC::ResponseBuilder rb{ctx, 2 + (sizeof(TimeZone::CalendarInfo) / 4)}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(calendar_info); } @@ -112,14 +112,14 @@ void ITimeZoneService::ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx) if (const ResultCode result{ time_zone_content_manager.GetTimeZoneManager().ToCalendarTimeWithMyRules( posix_time, calendar_info)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); return; } IPC::ResponseBuilder rb{ctx, 2 + (sizeof(TimeZone::CalendarInfo) / 4)}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw(calendar_info); } @@ -134,7 +134,7 @@ void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) { s64 posix_time{}; if (const ResultCode result{time_zone_content_manager.GetTimeZoneManager().ToPosixTime( time_zone_rule, calendar_time, posix_time)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); return; @@ -144,7 +144,7 @@ void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) { // TODO(bunnei): Handle multiple times IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u32>(1); // Number of times we're returning } @@ -158,7 +158,7 @@ void ITimeZoneService::ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) { if (const ResultCode result{ time_zone_content_manager.GetTimeZoneManager().ToPosixTimeWithMyRule(calendar_time, posix_time)}; - result != RESULT_SUCCESS) { + result != ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); return; @@ -167,7 +167,7 @@ void ITimeZoneService::ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(posix_time); IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushRaw<u32>(1); // Number of times we're returning } diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp index b3b230a8c..7f436c3bb 100644 --- a/src/core/hle/service/usb/usb.cpp +++ b/src/core/hle/service/usb/usb.cpp @@ -165,7 +165,7 @@ private: LOG_DEBUG(Service_USB, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IPdSession>(system); } }; @@ -207,7 +207,7 @@ public: private: void GetPdCradleSession(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IPdCradleSession>(system); LOG_DEBUG(Service_USB, "called"); diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index fdd2b4b4f..3e5949d52 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -646,7 +646,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void AdjustRefcount(Kernel::HLERequestContext& ctx) { @@ -659,7 +659,7 @@ private: type); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetNativeHandle(Kernel::HLERequestContext& ctx) { @@ -671,7 +671,7 @@ private: // TODO(Subv): Find out what this actually is. IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(nv_flinger.FindBufferQueue(id)->GetBufferWaitEvent()); } @@ -744,7 +744,7 @@ private: z_value); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } // This function currently does nothing but return a success error code in @@ -757,14 +757,14 @@ private: LOG_DEBUG(Service_VI, "called, layer_id=0x{:08X}, visibility={}", layer_id, visibility); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetDisplayMode(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); if (Settings::values.use_docked_mode.GetValue()) { rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * @@ -879,7 +879,7 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called. display=0x{:016X}", display); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void CreateManagedLayer(Kernel::HLERequestContext& ctx) { @@ -902,7 +902,7 @@ private: } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(*layer_id); } @@ -915,7 +915,7 @@ private: layer_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void SetLayerVisibility(Kernel::HLERequestContext& ctx) { @@ -927,7 +927,7 @@ private: visibility); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } NVFlinger::NVFlinger& nv_flinger; @@ -958,7 +958,7 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger); } @@ -966,7 +966,7 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<ISystemDisplayService>(system); } @@ -974,7 +974,7 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IManagerDisplayService>(system, nv_flinger); } @@ -982,7 +982,7 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger); } @@ -1019,7 +1019,7 @@ private: } IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(*display_id); } @@ -1030,7 +1030,7 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called. display_id=0x{:016X}", display_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } // This literally does nothing internally in the actual service itself, @@ -1039,7 +1039,7 @@ private: LOG_DEBUG(Service_VI, "called."); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetDisplayResolution(Kernel::HLERequestContext& ctx) { @@ -1049,7 +1049,7 @@ private: LOG_DEBUG(Service_VI, "called. display_id=0x{:016X}", display_id); IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); // This only returns the fixed values of 1280x720 and makes no distinguishing // between docked and undocked dimensions. We take the liberty of applying @@ -1083,7 +1083,7 @@ private: return; } - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void ListDisplays(Kernel::HLERequestContext& ctx) { @@ -1094,7 +1094,7 @@ private: display_info.height *= static_cast<u64>(Settings::values.resolution_factor.GetValue()); ctx.WriteBuffer(&display_info, sizeof(DisplayInfo)); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(1); } @@ -1130,7 +1130,7 @@ private: const auto buffer_size = ctx.WriteBuffer(native_window.Serialize()); IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push<u64>(buffer_size); } @@ -1143,7 +1143,7 @@ private: nv_flinger.CloseLayer(layer_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void CreateStrayLayer(Kernel::HLERequestContext& ctx) { @@ -1176,7 +1176,7 @@ private: const auto buffer_size = ctx.WriteBuffer(native_window.Serialize()); IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(*layer_id); rb.Push<u64>(buffer_size); } @@ -1188,7 +1188,7 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called. layer_id=0x{:016X}", layer_id); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetDisplayVsyncEvent(Kernel::HLERequestContext& ctx) { @@ -1206,7 +1206,7 @@ private: } IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushCopyObjects(vsync_event); } @@ -1219,7 +1219,7 @@ private: if (converted_mode.Succeeded()) { IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushEnum(*converted_mode); } else { IPC::ResponseBuilder rb{ctx, 2}; @@ -1250,7 +1250,7 @@ private: IPC::ResponseBuilder rb{ctx, 6}; rb.Push(unknown_result_1); rb.Push(unknown_result_2); - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); } void GetIndirectLayerImageRequiredMemoryInfo(Kernel::HLERequestContext& ctx) { @@ -1265,7 +1265,7 @@ private: const auto out_size = (texture_size + base_size - 1) / base_size * base_size; IPC::ResponseBuilder rb{ctx, 6}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.Push(out_size); rb.Push(alignment); } @@ -1347,7 +1347,7 @@ void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& } IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); + rb.Push(ResultSuccess); rb.PushIpcInterface<IApplicationDisplayService>(system, nv_flinger); } diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index a9596fe4d..ec2a16e62 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp @@ -144,7 +144,7 @@ json GetFullDataAuto(const std::string& timestamp, u64 title_id, Core::System& s json out; out["yuzu_version"] = GetYuzuVersionData(); - out["report_common"] = GetReportCommonData(title_id, RESULT_SUCCESS, timestamp); + out["report_common"] = GetReportCommonData(title_id, ResultSuccess, timestamp); out["processor_state"] = GetProcessorStateDataAuto(system); out["backtrace"] = GetBacktraceData(system); @@ -322,7 +322,7 @@ void Reporter::SavePlayReport(PlayReportType type, u64 title_id, std::vector<std json out; out["yuzu_version"] = GetYuzuVersionData(); - out["report_common"] = GetReportCommonData(title_id, RESULT_SUCCESS, timestamp, user_id); + out["report_common"] = GetReportCommonData(title_id, ResultSuccess, timestamp, user_id); auto data_out = json::array(); for (const auto& d : data) { @@ -372,7 +372,7 @@ void Reporter::SaveFilesystemAccessReport(Service::FileSystem::LogMode log_mode, json out; out["yuzu_version"] = GetYuzuVersionData(); - out["report_common"] = GetReportCommonData(title_id, RESULT_SUCCESS, timestamp); + out["report_common"] = GetReportCommonData(title_id, ResultSuccess, timestamp); out["log_mode"] = fmt::format("{:08X}", static_cast<u32>(log_mode)); out["log_message"] = std::move(log_message); diff --git a/src/input_common/analog_from_button.cpp b/src/input_common/analog_from_button.cpp index f8ec179d0..100138d11 100755 --- a/src/input_common/analog_from_button.cpp +++ b/src/input_common/analog_from_button.cpp @@ -21,104 +21,153 @@ public: : up(std::move(up_)), down(std::move(down_)), left(std::move(left_)), right(std::move(right_)), modifier(std::move(modifier_)), modifier_scale(modifier_scale_), modifier_angle(modifier_angle_) { - update_thread_running.store(true); - update_thread = std::thread(&Analog::UpdateStatus, this); + Input::InputCallback<bool> callbacks{ + [this]([[maybe_unused]] bool status) { UpdateStatus(); }}; + up->SetCallback(callbacks); + down->SetCallback(callbacks); + left->SetCallback(callbacks); + right->SetCallback(callbacks); } - ~Analog() override { - if (update_thread_running.load()) { - update_thread_running.store(false); - if (update_thread.joinable()) { - update_thread.join(); - } - } + bool IsAngleGreater(float old_angle, float new_angle) const { + constexpr float TAU = Common::PI * 2.0f; + // Use wider angle to ease the transition. + constexpr float aperture = TAU * 0.15f; + const float top_limit = new_angle + aperture; + return (old_angle > new_angle && old_angle <= top_limit) || + (old_angle + TAU > new_angle && old_angle + TAU <= top_limit); } - void MoveToDirection(bool enable, float to_angle) { - if (!enable) { - return; - } + bool IsAngleSmaller(float old_angle, float new_angle) const { constexpr float TAU = Common::PI * 2.0f; // Use wider angle to ease the transition. constexpr float aperture = TAU * 0.15f; - const float top_limit = to_angle + aperture; - const float bottom_limit = to_angle - aperture; - - if ((angle > to_angle && angle <= top_limit) || - (angle + TAU > to_angle && angle + TAU <= top_limit)) { - angle -= modifier_angle; - if (angle < 0) { - angle += TAU; + const float bottom_limit = new_angle - aperture; + return (old_angle >= bottom_limit && old_angle < new_angle) || + (old_angle - TAU >= bottom_limit && old_angle - TAU < new_angle); + } + + float GetAngle(std::chrono::time_point<std::chrono::steady_clock> now) const { + constexpr float TAU = Common::PI * 2.0f; + float new_angle = angle; + + auto time_difference = static_cast<float>( + std::chrono::duration_cast<std::chrono::microseconds>(now - last_update).count()); + time_difference /= 1000.0f * 1000.0f; + if (time_difference > 0.5f) { + time_difference = 0.5f; + } + + if (IsAngleGreater(new_angle, goal_angle)) { + new_angle -= modifier_angle * time_difference; + if (new_angle < 0) { + new_angle += TAU; + } + if (!IsAngleGreater(new_angle, goal_angle)) { + return goal_angle; } - } else if ((angle >= bottom_limit && angle < to_angle) || - (angle - TAU >= bottom_limit && angle - TAU < to_angle)) { - angle += modifier_angle; - if (angle >= TAU) { - angle -= TAU; + } else if (IsAngleSmaller(new_angle, goal_angle)) { + new_angle += modifier_angle * time_difference; + if (new_angle >= TAU) { + new_angle -= TAU; + } + if (!IsAngleSmaller(new_angle, goal_angle)) { + return goal_angle; } } else { - angle = to_angle; + return goal_angle; } + return new_angle; } - void UpdateStatus() { - while (update_thread_running.load()) { - const float coef = modifier->GetStatus() ? modifier_scale : 1.0f; - - bool r = right->GetStatus(); - bool l = left->GetStatus(); - bool u = up->GetStatus(); - bool d = down->GetStatus(); - - // Eliminate contradictory movements - if (r && l) { - r = false; - l = false; - } - if (u && d) { - u = false; - d = false; - } + void SetGoalAngle(bool r, bool l, bool u, bool d) { + // Move to the right + if (r && !u && !d) { + goal_angle = 0.0f; + } + + // Move to the upper right + if (r && u && !d) { + goal_angle = Common::PI * 0.25f; + } - // Move to the right - MoveToDirection(r && !u && !d, 0.0f); + // Move up + if (u && !l && !r) { + goal_angle = Common::PI * 0.5f; + } - // Move to the upper right - MoveToDirection(r && u && !d, Common::PI * 0.25f); + // Move to the upper left + if (l && u && !d) { + goal_angle = Common::PI * 0.75f; + } - // Move up - MoveToDirection(u && !l && !r, Common::PI * 0.5f); + // Move to the left + if (l && !u && !d) { + goal_angle = Common::PI; + } - // Move to the upper left - MoveToDirection(l && u && !d, Common::PI * 0.75f); + // Move to the bottom left + if (l && !u && d) { + goal_angle = Common::PI * 1.25f; + } - // Move to the left - MoveToDirection(l && !u && !d, Common::PI); + // Move down + if (d && !l && !r) { + goal_angle = Common::PI * 1.5f; + } - // Move to the bottom left - MoveToDirection(l && !u && d, Common::PI * 1.25f); + // Move to the bottom right + if (r && !u && d) { + goal_angle = Common::PI * 1.75f; + } + } - // Move down - MoveToDirection(d && !l && !r, Common::PI * 1.5f); + void UpdateStatus() { + const float coef = modifier->GetStatus() ? modifier_scale : 1.0f; - // Move to the bottom right - MoveToDirection(r && !u && d, Common::PI * 1.75f); + bool r = right->GetStatus(); + bool l = left->GetStatus(); + bool u = up->GetStatus(); + bool d = down->GetStatus(); - // Move if a key is pressed - if (r || l || u || d) { - amplitude = coef; - } else { - amplitude = 0; - } + // Eliminate contradictory movements + if (r && l) { + r = false; + l = false; + } + if (u && d) { + u = false; + d = false; + } - // Delay the update rate to 100hz - std::this_thread::sleep_for(std::chrono::milliseconds(10)); + // Move if a key is pressed + if (r || l || u || d) { + amplitude = coef; + } else { + amplitude = 0; } + + const auto now = std::chrono::steady_clock::now(); + const auto time_difference = static_cast<u64>( + std::chrono::duration_cast<std::chrono::milliseconds>(now - last_update).count()); + + if (time_difference < 10) { + // Disable analog mode if inputs are too fast + SetGoalAngle(r, l, u, d); + angle = goal_angle; + } else { + angle = GetAngle(now); + SetGoalAngle(r, l, u, d); + } + + last_update = now; } std::tuple<float, float> GetStatus() const override { if (Settings::values.emulate_analog_keyboard) { - return std::make_tuple(std::cos(angle) * amplitude, std::sin(angle) * amplitude); + const auto now = std::chrono::steady_clock::now(); + float angle_ = GetAngle(now); + return std::make_tuple(std::cos(angle_) * amplitude, std::sin(angle_) * amplitude); } constexpr float SQRT_HALF = 0.707106781f; int x = 0, y = 0; @@ -166,9 +215,9 @@ private: float modifier_scale; float modifier_angle; float angle{}; + float goal_angle{}; float amplitude{}; - std::thread update_thread; - std::atomic<bool> update_thread_running{}; + std::chrono::time_point<std::chrono::steady_clock> last_update; }; std::unique_ptr<Input::AnalogDevice> AnalogFromButton::Create(const Common::ParamPackage& params) { @@ -179,7 +228,7 @@ std::unique_ptr<Input::AnalogDevice> AnalogFromButton::Create(const Common::Para auto right = Input::CreateDevice<Input::ButtonDevice>(params.Get("right", null_engine)); auto modifier = Input::CreateDevice<Input::ButtonDevice>(params.Get("modifier", null_engine)); auto modifier_scale = params.Get("modifier_scale", 0.5f); - auto modifier_angle = params.Get("modifier_angle", 0.035f); + auto modifier_angle = params.Get("modifier_angle", 5.5f); return std::make_unique<Analog>(std::move(up), std::move(down), std::move(left), std::move(right), std::move(modifier), modifier_scale, modifier_angle); diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp index c467ff4c5..8261e76fd 100644 --- a/src/input_common/keyboard.cpp +++ b/src/input_common/keyboard.cpp @@ -75,6 +75,7 @@ public: } else { pair.key_button->UnlockButton(); } + pair.key_button->TriggerOnChange(); } } } diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index 0c00ae280..a39505903 100644 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h @@ -476,6 +476,9 @@ private: current_size = 0; on_going = false; } + if (empty_bits == PAGES_PER_WORD) { + break; + } page += empty_bits; const int continuous_bits = std::countr_one(word >> page); diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 9e6b87960..d371b842f 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -110,6 +110,8 @@ public: void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size); + void DisableGraphicsUniformBuffer(size_t stage, u32 index); + void UpdateGraphicsBuffers(bool is_indexed); void UpdateComputeBuffers(); @@ -419,10 +421,6 @@ template <class P> void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) { const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr); - if (!cpu_addr) { - uniform_buffers[stage][index] = NULL_BINDING; - return; - } const Binding binding{ .cpu_addr = *cpu_addr, .size = size, @@ -432,6 +430,11 @@ void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr } template <class P> +void BufferCache<P>::DisableGraphicsUniformBuffer(size_t stage, u32 index) { + uniform_buffers[stage][index] = NULL_BINDING; +} + +template <class P> void BufferCache<P>::UpdateGraphicsBuffers(bool is_indexed) { MICROPROFILE_SCOPE(GPU_PrepareBuffers); do { diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 75517a4f7..aab6b8f7a 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -578,8 +578,12 @@ void Maxwell3D::ProcessCBBind(size_t stage_index) { buffer.size = regs.const_buffer.cb_size; const bool is_enabled = bind_data.valid.Value() != 0; - const GPUVAddr gpu_addr = is_enabled ? regs.const_buffer.BufferAddress() : 0; - const u32 size = is_enabled ? regs.const_buffer.cb_size : 0; + if (!is_enabled) { + rasterizer->DisableGraphicsUniformBuffer(stage_index, bind_data.index); + return; + } + const GPUVAddr gpu_addr = regs.const_buffer.BufferAddress(); + const u32 size = regs.const_buffer.cb_size; rasterizer->BindGraphicsUniformBuffer(stage_index, bind_data.index, gpu_addr, size); } diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index eb58ac6b6..7124c755c 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -163,6 +163,9 @@ std::optional<GPUVAddr> MemoryManager::FindFreeRange(std::size_t size, std::size } std::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) const { + if (gpu_addr == 0) { + return std::nullopt; + } const auto page_entry{GetPageEntry(gpu_addr)}; if (!page_entry.IsValid()) { return std::nullopt; diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index 50491b758..f968b5b16 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -54,6 +54,9 @@ public: virtual void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) = 0; + /// Signal disabling of a uniform buffer + virtual void DisableGraphicsUniformBuffer(size_t stage, u32 index) = 0; + /// Signal a GPU based semaphore as a fence virtual void SignalSemaphore(GPUVAddr addr, u32 value) = 0; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index a5dbb9adf..f87bb269b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -526,6 +526,10 @@ void RasterizerOpenGL::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAd buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size); } +void RasterizerOpenGL::DisableGraphicsUniformBuffer(size_t stage, u32 index) { + buffer_cache.DisableGraphicsUniformBuffer(stage, index); +} + void RasterizerOpenGL::FlushAll() {} void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 3745cf637..76298517f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -72,6 +72,7 @@ public: void ResetCounter(VideoCore::QueryType type) override; void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) override; void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) override; + void DisableGraphicsUniformBuffer(size_t stage, u32 index) override; void FlushAll() override; void FlushRegion(VAddr addr, u64 size) override; bool MustFlushRegion(VAddr addr, u64 size) override; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index e9a0e7811..1c9120170 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -476,6 +476,10 @@ void RasterizerVulkan::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAd buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size); } +void Vulkan::RasterizerVulkan::DisableGraphicsUniformBuffer(size_t stage, u32 index) { + buffer_cache.DisableGraphicsUniformBuffer(stage, index); +} + void RasterizerVulkan::FlushAll() {} void RasterizerVulkan::FlushRegion(VAddr addr, u64 size) { diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 235afc6f3..cb8c5c279 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -64,6 +64,7 @@ public: void ResetCounter(VideoCore::QueryType type) override; void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) override; void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) override; + void DisableGraphicsUniformBuffer(size_t stage, u32 index) override; void FlushAll() override; void FlushRegion(VAddr addr, u64 size) override; bool MustFlushRegion(VAddr addr, u64 size) override; diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 8c4a5523b..906604a39 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp @@ -647,6 +647,9 @@ u32 CalculateLayerSize(const ImageInfo& info) noexcept { } LevelArray CalculateMipLevelOffsets(const ImageInfo& info) noexcept { + if (info.type == ImageType::Linear) { + return {}; + } ASSERT(info.resources.levels <= static_cast<s32>(MAX_MIP_LEVELS)); const LevelInfo level_info = MakeLevelInfo(info); LevelArray offsets{}; diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 3a463d5db..f1f523ad1 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp @@ -63,6 +63,14 @@ void Swizzle(std::span<u8> output, std::span<const u8> input, u32 bytes_per_pixe const u32 unswizzled_offset = slice * pitch * height + line * pitch + column * bytes_per_pixel; + if (const auto offset = (TO_LINEAR ? unswizzled_offset : swizzled_offset); + offset >= input.size()) { + // TODO(Rodrigo): This is an out of bounds access that should never happen. To + // avoid crashing the emulator, break. + ASSERT_MSG(false, "offset {} exceeds input size {}!", offset, input.size()); + break; + } + u8* const dst = &output[TO_LINEAR ? swizzled_offset : unswizzled_offset]; const u8* const src = &input[TO_LINEAR ? unswizzled_offset : swizzled_offset]; std::memcpy(dst, src, bytes_per_pixel); diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 6028135c5..371bc01b1 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -27,6 +27,8 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, ui->inputTab->Initialize(input_subsystem); + ui->generalTab->SetResetCallback([&] { this->close(); }); + SetConfiguration(); PopulateSelectionList(); diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 55a6a37bd..38edb4d8d 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -2,11 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <functional> +#include <utility> #include <QCheckBox> +#include <QMessageBox> #include <QSpinBox> #include "common/settings.h" #include "core/core.h" #include "ui_configure_general.h" +#include "yuzu/configuration/config.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_general.h" #include "yuzu/uisettings.h" @@ -23,6 +27,9 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); }); } + + connect(ui->button_reset_defaults, &QPushButton::clicked, this, + &ConfigureGeneral::ResetDefaults); } ConfigureGeneral::~ConfigureGeneral() = default; @@ -41,6 +48,8 @@ void ConfigureGeneral::SetConfiguration() { ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); + ui->button_reset_defaults->setEnabled(runtime_lock); + if (Settings::IsConfiguringGlobal()) { ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); } else { @@ -49,6 +58,25 @@ void ConfigureGeneral::SetConfiguration() { } } +// Called to set the callback when resetting settings to defaults +void ConfigureGeneral::SetResetCallback(std::function<void()> callback) { + reset_callback = std::move(callback); +} + +void ConfigureGeneral::ResetDefaults() { + QMessageBox::StandardButton answer = QMessageBox::question( + this, tr("yuzu"), + tr("This reset all settings and remove all per-game configurations. This will not delete " + "game directories, profiles, or input profiles. Proceed?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + if (answer == QMessageBox::No) { + return; + } + UISettings::values.reset_to_defaults = true; + UISettings::values.is_game_list_reload_pending.exchange(true); + reset_callback(); +} + void ConfigureGeneral::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, ui->use_multi_core, use_multi_core); @@ -105,6 +133,8 @@ void ConfigureGeneral::SetupPerGameUI() { ui->toggle_background_pause->setVisible(false); ui->toggle_hide_mouse->setVisible(false); + ui->button_reset_defaults->setVisible(false); + ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, Settings::values.use_frame_limit, use_frame_limit); ConfigurationShared::SetColoredTristate(ui->use_multi_core, Settings::values.use_multi_core, diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index 323ffbd8f..a0fd52492 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h @@ -4,9 +4,12 @@ #pragma once +#include <functional> #include <memory> #include <QWidget> +class ConfigureDialog; + namespace ConfigurationShared { enum class CheckState; } @@ -24,6 +27,8 @@ public: explicit ConfigureGeneral(QWidget* parent = nullptr); ~ConfigureGeneral() override; + void SetResetCallback(std::function<void()> callback); + void ResetDefaults(); void ApplyConfiguration(); private: @@ -34,6 +39,8 @@ private: void SetupPerGameUI(); + std::function<void()> reset_callback; + std::unique_ptr<Ui::ConfigureGeneral> ui; ConfigurationShared::CheckState use_frame_limit; diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index 2711116a2..bc7041090 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>300</width> + <width>329</width> <height>407</height> </rect> </property> @@ -104,6 +104,45 @@ </property> </spacer> </item> + <item> + <layout class="QHBoxLayout" name="layout_reset"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <property name="bottomMargin"> + <number>5</number> + </property> + <item> + <widget class="QPushButton" name="button_reset_defaults"> + <property name="text"> + <string>Reset All Settings</string> + </property> + </widget> + </item> + <item> + <spacer name="spacer_reset"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> </layout> </item> </layout> diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index ab3512810..d5d624b96 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -1395,7 +1395,8 @@ void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) { void ConfigureInputPlayer::CreateProfile() { const auto profile_name = - LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 20); + LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 20, + LimitableInputDialog::InputLimiter::Filesystem); if (profile_name.isEmpty()) { return; diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index 61ba91cef..f50cda2f3 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp @@ -85,6 +85,8 @@ void PlayerControlPreview::SetConnectedStatus(bool checked) { led_color[1] = led_pattern.position2 ? colors.led_on : colors.led_off; led_color[2] = led_pattern.position3 ? colors.led_on : colors.led_off; led_color[3] = led_pattern.position4 ? colors.led_on : colors.led_off; + is_enabled = checked; + ResetInputs(); } void PlayerControlPreview::SetControllerType(const Settings::ControllerType type) { @@ -108,6 +110,7 @@ void PlayerControlPreview::EndMapping() { analog_mapping_index = Settings::NativeAnalog::NumAnalogs; mapping_active = false; blink_counter = 0; + ResetInputs(); } void PlayerControlPreview::UpdateColors() { @@ -156,7 +159,23 @@ void PlayerControlPreview::UpdateColors() { // colors.right = QColor(Settings::values.players.GetValue()[player_index].body_color_right); } +void PlayerControlPreview::ResetInputs() { + for (std::size_t index = 0; index < button_values.size(); ++index) { + button_values[index] = false; + } + + for (std::size_t index = 0; index < axis_values.size(); ++index) { + axis_values[index].properties = {0, 1, 0}; + axis_values[index].value = {0, 0}; + axis_values[index].raw_value = {0, 0}; + } + update(); +} + void PlayerControlPreview::UpdateInput() { + if (!is_enabled && !mapping_active) { + return; + } bool input_changed = false; const auto& button_state = buttons; for (std::size_t index = 0; index < button_values.size(); ++index) { diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h index 51bb84eb6..5fc16d8af 100644 --- a/src/yuzu/configuration/configure_input_player_widget.h +++ b/src/yuzu/configuration/configure_input_player_widget.h @@ -100,6 +100,7 @@ private: static LedPattern GetColorPattern(std::size_t index, bool player_on); void UpdateColors(); + void ResetInputs(); // Draw controller functions void DrawHandheldController(QPainter& p, QPointF center); @@ -176,6 +177,7 @@ private: using StickArray = std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID>; + bool is_enabled{}; bool mapping_active{}; int blink_counter{}; QColor button_color{}; diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 0a28c87c0..9674119e1 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -17,17 +17,30 @@ namespace { constexpr std::array default_icon_sizes{ - std::make_pair(0, QT_TR_NOOP("None")), - std::make_pair(32, QT_TR_NOOP("Small (32x32)")), - std::make_pair(64, QT_TR_NOOP("Standard (64x64)")), - std::make_pair(128, QT_TR_NOOP("Large (128x128)")), - std::make_pair(256, QT_TR_NOOP("Full Size (256x256)")), + std::make_pair(0, QT_TRANSLATE_NOOP("ConfigureUI", "None")), + std::make_pair(32, QT_TRANSLATE_NOOP("ConfigureUI", "Small (32x32)")), + std::make_pair(64, QT_TRANSLATE_NOOP("ConfigureUI", "Standard (64x64)")), + std::make_pair(128, QT_TRANSLATE_NOOP("ConfigureUI", "Large (128x128)")), + std::make_pair(256, QT_TRANSLATE_NOOP("ConfigureUI", "Full Size (256x256)")), }; +// clang-format off constexpr std::array row_text_names{ - QT_TR_NOOP("Filename"), QT_TR_NOOP("Filetype"), QT_TR_NOOP("Title ID"), - QT_TR_NOOP("Title Name"), QT_TR_NOOP("None"), + QT_TRANSLATE_NOOP("ConfigureUI", "Filename"), + QT_TRANSLATE_NOOP("ConfigureUI", "Filetype"), + QT_TRANSLATE_NOOP("ConfigureUI", "Title ID"), + QT_TRANSLATE_NOOP("ConfigureUI", "Title Name"), + QT_TRANSLATE_NOOP("ConfigureUI", "None"), }; +// clang-format on + +QString GetTranslatedIconSize(size_t index) { + return QCoreApplication::translate("ConfigureUI", default_icon_sizes[index].second); +} + +QString GetTranslatedRowTextName(size_t index) { + return QCoreApplication::translate("ConfigureUI", row_text_names[index]); +} } // Anonymous namespace ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { @@ -121,11 +134,11 @@ void ConfigureUi::RetranslateUI() { ui->retranslateUi(this); for (int i = 0; i < ui->icon_size_combobox->count(); i++) { - ui->icon_size_combobox->setItemText(i, tr(default_icon_sizes[i].second)); + ui->icon_size_combobox->setItemText(i, GetTranslatedIconSize(static_cast<size_t>(i))); } for (int i = 0; i < ui->row_1_text_combobox->count(); i++) { - const QString name = tr(row_text_names[i]); + const QString name = GetTranslatedRowTextName(static_cast<size_t>(i)); ui->row_1_text_combobox->setItemText(i, name); ui->row_2_text_combobox->setItemText(i, name); @@ -152,8 +165,9 @@ void ConfigureUi::InitializeLanguageComboBox() { } void ConfigureUi::InitializeIconSizeComboBox() { - for (const auto& size : default_icon_sizes) { - ui->icon_size_combobox->addItem(QString::fromUtf8(size.second), size.first); + for (size_t i = 0; i < default_icon_sizes.size(); i++) { + const auto size = default_icon_sizes[i].first; + ui->icon_size_combobox->addItem(GetTranslatedIconSize(i), size); } } @@ -170,7 +184,7 @@ void ConfigureUi::UpdateFirstRowComboBox(bool init) { ui->row_1_text_combobox->clear(); for (std::size_t i = 0; i < row_text_names.size(); i++) { - const QString row_text_name = QString::fromUtf8(row_text_names[i]); + const QString row_text_name = GetTranslatedRowTextName(i); ui->row_1_text_combobox->addItem(row_text_name, QVariant::fromValue(i)); } @@ -189,7 +203,7 @@ void ConfigureUi::UpdateSecondRowComboBox(bool init) { ui->row_2_text_combobox->clear(); for (std::size_t i = 0; i < row_text_names.size(); ++i) { - const QString row_text_name = QString::fromUtf8(row_text_names[i]); + const QString row_text_name = GetTranslatedRowTextName(i); ui->row_2_text_combobox->addItem(row_text_name, QVariant::fromValue(i)); } diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index d85408ac6..c1fc69578 100644 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp @@ -28,6 +28,7 @@ ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog // Configure focus so that widget is focusable and the dialog automatically forwards focus to // it. setFocusProxy(widget); + widget->SetConnectedStatus(false); widget->setFocusPolicy(Qt::StrongFocus); widget->setFocus(); } @@ -36,9 +37,8 @@ void ControllerDialog::refreshConfiguration() { const auto& players = Settings::values.players.GetValue(); constexpr std::size_t player = 0; widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); - widget->SetConnectedStatus(players[player].connected); widget->SetControllerType(players[player].controller_type); - widget->repaint(); + widget->SetConnectedStatus(players[player].connected); } QAction* ControllerDialog::toggleViewAction() { @@ -56,6 +56,7 @@ void ControllerDialog::showEvent(QShowEvent* ev) { if (toggle_view_action) { toggle_view_action->setChecked(isVisible()); } + refreshConfiguration(); QWidget::showEvent(ev); } @@ -63,5 +64,6 @@ void ControllerDialog::hideEvent(QHideEvent* ev) { if (toggle_view_action) { toggle_view_action->setChecked(isVisible()); } + widget->SetConnectedStatus(false); QWidget::hideEvent(ev); } diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index aa3bd5e34..da956c99b 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -91,9 +91,8 @@ QString GameListSearchField::filterText() const { QString GameList::GetLastFilterResultItem() const { QString file_path; - const int folder_count = item_model->rowCount(); - for (int i = 0; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { const QStandardItem* folder = item_model->item(i, 0); const QModelIndex folder_index = folder->index(); const int children_count = folder->rowCount(); @@ -184,7 +183,6 @@ void GameList::OnItemExpanded(const QModelIndex& item) { // Event in order to filter the gamelist after editing the searchfield void GameList::OnTextChanged(const QString& new_text) { - const int folder_count = tree_view->model()->rowCount(); QString edit_filter_text = new_text.toLower(); QStandardItem* folder; int children_total = 0; @@ -194,7 +192,7 @@ void GameList::OnTextChanged(const QString& new_text) { if (edit_filter_text.isEmpty()) { tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), UISettings::values.favorited_ids.size() == 0); - for (int i = 1; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { folder = item_model->item(i, 0); const QModelIndex folder_index = folder->index(); const int children_count = folder->rowCount(); @@ -207,7 +205,7 @@ void GameList::OnTextChanged(const QString& new_text) { } else { tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), true); int result_count = 0; - for (int i = 1; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { folder = item_model->item(i, 0); const QModelIndex folder_index = folder->index(); const int children_count = folder->rowCount(); @@ -328,18 +326,14 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide tree_view->setContextMenuPolicy(Qt::CustomContextMenu); tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); - item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); + item_model->insertColumns(0, COLUMN_COUNT); item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); - if (UISettings::values.show_add_ons) { - item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); - item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); - item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); - } else { - item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); - item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); - } + item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); + tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); + item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); + item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); item_model->setSortRole(GameListItemPath::SortRole); connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons); @@ -466,9 +460,8 @@ void GameList::DonePopulating(const QStringList& watch_list) { QCoreApplication::processEvents(); } tree_view->setEnabled(true); - const int folder_count = tree_view->model()->rowCount(); int children_total = 0; - for (int i = 1; i < folder_count; ++i) { + for (int i = 1; i < item_model->rowCount() - 1; ++i) { children_total += item_model->item(i, 0)->rowCount(); } search_field->setFilterResult(children_total, children_total); @@ -512,6 +505,10 @@ void GameList::PopupContextMenu(const QPoint& menu_location) { void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::string& path) { QAction* favorite = context_menu.addAction(tr("Favorite")); context_menu.addSeparator(); + QAction* start_game = context_menu.addAction(tr("Start Game")); + QAction* start_game_global = + context_menu.addAction(tr("Start Game without Custom Configuration")); + context_menu.addSeparator(); QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location")); QAction* open_mod_location = context_menu.addAction(tr("Open Mod Data Location")); QAction* open_transferable_shader_cache = @@ -547,6 +544,12 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri connect(open_save_location, &QAction::triggered, [this, program_id, path]() { emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData, path); }); + connect(start_game, &QAction::triggered, [this, path]() { + emit BootGame(QString::fromStdString(path), 0, StartGameType::Normal); + }); + connect(start_game_global, &QAction::triggered, [this, path]() { + emit BootGame(QString::fromStdString(path), 0, StartGameType::Global); + }); connect(open_mod_location, &QAction::triggered, [this, program_id, path]() { emit OpenFolderRequested(program_id, GameListOpenTarget::ModData, path); }); @@ -649,9 +652,9 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { } void GameList::AddFavoritesPopup(QMenu& context_menu) { - QAction* clear_all = context_menu.addAction(tr("Clear")); + QAction* clear = context_menu.addAction(tr("Clear")); - connect(clear_all, &QAction::triggered, [this] { + connect(clear, &QAction::triggered, [this] { for (const auto id : UISettings::values.favorited_ids) { RemoveFavorite(id); } @@ -708,22 +711,7 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) { tree_view->setEnabled(false); // Update the columns in case UISettings has changed - item_model->removeColumns(0, item_model->columnCount()); - item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); - item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); - item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); - - if (UISettings::values.show_add_ons) { - item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); - item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); - item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); - } else { - item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); - item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); - item_model->removeColumns(COLUMN_COUNT - 1, 1); - } - - LoadInterfaceLayout(); + tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); // Delete any rows that might already exist if we're repopulating item_model->removeRows(0, item_model->rowCount()); @@ -800,7 +788,7 @@ void GameList::AddFavorite(u64 program_id) { if (folder->child(j)->data(GameListItemPath::ProgramIdRole).toULongLong() == program_id) { QList<QStandardItem*> list; - for (int k = 0; k < item_model->columnCount(); k++) { + for (int k = 0; k < COLUMN_COUNT; k++) { list.append(folder->child(j, k)->clone()); } list[0]->setData(folder->child(j)->data(GameListItem::SortRole), diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index ab6866735..b630e34ff 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h @@ -28,6 +28,7 @@ class GameListWorker; class GameListSearchField; class GameListDir; class GMainWindow; +enum class StartGameType; namespace FileSys { class ManualContentProvider; @@ -82,6 +83,7 @@ public: static const QStringList supported_file_extensions; signals: + void BootGame(const QString& game_path, std::size_t program_index, StartGameType type); void GameChosen(const QString& game_path); void ShouldCancelWorker(); void OpenFolderRequested(u64 program_id, GameListOpenTarget target, diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 485045334..33cc90d5a 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -215,13 +215,11 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri new GameListItemSize(Common::FS::GetSize(path)), }; - if (UISettings::values.show_add_ons) { - const auto patch_versions = GetGameListCachedObject( - fmt::format("{:016X}", patch.GetTitleID()), "pv.txt", [&patch, &loader] { - return FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable()); - }); - list.insert(2, new GameListItem(patch_versions)); - } + const auto patch_versions = GetGameListCachedObject( + fmt::format("{:016X}", patch.GetTitleID()), "pv.txt", [&patch, &loader] { + return FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable()); + }); + list.insert(2, new GameListItem(patch_versions)); return list; } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 237e26829..19339ff2d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1094,6 +1094,7 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) { } void GMainWindow::ConnectWidgetEvents() { + connect(game_list, &GameList::BootGame, this, &GMainWindow::BootGame); connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile); connect(game_list, &GameList::OpenDirectory, this, &GMainWindow::OnGameListOpenDirectory); connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder); @@ -1320,7 +1321,7 @@ void GMainWindow::SelectAndSetCurrentUser() { Settings::values.current_user = dialog.GetIndex(); } -void GMainWindow::BootGame(const QString& filename, std::size_t program_index) { +void GMainWindow::BootGame(const QString& filename, std::size_t program_index, StartGameType type) { LOG_INFO(Frontend, "yuzu starting..."); StoreRecentFile(filename); // Put the filename on top of the list @@ -1332,7 +1333,8 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) { const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); const auto loader = Loader::GetLoader(system, v_file, program_index); - if (!(loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success)) { + if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success && + type == StartGameType::Normal) { // Load per game settings const auto file_path = std::filesystem::path{filename.toStdU16String()}; const auto config_file_name = title_id == 0 @@ -2596,13 +2598,53 @@ void GMainWindow::OnConfigure() { &GMainWindow::OnLanguageChanged); const auto result = configure_dialog.exec(); - if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { + if (result != QDialog::Accepted && !UISettings::values.configuration_applied && + !UISettings::values.reset_to_defaults) { + // Runs if the user hit Cancel or closed the window, and did not ever press the Apply button + // or `Reset to Defaults` button return; } else if (result == QDialog::Accepted) { + // Only apply new changes if user hit Okay + // This is here to avoid applying changes if the user hit Apply, made some changes, then hit + // Cancel configure_dialog.ApplyConfiguration(); - controller_dialog->refreshConfiguration(); + } else if (UISettings::values.reset_to_defaults) { + LOG_INFO(Frontend, "Resetting all settings to defaults"); + if (!Common::FS::RemoveFile(config->GetConfigFilePath())) { + LOG_WARNING(Frontend, "Failed to remove configuration file"); + } + if (!Common::FS::RemoveDirContentsRecursively( + Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "custom")) { + LOG_WARNING(Frontend, "Failed to remove custom configuration files"); + } + if (!Common::FS::RemoveDirRecursively( + Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / "game_list")) { + LOG_WARNING(Frontend, "Failed to remove game metadata cache files"); + } + + // Explicitly save the game directories, since reinitializing config does not explicitly do + // so. + QVector<UISettings::GameDir> old_game_dirs = std::move(UISettings::values.game_dirs); + QVector<u64> old_favorited_ids = std::move(UISettings::values.favorited_ids); + + Settings::values.disabled_addons.clear(); + + config = std::make_unique<Config>(); + UISettings::values.reset_to_defaults = false; + + UISettings::values.game_dirs = std::move(old_game_dirs); + UISettings::values.favorited_ids = std::move(old_favorited_ids); + + InitializeRecentFileMenuActions(); + + SetDefaultUIGeometry(); + RestoreUIState(); + + ShowTelemetryCallout(); } + controller_dialog->refreshConfiguration(); InitializeHotkeys(); + if (UISettings::values.theme != old_theme) { UpdateUITheme(); } diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 490b6889f..11f152cbe 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -39,6 +39,11 @@ class GameListPlaceholder; class QtSoftwareKeyboardDialog; +enum class StartGameType { + Normal, // Can use custom configuration + Global, // Only uses global configuration +}; + namespace Core::Frontend { struct ControllerParameters; struct InlineAppearParameters; @@ -181,7 +186,8 @@ private: void AllowOSSleep(); bool LoadROM(const QString& filename, std::size_t program_index); - void BootGame(const QString& filename, std::size_t program_index = 0); + void BootGame(const QString& filename, std::size_t program_index = 0, + StartGameType with_config = StartGameType::Normal); void ShutdownGame(); void ShowTelemetryCallout(); diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 49122ec32..cdcb83f9f 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -97,6 +97,7 @@ struct Values { bool cache_game_list; bool configuration_applied; + bool reset_to_defaults; }; extern Values values; diff --git a/src/yuzu/util/limitable_input_dialog.cpp b/src/yuzu/util/limitable_input_dialog.cpp index edd78e579..6fea41f95 100644 --- a/src/yuzu/util/limitable_input_dialog.cpp +++ b/src/yuzu/util/limitable_input_dialog.cpp @@ -21,11 +21,13 @@ void LimitableInputDialog::CreateUI() { text_label = new QLabel(this); text_entry = new QLineEdit(this); + text_label_invalid = new QLabel(this); buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); auto* const layout = new QVBoxLayout; layout->addWidget(text_label); layout->addWidget(text_entry); + layout->addWidget(text_label_invalid); layout->addWidget(buttons); setLayout(layout); @@ -37,18 +39,36 @@ void LimitableInputDialog::ConnectEvents() { } QString LimitableInputDialog::GetText(QWidget* parent, const QString& title, const QString& text, - int min_character_limit, int max_character_limit) { + int min_character_limit, int max_character_limit, + InputLimiter limit_type) { Q_ASSERT(min_character_limit <= max_character_limit); LimitableInputDialog dialog{parent}; dialog.setWindowTitle(title); dialog.text_label->setText(text); dialog.text_entry->setMaxLength(max_character_limit); + dialog.text_label_invalid->show(); + + switch (limit_type) { + case InputLimiter::Filesystem: + dialog.invalid_characters = QStringLiteral("<>:;\"/\\|,.!?*"); + break; + default: + dialog.invalid_characters.clear(); + dialog.text_label_invalid->hide(); + break; + } + dialog.text_label_invalid->setText( + tr("The text can't contain any of the following characters:\n%1") + .arg(dialog.invalid_characters)); auto* const ok_button = dialog.buttons->button(QDialogButtonBox::Ok); ok_button->setEnabled(false); - connect(dialog.text_entry, &QLineEdit::textEdited, [&](const QString& new_text) { - ok_button->setEnabled(new_text.length() >= min_character_limit); + connect(dialog.text_entry, &QLineEdit::textEdited, [&] { + if (!dialog.invalid_characters.isEmpty()) { + dialog.RemoveInvalidCharacters(); + } + ok_button->setEnabled(dialog.text_entry->text().length() >= min_character_limit); }); if (dialog.exec() != QDialog::Accepted) { @@ -57,3 +77,15 @@ QString LimitableInputDialog::GetText(QWidget* parent, const QString& title, con return dialog.text_entry->text(); } + +void LimitableInputDialog::RemoveInvalidCharacters() { + auto cpos = text_entry->cursorPosition(); + for (int i = 0; i < text_entry->text().length(); i++) { + if (invalid_characters.contains(text_entry->text().at(i))) { + text_entry->setText(text_entry->text().remove(i, 1)); + i--; + cpos--; + } + } + text_entry->setCursorPosition(cpos); +} diff --git a/src/yuzu/util/limitable_input_dialog.h b/src/yuzu/util/limitable_input_dialog.h index 164ad7301..a8e31098b 100644 --- a/src/yuzu/util/limitable_input_dialog.h +++ b/src/yuzu/util/limitable_input_dialog.h @@ -18,14 +18,24 @@ public: explicit LimitableInputDialog(QWidget* parent = nullptr); ~LimitableInputDialog() override; + enum class InputLimiter { + None, + Filesystem, + }; + static QString GetText(QWidget* parent, const QString& title, const QString& text, - int min_character_limit, int max_character_limit); + int min_character_limit, int max_character_limit, + InputLimiter limit_type = InputLimiter::None); private: void CreateUI(); void ConnectEvents(); + void RemoveInvalidCharacters(); + QString invalid_characters; + QLabel* text_label; QLineEdit* text_entry; + QLabel* text_label_invalid; QDialogButtonBox* buttons; }; diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index a2ab69cdd..63f368fe5 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -317,6 +317,43 @@ void Config::ReadValues() { sdl2_config->GetInteger("ControlsGeneral", "touch_diameter_x", 15); Settings::values.touchscreen.diameter_y = sdl2_config->GetInteger("ControlsGeneral", "touch_diameter_y", 15); + + int num_touch_from_button_maps = + sdl2_config->GetInteger("ControlsGeneral", "touch_from_button_map", 0); + if (num_touch_from_button_maps > 0) { + for (int i = 0; i < num_touch_from_button_maps; ++i) { + Settings::TouchFromButtonMap map; + map.name = sdl2_config->Get("ControlsGeneral", + std::string("touch_from_button_maps_") + std::to_string(i) + + std::string("_name"), + "default"); + const int num_touch_maps = sdl2_config->GetInteger( + "ControlsGeneral", + std::string("touch_from_button_maps_") + std::to_string(i) + std::string("_count"), + 0); + map.buttons.reserve(num_touch_maps); + + for (int j = 0; j < num_touch_maps; ++j) { + std::string touch_mapping = + sdl2_config->Get("ControlsGeneral", + std::string("touch_from_button_maps_") + std::to_string(i) + + std::string("_bind_") + std::to_string(j), + ""); + map.buttons.emplace_back(std::move(touch_mapping)); + } + + Settings::values.touch_from_button_maps.emplace_back(std::move(map)); + } + } else { + Settings::values.touch_from_button_maps.emplace_back( + Settings::TouchFromButtonMap{"default", {}}); + num_touch_from_button_maps = 1; + } + Settings::values.use_touch_from_button = + sdl2_config->GetBoolean("ControlsGeneral", "use_touch_from_button", false); + Settings::values.touch_from_button_map_index = + std::clamp(Settings::values.touch_from_button_map_index, 0, num_touch_from_button_maps - 1); + Settings::values.udp_input_servers = sdl2_config->Get("Controls", "udp_input_address", InputCommon::CemuhookUDP::DEFAULT_SRV); diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 4ce8e08e4..8ce2967ac 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -7,7 +7,7 @@ namespace DefaultINI { const char* sdl2_config_file = R"( -[Controls] +[ControlsGeneral] # The input devices and parameters for each Switch native input # It should be in the format of "engine:[engine_name],[param1]:[value1],[param2]:[value2]..." # Escape characters $0 (for ':'), $1 (for ',') and $2 (for '$') can be used in values @@ -86,6 +86,18 @@ motion_device= # - "min_x", "min_y", "max_x", "max_y": defines the udp device's touch screen coordinate system touch_device= +# Whether to enable or disable touch input from button +# 0 (default): Disabled, 1: Enabled +use_touch_from_button= + +# for mapping buttons to touch inputs. +#touch_from_button_map=1 +#touch_from_button_maps_0_name=default +#touch_from_button_maps_0_count=2 +#touch_from_button_maps_0_bind_0=foo +#touch_from_button_maps_0_bind_1=bar +# etc. + # Most desktop operating systems do not expose a way to poll the motion state of the controllers # so as a way around it, cemuhook created a udp client/server protocol to broadcast the data directly # from a controller device to the client program. Citra has a client that can connect and read diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp index 3c49a300b..837a44be7 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp @@ -32,17 +32,17 @@ class SDLGLContext : public Core::Frontend::GraphicsContext { public: - explicit SDLGLContext() { - // create a hidden window to make the shared context against - window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, - SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL); + explicit SDLGLContext(SDL_Window* window_) : window{window_} { context = SDL_GL_CreateContext(window); } ~SDLGLContext() { DoneCurrent(); SDL_GL_DeleteContext(context); - SDL_DestroyWindow(window); + } + + void SwapBuffers() override { + SDL_GL_SwapWindow(window); } void MakeCurrent() override { @@ -114,9 +114,6 @@ EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsyste exit(1); } - dummy_window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, - SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL); - SetWindowIcon(); if (fullscreen) { @@ -159,5 +156,5 @@ EmuWindow_SDL2_GL::~EmuWindow_SDL2_GL() { } std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_GL::CreateSharedContext() const { - return std::make_unique<SDLGLContext>(); + return std::make_unique<SDLGLContext>(render_window); } diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h index dba5c293c..9e694d985 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h @@ -20,9 +20,6 @@ public: std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override; private: - /// Fake hidden window for the core context - SDL_Window* dummy_window{}; - /// Whether the GPU and driver supports the OpenGL extension required bool SupportsRequiredGLExtensions(); |