mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-17 20:32:45 +01:00
service: npns: Add ListenTo and GetReceiveEvent for QLaunch
This commit is contained in:
parent
0fb26acccc
commit
624c90a439
1 changed files with 34 additions and 8 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue