summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/ns/ns.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/ns/ns.cpp61
1 files changed, 32 insertions, 29 deletions
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index e53bdde52..376067a95 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -7,13 +7,14 @@
#include "core/file_sys/control_metadata.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/vfs.h"
-#include "core/hle/ipc_helpers.h"
#include "core/hle/service/glue/glue_manager.h"
+#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/ns/errors.h"
#include "core/hle/service/ns/iplatform_service_manager.h"
#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 {
@@ -328,7 +329,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
IApplicationManagerInterface::~IApplicationManagerInterface() = default;
-void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestContext& ctx) {
+void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto flag = rp.PopRaw<u64>();
LOG_DEBUG(Service_NS, "called with flag={:016X}", flag);
@@ -387,7 +388,7 @@ void IApplicationManagerInterface::GetApplicationControlData(Kernel::HLERequestC
rb.Push<u32>(static_cast<u32>(out.size()));
}
-void IApplicationManagerInterface::GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx) {
+void IApplicationManagerInterface::GetApplicationDesiredLanguage(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto supported_languages = rp.Pop<u32>();
@@ -415,14 +416,14 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
if (application_language == std::nullopt) {
LOG_ERROR(Service_NS, "Could not convert application language! language_code={}",
language_code);
- return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
+ return Service::NS::ResultApplicationLanguageNotFound;
}
const auto priority_list = GetApplicationLanguagePriorityList(*application_language);
if (!priority_list) {
LOG_ERROR(Service_NS,
"Could not find application language priorities! application_language={}",
*application_language);
- return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
+ return Service::NS::ResultApplicationLanguageNotFound;
}
// Try to find a valid language.
@@ -435,11 +436,11 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}",
supported_languages);
- return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
+ return Service::NS::ResultApplicationLanguageNotFound;
}
void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
- Kernel::HLERequestContext& ctx) {
+ HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto application_language = rp.Pop<u8>();
@@ -460,7 +461,7 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag
ConvertToLanguageCode(static_cast<ApplicationLanguage>(application_language));
if (language_code == std::nullopt) {
LOG_ERROR(Service_NS, "Language not found! application_language={}", application_language);
- return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
+ return Service::NS::ResultApplicationLanguageNotFound;
}
return static_cast<u64>(*language_code);
@@ -603,8 +604,7 @@ IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterfa
IReadOnlyApplicationControlDataInterface::~IReadOnlyApplicationControlDataInterface() = default;
-void IReadOnlyApplicationControlDataInterface::GetApplicationControlData(
- Kernel::HLERequestContext& ctx) {
+void IReadOnlyApplicationControlDataInterface::GetApplicationControlData(HLERequestContext& ctx) {
enum class ApplicationControlSource : u8 {
CacheOnly,
Storage,
@@ -752,7 +752,7 @@ public:
}
private:
- void OpenSystemUpdateControl(Kernel::HLERequestContext& ctx) {
+ void OpenSystemUpdateControl(HLERequestContext& ctx) {
LOG_DEBUG(Service_NS, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -776,7 +776,7 @@ public:
}
private:
- void NeedsUpdateVulnerability(Kernel::HLERequestContext& ctx) {
+ void NeedsUpdateVulnerability(HLERequestContext& ctx) {
LOG_WARNING(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
@@ -785,23 +785,26 @@ private:
}
};
-void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
-
- std::make_shared<NS>("ns:am2", system)->InstallAsService(service_manager);
- std::make_shared<NS>("ns:ec", system)->InstallAsService(service_manager);
- std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager);
- std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager);
- std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager);
- std::make_shared<NS>("ns:ro", system)->InstallAsService(service_manager);
-
- std::make_shared<NS_DEV>(system)->InstallAsService(service_manager);
- std::make_shared<NS_SU>(system)->InstallAsService(service_manager);
- std::make_shared<NS_VM>(system)->InstallAsService(service_manager);
-
- std::make_shared<PDM_QRY>(system)->InstallAsService(service_manager);
-
- std::make_shared<IPlatformServiceManager>(system, "pl:s")->InstallAsService(service_manager);
- std::make_shared<IPlatformServiceManager>(system, "pl:u")->InstallAsService(service_manager);
+void LoopProcess(Core::System& system) {
+ auto server_manager = std::make_unique<ServerManager>(system);
+
+ server_manager->RegisterNamedService("ns:am2", std::make_shared<NS>("ns:am2", system));
+ server_manager->RegisterNamedService("ns:ec", std::make_shared<NS>("ns:ec", system));
+ server_manager->RegisterNamedService("ns:rid", std::make_shared<NS>("ns:rid", system));
+ server_manager->RegisterNamedService("ns:rt", std::make_shared<NS>("ns:rt", system));
+ server_manager->RegisterNamedService("ns:web", std::make_shared<NS>("ns:web", system));
+ server_manager->RegisterNamedService("ns:ro", std::make_shared<NS>("ns:ro", system));
+
+ server_manager->RegisterNamedService("ns:dev", std::make_shared<NS_DEV>(system));
+ server_manager->RegisterNamedService("ns:su", std::make_shared<NS_SU>(system));
+ server_manager->RegisterNamedService("ns:vm", std::make_shared<NS_VM>(system));
+ server_manager->RegisterNamedService("pdm:qry", std::make_shared<PDM_QRY>(system));
+
+ server_manager->RegisterNamedService("pl:s",
+ std::make_shared<IPlatformServiceManager>(system, "pl:s"));
+ server_manager->RegisterNamedService("pl:u",
+ std::make_shared<IPlatformServiceManager>(system, "pl:u"));
+ ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::NS