// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" #include "common/settings.h" #include "core/arm/debug.h" #include "core/core.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" #include "core/file_sys/vfs/vfs.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/glue/glue_manager.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/ns/account_proxy_interface.h" #include "core/hle/service/ns/application_manager_interface.h" #include "core/hle/service/ns/application_version_interface.h" #include "core/hle/service/ns/content_management_interface.h" #include "core/hle/service/ns/develop_interface.h" #include "core/hle/service/ns/document_interface.h" #include "core/hle/service/ns/download_task_interface.h" #include "core/hle/service/ns/dynamic_rights_interface.h" #include "core/hle/service/ns/ecommerce_interface.h" #include "core/hle/service/ns/factory_reset_interface.h" #include "core/hle/service/ns/language.h" #include "core/hle/service/ns/ns.h" #include "core/hle/service/ns/ns_results.h" #include "core/hle/service/ns/pdm_qry.h" #include "core/hle/service/ns/platform_service_manager.h" #include "core/hle/service/ns/read_only_application_control_data_interface.h" #include "core/hle/service/ns/read_only_application_record_interface.h" #include "core/hle/service/ns/system_update_control.h" #include "core/hle/service/ns/system_update_interface.h" #include "core/hle/service/ns/vulnerability_manager_interface.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/set/settings_server.h" namespace Service::NS { NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { // clang-format off static const FunctionInfo functions[] = { {7988, &NS::PushInterface, "GetDynamicRightsInterface"}, {7989, &NS::PushInterface, "GetReadOnlyApplicationControlDataInterface"}, {7991, &NS::PushInterface, "GetReadOnlyApplicationRecordInterface"}, {7992, &NS::PushInterface, "GetECommerceInterface"}, {7993, &NS::PushInterface, "GetApplicationVersionInterface"}, {7994, &NS::PushInterface, "GetFactoryResetInterface"}, {7995, &NS::PushInterface, "GetAccountProxyInterface"}, {7996, &NS::PushIApplicationManagerInterface, "GetApplicationManagerInterface"}, {7997, &NS::PushInterface, "GetDownloadTaskInterface"}, {7998, &NS::PushInterface, "GetContentManagementInterface"}, {7999, &NS::PushInterface, "GetDocumentInterface"}, }; // clang-format on RegisterHandlers(functions); } NS::~NS() = default; std::shared_ptr NS::GetApplicationManagerInterface() const { return GetInterface(system); } template void NS::PushInterface(HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); rb.PushIpcInterface(system); } void NS::PushIApplicationManagerInterface(HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); rb.PushIpcInterface(system); } template std::shared_ptr NS::GetInterface(Args&&... args) const { static_assert(std::is_base_of_v, "Not a base of ServiceFrameworkBase"); return std::make_shared(std::forward(args)...); } 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