From 688dea647d92cc6a039f05e182c04aeea7cfbb93 Mon Sep 17 00:00:00 2001 From: Dima Date: Thu, 20 Apr 2023 16:30:12 +0300 Subject: [PATCH] Stub some required calls Co-authored-by: PabloG02 --- app/CMakeLists.txt | 2 ++ .../services/account/IAsyncContext.cpp | 31 +++++++++++++++++ .../skyline/services/account/IAsyncContext.h | 34 +++++++++++++++++++ .../account/IManagerForApplication.cpp | 10 ++++++ .../services/account/IManagerForApplication.h | 6 ++++ .../services/pctl/IParentalControlService.cpp | 5 ++- .../services/pctl/IParentalControlService.h | 3 ++ .../skyline/services/socket/nsd/IManager.cpp | 4 +++ .../skyline/services/socket/nsd/IManager.h | 6 ++++ .../cpp/skyline/services/ssl/ISslContext.cpp | 4 +++ .../cpp/skyline/services/ssl/ISslContext.h | 8 ++++- 11 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 app/src/main/cpp/skyline/services/account/IAsyncContext.cpp create mode 100644 app/src/main/cpp/skyline/services/account/IAsyncContext.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 03a0209d..2b1a5c8f 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -376,6 +376,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/account/IAccountServiceForApplication.cpp ${source_DIR}/skyline/services/account/IManagerForApplication.cpp ${source_DIR}/skyline/services/account/IProfile.cpp + ${source_DIR}/skyline/services/account/IAsyncContext.cpp ${source_DIR}/skyline/services/friends/IServiceCreator.cpp ${source_DIR}/skyline/services/friends/IFriendService.cpp ${source_DIR}/skyline/services/friends/INotificationService.cpp @@ -400,6 +401,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/mii/IStaticService.cpp ${source_DIR}/skyline/services/mii/IDatabaseService.cpp ${source_DIR}/skyline/services/olsc/IOlscServiceForApplication.cpp + ${source_DIR}/skyline/services/ntc/IEnsureNetworkClockAvailabilityService.cpp ) target_include_directories(skyline PRIVATE ${source_DIR}/skyline) # target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense diff --git a/app/src/main/cpp/skyline/services/account/IAsyncContext.cpp b/app/src/main/cpp/skyline/services/account/IAsyncContext.cpp new file mode 100644 index 00000000..58d084e2 --- /dev/null +++ b/app/src/main/cpp/skyline/services/account/IAsyncContext.cpp @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IAsyncContext.h" + +namespace skyline::service::account { + IAsyncContext::IAsyncContext(const DeviceState &state, ServiceManager &manager) : BaseService{state, manager}, + systemEvent{std::make_shared(state, true)} {} + + Result IAsyncContext::GetSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + auto handle{state.process->InsertItem(systemEvent)}; + Logger::Debug("System Event Handle: 0x{:X}", handle); + + response.copyHandles.push_back(handle); + return {}; + } + + Result IAsyncContext::Cancel(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + systemEvent->Signal(); + return {}; + } + + Result IAsyncContext::HasDone(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(1); + return {}; + } + + Result IAsyncContext::GetResult(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/account/IAsyncContext.h b/app/src/main/cpp/skyline/services/account/IAsyncContext.h new file mode 100644 index 00000000..318f0bcd --- /dev/null +++ b/app/src/main/cpp/skyline/services/account/IAsyncContext.h @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::account { + /** + * @url https://switchbrew.org/wiki/Account_services#IAsyncContext + */ + class IAsyncContext : public BaseService { + private: + std::shared_ptr systemEvent; + + public: + IAsyncContext(const DeviceState &state, ServiceManager &manager); + + Result GetSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result Cancel(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result HasDone(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result GetResult(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAsyncContext, GetSystemEvent), + SFUNC(0x1, IAsyncContext, Cancel), + SFUNC(0x2, IAsyncContext, HasDone), + SFUNC(0x3, IAsyncContext, GetResult) + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp b/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp index 460d0ca4..b3eaa50a 100644 --- a/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp +++ b/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp @@ -3,6 +3,7 @@ #include "IManagerForApplication.h" #include "IAccountServiceForApplication.h" +#include "IAsyncContext.h" namespace skyline::service::account { IManagerForApplication::IManagerForApplication(const DeviceState &state, ServiceManager &manager, std::vector &openedUsers) : BaseService(state, manager) { @@ -19,6 +20,15 @@ namespace skyline::service::account { return {}; } + Result IManagerForApplication::EnsureIdTokenCacheAsync(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IAsyncContext), session, response); + return {}; + } + + Result IManagerForApplication::LoadIdTokenCache(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } + Result IManagerForApplication::StoreOpenContext(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { openedUsers->clear(); openedUsers->push_back(constant::DefaultUserId); diff --git a/app/src/main/cpp/skyline/services/account/IManagerForApplication.h b/app/src/main/cpp/skyline/services/account/IManagerForApplication.h index 2e28d134..01cac050 100644 --- a/app/src/main/cpp/skyline/services/account/IManagerForApplication.h +++ b/app/src/main/cpp/skyline/services/account/IManagerForApplication.h @@ -28,11 +28,17 @@ namespace skyline::service::account { */ Result GetAccountId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + Result EnsureIdTokenCacheAsync(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result LoadIdTokenCache(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + Result StoreOpenContext(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); SERVICE_DECL( SFUNC(0x0, IManagerForApplication, CheckAvailability), SFUNC(0x1, IManagerForApplication, GetAccountId), + SFUNC(0x2, IManagerForApplication, EnsureIdTokenCacheAsync), + SFUNC(0x3, IManagerForApplication, LoadIdTokenCache), SFUNC(0xA0, IManagerForApplication, StoreOpenContext) ) }; diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp index ef37aa2f..dbcd0bbd 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp @@ -11,7 +11,10 @@ namespace skyline::service::pctl { } Result IParentalControlService::CheckFreeCommunicationPermission(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { - response.Push(0); + return {}; + } + + Result IParentalControlService::EndFreeCommunication(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; } diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.h b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.h index d1d9b6b2..62d116f5 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.h +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.h @@ -21,11 +21,14 @@ namespace skyline::service::pctl { Result CheckFreeCommunicationPermission(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + Result EndFreeCommunication(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + Result IsFreeCommunicationAvailable(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); SERVICE_DECL( SFUNC(0x1, IParentalControlService, Initialize), SFUNC(0x3E9, IParentalControlService, CheckFreeCommunicationPermission), + SFUNC(0x3F9, IParentalControlService, EndFreeCommunication), SFUNC(0x3FA, IParentalControlService, IsFreeCommunicationAvailable) ) }; diff --git a/app/src/main/cpp/skyline/services/socket/nsd/IManager.cpp b/app/src/main/cpp/skyline/services/socket/nsd/IManager.cpp index bee2c293..e6f786ce 100644 --- a/app/src/main/cpp/skyline/services/socket/nsd/IManager.cpp +++ b/app/src/main/cpp/skyline/services/socket/nsd/IManager.cpp @@ -5,4 +5,8 @@ namespace skyline::service::socket { IManager::IManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IManager::ResolveEx(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } } diff --git a/app/src/main/cpp/skyline/services/socket/nsd/IManager.h b/app/src/main/cpp/skyline/services/socket/nsd/IManager.h index cf29b075..01ef46ca 100644 --- a/app/src/main/cpp/skyline/services/socket/nsd/IManager.h +++ b/app/src/main/cpp/skyline/services/socket/nsd/IManager.h @@ -12,5 +12,11 @@ namespace skyline::service::socket { class IManager : public BaseService { public: IManager(const DeviceState &state, ServiceManager &manager); + + Result ResolveEx(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x15, IManager, ResolveEx), + ) }; } diff --git a/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp b/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp index eb0adba7..04351d15 100644 --- a/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp +++ b/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp @@ -17,4 +17,8 @@ namespace skyline::service::ssl { response.Push(0); return {}; } + + Result ISslContext::RegisterInternalPki(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } } diff --git a/app/src/main/cpp/skyline/services/ssl/ISslContext.h b/app/src/main/cpp/skyline/services/ssl/ISslContext.h index 15dd589c..273734ab 100644 --- a/app/src/main/cpp/skyline/services/ssl/ISslContext.h +++ b/app/src/main/cpp/skyline/services/ssl/ISslContext.h @@ -19,8 +19,14 @@ namespace skyline::service::ssl { */ Result ImportServerPki(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + /** + * @url https://switchbrew.org/wiki/SSL_services#RegisterInternalPki + */ + Result RegisterInternalPki(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + SERVICE_DECL( - SFUNC(0x4, ISslContext, ImportServerPki) + SFUNC(0x4, ISslContext, ImportServerPki), + SFUNC(0x8, ISslContext, RegisterInternalPki) ) }; }