diff options
Diffstat (limited to 'src/core/hle/service/ns')
-rw-r--r-- | src/core/hle/service/ns/errors.h | 5 | ||||
-rw-r--r-- | src/core/hle/service/ns/iplatform_service_manager.cpp | 14 | ||||
-rw-r--r-- | src/core/hle/service/ns/iplatform_service_manager.h | 12 | ||||
-rw-r--r-- | src/core/hle/service/ns/ns.cpp | 61 | ||||
-rw-r--r-- | src/core/hle/service/ns/ns.h | 17 | ||||
-rw-r--r-- | src/core/hle/service/ns/pdm_qry.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/ns/pdm_qry.h | 2 |
7 files changed, 59 insertions, 56 deletions
diff --git a/src/core/hle/service/ns/errors.h b/src/core/hle/service/ns/errors.h index 8a7621798..16d2ea6f7 100644 --- a/src/core/hle/service/ns/errors.h +++ b/src/core/hle/service/ns/errors.h @@ -7,5 +7,6 @@ namespace Service::NS { -constexpr Result ERR_APPLICATION_LANGUAGE_NOT_FOUND{ErrorModule::NS, 300}; -}
\ No newline at end of file +constexpr Result ResultApplicationLanguageNotFound{ErrorModule::NS, 300}; + +} diff --git a/src/core/hle/service/ns/iplatform_service_manager.cpp b/src/core/hle/service/ns/iplatform_service_manager.cpp index 1fab2f0dd..cd2705881 100644 --- a/src/core/hle/service/ns/iplatform_service_manager.cpp +++ b/src/core/hle/service/ns/iplatform_service_manager.cpp @@ -15,11 +15,11 @@ #include "core/file_sys/registered_cache.h" #include "core/file_sys/romfs.h" #include "core/file_sys/system_archive/system_archive.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_shared_memory.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/physical_memory.h" #include "core/hle/service/filesystem/filesystem.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/ns/iplatform_service_manager.h" namespace Service::NS { @@ -208,7 +208,7 @@ IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const ch IPlatformServiceManager::~IPlatformServiceManager() = default; -void IPlatformServiceManager::RequestLoad(Kernel::HLERequestContext& ctx) { +void IPlatformServiceManager::RequestLoad(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 shared_font_type{rp.Pop<u32>()}; // Games don't call this so all fonts should be loaded @@ -218,7 +218,7 @@ void IPlatformServiceManager::RequestLoad(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void IPlatformServiceManager::GetLoadState(Kernel::HLERequestContext& ctx) { +void IPlatformServiceManager::GetLoadState(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 font_id{rp.Pop<u32>()}; LOG_DEBUG(Service_NS, "called, font_id={}", font_id); @@ -228,7 +228,7 @@ void IPlatformServiceManager::GetLoadState(Kernel::HLERequestContext& ctx) { rb.Push<u32>(static_cast<u32>(LoadState::Done)); } -void IPlatformServiceManager::GetSize(Kernel::HLERequestContext& ctx) { +void IPlatformServiceManager::GetSize(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 font_id{rp.Pop<u32>()}; LOG_DEBUG(Service_NS, "called, font_id={}", font_id); @@ -238,7 +238,7 @@ void IPlatformServiceManager::GetSize(Kernel::HLERequestContext& ctx) { rb.Push<u32>(impl->GetSharedFontRegion(font_id).size); } -void IPlatformServiceManager::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) { +void IPlatformServiceManager::GetSharedMemoryAddressOffset(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 font_id{rp.Pop<u32>()}; LOG_DEBUG(Service_NS, "called, font_id={}", font_id); @@ -248,7 +248,7 @@ void IPlatformServiceManager::GetSharedMemoryAddressOffset(Kernel::HLERequestCon rb.Push<u32>(impl->GetSharedFontRegion(font_id).offset); } -void IPlatformServiceManager::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { +void IPlatformServiceManager::GetSharedMemoryNativeHandle(HLERequestContext& ctx) { // Map backing memory for the font data LOG_DEBUG(Service_NS, "called"); @@ -261,7 +261,7 @@ void IPlatformServiceManager::GetSharedMemoryNativeHandle(Kernel::HLERequestCont rb.PushCopyObjects(&kernel.GetFontSharedMem()); } -void IPlatformServiceManager::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { +void IPlatformServiceManager::GetSharedFontInOrderOfPriority(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code); diff --git a/src/core/hle/service/ns/iplatform_service_manager.h b/src/core/hle/service/ns/iplatform_service_manager.h index ed6eda89f..03071e02b 100644 --- a/src/core/hle/service/ns/iplatform_service_manager.h +++ b/src/core/hle/service/ns/iplatform_service_manager.h @@ -42,12 +42,12 @@ public: ~IPlatformServiceManager() override; private: - void RequestLoad(Kernel::HLERequestContext& ctx); - void GetLoadState(Kernel::HLERequestContext& ctx); - void GetSize(Kernel::HLERequestContext& ctx); - void GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx); - void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); - void GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx); + void RequestLoad(HLERequestContext& ctx); + void GetLoadState(HLERequestContext& ctx); + void GetSize(HLERequestContext& ctx); + void GetSharedMemoryAddressOffset(HLERequestContext& ctx); + void GetSharedMemoryNativeHandle(HLERequestContext& ctx); + void GetSharedFontInOrderOfPriority(HLERequestContext& ctx); struct Impl; std::unique_ptr<Impl> impl; 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 diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 9c18e935c..203388e1f 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -32,9 +32,9 @@ public: ResultVal<u64> ConvertApplicationLanguageToLanguageCode(u8 application_language); private: - void GetApplicationControlData(Kernel::HLERequestContext& ctx); - void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx); - void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx); + void GetApplicationControlData(HLERequestContext& ctx); + void GetApplicationDesiredLanguage(HLERequestContext& ctx); + void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx); }; class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { @@ -80,7 +80,7 @@ public: ~IReadOnlyApplicationControlDataInterface() override; private: - void GetApplicationControlData(Kernel::HLERequestContext& ctx); + void GetApplicationControlData(HLERequestContext& ctx); }; class NS final : public ServiceFramework<NS> { @@ -92,7 +92,7 @@ public: private: template <typename T, typename... Args> - void PushInterface(Kernel::HLERequestContext& ctx) { + void PushInterface(HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -100,7 +100,7 @@ private: rb.PushIpcInterface<T>(system); } - void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) { + void PushIApplicationManagerInterface(HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -110,15 +110,14 @@ private: template <typename T, typename... Args> std::shared_ptr<T> GetInterface(Args&&... args) const { - static_assert(std::is_base_of_v<Kernel::SessionRequestHandler, T>, + static_assert(std::is_base_of_v<SessionRequestHandler, T>, "Not a base of ServiceFrameworkBase"); return std::make_shared<T>(std::forward<Args>(args)...); } }; -/// 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 diff --git a/src/core/hle/service/ns/pdm_qry.cpp b/src/core/hle/service/ns/pdm_qry.cpp index aac8f573f..ce0ee30e0 100644 --- a/src/core/hle/service/ns/pdm_qry.cpp +++ b/src/core/hle/service/ns/pdm_qry.cpp @@ -5,7 +5,7 @@ #include "common/logging/log.h" #include "common/uuid.h" -#include "core/hle/ipc_helpers.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/ns/pdm_qry.h" #include "core/hle/service/service.h" @@ -42,7 +42,7 @@ PDM_QRY::PDM_QRY(Core::System& system_) : ServiceFramework{system_, "pdm:qry"} { PDM_QRY::~PDM_QRY() = default; -void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx) { +void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto unknown = rp.Pop<bool>(); rp.Pop<u8>(); // Padding diff --git a/src/core/hle/service/ns/pdm_qry.h b/src/core/hle/service/ns/pdm_qry.h index abcc3bef3..c98e01660 100644 --- a/src/core/hle/service/ns/pdm_qry.h +++ b/src/core/hle/service/ns/pdm_qry.h @@ -26,7 +26,7 @@ public: ~PDM_QRY() override; private: - void QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx); + void QueryPlayStatisticsByApplicationIdAndUserAccountId(HLERequestContext& ctx); }; } // namespace Service::NS |