From a9369726147c7499e0016e183d5d56a7b44efe4b Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 18 Feb 2023 16:26:48 -0500 Subject: service: refactor server architecture Converts services to have their own processes --- src/core/hle/service/ns/ns.cpp | 38 +++++++++++++++++++++----------------- src/core/hle/service/ns/ns.h | 3 +-- 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'src/core/hle/service/ns') diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index f59a1a63d..a9291ed5d 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -14,6 +14,7 @@ #include "core/hle/service/ns/language.h" #include "core/hle/service/ns/ns.h" #include "core/hle/service/ns/pdm_qry.h" +#include "core/hle/service/server_manager.h" #include "core/hle/service/set/set.h" namespace Service::NS { @@ -777,23 +778,26 @@ private: } }; -void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { - - std::make_shared("ns:am2", system)->InstallAsService(service_manager); - std::make_shared("ns:ec", system)->InstallAsService(service_manager); - std::make_shared("ns:rid", system)->InstallAsService(service_manager); - std::make_shared("ns:rt", system)->InstallAsService(service_manager); - std::make_shared("ns:web", system)->InstallAsService(service_manager); - std::make_shared("ns:ro", system)->InstallAsService(service_manager); - - std::make_shared(system)->InstallAsService(service_manager); - std::make_shared(system)->InstallAsService(service_manager); - std::make_shared(system)->InstallAsService(service_manager); - - std::make_shared(system)->InstallAsService(service_manager); - - std::make_shared(system, "pl:s")->InstallAsService(service_manager); - std::make_shared(system, "pl:u")->InstallAsService(service_manager); +void LoopProcess(Core::System& system) { + auto server_manager = std::make_unique(system); + + server_manager->RegisterNamedService("ns:am2", std::make_shared("ns:am2", system)); + server_manager->RegisterNamedService("ns:ec", std::make_shared("ns:ec", system)); + server_manager->RegisterNamedService("ns:rid", std::make_shared("ns:rid", system)); + server_manager->RegisterNamedService("ns:rt", std::make_shared("ns:rt", system)); + server_manager->RegisterNamedService("ns:web", std::make_shared("ns:web", system)); + server_manager->RegisterNamedService("ns:ro", std::make_shared("ns:ro", system)); + + server_manager->RegisterNamedService("ns:dev", std::make_shared(system)); + server_manager->RegisterNamedService("ns:su", std::make_shared(system)); + server_manager->RegisterNamedService("ns:vm", std::make_shared(system)); + server_manager->RegisterNamedService("pdm:qry", std::make_shared(system)); + + server_manager->RegisterNamedService("pl:s", + std::make_shared(system, "pl:s")); + server_manager->RegisterNamedService("pl:u", + std::make_shared(system, "pl:u")); + ServerManager::RunServer(std::move(server_manager)); } } // namespace Service::NS diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 9c18e935c..797e69a13 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -117,8 +117,7 @@ private: } }; -/// Registers all NS services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); +void LoopProcess(Core::System& system); } // namespace NS } // namespace Service -- cgit v1.2.3