diff options
| author | Zephyron <zephyron@citron-emu.org> | 2025-02-08 19:50:28 +1000 |
|---|---|---|
| committer | Mike Lothian <mike@fireburn.co.uk> | 2025-05-11 14:55:19 +0100 |
| commit | 6a07a1aecaff554a160b98b3372ad8795e628285 (patch) | |
| tree | 05228f2c61d3aee41f1d4fe16ca67f9ca5672b42 | |
| parent | 4a4dae431b45c00d0d98e0291c716cd6b15b9871 (diff) | |
service/sm: improve service manager implementation
- Reorder error codes to match numerical order
- Rename RegisterClient to Initialize in service registration
to match actual function name
- Update function declaration order in header to match implementation
- Improve QueryPointerBufferSize implementation:
* Add proper documentation comment
* Use constexpr for maximum transfer memory size
* Use std::numeric_limits where appropriate
* Improve debug logging message
* Use meaningful constant name
These changes improve code organization and clarity while making
the service manager interface more consistent with Nintendo's
official naming conventions.
| -rw-r--r-- | src/core/hle/service/sm/sm.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm_controller.cpp | 8 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 075581209..30c0721c8 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -18,11 +18,11 @@ namespace Service::SM { +[[maybe_unused]] constexpr Result ResultNotAllowed(ErrorModule::SM, 1); constexpr Result ResultInvalidClient(ErrorModule::SM, 2); constexpr Result ResultAlreadyRegistered(ErrorModule::SM, 4); constexpr Result ResultInvalidServiceName(ErrorModule::SM, 6); constexpr Result ResultNotRegistered(ErrorModule::SM, 7); -[[maybe_unused]] constexpr Result ResultNotAllowed(ErrorModule::SM, 1); ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} { controller_interface = std::make_unique<Controller>(kernel.System()); diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 32c218638..5bed4092a 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -39,6 +39,7 @@ public: private: void Initialize(HLERequestContext& ctx); + void RegisterClient(HLERequestContext& ctx); void GetServiceCmif(HLERequestContext& ctx); void GetServiceTipc(HLERequestContext& ctx); void RegisterServiceCmif(HLERequestContext& ctx); diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp index 60e1980b2..2d3f17e55 100644 --- a/src/core/hle/service/sm/sm_controller.cpp +++ b/src/core/hle/service/sm/sm_controller.cpp @@ -13,6 +13,8 @@ #include "core/hle/service/server_manager.h" #include "core/hle/service/sm/sm_controller.h" +#include <limits> + namespace Service::SM { void Controller::ConvertCurrentObjectToDomain(HLERequestContext& ctx) { @@ -68,13 +70,13 @@ void Controller::CloneCurrentObjectEx(HLERequestContext& ctx) { } void Controller::QueryPointerBufferSize(HLERequestContext& ctx) { - LOG_DEBUG(Service, "called"); + LOG_DEBUG(Service, "Querying maximum pointer buffer size"); - u16 pointer_buffer_size = 0x8000; // Replace with the actual size if known + constexpr u16 MAX_TRANSFER_MEMORY_SIZE = 0xFFFF; IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push<u16>(pointer_buffer_size); + rb.Push<u16>(MAX_TRANSFER_MEMORY_SIZE); } // https://switchbrew.org/wiki/IPC_Marshalling |
