2026-08-18 18:11:33 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-02-14 22:22:41 -05:00
|
|
|
|
2024-02-17 14:08:49 -05:00
|
|
|
#include "core/hle/service/ns/develop_interface.h"
|
2019-05-23 01:39:22 -07:00
|
|
|
#include "core/hle/service/ns/ns.h"
|
2024-02-17 11:30:02 -05:00
|
|
|
#include "core/hle/service/ns/platform_service_manager.h"
|
2024-02-17 14:49:47 -05:00
|
|
|
#include "core/hle/service/ns/query_service.h"
|
2024-02-17 14:34:13 -05:00
|
|
|
#include "core/hle/service/ns/service_getter_interface.h"
|
2024-02-17 14:05:41 -05:00
|
|
|
#include "core/hle/service/ns/system_update_interface.h"
|
2026-09-09 11:13:42 +02:00
|
|
|
#include "core/hle/service/ipc_helpers.h"
|
|
|
|
|
#include "core/hle/service/cmif_serialization.h"
|
|
|
|
|
#include "core/hle/service/cmif_types.h"
|
2023-02-18 16:26:48 -05:00
|
|
|
#include "core/hle/service/server_manager.h"
|
2018-02-14 22:22:41 -05:00
|
|
|
|
2018-04-19 21:41:44 -04:00
|
|
|
namespace Service::NS {
|
2018-02-14 22:22:41 -05:00
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
class INotifyService final : public ServiceFramework<INotifyService> {
|
|
|
|
|
public:
|
|
|
|
|
explicit INotifyService(Core::System& system_) : ServiceFramework{system_, "pdm:ntfy"} {
|
|
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{ 0, nullptr, "NotifyAppletEvent" },
|
|
|
|
|
{ 2, nullptr, "NotifyOperationModeChangeEvent" },
|
|
|
|
|
{ 3, nullptr, "NotifyPowerStateChangeEvent" },
|
|
|
|
|
{ 4, nullptr, "NotifyClearAllEvent" },
|
|
|
|
|
{ 5, nullptr, "NotifyEventForDebug" },
|
|
|
|
|
{ 6, nullptr, "SuspendUserAccountEventService" },
|
|
|
|
|
{ 7, nullptr, "ResumeUserAccountEventService" },
|
|
|
|
|
{ 8, nullptr, "NotifyLibraryAppletEvent" },
|
|
|
|
|
{ 9, nullptr, "Cmd9" },
|
|
|
|
|
{ 20, nullptr, "Cmd20" },
|
|
|
|
|
{ 30, nullptr, "Cmd30" },
|
|
|
|
|
{ 100, nullptr, "Cmd100" },
|
|
|
|
|
{ 101, nullptr, "Cmd101" },
|
|
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-09-09 11:13:42 +02:00
|
|
|
class IVulnerabilityManagerInterface final
|
|
|
|
|
: public ServiceFramework<IVulnerabilityManagerInterface> {
|
|
|
|
|
public:
|
|
|
|
|
explicit IVulnerabilityManagerInterface(Core::System& system_)
|
|
|
|
|
: ServiceFramework{system_, "ns:vm"} {
|
|
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{1200, D<&IVulnerabilityManagerInterface::NeedsUpdateVulnerability>, "NeedsUpdateVulnerability"},
|
|
|
|
|
{1201, nullptr, "UpdateSafeSystemVersionForDebug"},
|
|
|
|
|
{1202, nullptr, "GetSafeSystemVersion"},
|
|
|
|
|
{3100, D<&IVulnerabilityManagerInterface::GetSafeSystemVersionCheckInfo>, "GetSafeSystemVersionCheckInfo"},
|
|
|
|
|
{3101, nullptr, "RequestUpdateSafeSystemVersionCheckInfo"},
|
|
|
|
|
{3102, D<&IVulnerabilityManagerInterface::ResetSafeSystemVersionCheckInfo>, "ResetSafeSystemVersionCheckInfo"},
|
|
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
~IVulnerabilityManagerInterface() override = default;
|
|
|
|
|
|
|
|
|
|
Result NeedsUpdateVulnerability(Out<bool> out_needs_update_vulnerability) {
|
|
|
|
|
LOG_WARNING(Service_NS, "(STUBBED)");
|
|
|
|
|
*out_needs_update_vulnerability = false;
|
|
|
|
|
R_SUCCEED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Result GetSafeSystemVersionCheckInfo(Out<std::array<u8, 0x20>> out_system_version_check_info) {
|
|
|
|
|
LOG_WARNING(Service_NS, "(STUBBED)");
|
|
|
|
|
*out_system_version_check_info = {};
|
|
|
|
|
R_SUCCEED();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Result ResetSafeSystemVersionCheckInfo() {
|
|
|
|
|
LOG_WARNING(Service_NS, "(STUBBED)");
|
|
|
|
|
R_SUCCEED();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-18 16:26:48 -05:00
|
|
|
void LoopProcess(Core::System& system) {
|
|
|
|
|
auto server_manager = std::make_unique<ServerManager>(system);
|
|
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
server_manager->RegisterNamedService("ns:am2", std::make_shared<IServiceGetterInterface>(system, "ns:am2"));
|
|
|
|
|
server_manager->RegisterNamedService("ns:ec", std::make_shared<IServiceGetterInterface>(system, "ns:ec"));
|
|
|
|
|
server_manager->RegisterNamedService("ns:rid", std::make_shared<IServiceGetterInterface>(system, "ns:rid"));
|
|
|
|
|
server_manager->RegisterNamedService("ns:rt", std::make_shared<IServiceGetterInterface>(system, "ns:rt"));
|
|
|
|
|
server_manager->RegisterNamedService("ns:web", std::make_shared<IServiceGetterInterface>(system, "ns:web"));
|
|
|
|
|
server_manager->RegisterNamedService("ns:ro", std::make_shared<IServiceGetterInterface>(system, "ns:ro"));
|
2023-02-18 16:26:48 -05:00
|
|
|
|
2024-02-17 14:08:49 -05:00
|
|
|
server_manager->RegisterNamedService("ns:dev", std::make_shared<IDevelopInterface>(system));
|
2024-02-17 14:05:41 -05:00
|
|
|
server_manager->RegisterNamedService("ns:su", std::make_shared<ISystemUpdateInterface>(system));
|
2026-08-18 18:11:33 +02:00
|
|
|
server_manager->RegisterNamedService("ns:vm", std::make_shared<IVulnerabilityManagerInterface>(system));
|
|
|
|
|
server_manager->RegisterNamedService("pdm:ntfy", std::make_shared<INotifyService>(system));
|
2024-02-17 14:49:47 -05:00
|
|
|
server_manager->RegisterNamedService("pdm:qry", std::make_shared<IQueryService>(system));
|
2023-02-18 16:26:48 -05:00
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
server_manager->RegisterNamedService("pl:s", std::make_shared<IPlatformServiceManager>(system, "pl:s"));
|
|
|
|
|
server_manager->RegisterNamedService("pl:u", std::make_shared<IPlatformServiceManager>(system, "pl:u"));
|
2023-02-18 16:26:48 -05:00
|
|
|
ServerManager::RunServer(std::move(server_manager));
|
2018-02-14 22:22:41 -05:00
|
|
|
}
|
|
|
|
|
|
2018-04-19 21:41:44 -04:00
|
|
|
} // namespace Service::NS
|