summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2024-02-23 19:32:58 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2024-02-24 01:58:39 +0100
commit624c90a439c6a7cca9276aec8ccfa6d15ccb8d35 (patch)
tree417214f7b83a013a14441f6fce2c1766ca6e57c9
parentservice: set: Add default eula setting (diff)
downloadyuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar
yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar.gz
yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar.bz2
yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar.lz
yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar.xz
yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar.zst
yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.zip
-rw-r--r--src/core/hle/service/npns/npns.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp
index a162e5c54..e54827efe 100644
--- a/src/core/hle/service/npns/npns.cpp
+++ b/src/core/hle/service/npns/npns.cpp
@@ -3,22 +3,26 @@
#include <memory>
+#include "core/hle/kernel/k_event.h"
+#include "core/hle/service/cmif_serialization.h"
+#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/npns/npns.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h"
namespace Service::NPNS {
-class NPNS_S final : public ServiceFramework<NPNS_S> {
+class INpnsSystem final : public ServiceFramework<INpnsSystem> {
public:
- explicit NPNS_S(Core::System& system_) : ServiceFramework{system_, "npns:s"} {
+ explicit INpnsSystem(Core::System& system_)
+ : ServiceFramework{system_, "npns:s"}, service_context{system, "npns:s"} {
// clang-format off
static const FunctionInfo functions[] = {
{1, nullptr, "ListenAll"},
- {2, nullptr, "ListenTo"},
+ {2, C<&INpnsSystem::ListenTo>, "ListenTo"},
{3, nullptr, "Receive"},
{4, nullptr, "ReceiveRaw"},
- {5, nullptr, "GetReceiveEvent"},
+ {5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"},
{6, nullptr, "ListenUndelivered"},
{7, nullptr, "GetStateChangeEVent"},
{11, nullptr, "SubscribeTopic"},
@@ -59,12 +63,34 @@ public:
// clang-format on
RegisterHandlers(functions);
+
+ get_receive_event = service_context.CreateEvent("npns:s:GetReceiveEvent");
}
+
+ ~INpnsSystem() override {
+ service_context.CloseEvent(get_receive_event);
+ }
+
+private:
+ Result ListenTo(u32 program_id) {
+ LOG_WARNING(Service_AM, "(STUBBED) called, program_id={}", program_id);
+ R_SUCCEED();
+ }
+
+ Result GetReceiveEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) {
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+
+ *out_event = &get_receive_event->GetReadableEvent();
+ R_SUCCEED();
+ }
+
+ KernelHelpers::ServiceContext service_context;
+ Kernel::KEvent* get_receive_event;
};
-class NPNS_U final : public ServiceFramework<NPNS_U> {
+class INpnsUser final : public ServiceFramework<INpnsUser> {
public:
- explicit NPNS_U(Core::System& system_) : ServiceFramework{system_, "npns:u"} {
+ explicit INpnsUser(Core::System& system_) : ServiceFramework{system_, "npns:u"} {
// clang-format off
static const FunctionInfo functions[] = {
{1, nullptr, "ListenAll"},
@@ -97,8 +123,8 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
- server_manager->RegisterNamedService("npns:s", std::make_shared<NPNS_S>(system));
- server_manager->RegisterNamedService("npns:u", std::make_shared<NPNS_U>(system));
+ server_manager->RegisterNamedService("npns:s", std::make_shared<INpnsSystem>(system));
+ server_manager->RegisterNamedService("npns:u", std::make_shared<INpnsUser>(system));
ServerManager::RunServer(std::move(server_manager));
}