2022-04-23 08:59:50 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-07-26 06:17:15 +00:00
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
#include <chrono>
|
|
|
|
#include <ctime>
|
2018-09-25 21:14:19 +00:00
|
|
|
#include "core/core.h"
|
2021-01-31 09:38:57 +00:00
|
|
|
#include "core/hle/kernel/k_event.h"
|
2023-02-19 19:42:12 +00:00
|
|
|
#include "core/hle/service/ipc_helpers.h"
|
2021-09-29 03:42:50 +00:00
|
|
|
#include "core/hle/service/kernel_helpers.h"
|
2018-07-26 06:17:15 +00:00
|
|
|
#include "core/hle/service/nim/nim.h"
|
2023-02-18 21:26:48 +00:00
|
|
|
#include "core/hle/service/server_manager.h"
|
2018-07-26 06:17:15 +00:00
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
|
|
|
namespace Service::NIM {
|
|
|
|
|
2020-04-30 13:10:20 +00:00
|
|
|
class IShopServiceAsync final : public ServiceFramework<IShopServiceAsync> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IShopServiceAsync(Core::System& system_)
|
|
|
|
: ServiceFramework{system_, "IShopServiceAsync"} {
|
2020-04-30 13:10:20 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "Cancel"},
|
|
|
|
{1, nullptr, "GetSize"},
|
|
|
|
{2, nullptr, "Read"},
|
|
|
|
{3, nullptr, "GetErrorCode"},
|
|
|
|
{4, nullptr, "Request"},
|
|
|
|
{5, nullptr, "Prepare"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IShopServiceAccessor final : public ServiceFramework<IShopServiceAccessor> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IShopServiceAccessor(Core::System& system_)
|
|
|
|
: ServiceFramework{system_, "IShopServiceAccessor"} {
|
2020-04-30 13:10:20 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2023-02-19 19:42:12 +00:00
|
|
|
void CreateAsyncInterface(HLERequestContext& ctx) {
|
2020-04-30 13:10:20 +00:00
|
|
|
LOG_WARNING(Service_NIM, "(STUBBED) called");
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2020-11-26 20:19:08 +00:00
|
|
|
rb.PushIpcInterface<IShopServiceAsync>(system);
|
2020-04-30 13:10:20 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IShopServiceAccessServer final : public ServiceFramework<IShopServiceAccessServer> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IShopServiceAccessServer(Core::System& system_)
|
|
|
|
: ServiceFramework{system_, "IShopServiceAccessServer"} {
|
2020-04-30 13:10:20 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2023-02-19 19:42:12 +00:00
|
|
|
void CreateAccessorInterface(HLERequestContext& ctx) {
|
2020-04-30 13:10:20 +00:00
|
|
|
LOG_WARNING(Service_NIM, "(STUBBED) called");
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2020-11-26 20:19:08 +00:00
|
|
|
rb.PushIpcInterface<IShopServiceAccessor>(system);
|
2020-04-30 13:10:20 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-07-26 06:17:15 +00:00
|
|
|
class NIM final : public ServiceFramework<NIM> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit NIM(Core::System& system_) : ServiceFramework{system_, "nim"} {
|
2018-07-26 06:17:15 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "CreateSystemUpdateTask"},
|
|
|
|
{1, nullptr, "DestroySystemUpdateTask"},
|
|
|
|
{2, nullptr, "ListSystemUpdateTask"},
|
|
|
|
{3, nullptr, "RequestSystemUpdateTaskRun"},
|
|
|
|
{4, nullptr, "GetSystemUpdateTaskInfo"},
|
|
|
|
{5, nullptr, "CommitSystemUpdateTask"},
|
|
|
|
{6, nullptr, "CreateNetworkInstallTask"},
|
|
|
|
{7, nullptr, "DestroyNetworkInstallTask"},
|
|
|
|
{8, nullptr, "ListNetworkInstallTask"},
|
|
|
|
{9, nullptr, "RequestNetworkInstallTaskRun"},
|
|
|
|
{10, nullptr, "GetNetworkInstallTaskInfo"},
|
|
|
|
{11, nullptr, "CommitNetworkInstallTask"},
|
|
|
|
{12, nullptr, "RequestLatestSystemUpdateMeta"},
|
|
|
|
{14, nullptr, "ListApplicationNetworkInstallTask"},
|
|
|
|
{15, nullptr, "ListNetworkInstallTaskContentMeta"},
|
|
|
|
{16, nullptr, "RequestLatestVersion"},
|
|
|
|
{17, nullptr, "SetNetworkInstallTaskAttribute"},
|
|
|
|
{18, nullptr, "AddNetworkInstallTaskContentMeta"},
|
|
|
|
{19, nullptr, "GetDownloadedSystemDataPath"},
|
|
|
|
{20, nullptr, "CalculateNetworkInstallTaskRequiredSize"},
|
|
|
|
{21, nullptr, "IsExFatDriverIncluded"},
|
|
|
|
{22, nullptr, "GetBackgroundDownloadStressTaskInfo"},
|
|
|
|
{23, nullptr, "RequestDeviceAuthenticationToken"},
|
|
|
|
{24, nullptr, "RequestGameCardRegistrationStatus"},
|
|
|
|
{25, nullptr, "RequestRegisterGameCard"},
|
|
|
|
{26, nullptr, "RequestRegisterNotificationToken"},
|
|
|
|
{27, nullptr, "RequestDownloadTaskList"},
|
|
|
|
{28, nullptr, "RequestApplicationControl"},
|
|
|
|
{29, nullptr, "RequestLatestApplicationControl"},
|
|
|
|
{30, nullptr, "RequestVersionList"},
|
|
|
|
{31, nullptr, "CreateApplyDeltaTask"},
|
|
|
|
{32, nullptr, "DestroyApplyDeltaTask"},
|
|
|
|
{33, nullptr, "ListApplicationApplyDeltaTask"},
|
|
|
|
{34, nullptr, "RequestApplyDeltaTaskRun"},
|
|
|
|
{35, nullptr, "GetApplyDeltaTaskInfo"},
|
|
|
|
{36, nullptr, "ListApplyDeltaTask"},
|
|
|
|
{37, nullptr, "CommitApplyDeltaTask"},
|
|
|
|
{38, nullptr, "CalculateApplyDeltaTaskRequiredSize"},
|
|
|
|
{39, nullptr, "PrepareShutdown"},
|
|
|
|
{40, nullptr, "ListApplyDeltaTask"},
|
|
|
|
{41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"},
|
2021-04-07 15:26:22 +00:00
|
|
|
{42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"},
|
|
|
|
{43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"},
|
|
|
|
{44, nullptr, "GetApplyDeltaTaskRequiredStorage"},
|
|
|
|
{45, nullptr, "CalculateNetworkInstallTaskContentsSize"},
|
|
|
|
{46, nullptr, "PrepareShutdownForSystemUpdate"},
|
|
|
|
{47, nullptr, "FindMaxRequiredApplicationVersionOfTask"},
|
|
|
|
{48, nullptr, "CommitNetworkInstallTaskPartially"},
|
|
|
|
{49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"},
|
|
|
|
{50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"},
|
|
|
|
{51, nullptr, "FindMaxRequiredSystemVersionOfTask"},
|
|
|
|
{52, nullptr, "GetNetworkInstallTaskErrorContext"},
|
|
|
|
{53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"},
|
|
|
|
{54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"},
|
|
|
|
{55, nullptr, "ListLocalCommunicationReceiveApplicationTask"},
|
|
|
|
{56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"},
|
|
|
|
{57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"},
|
|
|
|
{58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"},
|
|
|
|
{59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"},
|
|
|
|
{60, nullptr, "CreateLocalCommunicationSendApplicationTask"},
|
|
|
|
{61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"},
|
|
|
|
{62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"},
|
|
|
|
{63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"},
|
|
|
|
{64, nullptr, "DestroyLocalCommunicationSendApplicationTask"},
|
|
|
|
{65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"},
|
|
|
|
{66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"},
|
|
|
|
{67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"},
|
|
|
|
{68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"},
|
|
|
|
{69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"},
|
|
|
|
{70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"},
|
|
|
|
{71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"},
|
|
|
|
{72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"},
|
|
|
|
{73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"},
|
|
|
|
{74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"},
|
|
|
|
{75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"},
|
|
|
|
{76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"},
|
|
|
|
{77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"},
|
|
|
|
{78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"},
|
|
|
|
{79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"},
|
|
|
|
{80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"},
|
|
|
|
{81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"},
|
|
|
|
{82, nullptr, "GetReceivedSystemDataPath"},
|
|
|
|
{83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"},
|
2020-06-29 02:01:34 +00:00
|
|
|
{84, nullptr, "Unknown84"},
|
2021-04-07 15:26:22 +00:00
|
|
|
{85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"},
|
|
|
|
{86, nullptr, "ListNetworkInstallTaskOccupiedSize"},
|
2020-06-29 02:01:34 +00:00
|
|
|
{87, nullptr, "Unknown87"},
|
|
|
|
{88, nullptr, "Unknown88"},
|
|
|
|
{89, nullptr, "Unknown89"},
|
|
|
|
{90, nullptr, "Unknown90"},
|
|
|
|
{91, nullptr, "Unknown91"},
|
|
|
|
{92, nullptr, "Unknown92"},
|
|
|
|
{93, nullptr, "Unknown93"},
|
|
|
|
{94, nullptr, "Unknown94"},
|
|
|
|
{95, nullptr, "Unknown95"},
|
|
|
|
{96, nullptr, "Unknown96"},
|
|
|
|
{97, nullptr, "Unknown97"},
|
|
|
|
{98, nullptr, "Unknown98"},
|
|
|
|
{99, nullptr, "Unknown99"},
|
|
|
|
{100, nullptr, "Unknown100"},
|
|
|
|
{101, nullptr, "Unknown101"},
|
|
|
|
{102, nullptr, "Unknown102"},
|
|
|
|
{103, nullptr, "Unknown103"},
|
|
|
|
{104, nullptr, "Unknown104"},
|
|
|
|
{105, nullptr, "Unknown105"},
|
|
|
|
{106, nullptr, "Unknown106"},
|
|
|
|
{107, nullptr, "Unknown107"},
|
|
|
|
{108, nullptr, "Unknown108"},
|
|
|
|
{109, nullptr, "Unknown109"},
|
|
|
|
{110, nullptr, "Unknown110"},
|
|
|
|
{111, nullptr, "Unknown111"},
|
|
|
|
{112, nullptr, "Unknown112"},
|
|
|
|
{113, nullptr, "Unknown113"},
|
|
|
|
{114, nullptr, "Unknown114"},
|
|
|
|
{115, nullptr, "Unknown115"},
|
|
|
|
{116, nullptr, "Unknown116"},
|
|
|
|
{117, nullptr, "Unknown117"},
|
|
|
|
{118, nullptr, "Unknown118"},
|
2021-04-07 15:26:22 +00:00
|
|
|
{119, nullptr, "Unknown119"},
|
|
|
|
{120, nullptr, "Unknown120"},
|
|
|
|
{121, nullptr, "Unknown121"},
|
|
|
|
{122, nullptr, "Unknown122"},
|
|
|
|
{123, nullptr, "Unknown123"},
|
|
|
|
{124, nullptr, "Unknown124"},
|
|
|
|
{125, nullptr, "Unknown125"},
|
|
|
|
{126, nullptr, "Unknown126"},
|
|
|
|
{127, nullptr, "Unknown127"},
|
|
|
|
{128, nullptr, "Unknown128"},
|
|
|
|
{129, nullptr, "Unknown129"},
|
2022-01-21 21:17:40 +00:00
|
|
|
{130, nullptr, "Unknown130"},
|
|
|
|
{131, nullptr, "Unknown131"},
|
|
|
|
{132, nullptr, "Unknown132"},
|
|
|
|
{133, nullptr, "Unknown133"},
|
|
|
|
{134, nullptr, "Unknown134"},
|
2018-07-26 06:17:15 +00:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-10-19 07:46:01 +00:00
|
|
|
class NIM_ECA final : public ServiceFramework<NIM_ECA> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit NIM_ECA(Core::System& system_) : ServiceFramework{system_, "nim:eca"} {
|
2018-10-19 07:46:01 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
2020-04-30 13:10:20 +00:00
|
|
|
{0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"},
|
2018-10-19 07:46:01 +00:00
|
|
|
{1, nullptr, "RefreshDebugAvailability"},
|
|
|
|
{2, nullptr, "ClearDebugResponse"},
|
|
|
|
{3, nullptr, "RegisterDebugResponse"},
|
2020-12-04 14:33:57 +00:00
|
|
|
{4, &NIM_ECA::IsLargeResourceAvailable, "IsLargeResourceAvailable"},
|
2018-10-19 07:46:01 +00:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
2020-04-30 13:10:20 +00:00
|
|
|
|
|
|
|
private:
|
2023-02-19 19:42:12 +00:00
|
|
|
void CreateServerInterface(HLERequestContext& ctx) {
|
2020-04-30 13:10:20 +00:00
|
|
|
LOG_WARNING(Service_NIM, "(STUBBED) called");
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2020-11-26 20:19:08 +00:00
|
|
|
rb.PushIpcInterface<IShopServiceAccessServer>(system);
|
2020-04-30 13:10:20 +00:00
|
|
|
}
|
2020-12-04 14:33:57 +00:00
|
|
|
|
2023-02-19 19:42:12 +00:00
|
|
|
void IsLargeResourceAvailable(HLERequestContext& ctx) {
|
2020-12-04 14:33:57 +00:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
const auto unknown{rp.Pop<u64>()};
|
|
|
|
|
|
|
|
LOG_INFO(Service_NIM, "(STUBBED) called, unknown={}", unknown);
|
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2020-12-04 14:33:57 +00:00
|
|
|
rb.Push(false);
|
|
|
|
}
|
2018-10-19 07:46:01 +00:00
|
|
|
};
|
|
|
|
|
2018-07-26 06:17:15 +00:00
|
|
|
class NIM_SHP final : public ServiceFramework<NIM_SHP> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit NIM_SHP(Core::System& system_) : ServiceFramework{system_, "nim:shp"} {
|
2018-07-26 06:17:15 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "RequestDeviceAuthenticationToken"},
|
|
|
|
{1, nullptr, "RequestCachedDeviceAuthenticationToken"},
|
2020-06-29 02:01:34 +00:00
|
|
|
{2, nullptr, "RequestEdgeToken"},
|
|
|
|
{3, nullptr, "RequestCachedEdgeToken"},
|
2018-07-26 06:17:15 +00:00
|
|
|
{100, nullptr, "RequestRegisterDeviceAccount"},
|
|
|
|
{101, nullptr, "RequestUnregisterDeviceAccount"},
|
|
|
|
{102, nullptr, "RequestDeviceAccountStatus"},
|
|
|
|
{103, nullptr, "GetDeviceAccountInfo"},
|
|
|
|
{104, nullptr, "RequestDeviceRegistrationInfo"},
|
|
|
|
{105, nullptr, "RequestTransferDeviceAccount"},
|
|
|
|
{106, nullptr, "RequestSyncRegistration"},
|
|
|
|
{107, nullptr, "IsOwnDeviceId"},
|
|
|
|
{200, nullptr, "RequestRegisterNotificationToken"},
|
|
|
|
{300, nullptr, "RequestUnlinkDevice"},
|
|
|
|
{301, nullptr, "RequestUnlinkDeviceIntegrated"},
|
|
|
|
{302, nullptr, "RequestLinkDevice"},
|
|
|
|
{303, nullptr, "HasDeviceLink"},
|
|
|
|
{304, nullptr, "RequestUnlinkDeviceAll"},
|
|
|
|
{305, nullptr, "RequestCreateVirtualAccount"},
|
|
|
|
{306, nullptr, "RequestDeviceLinkStatus"},
|
|
|
|
{400, nullptr, "GetAccountByVirtualAccount"},
|
2020-06-29 02:01:34 +00:00
|
|
|
{401, nullptr, "GetVirtualAccount"},
|
|
|
|
{500, nullptr, "RequestSyncTicketLegacy"},
|
2018-07-26 06:17:15 +00:00
|
|
|
{501, nullptr, "RequestDownloadTicket"},
|
|
|
|
{502, nullptr, "RequestDownloadTicketForPrepurchasedContents"},
|
2019-11-12 13:54:58 +00:00
|
|
|
{503, nullptr, "RequestSyncTicket"},
|
|
|
|
{504, nullptr, "RequestDownloadTicketForPrepurchasedContents2"},
|
2022-01-21 21:17:40 +00:00
|
|
|
{505, nullptr, "RequestDownloadTicketForPrepurchasedContentsForAccount"},
|
2018-07-26 06:17:15 +00:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
class IEnsureNetworkClockAvailabilityService final
|
|
|
|
: public ServiceFramework<IEnsureNetworkClockAvailabilityService> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit IEnsureNetworkClockAvailabilityService(Core::System& system_)
|
2021-04-04 07:56:09 +00:00
|
|
|
: ServiceFramework{system_, "IEnsureNetworkClockAvailabilityService"},
|
2021-09-29 03:42:50 +00:00
|
|
|
service_context{system_, "IEnsureNetworkClockAvailabilityService"} {
|
2018-09-20 05:14:07 +00:00
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"},
|
|
|
|
{1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent,
|
|
|
|
"GetFinishNotificationEvent"},
|
|
|
|
{2, &IEnsureNetworkClockAvailabilityService::GetResult, "GetResult"},
|
|
|
|
{3, &IEnsureNetworkClockAvailabilityService::Cancel, "Cancel"},
|
|
|
|
{4, &IEnsureNetworkClockAvailabilityService::IsProcessing, "IsProcessing"},
|
|
|
|
{5, &IEnsureNetworkClockAvailabilityService::GetServerTime, "GetServerTime"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
2021-09-29 03:42:50 +00:00
|
|
|
finished_event =
|
|
|
|
service_context.CreateEvent("IEnsureNetworkClockAvailabilityService:FinishEvent");
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
|
|
|
|
2021-09-29 03:42:50 +00:00
|
|
|
~IEnsureNetworkClockAvailabilityService() override {
|
|
|
|
service_context.CloseEvent(finished_event);
|
|
|
|
}
|
2018-09-20 05:14:07 +00:00
|
|
|
|
2021-09-29 03:42:50 +00:00
|
|
|
private:
|
2023-02-19 19:42:12 +00:00
|
|
|
void StartTask(HLERequestContext& ctx) {
|
2018-09-20 05:14:07 +00:00
|
|
|
// No need to connect to the internet, just finish the task straight away.
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_NIM, "called");
|
2022-10-13 00:26:04 +00:00
|
|
|
finished_event->Signal();
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
|
|
|
|
2023-02-19 19:42:12 +00:00
|
|
|
void GetFinishNotificationEvent(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_NIM, "called");
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2021-09-29 03:42:50 +00:00
|
|
|
rb.PushCopyObjects(finished_event->GetReadableEvent());
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
|
|
|
|
2023-02-19 19:42:12 +00:00
|
|
|
void GetResult(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_NIM, "called");
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
|
|
|
|
2023-02-19 19:42:12 +00:00
|
|
|
void Cancel(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_NIM, "called");
|
2022-10-13 00:26:04 +00:00
|
|
|
finished_event->Clear();
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
|
|
|
|
2023-02-19 19:42:12 +00:00
|
|
|
void IsProcessing(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_NIM, "called");
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2018-09-20 05:14:07 +00:00
|
|
|
rb.PushRaw<u32>(0); // We instantly process the request
|
|
|
|
}
|
|
|
|
|
2023-02-19 19:42:12 +00:00
|
|
|
void GetServerTime(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_NIM, "called");
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
const s64 server_time{std::chrono::duration_cast<std::chrono::seconds>(
|
|
|
|
std::chrono::system_clock::now().time_since_epoch())
|
|
|
|
.count()};
|
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2018-09-20 05:14:07 +00:00
|
|
|
rb.PushRaw<s64>(server_time);
|
|
|
|
}
|
2021-09-29 03:42:50 +00:00
|
|
|
|
|
|
|
KernelHelpers::ServiceContext service_context;
|
|
|
|
|
|
|
|
Kernel::KEvent* finished_event;
|
2018-09-20 05:14:07 +00:00
|
|
|
};
|
|
|
|
|
2018-07-26 06:17:15 +00:00
|
|
|
class NTC final : public ServiceFramework<NTC> {
|
|
|
|
public:
|
2020-11-26 20:19:08 +00:00
|
|
|
explicit NTC(Core::System& system_) : ServiceFramework{system_, "ntc"} {
|
2018-07-26 06:17:15 +00:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
2018-09-20 05:14:07 +00:00
|
|
|
{0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"},
|
|
|
|
{100, &NTC::SuspendAutonomicTimeCorrection, "SuspendAutonomicTimeCorrection"},
|
|
|
|
{101, &NTC::ResumeAutonomicTimeCorrection, "ResumeAutonomicTimeCorrection"},
|
2018-07-26 06:17:15 +00:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
2018-09-20 05:14:07 +00:00
|
|
|
|
|
|
|
private:
|
2023-02-19 19:42:12 +00:00
|
|
|
void OpenEnsureNetworkClockAvailabilityService(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_DEBUG(Service_NIM, "called");
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2019-09-21 09:11:52 +00:00
|
|
|
rb.PushIpcInterface<IEnsureNetworkClockAvailabilityService>(system);
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(ogniK): Do we need these?
|
2023-02-19 19:42:12 +00:00
|
|
|
void SuspendAutonomicTimeCorrection(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_WARNING(Service_NIM, "(STUBBED) called");
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
|
|
|
|
2023-02-19 19:42:12 +00:00
|
|
|
void ResumeAutonomicTimeCorrection(HLERequestContext& ctx) {
|
2018-11-26 06:06:13 +00:00
|
|
|
LOG_WARNING(Service_NIM, "(STUBBED) called");
|
|
|
|
|
2018-09-20 05:14:07 +00:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
2021-05-21 05:05:04 +00:00
|
|
|
rb.Push(ResultSuccess);
|
2018-09-20 05:14:07 +00:00
|
|
|
}
|
2018-07-26 06:17:15 +00:00
|
|
|
};
|
|
|
|
|
2023-02-18 21:26:48 +00:00
|
|
|
void LoopProcess(Core::System& system) {
|
|
|
|
auto server_manager = std::make_unique<ServerManager>(system);
|
|
|
|
|
|
|
|
server_manager->RegisterNamedService("nim", std::make_shared<NIM>(system));
|
|
|
|
server_manager->RegisterNamedService("nim:eca", std::make_shared<NIM_ECA>(system));
|
|
|
|
server_manager->RegisterNamedService("nim:shp", std::make_shared<NIM_SHP>(system));
|
|
|
|
server_manager->RegisterNamedService("ntc", std::make_shared<NTC>(system));
|
|
|
|
ServerManager::RunServer(std::move(server_manager));
|
2018-07-26 06:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Service::NIM
|