[hle] constexpr handler dispatch maps, introduce version gating (#4480)

This PR primarily focuses on upbringing constexpr maps for handlers.

Each time an HLE object of a service is construed, it registers it's own handlers, over and over.
Regardless of whetever it needs them at the moment or not.
Additionally we don't require to keep track of different function pointers amongst each object.
This can be done by overriding the given function instead, as opposed to having a separate
hash map for every given object.

In other words: Remove handlers (and handlers_tipc) map for every instance
then read from a static defined per-class.

- [x] Migrate all HLE functions to new `frozen::map` constexpr time finder
- [ ] Measure if this approach actually makes better codegen

Optional:
- [x] Properly gate all functions (that have versions commented next to them)
- [x] Maybe store `HandlerFnP<>` and `const char*` separately, version gating can go in a different map as well

Information such as name can be used on debug builds, but doesn't particularly help on release as one can consult an external reference (or have an annotated IPC map)

Signed-off-by: lizzie <lizzie@eden-emu.dev>

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

Co-authored-by: Maufeat <sahyno1996@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4480
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
lizzie
2026-10-13 04:38:36 +02:00
committed by PavelBARABANOV
parent 989768aa46
commit 1059202c75
392 changed files with 12453 additions and 14117 deletions
+79 -59
View File
@@ -9,7 +9,6 @@
#include "core/hle/service/ldn/ldn.h"
#include "core/hle/service/ldn/monitor_service.h"
#include "core/hle/service/ldn/sf_monitor_service.h"
#include "core/hle/service/ldn/sf_service.h"
#include "core/hle/service/ldn/sf_service_monitor.h"
#include "core/hle/service/ldn/system_local_communication_service.h"
#include "core/hle/service/ldn/user_local_communication_service.h"
@@ -19,14 +18,10 @@ namespace Service::LDN {
class IClientProcessMonitor final
: public ServiceFramework<IClientProcessMonitor> {
public:
explicit IClientProcessMonitor(Core::System& system_)
: ServiceFramework{system_, "IClientProcessMonitor"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"},
};
// clang-format on
RegisterHandlers(functions);
explicit IClientProcessMonitor(Core::System& system_) : ServiceFramework{system_, "IClientProcessMonitor"} {}
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
~IClientProcessMonitor() override = default;
private:
@@ -34,19 +29,19 @@ private:
LOG_WARNING(Service_LDN, "(STUBBED) called");
R_SUCCEED();
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"}
);
};
class IMonitorServiceCreator final : public ServiceFramework<IMonitorServiceCreator> {
public:
explicit IMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:m"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, C<&IMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"}
};
// clang-format on
RegisterHandlers(functions);
}
explicit IMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:m"} {}
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
Result CreateMonitorService(OutInterface<IMonitorService> out_interface) {
LOG_DEBUG(Service_LDN, "called");
@@ -54,21 +49,19 @@ private:
*out_interface = std::make_shared<IMonitorService>(system);
R_SUCCEED();
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&IMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"}
);
};
class ISystemServiceCreator final : public ServiceFramework<ISystemServiceCreator> {
public:
explicit ISystemServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:s"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, C<&ISystemServiceCreator::CreateSystemLocalCommunicationService>, "CreateSystemLocalCommunicationService"},
{1, C<&ISystemServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+
};
// clang-format on
explicit ISystemServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:s"} {}
RegisterHandlers(functions);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
Result CreateSystemLocalCommunicationService(
OutInterface<ISystemLocalCommunicationService> out_interface) {
@@ -85,21 +78,20 @@ private:
*out_interface = std::make_shared<IClientProcessMonitor>(system);
R_SUCCEED();
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&ISystemServiceCreator::CreateSystemLocalCommunicationService>, "CreateSystemLocalCommunicationService"},
FunctionInfo{1, C<&ISystemServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor", MakeVersionGate({18,0,0})}
);
};
class IUserServiceCreator final : public ServiceFramework<IUserServiceCreator> {
public:
explicit IUserServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:u"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"},
{1, D<&IUserServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+
};
// clang-format on
explicit IUserServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:u"} {}
RegisterHandlers(functions);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
Result CreateUserLocalCommunicationService(
OutInterface<IUserLocalCommunicationService> out_interface) {
@@ -116,22 +108,50 @@ private:
*out_interface = std::make_shared<IClientProcessMonitor>(system);
R_SUCCEED();
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"},
FunctionInfo{1, D<&IUserServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor", MakeVersionGate({18,0,0})}
);
};
class ISfService final : public ServiceFramework<ISfService> {
public:
explicit ISfService(Core::System& system_) : ServiceFramework{system_, "ISfService"} {}
~ISfService() override = default;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"},
FunctionInfo{264, nullptr, "GetNetworkInterfaceLastError"},
FunctionInfo{272, nullptr, "GetRole"},
FunctionInfo{280, nullptr, "GetAdvertiseData"},
FunctionInfo{288, nullptr, "GetGroupInfo"},
FunctionInfo{296, nullptr, "GetGroupInfo2"},
FunctionInfo{304, nullptr, "GetGroupOwner"},
FunctionInfo{312, nullptr, "GetIpConfig"},
FunctionInfo{320, nullptr, "GetLinkLevel"},
FunctionInfo{512, nullptr, "Scan"},
FunctionInfo{768, nullptr, "CreateGroup"},
FunctionInfo{776, nullptr, "DestroyGroup"},
FunctionInfo{784, nullptr, "SetAdvertiseData"},
FunctionInfo{1536, nullptr, "SendToOtherGroup"},
FunctionInfo{1544, nullptr, "RecvFromOtherGroup"},
FunctionInfo{1552, nullptr, "AddAcceptableGroupId"},
FunctionInfo{1560, nullptr, "ClearAcceptableGroupId"}
);
};
class ISfServiceCreator final : public ServiceFramework<ISfServiceCreator> {
public:
explicit ISfServiceCreator(Core::System& system_, bool is_system_, const char* name_)
: ServiceFramework{system_, name_}, is_system{is_system_} {
// clang-format off
static const FunctionInfo functions[] = {
{0, C<&ISfServiceCreator::CreateNetworkService>, "CreateNetworkService"},
{8, C<&ISfServiceCreator::CreateNetworkServiceMonitor>, "CreateNetworkServiceMonitor"},
};
// clang-format on
explicit ISfServiceCreator(Core::System& system_, bool is_system_, const char* name_) : ServiceFramework{system_, name_}, is_system{is_system_} {}
RegisterHandlers(functions);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
Result CreateNetworkService(OutInterface<ISfService> out_interface, u32 input,
u64 reserved_input) {
@@ -150,21 +170,20 @@ private:
R_SUCCEED();
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&ISfServiceCreator::CreateNetworkService>, "CreateNetworkService"},
FunctionInfo{8, C<&ISfServiceCreator::CreateNetworkServiceMonitor>, "CreateNetworkServiceMonitor"}
);
bool is_system{};
};
class ISfMonitorServiceCreator final : public ServiceFramework<ISfMonitorServiceCreator> {
public:
explicit ISfMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "lp2p:m"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, C<&ISfMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"},
};
// clang-format on
explicit ISfMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "lp2p:m"} {}
RegisterHandlers(functions);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
Result CreateMonitorService(OutInterface<ISfMonitorService> out_interface, u64 reserved_input) {
LOG_INFO(Service_LDN, "called, reserved_input={}", reserved_input);
@@ -172,6 +191,10 @@ private:
*out_interface = std::make_shared<ISfMonitorService>(system);
R_SUCCEED();
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&ISfMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"}
);
};
void LoopProcess(Core::System& system) {
@@ -181,12 +204,9 @@ void LoopProcess(Core::System& system) {
server_manager->RegisterNamedService("ldn:s", std::make_shared<ISystemServiceCreator>(system));
server_manager->RegisterNamedService("ldn:u", std::make_shared<IUserServiceCreator>(system));
server_manager->RegisterNamedService(
"lp2p:app", std::make_shared<ISfServiceCreator>(system, false, "lp2p:app"));
server_manager->RegisterNamedService(
"lp2p:sys", std::make_shared<ISfServiceCreator>(system, true, "lp2p:sys"));
server_manager->RegisterNamedService("lp2p:m",
std::make_shared<ISfMonitorServiceCreator>(system));
server_manager->RegisterNamedService("lp2p:app", std::make_shared<ISfServiceCreator>(system, false, "lp2p:app"));
server_manager->RegisterNamedService("lp2p:sys", std::make_shared<ISfServiceCreator>(system, true, "lp2p:sys"));
server_manager->RegisterNamedService("lp2p:m", std::make_shared<ISfMonitorServiceCreator>(system));
ServerManager::RunServer(std::move(server_manager));
}
+14 -14
View File
@@ -10,22 +10,22 @@
namespace Service::LDN {
std::optional<ServiceFrameworkBase::FunctionInfoBase> IMonitorService::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&IMonitorService::GetStateForMonitor>, "GetStateForMonitor"},
FunctionInfo{1, nullptr, "GetNetworkInfoForMonitor"},
FunctionInfo{2, nullptr, "GetIpv4AddressForMonitor"},
FunctionInfo{3, nullptr, "GetDisconnectReasonForMonitor"},
FunctionInfo{4, nullptr, "GetSecurityParameterForMonitor"},
FunctionInfo{5, nullptr, "GetNetworkConfigForMonitor"},
FunctionInfo{100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"},
FunctionInfo{101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"}
);
return HandlerTableGenerateWithFind(key, functions);
}
IMonitorService::IMonitorService(Core::System& system_)
: ServiceFramework{system_, "IMonitorService"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, C<&IMonitorService::GetStateForMonitor>, "GetStateForMonitor"},
{1, nullptr, "GetNetworkInfoForMonitor"},
{2, nullptr, "GetIpv4AddressForMonitor"},
{3, nullptr, "GetDisconnectReasonForMonitor"},
{4, nullptr, "GetSecurityParameterForMonitor"},
{5, nullptr, "GetNetworkConfigForMonitor"},
{100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"},
{101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"},
};
// clang-format on
RegisterHandlers(functions);
}
IMonitorService::~IMonitorService() = default;
@@ -26,6 +26,7 @@ private:
Result InitializeMonitor();
Result FinalizeMonitor();
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
State state{State::None};
};
@@ -10,17 +10,17 @@
namespace Service::LDN {
std::optional<ServiceFrameworkBase::FunctionInfoBase> ISfMonitorService::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&ISfMonitorService::Initialize>, "Initialize"},
FunctionInfo{288, C<&ISfMonitorService::GetGroupInfo>, "GetGroupInfo"},
FunctionInfo{320, nullptr, "GetLinkLevel"}
);
return HandlerTableGenerateWithFind(key, functions);
}
ISfMonitorService::ISfMonitorService(Core::System& system_)
: ServiceFramework{system_, "ISfMonitorService"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, C<&ISfMonitorService::Initialize>, "Initialize"},
{288, C<&ISfMonitorService::GetGroupInfo>, "GetGroupInfo"},
{320, nullptr, "GetLinkLevel"},
};
// clang-format on
RegisterHandlers(functions);
}
ISfMonitorService::~ISfMonitorService() = default;
@@ -24,6 +24,7 @@ public:
private:
Result Initialize(Out<u32> out_value);
Result GetGroupInfo(OutLargeData<GroupInfo, BufferAttr_HipcAutoSelect> out_group_info);
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
};
} // namespace Service::LDN
-40
View File
@@ -1,40 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "core/hle/service/ldn/sf_service.h"
namespace Service::LDN {
ISfService::ISfService(Core::System& system_) : ServiceFramework{system_, "ISfService"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "Initialize"},
{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"},
{264, nullptr, "GetNetworkInterfaceLastError"},
{272, nullptr, "GetRole"},
{280, nullptr, "GetAdvertiseData"},
{288, nullptr, "GetGroupInfo"},
{296, nullptr, "GetGroupInfo2"},
{304, nullptr, "GetGroupOwner"},
{312, nullptr, "GetIpConfig"},
{320, nullptr, "GetLinkLevel"},
{512, nullptr, "Scan"},
{768, nullptr, "CreateGroup"},
{776, nullptr, "DestroyGroup"},
{784, nullptr, "SetAdvertiseData"},
{1536, nullptr, "SendToOtherGroup"},
{1544, nullptr, "RecvFromOtherGroup"},
{1552, nullptr, "AddAcceptableGroupId"},
{1560, nullptr, "ClearAcceptableGroupId"},
};
// clang-format on
RegisterHandlers(functions);
}
ISfService::~ISfService() = default;
} // namespace Service::LDN
-24
View File
@@ -1,24 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::LDN {
class ISfService final : public ServiceFramework<ISfService> {
public:
explicit ISfService(Core::System& system_);
~ISfService() override;
};
} // namespace Service::LDN
+19 -19
View File
@@ -10,27 +10,27 @@
namespace Service::LDN {
std::optional<ServiceFrameworkBase::FunctionInfoBase> ISfServiceMonitor::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&ISfServiceMonitor::Initialize>, "Initialize"},
FunctionInfo{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"},
FunctionInfo{264, nullptr, "GetNetworkInterfaceLastError"},
FunctionInfo{272, nullptr, "GetRole"},
FunctionInfo{280, nullptr, "GetAdvertiseData"},
FunctionInfo{281, nullptr, "GetAdvertiseData2"},
FunctionInfo{288, C<&ISfServiceMonitor::GetGroupInfo>, "GetGroupInfo"},
FunctionInfo{296, nullptr, "GetGroupInfo2"},
FunctionInfo{304, nullptr, "GetGroupOwner"},
FunctionInfo{312, nullptr, "GetIpConfig"},
FunctionInfo{320, nullptr, "GetLinkLevel"},
FunctionInfo{328, nullptr, "AttachJoinEvent"},
FunctionInfo{336, nullptr, "GetMembers"}
);
return HandlerTableGenerateWithFind(key, functions);
}
ISfServiceMonitor::ISfServiceMonitor(Core::System& system_)
: ServiceFramework{system_, "ISfServiceMonitor"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, C<&ISfServiceMonitor::Initialize>, "Initialize"},
{256, nullptr, "AttachNetworkInterfaceStateChangeEvent"},
{264, nullptr, "GetNetworkInterfaceLastError"},
{272, nullptr, "GetRole"},
{280, nullptr, "GetAdvertiseData"},
{281, nullptr, "GetAdvertiseData2"},
{288, C<&ISfServiceMonitor::GetGroupInfo>, "GetGroupInfo"},
{296, nullptr, "GetGroupInfo2"},
{304, nullptr, "GetGroupOwner"},
{312, nullptr, "GetIpConfig"},
{320, nullptr, "GetLinkLevel"},
{328, nullptr, "AttachJoinEvent"},
{336, nullptr, "GetMembers"},
};
// clang-format on
RegisterHandlers(functions);
}
ISfServiceMonitor::~ISfServiceMonitor() = default;
@@ -23,8 +23,8 @@ public:
private:
Result Initialize(Out<u32> out_value);
Result GetGroupInfo(OutLargeData<GroupInfo, BufferAttr_HipcAutoSelect> out_group_info,
GroupInfo in_group_info);
Result GetGroupInfo(OutLargeData<GroupInfo, BufferAttr_HipcAutoSelect> out_group_info, GroupInfo in_group_info);
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
};
} // namespace Service::LDN
@@ -9,44 +9,44 @@
namespace Service::LDN {
std::optional<ServiceFrameworkBase::FunctionInfoBase> ISystemLocalCommunicationService::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "GetState"},
FunctionInfo{1, nullptr, "GetNetworkInfo"},
FunctionInfo{2, nullptr, "GetIpv4Address"},
FunctionInfo{3, nullptr, "GetDisconnectReason"},
FunctionInfo{4, nullptr, "GetSecurityParameter"},
FunctionInfo{5, nullptr, "GetNetworkConfig"},
FunctionInfo{100, nullptr, "AttachStateChangeEvent"},
FunctionInfo{101, nullptr, "GetNetworkInfoLatestUpdate"},
FunctionInfo{102, nullptr, "Scan"},
FunctionInfo{103, nullptr, "ScanPrivate"},
FunctionInfo{104, nullptr, "SetWirelessControllerRestriction"},
FunctionInfo{200, nullptr, "OpenAccessPoint"},
FunctionInfo{201, nullptr, "CloseAccessPoint"},
FunctionInfo{202, nullptr, "CreateNetwork"},
FunctionInfo{203, nullptr, "CreateNetworkPrivate"},
FunctionInfo{204, nullptr, "DestroyNetwork"},
FunctionInfo{205, nullptr, "Reject"},
FunctionInfo{206, nullptr, "SetAdvertiseData"},
FunctionInfo{207, nullptr, "SetStationAcceptPolicy"},
FunctionInfo{208, nullptr, "AddAcceptFilterEntry"},
FunctionInfo{209, nullptr, "ClearAcceptFilter"},
FunctionInfo{300, nullptr, "OpenStation"},
FunctionInfo{301, nullptr, "CloseStation"},
FunctionInfo{302, nullptr, "Connect"},
FunctionInfo{303, nullptr, "ConnectPrivate"},
FunctionInfo{304, nullptr, "Disconnect"},
FunctionInfo{400, nullptr, "InitializeSystem"},
FunctionInfo{401, nullptr, "FinalizeSystem"},
FunctionInfo{402, nullptr, "SetOperationMode"},
FunctionInfo{403, C<&ISystemLocalCommunicationService::InitializeSystem2>, "InitializeSystem2"}
);
return HandlerTableGenerateWithFind(key, functions);
}
ISystemLocalCommunicationService::ISystemLocalCommunicationService(Core::System& system_)
: ServiceFramework{system_, "ISystemLocalCommunicationService"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetState"},
{1, nullptr, "GetNetworkInfo"},
{2, nullptr, "GetIpv4Address"},
{3, nullptr, "GetDisconnectReason"},
{4, nullptr, "GetSecurityParameter"},
{5, nullptr, "GetNetworkConfig"},
{100, nullptr, "AttachStateChangeEvent"},
{101, nullptr, "GetNetworkInfoLatestUpdate"},
{102, nullptr, "Scan"},
{103, nullptr, "ScanPrivate"},
{104, nullptr, "SetWirelessControllerRestriction"},
{200, nullptr, "OpenAccessPoint"},
{201, nullptr, "CloseAccessPoint"},
{202, nullptr, "CreateNetwork"},
{203, nullptr, "CreateNetworkPrivate"},
{204, nullptr, "DestroyNetwork"},
{205, nullptr, "Reject"},
{206, nullptr, "SetAdvertiseData"},
{207, nullptr, "SetStationAcceptPolicy"},
{208, nullptr, "AddAcceptFilterEntry"},
{209, nullptr, "ClearAcceptFilter"},
{300, nullptr, "OpenStation"},
{301, nullptr, "CloseStation"},
{302, nullptr, "Connect"},
{303, nullptr, "ConnectPrivate"},
{304, nullptr, "Disconnect"},
{400, nullptr, "InitializeSystem"},
{401, nullptr, "FinalizeSystem"},
{402, nullptr, "SetOperationMode"},
{403, C<&ISystemLocalCommunicationService::InitializeSystem2>, "InitializeSystem2"},
};
// clang-format on
RegisterHandlers(functions);
}
ISystemLocalCommunicationService::~ISystemLocalCommunicationService() = default;
@@ -23,6 +23,7 @@ public:
private:
Result InitializeSystem2();
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
};
} // namespace Service::LDN
@@ -22,46 +22,46 @@
namespace Service::LDN {
std::optional<ServiceFrameworkBase::FunctionInfoBase> IUserLocalCommunicationService::FindRequest(u32 key) {
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IUserLocalCommunicationService::GetState>, "GetState"},
FunctionInfo{1, D<&IUserLocalCommunicationService::GetNetworkInfo>, "GetNetworkInfo"},
FunctionInfo{2, D<&IUserLocalCommunicationService::GetIpv4Address>, "GetIpv4Address"},
FunctionInfo{3, D<&IUserLocalCommunicationService::GetDisconnectReason>, "GetDisconnectReason"},
FunctionInfo{4, D<&IUserLocalCommunicationService::GetSecurityParameter>, "GetSecurityParameter"},
FunctionInfo{5, D<&IUserLocalCommunicationService::GetNetworkConfig>, "GetNetworkConfig"},
FunctionInfo{100, D<&IUserLocalCommunicationService::AttachStateChangeEvent>, "AttachStateChangeEvent"},
FunctionInfo{101, D<&IUserLocalCommunicationService::GetNetworkInfoLatestUpdate>, "GetNetworkInfoLatestUpdate"},
FunctionInfo{102, D<&IUserLocalCommunicationService::Scan>, "Scan"},
FunctionInfo{103, D<&IUserLocalCommunicationService::ScanPrivate>, "ScanPrivate"},
FunctionInfo{104, D<&IUserLocalCommunicationService::SetWirelessControllerRestriction>, "SetWirelessControllerRestriction"},
FunctionInfo{106, D<&IUserLocalCommunicationService::SetProtocol>, "SetProtocol" },
FunctionInfo{200, D<&IUserLocalCommunicationService::OpenAccessPoint>, "OpenAccessPoint"},
FunctionInfo{201, D<&IUserLocalCommunicationService::CloseAccessPoint>, "CloseAccessPoint"},
FunctionInfo{202, D<&IUserLocalCommunicationService::CreateNetwork>, "CreateNetwork"},
FunctionInfo{203, D<&IUserLocalCommunicationService::CreateNetworkPrivate>, "CreateNetworkPrivate"},
FunctionInfo{204, D<&IUserLocalCommunicationService::DestroyNetwork>, "DestroyNetwork"},
FunctionInfo{205, nullptr, "Reject"},
FunctionInfo{206, D<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"},
FunctionInfo{207, D<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"},
FunctionInfo{208, D<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"},
FunctionInfo{209, nullptr, "ClearAcceptFilter"},
FunctionInfo{300, D<&IUserLocalCommunicationService::OpenStation>, "OpenStation"},
FunctionInfo{301, D<&IUserLocalCommunicationService::CloseStation>, "CloseStation"},
FunctionInfo{302, D<&IUserLocalCommunicationService::Connect>, "Connect"},
FunctionInfo{303, nullptr, "ConnectPrivate"},
FunctionInfo{304, D<&IUserLocalCommunicationService::Disconnect>, "Disconnect"},
FunctionInfo{400, D<&IUserLocalCommunicationService::Initialize>, "Initialize"},
FunctionInfo{401, D<&IUserLocalCommunicationService::Finalize>, "Finalize"},
FunctionInfo{402, D<&IUserLocalCommunicationService::Initialize2>, "Initialize2"}
);
return HandlerTableGenerateWithFind(key, functions);
}
IUserLocalCommunicationService::IUserLocalCommunicationService(Core::System& system_)
: ServiceFramework{system_, "IUserLocalCommunicationService"},
service_context{system, "IUserLocalCommunicationService"},
lan_discovery{} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IUserLocalCommunicationService::GetState>, "GetState"},
{1, D<&IUserLocalCommunicationService::GetNetworkInfo>, "GetNetworkInfo"},
{2, D<&IUserLocalCommunicationService::GetIpv4Address>, "GetIpv4Address"},
{3, D<&IUserLocalCommunicationService::GetDisconnectReason>, "GetDisconnectReason"},
{4, D<&IUserLocalCommunicationService::GetSecurityParameter>, "GetSecurityParameter"},
{5, D<&IUserLocalCommunicationService::GetNetworkConfig>, "GetNetworkConfig"},
{100, D<&IUserLocalCommunicationService::AttachStateChangeEvent>, "AttachStateChangeEvent"},
{101, D<&IUserLocalCommunicationService::GetNetworkInfoLatestUpdate>, "GetNetworkInfoLatestUpdate"},
{102, D<&IUserLocalCommunicationService::Scan>, "Scan"},
{103, D<&IUserLocalCommunicationService::ScanPrivate>, "ScanPrivate"},
{104, D<&IUserLocalCommunicationService::SetWirelessControllerRestriction>, "SetWirelessControllerRestriction"},
{ 106, D<&IUserLocalCommunicationService::SetProtocol>, "SetProtocol" },
{200, D<&IUserLocalCommunicationService::OpenAccessPoint>, "OpenAccessPoint"},
{201, D<&IUserLocalCommunicationService::CloseAccessPoint>, "CloseAccessPoint"},
{202, D<&IUserLocalCommunicationService::CreateNetwork>, "CreateNetwork"},
{203, D<&IUserLocalCommunicationService::CreateNetworkPrivate>, "CreateNetworkPrivate"},
{204, D<&IUserLocalCommunicationService::DestroyNetwork>, "DestroyNetwork"},
{205, nullptr, "Reject"},
{206, D<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"},
{207, D<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"},
{208, D<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"},
{209, nullptr, "ClearAcceptFilter"},
{300, D<&IUserLocalCommunicationService::OpenStation>, "OpenStation"},
{301, D<&IUserLocalCommunicationService::CloseStation>, "CloseStation"},
{302, D<&IUserLocalCommunicationService::Connect>, "Connect"},
{303, nullptr, "ConnectPrivate"},
{304, D<&IUserLocalCommunicationService::Disconnect>, "Disconnect"},
{400, D<&IUserLocalCommunicationService::Initialize>, "Initialize"},
{401, D<&IUserLocalCommunicationService::Finalize>, "Finalize"},
{402, D<&IUserLocalCommunicationService::Initialize2>, "Initialize2"},
};
// clang-format on
RegisterHandlers(functions);
state_change_event =
service_context.CreateEvent("IUserLocalCommunicationService:StateChangeEvent");
@@ -89,6 +89,7 @@ private:
/// Callback to parse and handle a received LDN packet.
void OnLDNPacketReceived(const Network::LDNPacket& packet);
void OnEventFired();
std::optional<FunctionInfoBase> FindRequest(u32 key) override;
KernelHelpers::ServiceContext service_context;
Kernel::KEvent* state_change_event;