diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-12-11 00:16:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 00:16:50 +0100 |
commit | 108737fcc6244c34b4a6bdb542a6fd7a4006b86e (patch) | |
tree | 5dc61c0d1fcf1e12cdec4b5dc1e5145080555505 /src/core/hle/service/sm | |
parent | Merge pull request #12296 from liamwhite/client-session (diff) | |
parent | ro: add separate ro service (diff) | |
download | yuzu-108737fcc6244c34b4a6bdb542a6fd7a4006b86e.tar yuzu-108737fcc6244c34b4a6bdb542a6fd7a4006b86e.tar.gz yuzu-108737fcc6244c34b4a6bdb542a6fd7a4006b86e.tar.bz2 yuzu-108737fcc6244c34b4a6bdb542a6fd7a4006b86e.tar.lz yuzu-108737fcc6244c34b4a6bdb542a6fd7a4006b86e.tar.xz yuzu-108737fcc6244c34b4a6bdb542a6fd7a4006b86e.tar.zst yuzu-108737fcc6244c34b4a6bdb542a6fd7a4006b86e.zip |
Diffstat (limited to 'src/core/hle/service/sm')
-rw-r--r-- | src/core/hle/service/sm/sm.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/service/sm/sm.h | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index e0cde9a05..f2cdefa1c 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -51,7 +51,7 @@ static Result ValidateServiceName(const std::string& name) { } Result ServiceManager::RegisterService(std::string name, u32 max_sessions, - SessionRequestHandlerPtr handler) { + SessionRequestHandlerFactory handler) { R_TRY(ValidateServiceName(name)); std::scoped_lock lk{lock}; @@ -262,7 +262,9 @@ void LoopProcess(Core::System& system) { server_manager->ManageDeferral(&deferral_event); service_manager.SetDeferralEvent(deferral_event); - server_manager->ManageNamedPort("sm:", std::make_shared<SM>(system.ServiceManager(), system)); + auto sm_service = std::make_shared<SM>(system.ServiceManager(), system); + server_manager->ManageNamedPort("sm:", [sm_service] { return sm_service; }); + ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 14bfaf8c2..cf102c339 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -53,7 +53,8 @@ public: explicit ServiceManager(Kernel::KernelCore& kernel_); ~ServiceManager(); - Result RegisterService(std::string name, u32 max_sessions, SessionRequestHandlerPtr handler); + Result RegisterService(std::string name, u32 max_sessions, + SessionRequestHandlerFactory handler_factory); Result UnregisterService(const std::string& name); Result GetServicePort(Kernel::KPort** out_port, const std::string& name); @@ -64,7 +65,7 @@ public: LOG_DEBUG(Service, "Can't find service: {}", service_name); return nullptr; } - return std::static_pointer_cast<T>(service->second); + return std::static_pointer_cast<T>(service->second()); } void InvokeControlRequest(HLERequestContext& context); @@ -79,7 +80,7 @@ private: /// Map of registered services, retrieved using GetServicePort. std::mutex lock; - std::unordered_map<std::string, SessionRequestHandlerPtr> registered_services; + std::unordered_map<std::string, SessionRequestHandlerFactory> registered_services; std::unordered_map<std::string, Kernel::KPort*> service_ports; /// Kernel context |