diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-22 06:43:25 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-06 01:40:52 +0200 |
commit | 0297448fbc6bf909b0bc061723c38208b9667b66 (patch) | |
tree | 7c21303536466b0a76331e4274ecb3e12eb40421 /src/core/hle/service/sm | |
parent | hle: kernel: HandleTable: Remove deprecated APIs. (diff) | |
download | yuzu-0297448fbc6bf909b0bc061723c38208b9667b66.tar yuzu-0297448fbc6bf909b0bc061723c38208b9667b66.tar.gz yuzu-0297448fbc6bf909b0bc061723c38208b9667b66.tar.bz2 yuzu-0297448fbc6bf909b0bc061723c38208b9667b66.tar.lz yuzu-0297448fbc6bf909b0bc061723c38208b9667b66.tar.xz yuzu-0297448fbc6bf909b0bc061723c38208b9667b66.tar.zst yuzu-0297448fbc6bf909b0bc061723c38208b9667b66.zip |
Diffstat (limited to 'src/core/hle/service/sm')
-rw-r--r-- | src/core/hle/service/sm/sm.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/service/sm/sm.h | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 66e41277f..39575ce3d 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -6,7 +6,7 @@ #include "common/assert.h" #include "core/core.h" #include "core/hle/ipc_helpers.h" -#include "core/hle/kernel/client_port.h" +#include "core/hle/kernel/k_client_port.h" #include "core/hle/kernel/k_client_session.h" #include "core/hle/kernel/k_server_session.h" #include "core/hle/kernel/k_session.h" @@ -62,6 +62,8 @@ ResultVal<std::shared_ptr<Kernel::ServerPort>> ServiceManager::RegisterService(s auto [server_port, client_port] = Kernel::ServerPort::CreatePortPair(kernel, max_sessions, name); + client_port->Open(); + registered_services.emplace(std::move(name), std::move(client_port)); return MakeResult(std::move(server_port)); } @@ -74,12 +76,14 @@ ResultCode ServiceManager::UnregisterService(const std::string& name) { LOG_ERROR(Service_SM, "Server is not registered! service={}", name); return ERR_SERVICE_NOT_REGISTERED; } + + iter->second->Close(); + registered_services.erase(iter); return RESULT_SUCCESS; } -ResultVal<std::shared_ptr<Kernel::ClientPort>> ServiceManager::GetServicePort( - const std::string& name) { +ResultVal<Kernel::KClientPort*> ServiceManager::GetServicePort(const std::string& name) { CASCADE_CODE(ValidateServiceName(name)); auto it = registered_services.find(name); diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 8f6862fa9..aee9aefec 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -10,7 +10,7 @@ #include <unordered_map> #include "common/concepts.h" -#include "core/hle/kernel/client_port.h" +#include "core/hle/kernel/k_client_port.h" #include "core/hle/kernel/object.h" #include "core/hle/kernel/server_port.h" #include "core/hle/result.h" @@ -21,7 +21,7 @@ class System; } namespace Kernel { -class ClientPort; +class KClientPort; class KClientSession; class KernelCore; class ServerPort; @@ -58,7 +58,7 @@ public: ResultVal<std::shared_ptr<Kernel::ServerPort>> RegisterService(std::string name, u32 max_sessions); ResultCode UnregisterService(const std::string& name); - ResultVal<std::shared_ptr<Kernel::ClientPort>> GetServicePort(const std::string& name); + ResultVal<Kernel::KClientPort*> GetServicePort(const std::string& name); template <Common::DerivedFrom<Kernel::SessionRequestHandler> T> std::shared_ptr<T> GetService(const std::string& service_name) const { @@ -81,7 +81,7 @@ private: std::unique_ptr<Controller> controller_interface; /// Map of registered services, retrieved using GetServicePort. - std::unordered_map<std::string, std::shared_ptr<Kernel::ClientPort>> registered_services; + std::unordered_map<std::string, Kernel::KClientPort*> registered_services; /// Kernel context Kernel::KernelCore& kernel; |