VERY experimental Nintendo Switch 2 emulator
C++
[acc, ldn] Implement CreateClientProcessMonitor and stub LoadIdTokenCache changes (#2810)
JPikachub5d54b8df73b
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 62dab070e3..96046af916 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -708,6 +708,8 @@ add_library(core STATIChle/service/kernel_helpers.hhle/service/lbl/lbl.cpphle/service/lbl/lbl.h+ hle/service/ldn/client_process_monitor.cpp+ hle/service/ldn/client_process_monitor.hhle/service/ldn/lan_discovery.cpphle/service/ldn/lan_discovery.hhle/service/ldn/ldn.cppdiff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cppindex e8ccd483ab..76b0ba8818 100644--- a/src/core/hle/service/acc/acc.cpp+++ b/src/core/hle/service/acc/acc.cpp@@ -84,7 +84,8 @@ public:{0, D<&IManagerForSystemService::CheckAvailability>, "CheckAvailability"},{1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"},{2, nullptr, "EnsureIdTokenCacheAsync"},- {3, nullptr, "LoadIdTokenCache"},+ {3, D<&IManagerForSystemService::LoadIdTokenCacheDeprecated>, "LoadIdTokenCacheDeprecated"}, // 19.0.0++ {4, D<&IManagerForSystemService::LoadIdTokenCache>, "LoadIdTokenCache"}, // 19.0.0+{100, nullptr, "SetSystemProgramIdentification"},{101, nullptr, "RefreshNotificationTokenAsync"}, // 7.0.0+{110, nullptr, "GetServiceEntryRequirementCache"}, // 4.0.0+@@ -126,6 +127,16 @@ private:R_SUCCEED();}+ Result LoadIdTokenCacheDeprecated() {+ LOG_WARNING(Service_ACC, "(STUBBED) called");+ R_SUCCEED();+ }++ Result LoadIdTokenCache() {+ LOG_WARNING(Service_ACC, "(STUBBED) called");+ R_SUCCEED();+ }+Result GetNetworkServiceLicenseCacheEx() {LOG_DEBUG(Service_ACC, "(STUBBED) called.");@@ -647,7 +658,7 @@ public:{0, &IManagerForApplication::CheckAvailability, "CheckAvailability"},{1, &IManagerForApplication::GetAccountId, "GetAccountId"},{2, &IManagerForApplication::EnsureIdTokenCacheAsync, "EnsureIdTokenCacheAsync"},- {3, &IManagerForApplication::LoadIdTokenCacheDeprecated, "LoadIdTokenCache"},+ {3, &IManagerForApplication::LoadIdTokenCacheDeprecated, "LoadIdTokenCacheDeprecated"},{4, &IManagerForApplication::LoadIdTokenCache, "LoadIdTokenCache"},{130, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCacheForApplication"},{136, &IManagerForApplication::GetNintendoAccountUserResourceCacheForApplication, "GetNintendoAccountUserResourceCache"}, // 19.0.0+diff --git a/src/core/hle/service/cmif_serialization.h b/src/core/hle/service/cmif_serialization.hindex cdbf32c8ee..39f4905f67 100644--- a/src/core/hle/service/cmif_serialization.h+++ b/src/core/hle/service/cmif_serialization.h@@ -11,6 +11,7 @@#include "core/hle/service/cmif_types.h"#include "core/hle/service/ipc_helpers.h"#include "core/hle/service/service.h"+#include <typeinfo>namespace Service {@@ -439,7 +440,16 @@ template <bool Domain, typename T, typename... A>void CmifReplyWrapImpl(HLERequestContext& ctx, T& t, Result (T::*f)(A...)) {// Verify domain state.if constexpr (!Domain) {- ASSERT_MSG(!ctx.GetManager()->IsDomain(), "Non-domain reply used on domain session");+ const auto _mgr = ctx.GetManager();+ const bool _is_domain = _mgr ? _mgr->IsDomain() : false;+ ASSERT_MSG(!_is_domain,+ "Non-domain reply used on domain session\n"+ "Service={} (type={})\nTIPC={} CmdType={} Cmd=0x{:08X}\n"+ "HasDomainHeader={} DomainHandlers={}\nDesc={}",+ t.GetServiceName(), typeid(T).name(), ctx.IsTipc(),+ static_cast<u32>(ctx.GetCommandType()), static_cast<u32>(ctx.GetCommand()),+ ctx.HasDomainMessageHeader(), _mgr ? static_cast<u32>(_mgr->DomainHandlerCount()) : 0u,+ ctx.Description());}const bool is_domain = Domain ? ctx.GetManager()->IsDomain() : false;diff --git a/src/core/hle/service/ldn/client_process_monitor.cpp b/src/core/hle/service/ldn/client_process_monitor.cppnew file mode 100644index 0000000000..0c1963a4ca--- /dev/null+++ b/src/core/hle/service/ldn/client_process_monitor.cpp@@ -0,0 +1,27 @@+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project+// SPDX-License-Identifier: GPL-3.0-or-later++#include "core/hle/service/cmif_serialization.h"+#include "core/hle/service/ldn/ldn_results.h"+#include "core/hle/service/ldn/client_process_monitor.h"+#include "core/hle/service/ipc_helpers.h"++namespace Service::LDN {++IClientProcessMonitor::IClientProcessMonitor(Core::System& system_)+ : ServiceFramework{system_, "IClientProcessMonitor"} {+ static const FunctionInfo functions[] = {+ {0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"},+ };+ RegisterHandlers(functions);+}++IClientProcessMonitor::~IClientProcessMonitor() = default;++Result IClientProcessMonitor::RegisterClient() {+ LOG_WARNING(Service_LDN, "(STUBBED) called");++ R_SUCCEED();+}++} // namespace Service::LDNdiff --git a/src/core/hle/service/ldn/client_process_monitor.h b/src/core/hle/service/ldn/client_process_monitor.hnew file mode 100644index 0000000000..9caa337795--- /dev/null+++ b/src/core/hle/service/ldn/client_process_monitor.h@@ -0,0 +1,25 @@+// SPDX-FileCopyrightText: Copyright 2025 Eden 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 IClientProcessMonitor final+ : public ServiceFramework<IClientProcessMonitor> {+public:+ explicit IClientProcessMonitor(Core::System& system_);+ ~IClientProcessMonitor() override;++private:+ Result RegisterClient();+};++} // namespace Service::LDNdiff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cppindex 46e10e21c5..c77ae2911e 100644--- a/src/core/hle/service/ldn/ldn.cpp+++ b/src/core/hle/service/ldn/ldn.cpp@@ -1,9 +1,13 @@+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project+// SPDX-License-Identifier: GPL-3.0-or-later+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later#include "core/core.h"#include "core/hle/service/cmif_serialization.h"#include "core/hle/service/ldn/ldn.h"+#include "core/hle/service/ldn/client_process_monitor.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"@@ -40,7 +44,7 @@ public:// clang-format offstatic const FunctionInfo functions[] = {{0, C<&ISystemServiceCreator::CreateSystemLocalCommunicationService>, "CreateSystemLocalCommunicationService"},- {1, nullptr, "CreateClientProcessMonitor"} // 18.0.0++ {1, C<&ISystemServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+};// clang-format on@@ -55,6 +59,14 @@ private:*out_interface = std::make_shared<ISystemLocalCommunicationService>(system);R_SUCCEED();}++ Result CreateClientProcessMonitor(+ OutInterface<IClientProcessMonitor> out_interface) {+ LOG_DEBUG(Service_LDN, "called");++ *out_interface = std::make_shared<IClientProcessMonitor>(system);+ R_SUCCEED();+ }};class IUserServiceCreator final : public ServiceFramework<IUserServiceCreator> {@@ -62,8 +74,8 @@ public:explicit IUserServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:u"} {// clang-format offstatic const FunctionInfo functions[] = {- {0, C<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"},- {1, nullptr, "CreateClientProcessMonitor"} // 18.0.0++ {0, D<&IUserServiceCreator::CreateUserLocalCommunicationService>, "CreateUserLocalCommunicationService"},+ {1, D<&IUserServiceCreator::CreateClientProcessMonitor>, "CreateClientProcessMonitor"} // 18.0.0+};// clang-format on@@ -78,6 +90,14 @@ private:*out_interface = std::make_shared<IUserLocalCommunicationService>(system);R_SUCCEED();}++ Result CreateClientProcessMonitor(+ OutInterface<IClientProcessMonitor> out_interface) {+ LOG_DEBUG(Service_LDN, "called");++ *out_interface = std::make_shared<IClientProcessMonitor>(system);+ R_SUCCEED();+ }};class ISfServiceCreator final : public ServiceFramework<ISfServiceCreator> {diff --git a/src/core/hle/service/ldn/user_local_communication_service.cpp b/src/core/hle/service/ldn/user_local_communication_service.cppindex b8770120a7..d6a67ed75b 100644--- a/src/core/hle/service/ldn/user_local_communication_service.cpp+++ b/src/core/hle/service/ldn/user_local_communication_service.cpp@@ -27,35 +27,35 @@ IUserLocalCommunicationService::IUserLocalCommunicationService(Core::System& syslan_discovery{} {// clang-format offstatic const FunctionInfo functions[] = {- {0, C<&IUserLocalCommunicationService::GetState>, "GetState"},- {1, C<&IUserLocalCommunicationService::GetNetworkInfo>, "GetNetworkInfo"},- {2, C<&IUserLocalCommunicationService::GetIpv4Address>, "GetIpv4Address"},- {3, C<&IUserLocalCommunicationService::GetDisconnectReason>, "GetDisconnectReason"},- {4, C<&IUserLocalCommunicationService::GetSecurityParameter>, "GetSecurityParameter"},- {5, C<&IUserLocalCommunicationService::GetNetworkConfig>, "GetNetworkConfig"},- {100, C<&IUserLocalCommunicationService::AttachStateChangeEvent>, "AttachStateChangeEvent"},- {101, C<&IUserLocalCommunicationService::GetNetworkInfoLatestUpdate>, "GetNetworkInfoLatestUpdate"},- {102, C<&IUserLocalCommunicationService::Scan>, "Scan"},- {103, C<&IUserLocalCommunicationService::ScanPrivate>, "ScanPrivate"},- {104, C<&IUserLocalCommunicationService::SetWirelessControllerRestriction>, "SetWirelessControllerRestriction"},- {200, C<&IUserLocalCommunicationService::OpenAccessPoint>, "OpenAccessPoint"},- {201, C<&IUserLocalCommunicationService::CloseAccessPoint>, "CloseAccessPoint"},- {202, C<&IUserLocalCommunicationService::CreateNetwork>, "CreateNetwork"},- {203, C<&IUserLocalCommunicationService::CreateNetworkPrivate>, "CreateNetworkPrivate"},- {204, C<&IUserLocalCommunicationService::DestroyNetwork>, "DestroyNetwork"},+ {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"},+ {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, C<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"},- {207, C<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"},- {208, C<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"},+ {206, D<&IUserLocalCommunicationService::SetAdvertiseData>, "SetAdvertiseData"},+ {207, D<&IUserLocalCommunicationService::SetStationAcceptPolicy>, "SetStationAcceptPolicy"},+ {208, D<&IUserLocalCommunicationService::AddAcceptFilterEntry>, "AddAcceptFilterEntry"},{209, nullptr, "ClearAcceptFilter"},- {300, C<&IUserLocalCommunicationService::OpenStation>, "OpenStation"},- {301, C<&IUserLocalCommunicationService::CloseStation>, "CloseStation"},- {302, C<&IUserLocalCommunicationService::Connect>, "Connect"},+ {300, D<&IUserLocalCommunicationService::OpenStation>, "OpenStation"},+ {301, D<&IUserLocalCommunicationService::CloseStation>, "CloseStation"},+ {302, D<&IUserLocalCommunicationService::Connect>, "Connect"},{303, nullptr, "ConnectPrivate"},- {304, C<&IUserLocalCommunicationService::Disconnect>, "Disconnect"},- {400, C<&IUserLocalCommunicationService::Initialize>, "Initialize"},- {401, C<&IUserLocalCommunicationService::Finalize>, "Finalize"},- {402, C<&IUserLocalCommunicationService::Initialize2>, "Initialize2"},+ {304, D<&IUserLocalCommunicationService::Disconnect>, "Disconnect"},+ {400, D<&IUserLocalCommunicationService::Initialize>, "Initialize"},+ {401, D<&IUserLocalCommunicationService::Finalize>, "Finalize"},+ {402, D<&IUserLocalCommunicationService::Initialize2>, "Initialize2"},};// clang-format on