VERY experimental Nintendo Switch 2 emulator
C++
service: Add the basic skeleton for the NPNS services
Lioncashda95baa5de02
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 040b180881..9b1cfae425 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -282,6 +282,8 @@ add_library(core STATIChle/service/nifm/nifm.hhle/service/nim/nim.cpphle/service/nim/nim.h+ hle/service/npns/npns.cpp+ hle/service/npns/npns.hhle/service/ns/ns.cpphle/service/ns/ns.hhle/service/ns/pl_u.cppdiff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cppnew file mode 100644index 0000000000..ccb6f9da94--- /dev/null+++ b/src/core/hle/service/npns/npns.cpp@@ -0,0 +1,88 @@+// Copyright 2018 yuzu emulator team+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include <memory>++#include "core/hle/service/npns/npns.h"+#include "core/hle/service/service.h"+#include "core/hle/service/sm/sm.h"++namespace Service::NPNS {++class NPNS_S final : public ServiceFramework<NPNS_S> {+public:+ explicit NPNS_S() : ServiceFramework{"npns:s"} {+ // clang-format off+ static const FunctionInfo functions[] = {+ {1, nullptr, "ListenAll"},+ {2, nullptr, "ListenTo"},+ {3, nullptr, "Receive"},+ {4, nullptr, "ReceiveRaw"},+ {5, nullptr, "GetReceiveEvent"},+ {6, nullptr, "ListenUndelivered"},+ {7, nullptr, "GetStateChangeEVent"},+ {11, nullptr, "SubscribeTopic"},+ {12, nullptr, "UnsubscribeTopic"},+ {13, nullptr, "QueryIsTopicExist"},+ {21, nullptr, "CreateToken"},+ {22, nullptr, "CreateTokenWithApplicationId"},+ {23, nullptr, "DestroyToken"},+ {24, nullptr, "DestroyTokenWithApplicationId"},+ {25, nullptr, "QueryIsTokenValid"},+ {31, nullptr, "UploadTokenToBaaS"},+ {32, nullptr, "DestroyTokenForBaaS"},+ {33, nullptr, "CreateTokenForBaaS"},+ {34, nullptr, "SetBaaSDeviceAccountIdList"},+ {101, nullptr, "Suspend"},+ {102, nullptr, "Resume"},+ {103, nullptr, "GetState"},+ {104, nullptr, "GetStatistics"},+ {105, nullptr, "GetPlayReportRequestEvent"},+ {111, nullptr, "GetJid"},+ {112, nullptr, "CreateJid"},+ {113, nullptr, "DestroyJid"},+ {114, nullptr, "AttachJid"},+ {115, nullptr, "DetachJid"},+ {201, nullptr, "RequestChangeStateForceTimed"},+ {102, nullptr, "RequestChangeStateForceAsync"},+ };+ // clang-format on++ RegisterHandlers(functions);+ }+};++class NPNS_U final : public ServiceFramework<NPNS_U> {+public:+ explicit NPNS_U() : ServiceFramework{"npns:u"} {+ // clang-format off+ static const FunctionInfo functions[] = {+ {1, nullptr, "ListenAll"},+ {2, nullptr, "ListenTo"},+ {3, nullptr, "Receive"},+ {4, nullptr, "ReceiveRaw"},+ {5, nullptr, "GetReceiveEvent"},+ {7, nullptr, "GetStateChangeEVent"},+ {21, nullptr, "CreateToken"},+ {23, nullptr, "DestroyToken"},+ {25, nullptr, "QueryIsTokenValid"},+ {26, nullptr, "ListenToMyApplicationId"},+ {101, nullptr, "Suspend"},+ {102, nullptr, "Resume"},+ {103, nullptr, "GetState"},+ {104, nullptr, "GetStatistics"},+ {111, nullptr, "GetJid"},+ };+ // clang-format on++ RegisterHandlers(functions);+ }+};++void InstallInterfaces(SM::ServiceManager& sm) {+ std::make_shared<NPNS_S>()->InstallAsService(sm);+ std::make_shared<NPNS_U>()->InstallAsService(sm);+}++} // namespace Service::NPNSdiff --git a/src/core/hle/service/npns/npns.h b/src/core/hle/service/npns/npns.hnew file mode 100644index 0000000000..861cd3e485--- /dev/null+++ b/src/core/hle/service/npns/npns.h@@ -0,0 +1,15 @@+// Copyright 2018 yuzu emulator team+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++namespace Service::SM {+class ServiceManager;+}++namespace Service::NPNS {++void InstallInterfaces(SM::ServiceManager& sm);++} // namespace Service::NPNSdiff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex a225cb4cbd..dd6c6d3b32 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -22,7 +22,7 @@#include "core/hle/service/apm/apm.h"#include "core/hle/service/arp/arp.h"#include "core/hle/service/audio/audio.h"-#include "core/hle/service/bcat/bcat.h"+#include "core/hle/service/bcat/module.h"#include "core/hle/service/bpc/bpc.h"#include "core/hle/service/btdrv/btdrv.h"#include "core/hle/service/btm/btm.h"@@ -48,11 +48,12 @@#include "core/hle/service/nfp/nfp.h"#include "core/hle/service/nifm/nifm.h"#include "core/hle/service/nim/nim.h"+#include "core/hle/service/npns/npns.h"#include "core/hle/service/ns/ns.h"#include "core/hle/service/nvdrv/nvdrv.h"#include "core/hle/service/nvflinger/nvflinger.h"#include "core/hle/service/pcie/pcie.h"-#include "core/hle/service/pctl/pctl.h"+#include "core/hle/service/pctl/module.h"#include "core/hle/service/pcv/pcv.h"#include "core/hle/service/pm/pm.h"#include "core/hle/service/prepo/prepo.h"@@ -236,6 +237,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, FileSys::VfsFilesystem& vfs)NFP::InstallInterfaces(*sm);NIFM::InstallInterfaces(*sm);NIM::InstallInterfaces(*sm);+ NPNS::InstallInterfaces(*sm);NS::InstallInterfaces(*sm);Nvidia::InstallInterfaces(*sm, *nv_flinger);PCIe::InstallInterfaces(*sm);