From ff1c0e254ff65d59562133f3b774cd80dc592db2 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sat, 4 Jul 2020 20:35:07 +0100 Subject: [PATCH] Add an empty account services implementation This implements the base account service and stubs InitializeApplicationInfoV0 which is used by Puyo Puyo Tetris. Support for the entirety of account services will be added in the future. --- app/CMakeLists.txt | 1 + .../account/IAccountServiceForApplication.cpp | 12 ++++++++++ .../account/IAccountServiceForApplication.h | 22 +++++++++++++++++++ .../main/cpp/skyline/services/base_service.h | 6 +++-- .../main/cpp/skyline/services/serviceman.cpp | 4 ++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp create mode 100644 app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index aa9d9642..b7091d91 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -110,6 +110,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/pctl/IParentalControlServiceFactory.cpp ${source_DIR}/skyline/services/lm/ILogService.cpp ${source_DIR}/skyline/services/lm/ILogger.cpp + ${source_DIR}/skyline/services/account/IAccountServiceForApplication.cpp ${source_DIR}/skyline/vfs/partition_filesystem.cpp ${source_DIR}/skyline/vfs/rom_filesystem.cpp ${source_DIR}/skyline/vfs/os_backing.cpp diff --git a/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp new file mode 100644 index 00000000..42d2944f --- /dev/null +++ b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IAccountServiceForApplication.h" + +namespace skyline::service::account { + IAccountServiceForApplication::IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::account_IAccountServiceForApplication, "account:IAccountServiceForApplication", { + {0x64, SFUNC(IAccountServiceForApplication::InitializeApplicationInfoV0)} + }) {} + + void IAccountServiceForApplication::InitializeApplicationInfoV0(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {} +} diff --git a/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h new file mode 100644 index 00000000..900dd243 --- /dev/null +++ b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include +#include + +namespace skyline::service::account { + /** + * @brief IAccountServiceForApplication or acc:u0 provides functions for reading user information (https://switchbrew.org/wiki/Account_services#acc:u0) + */ + class IAccountServiceForApplication : public BaseService { + public: + IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager); + + /** + * @brief This provides information about the running application for account services to use (https://switchbrew.org/wiki/Account_services#InitializeApplicationInfoV0) + */ + void InitializeApplicationInfoV0(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + }; +} diff --git a/app/src/main/cpp/skyline/services/base_service.h b/app/src/main/cpp/skyline/services/base_service.h index 9f80c730..78db9d71 100644 --- a/app/src/main/cpp/skyline/services/base_service.h +++ b/app/src/main/cpp/skyline/services/base_service.h @@ -66,7 +66,8 @@ namespace skyline::service { aocsrv_IAddOnContentManager, pctl_IParentalControlServiceFactory, lm_ILogService, - lm_ILogger + lm_ILogger, + account_IAccountServiceForApplication, }; /** @@ -97,7 +98,8 @@ namespace skyline::service { {"pctl:a", Service::pctl_IParentalControlServiceFactory}, {"pctl:s", Service::pctl_IParentalControlServiceFactory}, {"pctl:r", Service::pctl_IParentalControlServiceFactory}, - {"lm", Service::lm_ILogService} + {"lm", Service::lm_ILogService}, + {"acc:u0", Service::account_IAccountServiceForApplication}, }; class ServiceManager; diff --git a/app/src/main/cpp/skyline/services/serviceman.cpp b/app/src/main/cpp/skyline/services/serviceman.cpp index dacb3ed3..08b0289c 100644 --- a/app/src/main/cpp/skyline/services/serviceman.cpp +++ b/app/src/main/cpp/skyline/services/serviceman.cpp @@ -20,6 +20,7 @@ #include "aocsrv/IAddOnContentManager.h" #include "pctl/IParentalControlServiceFactory.h" #include "lm/ILogService.h" +#include "account/IAccountServiceForApplication.h" #include "serviceman.h" namespace skyline::service { @@ -86,6 +87,9 @@ namespace skyline::service { case Service::lm_ILogService: serviceObj = std::make_shared(state, *this); break; + case Service::account_IAccountServiceForApplication: + serviceObj = std::make_shared(state, *this); + break; default: throw exception("CreateService called on missing object, type: {}", serviceType); }