From ef9760570bb7c471cc767227528282a38e4d6cb6 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 8 Jul 2020 11:59:02 +0100 Subject: [PATCH] Extend parental control services --- app/CMakeLists.txt | 1 + .../main/cpp/skyline/services/base_service.h | 1 + .../services/pctl/IParentalControlService.cpp | 9 +++++++++ .../services/pctl/IParentalControlService.h | 17 +++++++++++++++++ .../pctl/IParentalControlServiceFactory.cpp | 8 ++++++++ .../pctl/IParentalControlServiceFactory.h | 5 +++++ 6 files changed, 41 insertions(+) create mode 100644 app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp create mode 100644 app/src/main/cpp/skyline/services/pctl/IParentalControlService.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 6eabd86c..1573ca78 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -110,6 +110,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/pl/IPlatformServiceManager.cpp ${source_DIR}/skyline/services/aocsrv/IAddOnContentManager.cpp ${source_DIR}/skyline/services/pctl/IParentalControlServiceFactory.cpp + ${source_DIR}/skyline/services/pctl/IParentalControlService.cpp ${source_DIR}/skyline/services/lm/ILogService.cpp ${source_DIR}/skyline/services/lm/ILogger.cpp ${source_DIR}/skyline/services/account/IAccountServiceForApplication.cpp diff --git a/app/src/main/cpp/skyline/services/base_service.h b/app/src/main/cpp/skyline/services/base_service.h index 1cc5d2a2..ee8196c4 100644 --- a/app/src/main/cpp/skyline/services/base_service.h +++ b/app/src/main/cpp/skyline/services/base_service.h @@ -66,6 +66,7 @@ namespace skyline::service { pl_IPlatformServiceManager, aocsrv_IAddOnContentManager, pctl_IParentalControlServiceFactory, + pctl_IParentalControlService, lm_ILogService, lm_ILogger, account_IAccountServiceForApplication, diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp new file mode 100644 index 00000000..ecf7ebf7 --- /dev/null +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IParentalControlService.h" + +namespace skyline::service::pctl { + IParentalControlService::IParentalControlService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::pctl_IParentalControlService, "pctl:IParentalControlService", { + }) {} +} diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.h b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.h new file mode 100644 index 00000000..854099b4 --- /dev/null +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include +#include + +namespace skyline::service::pctl { + /** + * @brief IParentalControlService is used to access parental control configuration (https://switchbrew.org/wiki/Parental_Control_services#IParentalControlService) + */ + class IParentalControlService : public BaseService { + public: + IParentalControlService(const DeviceState &state, ServiceManager &manager); + }; +} diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp index 76a22e3a..081edf56 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp @@ -1,9 +1,17 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) +#include "IParentalControlService.h" #include "IParentalControlServiceFactory.h" namespace skyline::service::pctl { IParentalControlServiceFactory::IParentalControlServiceFactory(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::pctl_IParentalControlServiceFactory, "pctl:IParentalControlServiceFactory", { + {0x0, SFUNC(IParentalControlServiceFactory::CreateService)}, + {0x1, SFUNC(IParentalControlServiceFactory::CreateService)} + }) {} + + void IParentalControlServiceFactory::CreateService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(std::make_shared(state, manager), session, response); + } } diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.h b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.h index d98ec4a3..77c67ff6 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.h +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.h @@ -13,5 +13,10 @@ namespace skyline::service::pctl { class IParentalControlServiceFactory : public BaseService { public: IParentalControlServiceFactory(const DeviceState &state, ServiceManager &manager); + + /** + * @brief This creates and initializes an IParentalControlService instance that can be used to read parental control configuration + */ + void CreateService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); }; }