From 8846a85d3a80d07e5fc0e56ae6b842947e932d09 Mon Sep 17 00:00:00 2001 From: Pablo Date: Fri, 30 Dec 2022 18:00:03 +0100 Subject: [PATCH] Stub some IPurchaseEventManager functions --- app/CMakeLists.txt | 1 + .../services/aocsrv/IAddOnContentManager.cpp | 6 ++++ .../services/aocsrv/IAddOnContentManager.h | 7 +++-- .../services/aocsrv/IPurchaseEventManager.cpp | 23 +++++++++++++++ .../services/aocsrv/IPurchaseEventManager.h | 29 +++++++++++++++++++ 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.cpp create mode 100644 app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index c345ad5f..f07e4505 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -356,6 +356,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/visrv/ISystemDisplayService.cpp ${source_DIR}/skyline/services/pl/IPlatformServiceManager.cpp ${source_DIR}/skyline/services/aocsrv/IAddOnContentManager.cpp + ${source_DIR}/skyline/services/aocsrv/IPurchaseEventManager.cpp ${source_DIR}/skyline/services/pctl/IParentalControlServiceFactory.cpp ${source_DIR}/skyline/services/pctl/IParentalControlService.cpp ${source_DIR}/skyline/services/lm/ILogService.cpp diff --git a/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp b/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp index 1f3209b1..e689c37f 100644 --- a/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp +++ b/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp @@ -3,6 +3,7 @@ #include #include "IAddOnContentManager.h" +#include "IPurchaseEventManager.h" namespace skyline::service::aocsrv { IAddOnContentManager::IAddOnContentManager(const DeviceState &state, ServiceManager &manager) @@ -38,4 +39,9 @@ namespace skyline::service::aocsrv { Result IAddOnContentManager::CheckAddOnContentMountStatus(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; } + + Result IAddOnContentManager::CreateEcPurchasedEventManager(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IPurchaseEventManager), session, response); + return {}; + } } diff --git a/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.h b/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.h index 72cb17dd..c3d1acfb 100644 --- a/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.h +++ b/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.h @@ -4,7 +4,7 @@ #pragma once #include -#include +#include namespace skyline::service::aocsrv { /** @@ -28,12 +28,15 @@ namespace skyline::service::aocsrv { Result CheckAddOnContentMountStatus(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + Result CreateEcPurchasedEventManager(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + SERVICE_DECL( SFUNC(0x2, IAddOnContentManager, CountAddOnContent), SFUNC(0x3, IAddOnContentManager, ListAddOnContent), SFUNC(0x8, IAddOnContentManager, GetAddOnContentListChangedEvent), SFUNC(0xA, IAddOnContentManager, GetAddOnContentListChangedEventWithProcessId), - SFUNC(0x32, IAddOnContentManager, CheckAddOnContentMountStatus) + SFUNC(0x32, IAddOnContentManager, CheckAddOnContentMountStatus), + SFUNC(0x64, IAddOnContentManager, CreateEcPurchasedEventManager) ) }; } diff --git a/app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.cpp b/app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.cpp new file mode 100644 index 00000000..683b4861 --- /dev/null +++ b/app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.cpp @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include +#include "IPurchaseEventManager.h" + +namespace skyline::service::aocsrv { + IPurchaseEventManager::IPurchaseEventManager(const DeviceState &state, ServiceManager &manager) + : BaseService(state, manager), + purchasedEvent(std::make_shared(state, false)) {} + + Result IPurchaseEventManager::SetDefaultDeliveryTarget(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } + + Result IPurchaseEventManager::GetPurchasedEventReadableHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + auto handle{state.process->InsertItem(purchasedEvent)}; + Logger::Debug("Purchased Event Readable Handle: 0x{:X}", handle); + + response.copyHandles.push_back(handle); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.h b/app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.h new file mode 100644 index 00000000..aa730f77 --- /dev/null +++ b/app/src/main/cpp/skyline/services/aocsrv/IPurchaseEventManager.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include +#include + +namespace skyline::service::aocsrv { + /** + * @url https://switchbrew.org/wiki/NS_Services#IPurchaseEventManager + */ + class IPurchaseEventManager : public BaseService { + private: + std::shared_ptr purchasedEvent; + + public: + IPurchaseEventManager(const DeviceState &state, ServiceManager &manager); + + Result SetDefaultDeliveryTarget(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result GetPurchasedEventReadableHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IPurchaseEventManager, SetDefaultDeliveryTarget), + SFUNC(0x2, IPurchaseEventManager, GetPurchasedEventReadableHandle) + ) + }; +}