diff options
| author | 2024-02-23 12:32:58 -0600 | |
|---|---|---|
| committer | 2024-02-23 18:58:39 -0600 | |
| commit | 624c90a439c6a7cca9276aec8ccfa6d15ccb8d35 (patch) | |
| tree | 417214f7b83a013a14441f6fce2c1766ca6e57c9 /src/core/hle | |
| parent | service: set: Add default eula setting (diff) | |
| download | yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar.gz yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.tar.xz yuzu-624c90a439c6a7cca9276aec8ccfa6d15ccb8d35.zip | |
service: npns: Add ListenTo and GetReceiveEvent for QLaunch
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/npns/npns.cpp | 42 |
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 @@ | |||
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | 5 | ||
| 6 | #include "core/hle/kernel/k_event.h" | ||
| 7 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | #include "core/hle/service/kernel_helpers.h" | ||
| 6 | #include "core/hle/service/npns/npns.h" | 9 | #include "core/hle/service/npns/npns.h" |
| 7 | #include "core/hle/service/server_manager.h" | 10 | #include "core/hle/service/server_manager.h" |
| 8 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
| 9 | 12 | ||
| 10 | namespace Service::NPNS { | 13 | namespace Service::NPNS { |
| 11 | 14 | ||
| 12 | class NPNS_S final : public ServiceFramework<NPNS_S> { | 15 | class INpnsSystem final : public ServiceFramework<INpnsSystem> { |
| 13 | public: | 16 | public: |
| 14 | explicit NPNS_S(Core::System& system_) : ServiceFramework{system_, "npns:s"} { | 17 | explicit INpnsSystem(Core::System& system_) |
| 18 | : ServiceFramework{system_, "npns:s"}, service_context{system, "npns:s"} { | ||
| 15 | // clang-format off | 19 | // clang-format off |
| 16 | static const FunctionInfo functions[] = { | 20 | static const FunctionInfo functions[] = { |
| 17 | {1, nullptr, "ListenAll"}, | 21 | {1, nullptr, "ListenAll"}, |
| 18 | {2, nullptr, "ListenTo"}, | 22 | {2, C<&INpnsSystem::ListenTo>, "ListenTo"}, |
| 19 | {3, nullptr, "Receive"}, | 23 | {3, nullptr, "Receive"}, |
| 20 | {4, nullptr, "ReceiveRaw"}, | 24 | {4, nullptr, "ReceiveRaw"}, |
| 21 | {5, nullptr, "GetReceiveEvent"}, | 25 | {5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"}, |
| 22 | {6, nullptr, "ListenUndelivered"}, | 26 | {6, nullptr, "ListenUndelivered"}, |
| 23 | {7, nullptr, "GetStateChangeEVent"}, | 27 | {7, nullptr, "GetStateChangeEVent"}, |
| 24 | {11, nullptr, "SubscribeTopic"}, | 28 | {11, nullptr, "SubscribeTopic"}, |
| @@ -59,12 +63,34 @@ public: | |||
| 59 | // clang-format on | 63 | // clang-format on |
| 60 | 64 | ||
| 61 | RegisterHandlers(functions); | 65 | RegisterHandlers(functions); |
| 66 | |||
| 67 | get_receive_event = service_context.CreateEvent("npns:s:GetReceiveEvent"); | ||
| 62 | } | 68 | } |
| 69 | |||
| 70 | ~INpnsSystem() override { | ||
| 71 | service_context.CloseEvent(get_receive_event); | ||
| 72 | } | ||
| 73 | |||
| 74 | private: | ||
| 75 | Result ListenTo(u32 program_id) { | ||
| 76 | LOG_WARNING(Service_AM, "(STUBBED) called, program_id={}", program_id); | ||
| 77 | R_SUCCEED(); | ||
| 78 | } | ||
| 79 | |||
| 80 | Result GetReceiveEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 81 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 82 | |||
| 83 | *out_event = &get_receive_event->GetReadableEvent(); | ||
| 84 | R_SUCCEED(); | ||
| 85 | } | ||
| 86 | |||
| 87 | KernelHelpers::ServiceContext service_context; | ||
| 88 | Kernel::KEvent* get_receive_event; | ||
| 63 | }; | 89 | }; |
| 64 | 90 | ||
| 65 | class NPNS_U final : public ServiceFramework<NPNS_U> { | 91 | class INpnsUser final : public ServiceFramework<INpnsUser> { |
| 66 | public: | 92 | public: |
| 67 | explicit NPNS_U(Core::System& system_) : ServiceFramework{system_, "npns:u"} { | 93 | explicit INpnsUser(Core::System& system_) : ServiceFramework{system_, "npns:u"} { |
| 68 | // clang-format off | 94 | // clang-format off |
| 69 | static const FunctionInfo functions[] = { | 95 | static const FunctionInfo functions[] = { |
| 70 | {1, nullptr, "ListenAll"}, | 96 | {1, nullptr, "ListenAll"}, |
| @@ -97,8 +123,8 @@ public: | |||
| 97 | void LoopProcess(Core::System& system) { | 123 | void LoopProcess(Core::System& system) { |
| 98 | auto server_manager = std::make_unique<ServerManager>(system); | 124 | auto server_manager = std::make_unique<ServerManager>(system); |
| 99 | 125 | ||
| 100 | server_manager->RegisterNamedService("npns:s", std::make_shared<NPNS_S>(system)); | 126 | server_manager->RegisterNamedService("npns:s", std::make_shared<INpnsSystem>(system)); |
| 101 | server_manager->RegisterNamedService("npns:u", std::make_shared<NPNS_U>(system)); | 127 | server_manager->RegisterNamedService("npns:u", std::make_shared<INpnsUser>(system)); |
| 102 | ServerManager::RunServer(std::move(server_manager)); | 128 | ServerManager::RunServer(std::move(server_manager)); |
| 103 | } | 129 | } |
| 104 | 130 | ||