From 4d6ae9aa26155ce8565c43748008f03983eb23aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=97=B1=20PixelyIon?= Date: Mon, 21 Sep 2020 15:34:26 +0530 Subject: [PATCH] Constexpr Maps for Service Functions --- app/CMakeLists.txt | 1 + .../account/IAccountServiceForApplication.cpp | 10 +--- .../account/IAccountServiceForApplication.h | 15 ++++- .../account/IManagerForApplication.cpp | 3 +- .../cpp/skyline/services/account/IProfile.cpp | 5 +- .../cpp/skyline/services/account/IProfile.h | 5 ++ .../am/IAllSystemAppletProxiesService.cpp | 8 +-- .../am/IAllSystemAppletProxiesService.h | 8 +++ .../services/am/IApplicationProxyService.cpp | 4 +- .../services/am/IApplicationProxyService.h | 4 ++ .../am/applet/ILibraryAppletAccessor.cpp | 8 +-- .../am/applet/ILibraryAppletAccessor.h | 8 +++ .../am/controller/IAppletCommonFunctions.cpp | 3 +- .../am/controller/IApplicationFunctions.cpp | 12 +--- .../am/controller/IApplicationFunctions.h | 12 ++++ .../am/controller/IAudioController.cpp | 6 +- .../services/am/controller/IAudioController.h | 6 ++ .../am/controller/ICommonStateGetter.cpp | 9 +-- .../am/controller/ICommonStateGetter.h | 9 +++ .../am/controller/IDebugFunctions.cpp | 3 +- .../am/controller/IDisplayController.cpp | 3 +- .../am/controller/ILibraryAppletCreator.cpp | 5 +- .../am/controller/ILibraryAppletCreator.h | 5 ++ .../am/controller/ISelfController.cpp | 13 +---- .../services/am/controller/ISelfController.h | 13 +++++ .../am/controller/IWindowController.cpp | 5 +- .../am/controller/IWindowController.h | 5 ++ .../services/am/proxy/IApplicationProxy.cpp | 11 +--- .../services/am/proxy/IApplicationProxy.h | 14 +++++ .../services/am/proxy/ILibraryAppletProxy.cpp | 10 +--- .../services/am/proxy/ILibraryAppletProxy.h | 10 ++++ .../services/am/proxy/IOverlayAppletProxy.cpp | 11 +--- .../services/am/proxy/IOverlayAppletProxy.h | 11 ++++ .../services/am/proxy/ISystemAppletProxy.cpp | 11 +--- .../services/am/proxy/ISystemAppletProxy.h | 11 ++++ .../skyline/services/am/proxy/base_proxy.cpp | 2 +- .../skyline/services/am/proxy/base_proxy.h | 2 +- .../skyline/services/am/storage/IStorage.cpp | 4 +- .../skyline/services/am/storage/IStorage.h | 4 ++ .../services/am/storage/IStorageAccessor.cpp | 6 +- .../services/am/storage/IStorageAccessor.h | 6 ++ .../services/aocsrv/IAddOnContentManager.cpp | 3 +- .../cpp/skyline/services/apm/IManager.cpp | 4 +- .../main/cpp/skyline/services/apm/IManager.h | 4 ++ .../cpp/skyline/services/apm/ISession.cpp | 5 +- .../main/cpp/skyline/services/apm/ISession.h | 5 ++ .../skyline/services/audio/IAudioDevice.cpp | 11 +--- .../cpp/skyline/services/audio/IAudioDevice.h | 11 ++++ .../cpp/skyline/services/audio/IAudioOut.cpp | 12 +--- .../cpp/skyline/services/audio/IAudioOut.h | 12 ++++ .../services/audio/IAudioOutManager.cpp | 7 +-- .../skyline/services/audio/IAudioOutManager.h | 7 +++ .../audio/IAudioRenderer/IAudioRenderer.cpp | 12 +--- .../audio/IAudioRenderer/IAudioRenderer.h | 12 ++++ .../services/audio/IAudioRendererManager.cpp | 7 +-- .../services/audio/IAudioRendererManager.h | 7 +++ .../cpp/skyline/services/base_service.cpp | 35 ++++++++++++ .../main/cpp/skyline/services/base_service.h | 57 ++++++++++--------- .../skyline/services/fatalsrv/IService.cpp | 6 +- .../cpp/skyline/services/fatalsrv/IService.h | 6 ++ .../services/friends/IFriendService.cpp | 3 +- .../services/friends/INotificationService.cpp | 4 +- .../services/friends/INotificationService.h | 4 ++ .../services/friends/IServiceCreator.cpp | 5 +- .../services/friends/IServiceCreator.h | 5 ++ .../main/cpp/skyline/services/fssrv/IFile.cpp | 8 +-- .../main/cpp/skyline/services/fssrv/IFile.h | 8 +++ .../skyline/services/fssrv/IFileSystem.cpp | 7 +-- .../cpp/skyline/services/fssrv/IFileSystem.h | 7 +++ .../services/fssrv/IFileSystemProxy.cpp | 8 +-- .../skyline/services/fssrv/IFileSystemProxy.h | 8 +++ .../cpp/skyline/services/fssrv/IStorage.cpp | 5 +- .../cpp/skyline/services/fssrv/IStorage.h | 5 ++ .../hid/IActiveVibrationDeviceList.cpp | 4 +- .../services/hid/IActiveVibrationDeviceList.h | 4 ++ .../skyline/services/hid/IAppletResource.cpp | 4 +- .../skyline/services/hid/IAppletResource.h | 4 ++ .../cpp/skyline/services/hid/IHidServer.cpp | 21 +------ .../cpp/skyline/services/hid/IHidServer.h | 21 +++++++ .../services/hosbinder/IHOSBinderDriver.cpp | 7 +-- .../services/hosbinder/IHOSBinderDriver.h | 7 +++ .../cpp/skyline/services/lm/ILogService.cpp | 4 +- .../cpp/skyline/services/lm/ILogService.h | 4 ++ .../main/cpp/skyline/services/lm/ILogger.cpp | 5 +- .../main/cpp/skyline/services/lm/ILogger.h | 5 ++ .../main/cpp/skyline/services/nfp/IUser.cpp | 4 +- app/src/main/cpp/skyline/services/nfp/IUser.h | 4 ++ .../cpp/skyline/services/nfp/IUserManager.cpp | 4 +- .../cpp/skyline/services/nfp/IUserManager.h | 4 ++ .../skyline/services/nifm/IGeneralService.cpp | 4 +- .../skyline/services/nifm/IGeneralService.h | 4 ++ .../cpp/skyline/services/nifm/IRequest.cpp | 7 +-- .../main/cpp/skyline/services/nifm/IRequest.h | 7 +++ .../skyline/services/nifm/IStaticService.cpp | 5 +- .../skyline/services/nifm/IStaticService.h | 5 ++ .../skyline/services/nvdrv/INvDrvServices.cpp | 10 +--- .../skyline/services/nvdrv/INvDrvServices.h | 10 ++++ .../services/pctl/IParentalControlService.cpp | 3 +- .../pctl/IParentalControlServiceFactory.cpp | 5 +- .../pctl/IParentalControlServiceFactory.h | 5 ++ .../services/pl/IPlatformServiceManager.cpp | 7 +-- .../services/pl/IPlatformServiceManager.h | 7 +++ .../skyline/services/prepo/IPrepoService.cpp | 4 +- .../skyline/services/prepo/IPrepoService.h | 4 ++ .../main/cpp/skyline/services/serviceman.h | 5 ++ .../services/settings/ISettingsServer.cpp | 6 +- .../services/settings/ISettingsServer.h | 6 ++ .../settings/ISystemSettingsServer.cpp | 3 +- .../services/settings/ISystemSettingsServer.h | 4 ++ .../skyline/services/sm/IUserInterface.cpp | 5 +- .../cpp/skyline/services/sm/IUserInterface.h | 5 ++ .../skyline/services/socket/bsd/IClient.cpp | 7 +-- .../cpp/skyline/services/socket/bsd/IClient.h | 7 ++- .../cpp/skyline/services/ssl/ISslContext.cpp | 3 +- .../cpp/skyline/services/ssl/ISslService.cpp | 5 +- .../cpp/skyline/services/ssl/ISslService.h | 5 ++ .../services/timesrv/IStaticService.cpp | 8 +-- .../skyline/services/timesrv/IStaticService.h | 8 +++ .../skyline/services/timesrv/ISteadyClock.cpp | 4 +- .../skyline/services/timesrv/ISteadyClock.h | 4 ++ .../skyline/services/timesrv/ISystemClock.cpp | 5 +- .../skyline/services/timesrv/ISystemClock.h | 5 ++ .../services/timesrv/ITimeZoneService.cpp | 4 +- .../services/timesrv/ITimeZoneService.h | 4 ++ .../visrv/IApplicationDisplayService.cpp | 15 +---- .../visrv/IApplicationDisplayService.h | 15 +++++ .../services/visrv/IDisplayService.cpp | 2 +- .../skyline/services/visrv/IDisplayService.h | 2 +- .../services/visrv/IManagerDisplayService.cpp | 7 +-- .../services/visrv/IManagerDisplayService.h | 7 +++ .../services/visrv/IManagerRootService.cpp | 4 +- .../services/visrv/IManagerRootService.h | 4 ++ .../services/visrv/ISystemDisplayService.cpp | 5 +- .../services/visrv/ISystemDisplayService.h | 5 ++ 134 files changed, 560 insertions(+), 403 deletions(-) create mode 100644 app/src/main/cpp/skyline/services/base_service.cpp diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 8827e54c..718b49e9 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -69,6 +69,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/kernel/types/KTransferMemory.cpp ${source_DIR}/skyline/kernel/types/KPrivateMemory.cpp ${source_DIR}/skyline/services/serviceman.cpp + ${source_DIR}/skyline/services/base_service.cpp ${source_DIR}/skyline/services/common/parcel.cpp ${source_DIR}/skyline/services/sm/IUserInterface.cpp ${source_DIR}/skyline/services/fatalsrv/IService.cpp diff --git a/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp index b98c77b8..6f6f32b9 100644 --- a/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp +++ b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.cpp @@ -7,15 +7,7 @@ #include "IAccountServiceForApplication.h" namespace skyline::service::account { - IAccountServiceForApplication::IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x1, SFUNC(IAccountServiceForApplication::GetUserExistence)}, - {0x2, SFUNC(IAccountServiceForApplication::ListAllUsers)}, - {0x3, SFUNC(IAccountServiceForApplication::ListOpenUsers)}, - {0x4, SFUNC(IAccountServiceForApplication::GetLastOpenedUser)}, - {0x5, SFUNC(IAccountServiceForApplication::GetProfile)}, - {0x64, SFUNC(IAccountServiceForApplication::InitializeApplicationInfoV0)}, - {0x65, SFUNC(IAccountServiceForApplication::GetBaasAccountManagerForApplication)} - }) {} + IAccountServiceForApplication::IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IAccountServiceForApplication::GetUserExistence(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { auto id = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h index bddca61c..62214167 100644 --- a/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h +++ b/app/src/main/cpp/skyline/services/account/IAccountServiceForApplication.h @@ -16,7 +16,7 @@ namespace skyline { } /** - * @brief This hold an account's user ID + * @brief An HOS account's user ID */ struct UserId { u64 upper; //!< The upper 64 bits of the user ID @@ -30,6 +30,7 @@ namespace skyline { return !(*this == userId); } }; + /** * @brief IAccountServiceForApplication or acc:u0 provides functions for reading user information (https://switchbrew.org/wiki/Account_services#acc:u0) */ @@ -77,10 +78,20 @@ namespace skyline { * @brief This returns a handle to an IManagerForApplication which can be used for reading Nintendo Online info */ Result GetBaasAccountManagerForApplication(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x1, IAccountServiceForApplication, GetUserExistence), + SFUNC(0x2, IAccountServiceForApplication, ListAllUsers), + SFUNC(0x3, IAccountServiceForApplication, ListOpenUsers), + SFUNC(0x4, IAccountServiceForApplication, GetLastOpenedUser), + SFUNC(0x5, IAccountServiceForApplication, GetProfile), + SFUNC(0x64, IAccountServiceForApplication, InitializeApplicationInfoV0), + SFUNC(0x65, IAccountServiceForApplication, GetBaasAccountManagerForApplication) + ) }; } namespace constant { constexpr service::account::UserId DefaultUserId = {0x0000000000000001, 0x0000000000000000}; //!< The default user ID } -} \ No newline at end of file +} diff --git a/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp b/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp index 14da079f..d98cef7b 100644 --- a/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp +++ b/app/src/main/cpp/skyline/services/account/IManagerForApplication.cpp @@ -4,6 +4,5 @@ #include "IManagerForApplication.h" namespace skyline::service::account { - IManagerForApplication::IManagerForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + IManagerForApplication::IManagerForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/account/IProfile.cpp b/app/src/main/cpp/skyline/services/account/IProfile.cpp index d66fd10d..824368b9 100644 --- a/app/src/main/cpp/skyline/services/account/IProfile.cpp +++ b/app/src/main/cpp/skyline/services/account/IProfile.cpp @@ -5,10 +5,7 @@ #include "IProfile.h" namespace skyline::service::account { - IProfile::IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId) : userId(userId), BaseService(state, manager, { - {0x0, SFUNC(IProfile::Get)}, - {0x1, SFUNC(IProfile::GetBase)} - }) {} + IProfile::IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId) : userId(userId), BaseService(state, manager) {} Result IProfile::Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { struct AccountUserData { diff --git a/app/src/main/cpp/skyline/services/account/IProfile.h b/app/src/main/cpp/skyline/services/account/IProfile.h index 80f3220b..f20200ce 100644 --- a/app/src/main/cpp/skyline/services/account/IProfile.h +++ b/app/src/main/cpp/skyline/services/account/IProfile.h @@ -27,5 +27,10 @@ namespace skyline::service::account { * @brief This returns an AccountProfileBase object that describe the user's information */ Result GetBase(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IProfile, Get), + SFUNC(0x1, IProfile, GetBase) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.cpp b/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.cpp index fb96f1d7..ebf445d2 100644 --- a/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.cpp +++ b/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.cpp @@ -8,13 +8,7 @@ #include "IAllSystemAppletProxiesService.h" namespace skyline::service::am { - IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x64, SFUNC(IAllSystemAppletProxiesService::OpenSystemAppletProxy)}, - {0xC8, SFUNC(IAllSystemAppletProxiesService::OpenLibraryAppletProxy)}, - {0xC9, SFUNC(IAllSystemAppletProxiesService::OpenLibraryAppletProxy)}, - {0x12C, SFUNC(IAllSystemAppletProxiesService::OpenOverlayAppletProxy)}, - {0x15E, SFUNC(IAllSystemAppletProxiesService::OpenApplicationProxy)} - }) {} + IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(ILibraryAppletProxy), session, response); diff --git a/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.h b/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.h index 326e7a4b..b5a4335f 100644 --- a/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.h +++ b/app/src/main/cpp/skyline/services/am/IAllSystemAppletProxiesService.h @@ -33,5 +33,13 @@ namespace skyline::service::am { * @brief This returns #ISystemAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenSystemAppletProxy) */ Result OpenSystemAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x64, IAllSystemAppletProxiesService, OpenSystemAppletProxy), + SFUNC(0xC8, IAllSystemAppletProxiesService, OpenLibraryAppletProxy), + SFUNC(0xC9, IAllSystemAppletProxiesService, OpenLibraryAppletProxy), + SFUNC(0x12C, IAllSystemAppletProxiesService, OpenOverlayAppletProxy), + SFUNC(0x15E, IAllSystemAppletProxiesService, OpenApplicationProxy) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/IApplicationProxyService.cpp b/app/src/main/cpp/skyline/services/am/IApplicationProxyService.cpp index d5924077..6880522c 100644 --- a/app/src/main/cpp/skyline/services/am/IApplicationProxyService.cpp +++ b/app/src/main/cpp/skyline/services/am/IApplicationProxyService.cpp @@ -5,9 +5,7 @@ #include "IApplicationProxyService.h" namespace skyline::service::am { - IApplicationProxyService::IApplicationProxyService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IApplicationProxyService::OpenApplicationProxy)} - }) {} + IApplicationProxyService::IApplicationProxyService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IApplicationProxyService::OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IApplicationProxy), session, response); diff --git a/app/src/main/cpp/skyline/services/am/IApplicationProxyService.h b/app/src/main/cpp/skyline/services/am/IApplicationProxyService.h index dff00d05..e4320b95 100644 --- a/app/src/main/cpp/skyline/services/am/IApplicationProxyService.h +++ b/app/src/main/cpp/skyline/services/am/IApplicationProxyService.h @@ -18,5 +18,9 @@ namespace skyline::service::am { * @brief This returns #IApplicationProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenApplicationProxy) */ Result OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IApplicationProxyService, OpenApplicationProxy) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.cpp b/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.cpp index 2c057c48..b34e8976 100644 --- a/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.cpp +++ b/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.cpp @@ -7,13 +7,7 @@ #include "ILibraryAppletAccessor.h" namespace skyline::service::am { - ILibraryAppletAccessor::ILibraryAppletAccessor(const DeviceState &state, ServiceManager &manager) : stateChangeEvent(std::make_shared(state)), BaseService(state, manager, { - {0x0, SFUNC(ILibraryAppletAccessor::GetAppletStateChangedEvent)}, - {0xA, SFUNC(ILibraryAppletAccessor::Start)}, - {0x1E, SFUNC(ILibraryAppletAccessor::GetResult)}, - {0x64, SFUNC(ILibraryAppletAccessor::PushInData)}, - {0x65, SFUNC(ILibraryAppletAccessor::PopOutData)}, - }) {} + ILibraryAppletAccessor::ILibraryAppletAccessor(const DeviceState &state, ServiceManager &manager) : stateChangeEvent(std::make_shared(state)), BaseService(state, manager) {} Result ILibraryAppletAccessor::GetAppletStateChangedEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { stateChangeEvent->Signal(); diff --git a/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.h b/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.h index 97c5ceb9..85408e79 100644 --- a/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.h +++ b/app/src/main/cpp/skyline/services/am/applet/ILibraryAppletAccessor.h @@ -42,5 +42,13 @@ namespace skyline::service::am { * @brief This function receives data from the library applet (https://switchbrew.org/wiki/Applet_Manager_services#PopOutData) */ Result PopOutData(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ILibraryAppletAccessor, GetAppletStateChangedEvent), + SFUNC(0xA, ILibraryAppletAccessor, Start), + SFUNC(0x1E, ILibraryAppletAccessor, GetResult), + SFUNC(0x64, ILibraryAppletAccessor, PushInData), + SFUNC(0x65, ILibraryAppletAccessor, PopOutData) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/controller/IAppletCommonFunctions.cpp b/app/src/main/cpp/skyline/services/am/controller/IAppletCommonFunctions.cpp index 954a67e5..5a0c7c40 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IAppletCommonFunctions.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IAppletCommonFunctions.cpp @@ -4,6 +4,5 @@ #include "IAppletCommonFunctions.h" namespace skyline::service::am { - IAppletCommonFunctions::IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + IAppletCommonFunctions::IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp index 6a9d9a6a..c9b0d930 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp @@ -7,17 +7,7 @@ #include "IApplicationFunctions.h" namespace skyline::service::am { - IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : gpuErrorEvent(std::make_shared(state)), BaseService(state, manager, { - {0x1, SFUNC(IApplicationFunctions::PopLaunchParameter)}, - {0x14, SFUNC(IApplicationFunctions::EnsureSaveData)}, - {0x15, SFUNC(IApplicationFunctions::GetDesiredLanguage)}, - {0x28, SFUNC(IApplicationFunctions::NotifyRunning)}, - {0x32, SFUNC(IApplicationFunctions::GetPseudoDeviceId)}, - {0x42, SFUNC(IApplicationFunctions::InitializeGamePlayRecording)}, - {0x43, SFUNC(IApplicationFunctions::SetGamePlayRecordingState)}, - {0x64, SFUNC(IApplicationFunctions::SetGamePlayRecordingState)}, - {0x82, SFUNC(IApplicationFunctions::GetGpuErrorDetectedSystemEvent)}, - }) {} + IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : gpuErrorEvent(std::make_shared(state)), BaseService(state, manager) {} Result IApplicationFunctions::PopLaunchParameter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { constexpr u32 LaunchParameterMagic = 0xC79497CA; //!< This is the magic of the application launch parameters diff --git a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h index 35eddf3e..7c679964 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h +++ b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h @@ -57,5 +57,17 @@ namespace skyline::service::am { * @brief This obtains a handle to the system GPU error KEvent (https://switchbrew.org/wiki/Applet_Manager_services#GetGpuErrorDetectedSystemEvent) */ Result GetGpuErrorDetectedSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x1, IApplicationFunctions, PopLaunchParameter), + SFUNC(0x14, IApplicationFunctions, EnsureSaveData), + SFUNC(0x15, IApplicationFunctions, GetDesiredLanguage), + SFUNC(0x28, IApplicationFunctions, NotifyRunning), + SFUNC(0x32, IApplicationFunctions, GetPseudoDeviceId), + SFUNC(0x42, IApplicationFunctions, InitializeGamePlayRecording), + SFUNC(0x43, IApplicationFunctions, SetGamePlayRecordingState), + SFUNC(0x64, IApplicationFunctions, SetGamePlayRecordingState), + SFUNC(0x82, IApplicationFunctions, GetGpuErrorDetectedSystemEvent) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/controller/IAudioController.cpp b/app/src/main/cpp/skyline/services/am/controller/IAudioController.cpp index d1e094b5..fa84eba0 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IAudioController.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IAudioController.cpp @@ -4,11 +4,7 @@ #include "IAudioController.h" namespace skyline::service::am { - IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IAudioController::SetExpectedMasterVolume)}, - {0x1, SFUNC(IAudioController::GetMainAppletExpectedMasterVolume)}, - {0x2, SFUNC(IAudioController::GetLibraryAppletExpectedMasterVolume)} - }) {} + IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IAudioController::SetExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { mainAppletVolume = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/am/controller/IAudioController.h b/app/src/main/cpp/skyline/services/am/controller/IAudioController.h index df035f74..d4bca4e4 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IAudioController.h +++ b/app/src/main/cpp/skyline/services/am/controller/IAudioController.h @@ -32,5 +32,11 @@ namespace skyline::service::am { * @brief This returns the library applet volume that is expected by the application (https://switchbrew.org/wiki/Applet_Manager_services#GetLibraryAppletExpectedMasterVolume) */ Result GetLibraryAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAudioController, SetExpectedMasterVolume), + SFUNC(0x1, IAudioController, GetMainAppletExpectedMasterVolume), + SFUNC(0x2, IAudioController, GetLibraryAppletExpectedMasterVolume) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.cpp b/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.cpp index ba6c9025..466408f9 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.cpp @@ -10,14 +10,7 @@ namespace skyline::service::am { messageEvent->Signal(); } - ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager &manager) : messageEvent(std::make_shared(state)), BaseService(state, manager, { - {0x0, SFUNC(ICommonStateGetter::GetEventHandle)}, - {0x1, SFUNC(ICommonStateGetter::ReceiveMessage)}, - {0x5, SFUNC(ICommonStateGetter::GetOperationMode)}, - {0x6, SFUNC(ICommonStateGetter::GetPerformanceMode)}, - {0x9, SFUNC(ICommonStateGetter::GetCurrentFocusState)}, - {0x3C, SFUNC(ICommonStateGetter::GetDefaultDisplayResolution)} - }) { + ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager &manager) : messageEvent(std::make_shared(state)), BaseService(state, manager) { operationMode = static_cast(state.settings->GetBool("operation_mode")); state.logger->Info("Switch to mode: {}", static_cast(operationMode) ? "Docked" : "Handheld"); QueueMessage(Message::FocusStateChange); diff --git a/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.h b/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.h index a83af24d..4746305f 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.h +++ b/app/src/main/cpp/skyline/services/am/controller/ICommonStateGetter.h @@ -83,5 +83,14 @@ namespace skyline::service::am { * @brief This returns the current display width and height in two u32s (https://switchbrew.org/wiki/Applet_Manager_services#GetDefaultDisplayResolution) */ Result GetDefaultDisplayResolution(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ICommonStateGetter, GetEventHandle), + SFUNC(0x1, ICommonStateGetter, ReceiveMessage), + SFUNC(0x5, ICommonStateGetter, GetOperationMode), + SFUNC(0x6, ICommonStateGetter, GetPerformanceMode), + SFUNC(0x9, ICommonStateGetter, GetCurrentFocusState), + SFUNC(0x3C, ICommonStateGetter, GetDefaultDisplayResolution) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/controller/IDebugFunctions.cpp b/app/src/main/cpp/skyline/services/am/controller/IDebugFunctions.cpp index 078fc25c..a3d91cb1 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IDebugFunctions.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IDebugFunctions.cpp @@ -4,6 +4,5 @@ #include "IDebugFunctions.h" namespace skyline::service::am { - IDebugFunctions::IDebugFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + IDebugFunctions::IDebugFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/am/controller/IDisplayController.cpp b/app/src/main/cpp/skyline/services/am/controller/IDisplayController.cpp index 4c179952..98e8aabc 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IDisplayController.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IDisplayController.cpp @@ -4,6 +4,5 @@ #include "IDisplayController.h" namespace skyline::service::am { - IDisplayController::IDisplayController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + IDisplayController::IDisplayController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.cpp b/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.cpp index 3f48496e..4b59fb4f 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.cpp @@ -6,10 +6,7 @@ #include "ILibraryAppletCreator.h" namespace skyline::service::am { - ILibraryAppletCreator::ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(ILibraryAppletCreator::CreateLibraryApplet)}, - {0xA, SFUNC(ILibraryAppletCreator::CreateStorage)} - }) {} + ILibraryAppletCreator::ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result ILibraryAppletCreator::CreateLibraryApplet(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(ILibraryAppletAccessor), session, response); diff --git a/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.h b/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.h index b576a7de..e9849bcd 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.h +++ b/app/src/main/cpp/skyline/services/am/controller/ILibraryAppletCreator.h @@ -23,5 +23,10 @@ namespace skyline::service::am { * @brief This function creates an IStorage that can be used by the application (https://switchbrew.org/wiki/Applet_Manager_services#CreateStorage) */ Result CreateStorage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ILibraryAppletCreator, CreateLibraryApplet), + SFUNC(0xA, ILibraryAppletCreator, CreateStorage) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/controller/ISelfController.cpp b/app/src/main/cpp/skyline/services/am/controller/ISelfController.cpp index d96beb6a..12da4f8a 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ISelfController.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/ISelfController.cpp @@ -6,18 +6,7 @@ #include "ISelfController.h" namespace skyline::service::am { - ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared(state)), accumulatedSuspendedTickChangedEvent(std::make_shared(state)), BaseService(state, manager, { - {0x1, SFUNC(ISelfController::LockExit)}, - {0x2, SFUNC(ISelfController::UnlockExit)}, - {0x9, SFUNC(ISelfController::GetLibraryAppletLaunchableEvent)}, - {0xB, SFUNC(ISelfController::SetOperationModeChangedNotification)}, - {0xC, SFUNC(ISelfController::SetPerformanceModeChangedNotification)}, - {0xD, SFUNC(ISelfController::SetFocusHandlingMode)}, - {0xE, SFUNC(ISelfController::SetRestartMessageEnabled)}, - {0x10, SFUNC(ISelfController::SetOutOfFocusSuspendingEnabled)}, - {0x28, SFUNC(ISelfController::CreateManagedDisplayLayer)}, - {0x5B, SFUNC(ISelfController::GetLibraryAppletLaunchableEvent)} - }) {} + ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared(state)), accumulatedSuspendedTickChangedEvent(std::make_shared(state)), BaseService(state, manager) {} Result ISelfController::LockExit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; diff --git a/app/src/main/cpp/skyline/services/am/controller/ISelfController.h b/app/src/main/cpp/skyline/services/am/controller/ISelfController.h index 2dd25d9a..0a7f6ef9 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ISelfController.h +++ b/app/src/main/cpp/skyline/services/am/controller/ISelfController.h @@ -67,5 +67,18 @@ namespace skyline::service::am { * @brief This obtains a handle to the system sleep time change KEvent (https://switchbrew.org/wiki/Applet_Manager_services#GetAccumulatedSuspendedTickChangedEvent) */ Result GetAccumulatedSuspendedTickChangedEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x1, ISelfController, LockExit), + SFUNC(0x2, ISelfController, UnlockExit), + SFUNC(0x9, ISelfController, GetLibraryAppletLaunchableEvent), + SFUNC(0xB, ISelfController, SetOperationModeChangedNotification), + SFUNC(0xC, ISelfController, SetPerformanceModeChangedNotification), + SFUNC(0xD, ISelfController, SetFocusHandlingMode), + SFUNC(0xE, ISelfController, SetRestartMessageEnabled), + SFUNC(0x10, ISelfController, SetOutOfFocusSuspendingEnabled), + SFUNC(0x28, ISelfController, CreateManagedDisplayLayer), + SFUNC(0x5B, ISelfController, GetLibraryAppletLaunchableEvent) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/controller/IWindowController.cpp b/app/src/main/cpp/skyline/services/am/controller/IWindowController.cpp index 34080633..0e8b16b2 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IWindowController.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IWindowController.cpp @@ -5,10 +5,7 @@ #include "IWindowController.h" namespace skyline::service::am { - IWindowController::IWindowController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x1, SFUNC(IWindowController::GetAppletResourceUserId)}, - {0xA, SFUNC(IWindowController::AcquireForegroundRights)} - }) {} + IWindowController::IWindowController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IWindowController::GetAppletResourceUserId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { response.Push(static_cast(state.process->pid)); diff --git a/app/src/main/cpp/skyline/services/am/controller/IWindowController.h b/app/src/main/cpp/skyline/services/am/controller/IWindowController.h index 4205885b..d3a20957 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IWindowController.h +++ b/app/src/main/cpp/skyline/services/am/controller/IWindowController.h @@ -23,5 +23,10 @@ namespace skyline::service::am { * @brief This function has mo inputs or outputs (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#AcquireForegroundRights) */ Result AcquireForegroundRights(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x1, IWindowController, GetAppletResourceUserId), + SFUNC(0xA, IWindowController, AcquireForegroundRights) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.cpp b/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.cpp index 45674e76..a52c536c 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.cpp +++ b/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.cpp @@ -5,16 +5,7 @@ #include "IApplicationProxy.h" namespace skyline::service::am { - IApplicationProxy::IApplicationProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, { - {0x0, SFUNC(BaseProxy::GetCommonStateGetter)}, - {0x1, SFUNC(BaseProxy::GetSelfController)}, - {0x2, SFUNC(BaseProxy::GetWindowController)}, - {0x3, SFUNC(BaseProxy::GetAudioController)}, - {0x4, SFUNC(BaseProxy::GetDisplayController)}, - {0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)}, - {0x14, SFUNC(IApplicationProxy::GetApplicationFunctions)}, - {0x3E8, SFUNC(BaseProxy::GetDebugFunctions)} - }) {} + IApplicationProxy::IApplicationProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {} Result IApplicationProxy::GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IApplicationFunctions), session, response); diff --git a/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.h b/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.h index b999fb1a..e7602fe4 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.h +++ b/app/src/main/cpp/skyline/services/am/proxy/IApplicationProxy.h @@ -17,5 +17,19 @@ namespace skyline::service::am { * @brief This returns #IApplicationFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions) */ Result GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + //#undef SFUNC_BASE + //#define SFUNC_BASE(id, Class, BaseClass, Function) std::pair, std::string_view>>{id, {&CallBaseFunction, #Function}} + + SERVICE_DECL( + SFUNC_BASE(0x0, IApplicationProxy, BaseProxy, GetCommonStateGetter), + SFUNC_BASE(0x1, IApplicationProxy, BaseProxy, GetSelfController), + SFUNC_BASE(0x2, IApplicationProxy, BaseProxy, GetWindowController), + SFUNC_BASE(0x3, IApplicationProxy, BaseProxy, GetAudioController), + SFUNC_BASE(0x4, IApplicationProxy, BaseProxy, GetDisplayController), + SFUNC_BASE(0xB, IApplicationProxy, BaseProxy, GetLibraryAppletCreator), + SFUNC(0x14, IApplicationProxy, GetApplicationFunctions), + SFUNC_BASE(0x3E8, IApplicationProxy, BaseProxy, GetDebugFunctions) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.cpp b/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.cpp index 4bf624bb..da40f6f8 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.cpp +++ b/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.cpp @@ -4,13 +4,5 @@ #include "ILibraryAppletProxy.h" namespace skyline::service::am { - ILibraryAppletProxy::ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, { - {0x0, SFUNC(BaseProxy::GetCommonStateGetter)}, - {0x1, SFUNC(BaseProxy::GetSelfController)}, - {0x2, SFUNC(BaseProxy::GetWindowController)}, - {0x3, SFUNC(BaseProxy::GetAudioController)}, - {0x4, SFUNC(BaseProxy::GetDisplayController)}, - {0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)}, - {0x3E8, SFUNC(BaseProxy::GetDebugFunctions)} - }) {} + ILibraryAppletProxy::ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.h b/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.h index 9beb9b50..8c0f3e1a 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.h +++ b/app/src/main/cpp/skyline/services/am/proxy/ILibraryAppletProxy.h @@ -12,5 +12,15 @@ namespace skyline::service::am { class ILibraryAppletProxy : public BaseProxy { public: ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager); + + SERVICE_DECL( + SFUNC(0x0, BaseProxy, GetCommonStateGetter), + SFUNC(0x1, BaseProxy, GetSelfController), + SFUNC(0x2, BaseProxy, GetWindowController), + SFUNC(0x3, BaseProxy, GetAudioController), + SFUNC(0x4, BaseProxy, GetDisplayController), + SFUNC(0xB, BaseProxy, GetLibraryAppletCreator), + SFUNC(0x3E8, BaseProxy, GetDebugFunctions) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.cpp b/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.cpp index c181d2f4..94091fc2 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.cpp +++ b/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.cpp @@ -4,14 +4,5 @@ #include "IOverlayAppletProxy.h" namespace skyline::service::am { - IOverlayAppletProxy::IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, { - {0x0, SFUNC(BaseProxy::GetCommonStateGetter)}, - {0x1, SFUNC(BaseProxy::GetSelfController)}, - {0x2, SFUNC(BaseProxy::GetWindowController)}, - {0x3, SFUNC(BaseProxy::GetAudioController)}, - {0x4, SFUNC(BaseProxy::GetDisplayController)}, - {0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)}, - {0x15, SFUNC(BaseProxy::GetAppletCommonFunctions)}, - {0x3E8, SFUNC(BaseProxy::GetDebugFunctions)} - }) {} + IOverlayAppletProxy::IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.h b/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.h index fd8d68ba..ec10a43b 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.h +++ b/app/src/main/cpp/skyline/services/am/proxy/IOverlayAppletProxy.h @@ -12,5 +12,16 @@ namespace skyline::service::am { class IOverlayAppletProxy : public BaseProxy { public: IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager); + + SERVICE_DECL( + SFUNC(0x0, BaseProxy, GetCommonStateGetter), + SFUNC(0x1, BaseProxy, GetSelfController), + SFUNC(0x2, BaseProxy, GetWindowController), + SFUNC(0x3, BaseProxy, GetAudioController), + SFUNC(0x4, BaseProxy, GetDisplayController), + SFUNC(0xB, BaseProxy, GetLibraryAppletCreator), + SFUNC(0x15, BaseProxy, GetAppletCommonFunctions), + SFUNC(0x3E8, BaseProxy, GetDebugFunctions) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.cpp b/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.cpp index d3fa68d4..8eba9282 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.cpp +++ b/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.cpp @@ -4,14 +4,5 @@ #include "ISystemAppletProxy.h" namespace skyline::service::am { - ISystemAppletProxy::ISystemAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, { - {0x0, SFUNC(BaseProxy::GetCommonStateGetter)}, - {0x1, SFUNC(BaseProxy::GetSelfController)}, - {0x2, SFUNC(BaseProxy::GetWindowController)}, - {0x3, SFUNC(BaseProxy::GetAudioController)}, - {0x4, SFUNC(BaseProxy::GetDisplayController)}, - {0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)}, - {0x17, SFUNC(BaseProxy::GetAppletCommonFunctions)}, - {0x3E8, SFUNC(BaseProxy::GetDebugFunctions)} - }) {} + ISystemAppletProxy::ISystemAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.h b/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.h index 4922eee9..0be48e79 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.h +++ b/app/src/main/cpp/skyline/services/am/proxy/ISystemAppletProxy.h @@ -12,5 +12,16 @@ namespace skyline::service::am { class ISystemAppletProxy : public BaseProxy { public: ISystemAppletProxy(const DeviceState &state, ServiceManager &manager); + + SERVICE_DECL( + SFUNC(0x0, BaseProxy, GetCommonStateGetter), + SFUNC(0x1, BaseProxy, GetSelfController), + SFUNC(0x2, BaseProxy, GetWindowController), + SFUNC(0x3, BaseProxy, GetAudioController), + SFUNC(0x4, BaseProxy, GetDisplayController), + SFUNC(0xB, BaseProxy, GetLibraryAppletCreator), + SFUNC(0x17, BaseProxy, GetAppletCommonFunctions), + SFUNC(0x3E8, BaseProxy, GetDebugFunctions) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/proxy/base_proxy.cpp b/app/src/main/cpp/skyline/services/am/proxy/base_proxy.cpp index f17a1b02..929829af 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/base_proxy.cpp +++ b/app/src/main/cpp/skyline/services/am/proxy/base_proxy.cpp @@ -12,7 +12,7 @@ #include "base_proxy.h" namespace skyline::service::am { - BaseProxy::BaseProxy(const DeviceState &state, ServiceManager &manager, const std::unordered_map> &vTable) : BaseService(state, manager, vTable) {} + BaseProxy::BaseProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result BaseProxy::GetCommonStateGetter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(ICommonStateGetter), session, response); diff --git a/app/src/main/cpp/skyline/services/am/proxy/base_proxy.h b/app/src/main/cpp/skyline/services/am/proxy/base_proxy.h index bf5a44a0..8aeabbb3 100644 --- a/app/src/main/cpp/skyline/services/am/proxy/base_proxy.h +++ b/app/src/main/cpp/skyline/services/am/proxy/base_proxy.h @@ -12,7 +12,7 @@ namespace skyline::service::am { */ class BaseProxy : public BaseService { public: - BaseProxy(const DeviceState &state, ServiceManager &manager, const std::unordered_map> &vTable); + BaseProxy(const DeviceState &state, ServiceManager &manager); /** * @brief This returns #ICommonStateGetter (https://switchbrew.org/wiki/Applet_Manager_services#ICommonStateGetter) diff --git a/app/src/main/cpp/skyline/services/am/storage/IStorage.cpp b/app/src/main/cpp/skyline/services/am/storage/IStorage.cpp index 76dd00e9..d9c57018 100644 --- a/app/src/main/cpp/skyline/services/am/storage/IStorage.cpp +++ b/app/src/main/cpp/skyline/services/am/storage/IStorage.cpp @@ -5,9 +5,7 @@ #include "IStorage.h" namespace skyline::service::am { - IStorage::IStorage(const DeviceState &state, ServiceManager &manager, size_t size) : content(size), BaseService(state, manager, { - {0x0, SFUNC(IStorage::Open)} - }) {} + IStorage::IStorage(const DeviceState &state, ServiceManager &manager, size_t size) : content(size), BaseService(state, manager) {} Result IStorage::Open(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(std::make_shared(state, manager, shared_from_this()), session, response); diff --git a/app/src/main/cpp/skyline/services/am/storage/IStorage.h b/app/src/main/cpp/skyline/services/am/storage/IStorage.h index a37130b6..09c14891 100644 --- a/app/src/main/cpp/skyline/services/am/storage/IStorage.h +++ b/app/src/main/cpp/skyline/services/am/storage/IStorage.h @@ -37,5 +37,9 @@ namespace skyline::service::am { std::memcpy(content.data() + offset, reinterpret_cast(&value), sizeof(ValueType)); offset += sizeof(ValueType); } + + SERVICE_DECL( + SFUNC(0x0, IStorage, Open) + ) }; } diff --git a/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.cpp b/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.cpp index 49e42982..5bd619e9 100644 --- a/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.cpp +++ b/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.cpp @@ -6,11 +6,7 @@ #include "IStorageAccessor.h" namespace skyline::service::am { - IStorageAccessor::IStorageAccessor(const DeviceState &state, ServiceManager &manager, std::shared_ptr parent) : parent(parent), BaseService(state, manager, { - {0x0, SFUNC(IStorageAccessor::GetSize)}, - {0xA, SFUNC(IStorageAccessor::Write)}, - {0xB, SFUNC(IStorageAccessor::Read)} - }) {} + IStorageAccessor::IStorageAccessor(const DeviceState &state, ServiceManager &manager, std::shared_ptr parent) : parent(parent), BaseService(state, manager) {} Result IStorageAccessor::GetSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { response.Push(parent->content.size()); diff --git a/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.h b/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.h index 65fe387d..b94822a4 100644 --- a/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.h +++ b/app/src/main/cpp/skyline/services/am/storage/IStorageAccessor.h @@ -36,5 +36,11 @@ namespace skyline::service::am { * @brief This returns a buffer containing the contents of the storage at the specified offset */ Result Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IStorageAccessor, GetSize), + SFUNC(0xA, IStorageAccessor, Write), + SFUNC(0xB, IStorageAccessor, Read) + ) }; } diff --git a/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp b/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp index 461507d5..6be8201e 100644 --- a/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp +++ b/app/src/main/cpp/skyline/services/aocsrv/IAddOnContentManager.cpp @@ -4,6 +4,5 @@ #include "IAddOnContentManager.h" namespace skyline::service::aocsrv { - IAddOnContentManager::IAddOnContentManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + IAddOnContentManager::IAddOnContentManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/apm/IManager.cpp b/app/src/main/cpp/skyline/services/apm/IManager.cpp index 97fa9dd6..456ccc58 100644 --- a/app/src/main/cpp/skyline/services/apm/IManager.cpp +++ b/app/src/main/cpp/skyline/services/apm/IManager.cpp @@ -5,9 +5,7 @@ #include "IManager.h" namespace skyline::service::apm { - IManager::IManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IManager::OpenSession)} - }) {} + IManager::IManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IManager::OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(ISession), session, response); diff --git a/app/src/main/cpp/skyline/services/apm/IManager.h b/app/src/main/cpp/skyline/services/apm/IManager.h index ec337a1d..aad8fbb1 100644 --- a/app/src/main/cpp/skyline/services/apm/IManager.h +++ b/app/src/main/cpp/skyline/services/apm/IManager.h @@ -18,5 +18,9 @@ namespace skyline::service::apm { * @brief This returns an handle to ISession */ Result OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IManager, OpenSession) + ) }; } diff --git a/app/src/main/cpp/skyline/services/apm/ISession.cpp b/app/src/main/cpp/skyline/services/apm/ISession.cpp index 821825da..cfb4333f 100644 --- a/app/src/main/cpp/skyline/services/apm/ISession.cpp +++ b/app/src/main/cpp/skyline/services/apm/ISession.cpp @@ -4,10 +4,7 @@ #include "ISession.h" namespace skyline::service::apm { - ISession::ISession(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(ISession::SetPerformanceConfiguration)}, - {0x1, SFUNC(ISession::GetPerformanceConfiguration)} - }) {} + ISession::ISession(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result ISession::SetPerformanceConfiguration(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { auto mode = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/apm/ISession.h b/app/src/main/cpp/skyline/services/apm/ISession.h index 09832535..070f4a64 100644 --- a/app/src/main/cpp/skyline/services/apm/ISession.h +++ b/app/src/main/cpp/skyline/services/apm/ISession.h @@ -26,5 +26,10 @@ namespace skyline::service::apm { * @brief This retrieves the particular performanceConfig for a mode and returns it to the client (https://switchbrew.org/wiki/PPC_services#SetPerformanceConfiguration) */ Result GetPerformanceConfiguration(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ISession, SetPerformanceConfiguration), + SFUNC(0x1, ISession, GetPerformanceConfiguration) + ) }; } diff --git a/app/src/main/cpp/skyline/services/audio/IAudioDevice.cpp b/app/src/main/cpp/skyline/services/audio/IAudioDevice.cpp index 72877362..ce6319ca 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioDevice.cpp +++ b/app/src/main/cpp/skyline/services/audio/IAudioDevice.cpp @@ -6,16 +6,7 @@ #include "IAudioDevice.h" namespace skyline::service::audio { - IAudioDevice::IAudioDevice(const DeviceState &state, ServiceManager &manager) : systemEvent(std::make_shared(state)), BaseService(state, manager, { - {0x0, SFUNC(IAudioDevice::ListAudioDeviceName)}, - {0x1, SFUNC(IAudioDevice::SetAudioDeviceOutputVolume)}, - {0x3, SFUNC(IAudioDevice::GetActiveAudioDeviceName)}, - {0x4, SFUNC(IAudioDevice::QueryAudioDeviceSystemEvent)}, - {0x5, SFUNC(IAudioDevice::GetActiveChannelCount)}, - {0x6, SFUNC(IAudioDevice::ListAudioDeviceName)}, - {0x7, SFUNC(IAudioDevice::SetAudioDeviceOutputVolume)}, - {0xA, SFUNC(IAudioDevice::GetActiveAudioDeviceName)} - }) {} + IAudioDevice::IAudioDevice(const DeviceState &state, ServiceManager &manager) : systemEvent(std::make_shared(state)), BaseService(state, manager) {} Result IAudioDevice::ListAudioDeviceName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { u64 offset{}; diff --git a/app/src/main/cpp/skyline/services/audio/IAudioDevice.h b/app/src/main/cpp/skyline/services/audio/IAudioDevice.h index eaae823f..e74242b8 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioDevice.h +++ b/app/src/main/cpp/skyline/services/audio/IAudioDevice.h @@ -41,5 +41,16 @@ namespace skyline::service::audio { * @brief This returns the current output devices channel count */ Result GetActiveChannelCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAudioDevice, ListAudioDeviceName), + SFUNC(0x1, IAudioDevice, SetAudioDeviceOutputVolume), + SFUNC(0x3, IAudioDevice, GetActiveAudioDeviceName), + SFUNC(0x4, IAudioDevice, QueryAudioDeviceSystemEvent), + SFUNC(0x5, IAudioDevice, GetActiveChannelCount), + SFUNC(0x6, IAudioDevice, ListAudioDeviceName), + SFUNC(0x7, IAudioDevice, SetAudioDeviceOutputVolume), + SFUNC(0xA, IAudioDevice, GetActiveAudioDeviceName) + ) }; } diff --git a/app/src/main/cpp/skyline/services/audio/IAudioOut.cpp b/app/src/main/cpp/skyline/services/audio/IAudioOut.cpp index d946dc60..244c83e4 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioOut.cpp +++ b/app/src/main/cpp/skyline/services/audio/IAudioOut.cpp @@ -5,17 +5,7 @@ #include "IAudioOut.h" namespace skyline::service::audio { - IAudioOut::IAudioOut(const DeviceState &state, ServiceManager &manager, u8 channelCount, u32 sampleRate) : sampleRate(sampleRate), channelCount(channelCount), releaseEvent(std::make_shared(state)), BaseService(state, manager, { - {0x0, SFUNC(IAudioOut::GetAudioOutState)}, - {0x1, SFUNC(IAudioOut::StartAudioOut)}, - {0x2, SFUNC(IAudioOut::StopAudioOut)}, - {0x3, SFUNC(IAudioOut::AppendAudioOutBuffer)}, - {0x4, SFUNC(IAudioOut::RegisterBufferEvent)}, - {0x5, SFUNC(IAudioOut::GetReleasedAudioOutBuffer)}, - {0x6, SFUNC(IAudioOut::ContainsAudioOutBuffer)}, - {0x7, SFUNC(IAudioOut::AppendAudioOutBuffer)}, - {0x8, SFUNC(IAudioOut::GetReleasedAudioOutBuffer)} - }) { + IAudioOut::IAudioOut(const DeviceState &state, ServiceManager &manager, u8 channelCount, u32 sampleRate) : sampleRate(sampleRate), channelCount(channelCount), releaseEvent(std::make_shared(state)), BaseService(state, manager) { track = state.audio->OpenTrack(channelCount, constant::SampleRate, [this]() { this->releaseEvent->Signal(); }); } diff --git a/app/src/main/cpp/skyline/services/audio/IAudioOut.h b/app/src/main/cpp/skyline/services/audio/IAudioOut.h index bb2118dd..a849d8a9 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioOut.h +++ b/app/src/main/cpp/skyline/services/audio/IAudioOut.h @@ -68,5 +68,17 @@ namespace skyline::service::audio { * @brief Checks if the given buffer ID is in the playback queue (https://switchbrew.org/wiki/Audio_services#ContainsAudioOutBuffer) */ Result ContainsAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAudioOut, GetAudioOutState), + SFUNC(0x1, IAudioOut, StartAudioOut), + SFUNC(0x2, IAudioOut, StopAudioOut), + SFUNC(0x3, IAudioOut, AppendAudioOutBuffer), + SFUNC(0x4, IAudioOut, RegisterBufferEvent), + SFUNC(0x5, IAudioOut, GetReleasedAudioOutBuffer), + SFUNC(0x6, IAudioOut, ContainsAudioOutBuffer), + SFUNC(0x7, IAudioOut, AppendAudioOutBuffer), + SFUNC(0x8, IAudioOut, GetReleasedAudioOutBuffer) + ) }; } diff --git a/app/src/main/cpp/skyline/services/audio/IAudioOutManager.cpp b/app/src/main/cpp/skyline/services/audio/IAudioOutManager.cpp index bbf4fec5..5eee8de3 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioOutManager.cpp +++ b/app/src/main/cpp/skyline/services/audio/IAudioOutManager.cpp @@ -6,12 +6,7 @@ #include "IAudioOut.h" namespace skyline::service::audio { - IAudioOutManager::IAudioOutManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IAudioOutManager::ListAudioOuts)}, - {0x1, SFUNC(IAudioOutManager::OpenAudioOut)}, - {0x2, SFUNC(IAudioOutManager::ListAudioOuts)}, - {0x3, SFUNC(IAudioOutManager::OpenAudioOut)} - }) {} + IAudioOutManager::IAudioOutManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IAudioOutManager::ListAudioOuts(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { state.process->WriteMemory(reinterpret_cast(const_cast(constant::DefaultAudioOutName.data())), request.outputBuf.at(0).address, constant::DefaultAudioOutName.size()); diff --git a/app/src/main/cpp/skyline/services/audio/IAudioOutManager.h b/app/src/main/cpp/skyline/services/audio/IAudioOutManager.h index b96dcf21..fb2112cd 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioOutManager.h +++ b/app/src/main/cpp/skyline/services/audio/IAudioOutManager.h @@ -29,6 +29,13 @@ namespace skyline { * @brief Creates a new audoutU::IAudioOut object and returns a handle to it (https://switchbrew.org/wiki/Audio_services#OpenAudioOut) */ Result OpenAudioOut(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAudioOutManager, ListAudioOuts), + SFUNC(0x1, IAudioOutManager, OpenAudioOut), + SFUNC(0x2, IAudioOutManager, ListAudioOuts), + SFUNC(0x3, IAudioOutManager, OpenAudioOut) + ) }; } } diff --git a/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.cpp b/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.cpp index a8fffc72..4add5469 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.cpp +++ b/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.cpp @@ -6,17 +6,7 @@ namespace skyline::service::audio::IAudioRenderer { IAudioRenderer::IAudioRenderer(const DeviceState &state, ServiceManager &manager, AudioRendererParameters ¶meters) - : systemEvent(std::make_shared(state)), parameters(parameters), BaseService(state, manager, { - {0x0, SFUNC(IAudioRenderer::GetSampleRate)}, - {0x1, SFUNC(IAudioRenderer::GetSampleCount)}, - {0x2, SFUNC(IAudioRenderer::GetMixBufferCount)}, - {0x3, SFUNC(IAudioRenderer::GetState)}, - {0x4, SFUNC(IAudioRenderer::RequestUpdate)}, - {0x5, SFUNC(IAudioRenderer::Start)}, - {0x6, SFUNC(IAudioRenderer::Stop)}, - {0x7, SFUNC(IAudioRenderer::QuerySystemEvent)}, - {0xA, SFUNC(IAudioRenderer::RequestUpdate)}, - }) { + : systemEvent(std::make_shared(state)), parameters(parameters), BaseService(state, manager) { track = state.audio->OpenTrack(constant::ChannelCount, constant::SampleRate, []() {}); track->Start(); diff --git a/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.h b/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.h index 31398e0c..25ffbeac 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.h +++ b/app/src/main/cpp/skyline/services/audio/IAudioRenderer/IAudioRenderer.h @@ -134,6 +134,18 @@ namespace skyline { * @brief Returns a handle to the sample release KEvent */ Result QuerySystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAudioRenderer, GetSampleRate), + SFUNC(0x1, IAudioRenderer, GetSampleCount), + SFUNC(0x2, IAudioRenderer, GetMixBufferCount), + SFUNC(0x3, IAudioRenderer, GetState), + SFUNC(0x4, IAudioRenderer, RequestUpdate), + SFUNC(0x5, IAudioRenderer, Start), + SFUNC(0x6, IAudioRenderer, Stop), + SFUNC(0x7, IAudioRenderer, QuerySystemEvent), + SFUNC(0xA, IAudioRenderer, RequestUpdate) + ) }; } } diff --git a/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.cpp b/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.cpp index 20f96b91..8983b7c2 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.cpp +++ b/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.cpp @@ -7,12 +7,7 @@ #include "IAudioRendererManager.h" namespace skyline::service::audio { - IAudioRendererManager::IAudioRendererManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IAudioRendererManager::OpenAudioRenderer)}, - {0x1, SFUNC(IAudioRendererManager::GetAudioRendererWorkBufferSize)}, - {0x2, SFUNC(IAudioRendererManager::GetAudioDeviceService)}, - {0x4, SFUNC(IAudioRendererManager::GetAudioDeviceService)} - }) {} + IAudioRendererManager::IAudioRendererManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IAudioRendererManager::OpenAudioRenderer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { IAudioRenderer::AudioRendererParameters params = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.h b/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.h index a54e6827..6999d0df 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.h +++ b/app/src/main/cpp/skyline/services/audio/IAudioRendererManager.h @@ -28,5 +28,12 @@ namespace skyline::service::audio { * @brief This returns a handle to an instance of an IAudioDevice (https://switchbrew.org/wiki/Audio_services#GetAudioDeviceService) */ Result GetAudioDeviceService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAudioRendererManager, OpenAudioRenderer), + SFUNC(0x1, IAudioRendererManager, GetAudioRendererWorkBufferSize), + SFUNC(0x2, IAudioRendererManager, GetAudioDeviceService), + SFUNC(0x4, IAudioRendererManager, GetAudioDeviceService) + ) }; } diff --git a/app/src/main/cpp/skyline/services/base_service.cpp b/app/src/main/cpp/skyline/services/base_service.cpp new file mode 100644 index 00000000..3947299b --- /dev/null +++ b/app/src/main/cpp/skyline/services/base_service.cpp @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "base_service.h" + +namespace skyline::service { + const std::string &BaseService::GetName() { + if (name.empty()) { + auto mangledName = typeid(*this).name(); + + int status{}; + size_t length{}; + std::unique_ptr demangled{abi::__cxa_demangle(mangledName, nullptr, &length, &status), std::free}; + + name = (status == 0) ? std::string(demangled.get() + std::char_traits::length("skyline::service::")) : mangledName; + } + return name; + } + + Result service::BaseService::HandleRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + std::pair, std::string_view> function; + try { + function = GetServiceFunction(request.payload->value); + state.logger->Debug("Service: {} @ {}", function.second, GetName()); + } catch (const std::out_of_range &) { + state.logger->Warn("Cannot find function in service '{0}': 0x{1:X} ({1})", GetName(), static_cast(request.payload->value)); + return {}; + } + try { + return function.first(session, request, response); + } catch (const std::exception &e) { + throw exception("{} (Service: {} @ {})", e.what(), function.second, GetName()); + } + } +} diff --git a/app/src/main/cpp/skyline/services/base_service.h b/app/src/main/cpp/skyline/services/base_service.h index 80b6a568..315eacf8 100644 --- a/app/src/main/cpp/skyline/services/base_service.h +++ b/app/src/main/cpp/skyline/services/base_service.h @@ -8,8 +8,16 @@ #include #include -#define SFUNC(function) std::bind(&function, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3) -#define SRVREG(class) std::make_shared(state, manager) +#define SFUNC(id, Class, Function) std::pair, std::string_view>>{id, {&Class::Function, #Function}} +#define SFUNC_BASE(id, Class, BaseClass, Function) std::pair, std::string_view>>{id, {&CallBaseFunction, #Function}} +#define SERVICE_DECL_AUTO(name, value) decltype(value) name = value +#define SERVICE_DECL(...) \ +SERVICE_DECL_AUTO(functions, frz::make_unordered_map({__VA_ARGS__})); \ +std::pair, std::string_view> GetServiceFunction(u32 id) { \ + auto& function = functions.at(id); \ + return std::make_pair(std::bind(function.first, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), function.second); \ +} +#define SRVREG(class, ...) std::make_shared(state, manager, ##__VA_ARGS__) namespace skyline::kernel::type { class KSession; @@ -22,55 +30,48 @@ namespace skyline::service { class ServiceManager; /** - * @brief The BaseService class is a class for all Services to inherit from + * @brief The base class for all service interfaces hosted by sysmodules */ class BaseService { + private: + std::string name; //!< The name of the service + protected: const DeviceState &state; //!< The state of the device ServiceManager &manager; //!< A reference to the service manager - std::unordered_map> vTable; //!< This holds the mapping from a function's CmdId to the actual function + + template + static constexpr Result CallBaseFunction(Class* clazz, type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return (static_cast(clazz)->*BaseFunction)(session, request, response); + } public: /** * @param state The state of the device * @param vTable The functions of the service */ - BaseService(const DeviceState &state, ServiceManager &manager, const std::unordered_map> &vTable) : state(state), manager(manager), vTable(vTable) {} + BaseService(const DeviceState &state, ServiceManager &manager) : state(state), manager(manager) {} /** * @note To be able to extract the name of the underlying class and ensure correct destruction order */ virtual ~BaseService() = default; - std::string GetName() { - int status{}; - size_t length{}; - auto mangledName{typeid(*this).name()}; - - std::unique_ptr demangled{ abi::__cxa_demangle(mangledName, nullptr, &length, &status), std::free}; - - return (status == 0) ? std::string(demangled.get() + std::char_traits::length("skyline::service::")) : mangledName; + virtual std::pair, std::string_view> GetServiceFunction(u32 id) { + throw std::out_of_range("GetServiceFunction not implemented"); } + /** + * @return The name of the class + * @note The lifetime of the returned string is tied to that of the class + */ + const std::string &GetName(); + /** * @brief This handles all IPC commands with type request to a service * @param request The corresponding IpcRequest object * @param response The corresponding IpcResponse object */ - Result HandleRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { - std::function function; - try { - function = vTable.at(request.payload->value); - } catch (std::out_of_range &) { - state.logger->Warn("Cannot find function in service '{0}': 0x{1:X} ({1})", GetName(), static_cast(request.payload->value)); - return {}; - } - - try { - return function(session, request, response); - } catch (std::exception &e) { - throw exception("{} (Service: {})", e.what(), GetName()); - } - }; + Result HandleRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);; }; } diff --git a/app/src/main/cpp/skyline/services/fatalsrv/IService.cpp b/app/src/main/cpp/skyline/services/fatalsrv/IService.cpp index 873ebb9c..a81018b2 100644 --- a/app/src/main/cpp/skyline/services/fatalsrv/IService.cpp +++ b/app/src/main/cpp/skyline/services/fatalsrv/IService.cpp @@ -4,11 +4,7 @@ #include "IService.h" namespace skyline::service::fatalsrv { - IService::IService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IService::ThrowFatal)}, - {0x1, SFUNC(IService::ThrowFatal)}, - {0x2, SFUNC(IService::ThrowFatal)} - }) {} + IService::IService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IService::ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { throw exception("A fatal error with code: 0x{:X} has caused emulation to stop", request.Pop()); diff --git a/app/src/main/cpp/skyline/services/fatalsrv/IService.h b/app/src/main/cpp/skyline/services/fatalsrv/IService.h index 21d3f1be..1a760916 100644 --- a/app/src/main/cpp/skyline/services/fatalsrv/IService.h +++ b/app/src/main/cpp/skyline/services/fatalsrv/IService.h @@ -18,5 +18,11 @@ namespace skyline::service::fatalsrv { * @brief This throws an exception that causes emulation to quit */ Result ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IService, ThrowFatal), + SFUNC(0x1, IService, ThrowFatal), + SFUNC(0x2, IService, ThrowFatal) + ) }; } diff --git a/app/src/main/cpp/skyline/services/friends/IFriendService.cpp b/app/src/main/cpp/skyline/services/friends/IFriendService.cpp index 2e6a2124..1f714980 100644 --- a/app/src/main/cpp/skyline/services/friends/IFriendService.cpp +++ b/app/src/main/cpp/skyline/services/friends/IFriendService.cpp @@ -4,6 +4,5 @@ #include "IFriendService.h" namespace skyline::service::friends { - IFriendService::IFriendService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + IFriendService::IFriendService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/friends/INotificationService.cpp b/app/src/main/cpp/skyline/services/friends/INotificationService.cpp index 00ee161f..93308c3f 100644 --- a/app/src/main/cpp/skyline/services/friends/INotificationService.cpp +++ b/app/src/main/cpp/skyline/services/friends/INotificationService.cpp @@ -5,9 +5,7 @@ #include "INotificationService.h" namespace skyline::service::friends { - INotificationService::INotificationService(const DeviceState &state, ServiceManager &manager) : notificationEvent(std::make_shared(state)), BaseService(state, manager, { - {0x0, SFUNC(INotificationService::GetEvent)}, - }) {} + INotificationService::INotificationService(const DeviceState &state, ServiceManager &manager) : notificationEvent(std::make_shared(state)), BaseService(state, manager) {} Result INotificationService::GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { KHandle handle = state.process->InsertItem(notificationEvent); diff --git a/app/src/main/cpp/skyline/services/friends/INotificationService.h b/app/src/main/cpp/skyline/services/friends/INotificationService.h index 5410fd06..c3edeb33 100644 --- a/app/src/main/cpp/skyline/services/friends/INotificationService.h +++ b/app/src/main/cpp/skyline/services/friends/INotificationService.h @@ -22,5 +22,9 @@ namespace skyline::service::friends { * @brief This returns a handle to the notification event */ Result GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, INotificationService, GetEvent) + ) }; } diff --git a/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp b/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp index 72380d1d..24c8c408 100644 --- a/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp +++ b/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp @@ -6,10 +6,7 @@ #include "IServiceCreator.h" namespace skyline::service::friends { - IServiceCreator::IServiceCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IServiceCreator::CreateFriendService)}, - {0x1, SFUNC(IServiceCreator::CreateNotificationService)}, - }) {} + IServiceCreator::IServiceCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IServiceCreator::CreateFriendService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IFriendService), session, response); diff --git a/app/src/main/cpp/skyline/services/friends/IServiceCreator.h b/app/src/main/cpp/skyline/services/friends/IServiceCreator.h index 32647f6e..c3d24b25 100644 --- a/app/src/main/cpp/skyline/services/friends/IServiceCreator.h +++ b/app/src/main/cpp/skyline/services/friends/IServiceCreator.h @@ -23,5 +23,10 @@ namespace skyline::service::friends { * @brief This opens an INotificationService that can be used by applications to receive notifications */ Result CreateNotificationService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IServiceCreator, CreateFriendService), + SFUNC(0x1, IServiceCreator, CreateNotificationService) + ) }; } diff --git a/app/src/main/cpp/skyline/services/fssrv/IFile.cpp b/app/src/main/cpp/skyline/services/fssrv/IFile.cpp index fe32e664..3ac5140f 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFile.cpp +++ b/app/src/main/cpp/skyline/services/fssrv/IFile.cpp @@ -6,13 +6,7 @@ #include "IFile.h" namespace skyline::service::fssrv { - IFile::IFile(std::shared_ptr &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager, { - {0x0, SFUNC(IFile::Read)}, - {0x1, SFUNC(IFile::Write)}, - {0x2, SFUNC(IFile::Flush)}, - {0x3, SFUNC(IFile::SetSize)}, - {0x4, SFUNC(IFile::GetSize)} - }) {} + IFile::IFile(std::shared_ptr &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager) {} Result IFile::Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { auto readOption = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/fssrv/IFile.h b/app/src/main/cpp/skyline/services/fssrv/IFile.h index 6130197e..1bdaca75 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFile.h +++ b/app/src/main/cpp/skyline/services/fssrv/IFile.h @@ -42,5 +42,13 @@ namespace skyline::service::fssrv { * @brief This obtains the size of an IFile */ Result GetSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IFile, Read), + SFUNC(0x1, IFile, Write), + SFUNC(0x2, IFile, Flush), + SFUNC(0x3, IFile, SetSize), + SFUNC(0x4, IFile, GetSize) + ) }; } diff --git a/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp b/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp index fd8b94f2..73656ef6 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp +++ b/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp @@ -8,12 +8,7 @@ #include "IFileSystem.h" namespace skyline::service::fssrv { - IFileSystem::IFileSystem(std::shared_ptr backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager, { - {0x0, SFUNC(IFileSystem::CreateFile)}, - {0x7, SFUNC(IFileSystem::GetEntryType)}, - {0x8, SFUNC(IFileSystem::OpenFile)}, - {0xA, SFUNC(IFileSystem::Commit)} - }) {} + IFileSystem::IFileSystem(std::shared_ptr backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager) {} Result IFileSystem::CreateFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { std::string path = std::string(state.process->GetPointer(request.inputBuf.at(0).address)); diff --git a/app/src/main/cpp/skyline/services/fssrv/IFileSystem.h b/app/src/main/cpp/skyline/services/fssrv/IFileSystem.h index 2d431ac9..b121b7ae 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFileSystem.h +++ b/app/src/main/cpp/skyline/services/fssrv/IFileSystem.h @@ -37,5 +37,12 @@ namespace skyline::service::fssrv { * @brief This commits all changes to the filesystem (https://switchbrew.org/wiki/Filesystem_services#Commit) */ Result Commit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IFileSystem, CreateFile), + SFUNC(0x7, IFileSystem, GetEntryType), + SFUNC(0x8, IFileSystem, OpenFile), + SFUNC(0xA, IFileSystem, Commit) + ) }; } diff --git a/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp b/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp index 4caa6541..a424b7df 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp +++ b/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp @@ -9,13 +9,7 @@ #include "IFileSystemProxy.h" namespace skyline::service::fssrv { - IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x1, SFUNC(IFileSystemProxy::SetCurrentProcess)}, - {0x12, SFUNC(IFileSystemProxy::OpenSdCardFileSystem)}, - {0x33, SFUNC(IFileSystemProxy::OpenSaveDataFileSystem)}, - {0xC8, SFUNC(IFileSystemProxy::OpenDataStorageByCurrentProcess)}, - {0x3ED, SFUNC(IFileSystemProxy::GetGlobalAccessLogMode)}, - }) {} + IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IFileSystemProxy::SetCurrentProcess(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { process = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.h b/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.h index 0e0e26f4..f99d526f 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.h +++ b/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.h @@ -89,5 +89,13 @@ namespace skyline::service::fssrv { * @brief This returns the filesystem log access mode (https://switchbrew.org/wiki/Filesystem_services#GetGlobalAccessLogMode) */ Result GetGlobalAccessLogMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x1, IFileSystemProxy, SetCurrentProcess), + SFUNC(0x12, IFileSystemProxy, OpenSdCardFileSystem), + SFUNC(0x33, IFileSystemProxy, OpenSaveDataFileSystem), + SFUNC(0xC8, IFileSystemProxy, OpenDataStorageByCurrentProcess), + SFUNC(0x3ED, IFileSystemProxy, GetGlobalAccessLogMode) + ) }; } diff --git a/app/src/main/cpp/skyline/services/fssrv/IStorage.cpp b/app/src/main/cpp/skyline/services/fssrv/IStorage.cpp index 9d80a848..72b09f4f 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IStorage.cpp +++ b/app/src/main/cpp/skyline/services/fssrv/IStorage.cpp @@ -6,10 +6,7 @@ #include "IStorage.h" namespace skyline::service::fssrv { - IStorage::IStorage(std::shared_ptr &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager, { - {0x0, SFUNC(IStorage::Read)}, - {0x4, SFUNC(IStorage::GetSize)} - }) {} + IStorage::IStorage(std::shared_ptr &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager) {} Result IStorage::Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { auto offset = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/fssrv/IStorage.h b/app/src/main/cpp/skyline/services/fssrv/IStorage.h index ca0bef18..6f90f3d9 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IStorage.h +++ b/app/src/main/cpp/skyline/services/fssrv/IStorage.h @@ -27,5 +27,10 @@ namespace skyline::service::fssrv { * @brief This obtains the size of an IStorage (https://switchbrew.org/wiki/Filesystem_services#GetSize) */ Result GetSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IStorage, Read), + SFUNC(0x4, IStorage, GetSize) + ) }; } diff --git a/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.cpp b/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.cpp index 2fb1f3fa..b7bb3a63 100644 --- a/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.cpp +++ b/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.cpp @@ -7,9 +7,7 @@ using namespace skyline::input; namespace skyline::service::hid { - IActiveVibrationDeviceList::IActiveVibrationDeviceList(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IActiveVibrationDeviceList::ActivateVibrationDevice)} - }) {} + IActiveVibrationDeviceList::IActiveVibrationDeviceList(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IActiveVibrationDeviceList::ActivateVibrationDevice(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { auto handle = request.Pop(); diff --git a/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.h b/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.h index 232c3b81..8bca6397 100644 --- a/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.h +++ b/app/src/main/cpp/skyline/services/hid/IActiveVibrationDeviceList.h @@ -19,5 +19,9 @@ namespace skyline::service::hid { * @brief Activates a vibration device with the specified #VibrationDeviceHandle (https://switchbrew.org/wiki/HID_services#ActivateVibrationDevice) */ Result ActivateVibrationDevice(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IActiveVibrationDeviceList, ActivateVibrationDevice) + ) }; } diff --git a/app/src/main/cpp/skyline/services/hid/IAppletResource.cpp b/app/src/main/cpp/skyline/services/hid/IAppletResource.cpp index 0f79b1cb..3c38db24 100644 --- a/app/src/main/cpp/skyline/services/hid/IAppletResource.cpp +++ b/app/src/main/cpp/skyline/services/hid/IAppletResource.cpp @@ -5,9 +5,7 @@ #include "IAppletResource.h" namespace skyline::service::hid { - IAppletResource::IAppletResource(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IAppletResource::GetSharedMemoryHandle)} - }) {} + IAppletResource::IAppletResource(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IAppletResource::GetSharedMemoryHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { auto handle = state.process->InsertItem(state.input->kHid); diff --git a/app/src/main/cpp/skyline/services/hid/IAppletResource.h b/app/src/main/cpp/skyline/services/hid/IAppletResource.h index 5d00da7b..9d4e364f 100644 --- a/app/src/main/cpp/skyline/services/hid/IAppletResource.h +++ b/app/src/main/cpp/skyline/services/hid/IAppletResource.h @@ -19,5 +19,9 @@ namespace skyline::service::hid { * @brief This opens a handle to HID shared memory (https://switchbrew.org/wiki/HID_services#GetSharedMemoryHandle) */ Result GetSharedMemoryHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IAppletResource, GetSharedMemoryHandle) + ) }; } diff --git a/app/src/main/cpp/skyline/services/hid/IHidServer.cpp b/app/src/main/cpp/skyline/services/hid/IHidServer.cpp index 587db7f2..7f291be8 100644 --- a/app/src/main/cpp/skyline/services/hid/IHidServer.cpp +++ b/app/src/main/cpp/skyline/services/hid/IHidServer.cpp @@ -8,26 +8,7 @@ using namespace skyline::input; namespace skyline::service::hid { - IHidServer::IHidServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IHidServer::CreateAppletResource)}, - {0x1, SFUNC(IHidServer::ActivateDebugPad)}, - {0xB, SFUNC(IHidServer::ActivateTouchScreen)}, - {0x64, SFUNC(IHidServer::SetSupportedNpadStyleSet)}, - {0x65, SFUNC(IHidServer::GetSupportedNpadStyleSet)}, - {0x66, SFUNC(IHidServer::SetSupportedNpadIdType)}, - {0x67, SFUNC(IHidServer::ActivateNpad)}, - {0x68, SFUNC(IHidServer::DeactivateNpad)}, - {0x6A, SFUNC(IHidServer::AcquireNpadStyleSetUpdateEventHandle)}, - {0x6C, SFUNC(IHidServer::GetPlayerLedPattern)}, - {0x6D, SFUNC(IHidServer::ActivateNpadWithRevision)}, - {0x78, SFUNC(IHidServer::SetNpadJoyHoldType)}, - {0x79, SFUNC(IHidServer::GetNpadJoyHoldType)}, - {0x7A, SFUNC(IHidServer::SetNpadJoyAssignmentModeSingleByDefault)}, - {0x7B, SFUNC(IHidServer::SetNpadJoyAssignmentModeSingle)}, - {0x7C, SFUNC(IHidServer::SetNpadJoyAssignmentModeDual)}, - {0xCB, SFUNC(IHidServer::CreateActiveVibrationDeviceList)}, - {0xCE, SFUNC(IHidServer::SendVibrationValues)} - }) {} + IHidServer::IHidServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IHidServer::CreateAppletResource(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IAppletResource), session, response); diff --git a/app/src/main/cpp/skyline/services/hid/IHidServer.h b/app/src/main/cpp/skyline/services/hid/IHidServer.h index d4a2e08c..d7a8d1e1 100644 --- a/app/src/main/cpp/skyline/services/hid/IHidServer.h +++ b/app/src/main/cpp/skyline/services/hid/IHidServer.h @@ -104,5 +104,26 @@ namespace skyline::service::hid { * @brief Send vibration values to an NPad (https://switchbrew.org/wiki/HID_services#SendVibrationValues) */ Result SendVibrationValues(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IHidServer, CreateAppletResource), + SFUNC(0x1, IHidServer, ActivateDebugPad), + SFUNC(0xB, IHidServer, ActivateTouchScreen), + SFUNC(0x64, IHidServer, SetSupportedNpadStyleSet), + SFUNC(0x65, IHidServer, GetSupportedNpadStyleSet), + SFUNC(0x66, IHidServer, SetSupportedNpadIdType), + SFUNC(0x67, IHidServer, ActivateNpad), + SFUNC(0x68, IHidServer, DeactivateNpad), + SFUNC(0x6A, IHidServer, AcquireNpadStyleSetUpdateEventHandle), + SFUNC(0x6C, IHidServer, GetPlayerLedPattern), + SFUNC(0x6D, IHidServer, ActivateNpadWithRevision), + SFUNC(0x78, IHidServer, SetNpadJoyHoldType), + SFUNC(0x79, IHidServer, GetNpadJoyHoldType), + SFUNC(0x7A, IHidServer, SetNpadJoyAssignmentModeSingleByDefault), + SFUNC(0x7B, IHidServer, SetNpadJoyAssignmentModeSingle), + SFUNC(0x7C, IHidServer, SetNpadJoyAssignmentModeDual), + SFUNC(0xCB, IHidServer, CreateActiveVibrationDeviceList), + SFUNC(0xCE, IHidServer, SendVibrationValues) + ) }; } diff --git a/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.cpp b/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.cpp index 92367304..ef9c0f7a 100644 --- a/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.cpp +++ b/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.cpp @@ -6,12 +6,7 @@ #include "GraphicBufferProducer.h" namespace skyline::service::hosbinder { - IHOSBinderDriver::IHOSBinderDriver(const DeviceState &state, ServiceManager &manager) : producer(hosbinder::producer.expired() ? std::make_shared(state) : hosbinder::producer.lock()), BaseService(state, manager, { - {0x0, SFUNC(IHOSBinderDriver::TransactParcel)}, - {0x1, SFUNC(IHOSBinderDriver::AdjustRefcount)}, - {0x2, SFUNC(IHOSBinderDriver::GetNativeHandle)}, - {0x3, SFUNC(IHOSBinderDriver::TransactParcel)} - }) { + IHOSBinderDriver::IHOSBinderDriver(const DeviceState &state, ServiceManager &manager) : producer(hosbinder::producer.expired() ? std::make_shared(state) : hosbinder::producer.lock()), BaseService(state, manager) { if (hosbinder::producer.expired()) hosbinder::producer = producer; } diff --git a/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.h b/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.h index 09468afc..9849a4e0 100644 --- a/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.h +++ b/app/src/main/cpp/skyline/services/hosbinder/IHOSBinderDriver.h @@ -33,5 +33,12 @@ namespace skyline::service::hosbinder { * @brief This adjusts the reference counts to the underlying binder, it is stubbed as we aren't using the real symbols (https://switchbrew.org/wiki/Nvnflinger_services#GetNativeHandle) */ Result GetNativeHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IHOSBinderDriver, TransactParcel), + SFUNC(0x1, IHOSBinderDriver, AdjustRefcount), + SFUNC(0x2, IHOSBinderDriver, GetNativeHandle), + SFUNC(0x3, IHOSBinderDriver, TransactParcel) + ) }; } diff --git a/app/src/main/cpp/skyline/services/lm/ILogService.cpp b/app/src/main/cpp/skyline/services/lm/ILogService.cpp index e9e17609..8e5e583d 100644 --- a/app/src/main/cpp/skyline/services/lm/ILogService.cpp +++ b/app/src/main/cpp/skyline/services/lm/ILogService.cpp @@ -5,9 +5,7 @@ #include "ILogService.h" namespace skyline::service::lm { - ILogService::ILogService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(ILogService::OpenLogger)} - }) {} + ILogService::ILogService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result ILogService::OpenLogger(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(ILogger), session, response); diff --git a/app/src/main/cpp/skyline/services/lm/ILogService.h b/app/src/main/cpp/skyline/services/lm/ILogService.h index eccc467b..3579a7e4 100644 --- a/app/src/main/cpp/skyline/services/lm/ILogService.h +++ b/app/src/main/cpp/skyline/services/lm/ILogService.h @@ -18,5 +18,9 @@ namespace skyline::service::lm { * @brief This opens an ILogger that can be used by applications to print log messages (https://switchbrew.org/wiki/Log_services#OpenLogger) */ Result OpenLogger(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ILogService, OpenLogger) + ) }; } diff --git a/app/src/main/cpp/skyline/services/lm/ILogger.cpp b/app/src/main/cpp/skyline/services/lm/ILogger.cpp index c59891f4..065f9e1d 100644 --- a/app/src/main/cpp/skyline/services/lm/ILogger.cpp +++ b/app/src/main/cpp/skyline/services/lm/ILogger.cpp @@ -5,10 +5,7 @@ #include "ILogger.h" namespace skyline::service::lm { - ILogger::ILogger(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(ILogger::Log)}, - {0x1, SFUNC(ILogger::SetDestination)} - }) {} + ILogger::ILogger(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} std::string ILogger::GetFieldName(LogFieldType type) { switch (type) { diff --git a/app/src/main/cpp/skyline/services/lm/ILogger.h b/app/src/main/cpp/skyline/services/lm/ILogger.h index 0f96d30f..7ea798fa 100644 --- a/app/src/main/cpp/skyline/services/lm/ILogger.h +++ b/app/src/main/cpp/skyline/services/lm/ILogger.h @@ -59,5 +59,10 @@ namespace skyline::service::lm { * @brief This sets the log destination (https://switchbrew.org/wiki/Log_services#SetDestination) */ Result SetDestination(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ILogger, Log), + SFUNC(0x1, ILogger, SetDestination) + ) }; } diff --git a/app/src/main/cpp/skyline/services/nfp/IUser.cpp b/app/src/main/cpp/skyline/services/nfp/IUser.cpp index 790c8f87..6f7e7189 100644 --- a/app/src/main/cpp/skyline/services/nfp/IUser.cpp +++ b/app/src/main/cpp/skyline/services/nfp/IUser.cpp @@ -5,9 +5,7 @@ #include "IUserManager.h" namespace skyline::service::nfp { - IUser::IUser(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IUser::Initialize)} - }) {} + IUser::IUser(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IUser::Initialize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; diff --git a/app/src/main/cpp/skyline/services/nfp/IUser.h b/app/src/main/cpp/skyline/services/nfp/IUser.h index e8861038..b5b2b376 100644 --- a/app/src/main/cpp/skyline/services/nfp/IUser.h +++ b/app/src/main/cpp/skyline/services/nfp/IUser.h @@ -18,5 +18,9 @@ namespace skyline::service::nfp { * @brief This initializes an NFP session */ Result Initialize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IUser, Initialize) + ) }; } diff --git a/app/src/main/cpp/skyline/services/nfp/IUserManager.cpp b/app/src/main/cpp/skyline/services/nfp/IUserManager.cpp index b65d66fb..75110459 100644 --- a/app/src/main/cpp/skyline/services/nfp/IUserManager.cpp +++ b/app/src/main/cpp/skyline/services/nfp/IUserManager.cpp @@ -5,9 +5,7 @@ #include "IUserManager.h" namespace skyline::service::nfp { - IUserManager::IUserManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IUserManager::CreateUserInterface)} - }) {} + IUserManager::IUserManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IUserManager::CreateUserInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IUser), session, response); diff --git a/app/src/main/cpp/skyline/services/nfp/IUserManager.h b/app/src/main/cpp/skyline/services/nfp/IUserManager.h index 4ca72f5d..506601db 100644 --- a/app/src/main/cpp/skyline/services/nfp/IUserManager.h +++ b/app/src/main/cpp/skyline/services/nfp/IUserManager.h @@ -18,5 +18,9 @@ namespace skyline::service::nfp { * @brief This opens an IUser that can be used by applications to access NFC devices */ Result CreateUserInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IUserManager, CreateUserInterface) + ) }; } diff --git a/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp b/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp index e0a61b0d..50506538 100644 --- a/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp +++ b/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp @@ -5,9 +5,7 @@ #include "IGeneralService.h" namespace skyline::service::nifm { - IGeneralService::IGeneralService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x4, SFUNC(IGeneralService::CreateRequest)} - }) {} + IGeneralService::IGeneralService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IGeneralService::CreateRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IRequest), session, response); diff --git a/app/src/main/cpp/skyline/services/nifm/IGeneralService.h b/app/src/main/cpp/skyline/services/nifm/IGeneralService.h index fc7a60ed..199ee5b2 100644 --- a/app/src/main/cpp/skyline/services/nifm/IGeneralService.h +++ b/app/src/main/cpp/skyline/services/nifm/IGeneralService.h @@ -18,5 +18,9 @@ namespace skyline::service::nifm { * @brief This creates an IRequest instance that can be used to bring up the network (https://switchbrew.org/wiki/Network_Interface_services#CreateRequest) */ Result CreateRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x4, IGeneralService, CreateRequest) + ) }; } diff --git a/app/src/main/cpp/skyline/services/nifm/IRequest.cpp b/app/src/main/cpp/skyline/services/nifm/IRequest.cpp index b61a186b..9274a592 100644 --- a/app/src/main/cpp/skyline/services/nifm/IRequest.cpp +++ b/app/src/main/cpp/skyline/services/nifm/IRequest.cpp @@ -5,12 +5,7 @@ #include "IRequest.h" namespace skyline::service::nifm { - IRequest::IRequest(const DeviceState &state, ServiceManager &manager) : event0(std::make_shared(state)), event1(std::make_shared(state)), BaseService(state, manager, { - {0x0, SFUNC(IRequest::GetRequestState)}, - {0x1, SFUNC(IRequest::GetResult)}, - {0x2, SFUNC(IRequest::GetSystemEventReadableHandles)}, - {0x4, SFUNC(IRequest::Submit)}, - }) {} + IRequest::IRequest(const DeviceState &state, ServiceManager &manager) : event0(std::make_shared(state)), event1(std::make_shared(state)), BaseService(state, manager) {} Result IRequest::GetRequestState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { constexpr u32 Unsubmitted = 1; //!< The request has not been submitted diff --git a/app/src/main/cpp/skyline/services/nifm/IRequest.h b/app/src/main/cpp/skyline/services/nifm/IRequest.h index 9390c1ae..de996d72 100644 --- a/app/src/main/cpp/skyline/services/nifm/IRequest.h +++ b/app/src/main/cpp/skyline/services/nifm/IRequest.h @@ -38,5 +38,12 @@ namespace skyline::service::nifm { * @brief This submits a request to bring up a network (https://switchbrew.org/wiki/Network_Interface_services#Submit) */ Result Submit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IRequest, GetRequestState), + SFUNC(0x1, IRequest, GetResult), + SFUNC(0x2, IRequest, GetSystemEventReadableHandles), + SFUNC(0x4, IRequest, Submit) + ) }; } diff --git a/app/src/main/cpp/skyline/services/nifm/IStaticService.cpp b/app/src/main/cpp/skyline/services/nifm/IStaticService.cpp index 432b374a..2f35faa5 100644 --- a/app/src/main/cpp/skyline/services/nifm/IStaticService.cpp +++ b/app/src/main/cpp/skyline/services/nifm/IStaticService.cpp @@ -5,10 +5,7 @@ #include "IStaticService.h" namespace skyline::service::nifm { - IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x4, SFUNC(IStaticService::CreateGeneralService)}, - {0x5, SFUNC(IStaticService::CreateGeneralService)} - }) {} + IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IStaticService::CreateGeneralService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IGeneralService), session, response); diff --git a/app/src/main/cpp/skyline/services/nifm/IStaticService.h b/app/src/main/cpp/skyline/services/nifm/IStaticService.h index d3d02e53..75cd39fa 100644 --- a/app/src/main/cpp/skyline/services/nifm/IStaticService.h +++ b/app/src/main/cpp/skyline/services/nifm/IStaticService.h @@ -18,5 +18,10 @@ namespace skyline::service::nifm { * @brief This opens an IGeneralService that can be used by applications to control the network connection (https://switchbrew.org/wiki/Network_Interface_services#CreateGeneralServiceOld) */ Result CreateGeneralService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x4, IStaticService, CreateGeneralService), + SFUNC(0x5, IStaticService, CreateGeneralService) + ) }; } diff --git a/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.cpp b/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.cpp index 2018320f..c1897a5d 100644 --- a/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.cpp +++ b/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.cpp @@ -7,15 +7,7 @@ #include "devices/nvdevice.h" namespace skyline::service::nvdrv { - INvDrvServices::INvDrvServices(const DeviceState &state, ServiceManager &manager) : driver(nvdrv::driver.expired() ? std::make_shared(state) : nvdrv::driver.lock()), BaseService(state, manager, { - {0x0, SFUNC(INvDrvServices::Open)}, - {0x1, SFUNC(INvDrvServices::Ioctl)}, - {0x2, SFUNC(INvDrvServices::Close)}, - {0x3, SFUNC(INvDrvServices::Initialize)}, - {0x4, SFUNC(INvDrvServices::QueryEvent)}, - {0x8, SFUNC(INvDrvServices::SetAruid)}, - {0xD, SFUNC(INvDrvServices::SetGraphicsFirmwareMemoryMarginEnabled)} - }) { + INvDrvServices::INvDrvServices(const DeviceState &state, ServiceManager &manager) : driver(nvdrv::driver.expired() ? std::make_shared(state) : nvdrv::driver.lock()), BaseService(state, manager) { if (nvdrv::driver.expired()) nvdrv::driver = driver; } diff --git a/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.h b/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.h index 572c3c24..49ed6f66 100644 --- a/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.h +++ b/app/src/main/cpp/skyline/services/nvdrv/INvDrvServices.h @@ -63,5 +63,15 @@ namespace skyline::service::nvdrv { * @brief This enables the graphics firmware memory margin (https://switchbrew.org/wiki/NV_services#SetGraphicsFirmwareMemoryMarginEnabled) */ Result SetGraphicsFirmwareMemoryMarginEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, INvDrvServices, Open), + SFUNC(0x1, INvDrvServices, Ioctl), + SFUNC(0x2, INvDrvServices, Close), + SFUNC(0x3, INvDrvServices, Initialize), + SFUNC(0x4, INvDrvServices, QueryEvent), + SFUNC(0x8, INvDrvServices, SetAruid), + SFUNC(0xD, INvDrvServices, SetGraphicsFirmwareMemoryMarginEnabled) + ) }; } diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp index 0c65d369..4f4443de 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlService.cpp @@ -4,6 +4,5 @@ #include "IParentalControlService.h" namespace skyline::service::pctl { - IParentalControlService::IParentalControlService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + IParentalControlService::IParentalControlService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp index 883c180e..77505090 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp @@ -5,10 +5,7 @@ #include "IParentalControlServiceFactory.h" namespace skyline::service::pctl { - IParentalControlServiceFactory::IParentalControlServiceFactory(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IParentalControlServiceFactory::CreateService)}, - {0x1, SFUNC(IParentalControlServiceFactory::CreateService)} - }) {} + IParentalControlServiceFactory::IParentalControlServiceFactory(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IParentalControlServiceFactory::CreateService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IParentalControlService), 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 47d0095f..e42664cb 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.h +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.h @@ -18,5 +18,10 @@ namespace skyline::service::pctl { * @brief This creates and initializes an IParentalControlService instance that can be used to read parental control configuration */ Result CreateService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IParentalControlServiceFactory, CreateService), + SFUNC(0x1, IParentalControlServiceFactory, CreateService) + ) }; } diff --git a/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.cpp b/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.cpp index cc72f927..6cf6c618 100644 --- a/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.cpp +++ b/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.cpp @@ -29,12 +29,7 @@ namespace skyline::service::pl { {FontStandard, FontStandardLength} }}; - IPlatformServiceManager::IPlatformServiceManager(const DeviceState &state, ServiceManager &manager) : fontSharedMem(std::make_shared(state, NULL, constant::FontSharedMemSize, memory::Permission{true, false, false})), BaseService(state, manager, { - {0x1, SFUNC(IPlatformServiceManager::GetLoadState)}, - {0x2, SFUNC(IPlatformServiceManager::GetSize)}, - {0x3, SFUNC(IPlatformServiceManager::GetSharedMemoryAddressOffset)}, - {0x4, SFUNC(IPlatformServiceManager::GetSharedMemoryNativeHandle)} - }) { + IPlatformServiceManager::IPlatformServiceManager(const DeviceState &state, ServiceManager &manager) : fontSharedMem(std::make_shared(state, NULL, constant::FontSharedMemSize, memory::Permission{true, false, false})), BaseService(state, manager) { constexpr u32 SharedFontResult = 0x7F9A0218; //!< This is the decrypted magic for a single font in the shared font data constexpr u32 SharedFontMagic = 0x36F81A1E; //!< This is the encrypted magic for a single font in the shared font data constexpr u32 SharedFontKey = SharedFontMagic ^SharedFontResult; //!< This is the XOR key for encrypting the font size diff --git a/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.h b/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.h index 37b1ac25..e9f81f28 100644 --- a/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.h +++ b/app/src/main/cpp/skyline/services/pl/IPlatformServiceManager.h @@ -41,6 +41,13 @@ namespace skyline { * @brief This returns a handle to the whole font shared memory (https://switchbrew.org/wiki/Shared_Database_services#GetSharedMemoryNativeHandle) */ Result GetSharedMemoryNativeHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x1, IPlatformServiceManager, GetLoadState), + SFUNC(0x2, IPlatformServiceManager, GetSize), + SFUNC(0x3, IPlatformServiceManager, GetSharedMemoryAddressOffset), + SFUNC(0x4, IPlatformServiceManager, GetSharedMemoryNativeHandle) + ) }; } } diff --git a/app/src/main/cpp/skyline/services/prepo/IPrepoService.cpp b/app/src/main/cpp/skyline/services/prepo/IPrepoService.cpp index eb5a5ddc..312ad5d4 100644 --- a/app/src/main/cpp/skyline/services/prepo/IPrepoService.cpp +++ b/app/src/main/cpp/skyline/services/prepo/IPrepoService.cpp @@ -4,9 +4,7 @@ #include "IPrepoService.h" namespace skyline::service::prepo { - IPrepoService::IPrepoService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x2775, SFUNC(IPrepoService::SaveReportWithUser)}, - }) {} + IPrepoService::IPrepoService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IPrepoService::SaveReportWithUser(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; diff --git a/app/src/main/cpp/skyline/services/prepo/IPrepoService.h b/app/src/main/cpp/skyline/services/prepo/IPrepoService.h index 95a71378..623970c6 100644 --- a/app/src/main/cpp/skyline/services/prepo/IPrepoService.h +++ b/app/src/main/cpp/skyline/services/prepo/IPrepoService.h @@ -18,5 +18,9 @@ namespace skyline::service::prepo { * @brief This saves a play report for the given user */ Result SaveReportWithUser(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x2775, IPrepoService, SaveReportWithUser) + ) }; } diff --git a/app/src/main/cpp/skyline/services/serviceman.h b/app/src/main/cpp/skyline/services/serviceman.h index 7d271f29..0b76cd7a 100644 --- a/app/src/main/cpp/skyline/services/serviceman.h +++ b/app/src/main/cpp/skyline/services/serviceman.h @@ -51,6 +51,11 @@ namespace skyline::service { */ void RegisterService(std::shared_ptr serviceObject, type::KSession &session, ipc::IpcResponse &response); + template + inline void RegisterService(std::shared_ptr serviceObject, type::KSession &session, ipc::IpcResponse &response) { + RegisterService(std::static_pointer_cast(serviceObject), session, response); + } + /** * @param serviceType The type of the service * @tparam The class of the service diff --git a/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp b/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp index 1cd38c6f..7fbe87a7 100644 --- a/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp +++ b/app/src/main/cpp/skyline/services/settings/ISettingsServer.cpp @@ -5,11 +5,7 @@ #include "ISettingsServer.h" namespace skyline::service::settings { - ISettingsServer::ISettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x1, SFUNC(ISettingsServer::GetAvailableLanguageCodes)}, - {0x2, SFUNC(ISettingsServer::MakeLanguageCode)}, - {0x5, SFUNC(ISettingsServer::GetAvailableLanguageCodes2)} - }) {} + ISettingsServer::ISettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} constexpr std::array LanguageCodeList = { util::MakeMagic("ja"), diff --git a/app/src/main/cpp/skyline/services/settings/ISettingsServer.h b/app/src/main/cpp/skyline/services/settings/ISettingsServer.h index 1bf68805..1fa869f5 100644 --- a/app/src/main/cpp/skyline/services/settings/ISettingsServer.h +++ b/app/src/main/cpp/skyline/services/settings/ISettingsServer.h @@ -34,6 +34,12 @@ namespace skyline::service { * @brief This reads the available language codes that an application can use (post 4.0.0) */ Result GetAvailableLanguageCodes2(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x1, ISettingsServer, GetAvailableLanguageCodes), + SFUNC(0x2, ISettingsServer, MakeLanguageCode), + SFUNC(0x5, ISettingsServer, GetAvailableLanguageCodes2) + ) }; } } diff --git a/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp index 298be4c6..8f7261aa 100644 --- a/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp +++ b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp @@ -5,8 +5,7 @@ #include "ISystemSettingsServer.h" namespace skyline::service::settings { - ISystemSettingsServer::ISystemSettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x3, SFUNC(ISystemSettingsServer::GetFirmwareVersion)}}) {} + ISystemSettingsServer::ISystemSettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result ISystemSettingsServer::GetFirmwareVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { SysVerTitle title{.major=9, .minor=0, .micro=0, .revMajor=4, .revMinor=0, .platform="NX", .verHash="4de65c071fd0869695b7629f75eb97b2551dbf2f", .dispVer="9.0.0", .dispTitle="NintendoSDK Firmware for NX 9.0.0-4.0"}; diff --git a/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.h b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.h index c5ab6b64..2d133a64 100644 --- a/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.h +++ b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.h @@ -37,5 +37,9 @@ namespace skyline::service::settings { * @brief Writes the Firmware version to a 0xA buffer (https://switchbrew.org/wiki/Settings_services#GetFirmwareVersion) */ Result GetFirmwareVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x3, ISystemSettingsServer, GetFirmwareVersion) + ) }; } diff --git a/app/src/main/cpp/skyline/services/sm/IUserInterface.cpp b/app/src/main/cpp/skyline/services/sm/IUserInterface.cpp index ff10643f..49390117 100644 --- a/app/src/main/cpp/skyline/services/sm/IUserInterface.cpp +++ b/app/src/main/cpp/skyline/services/sm/IUserInterface.cpp @@ -4,10 +4,7 @@ #include "IUserInterface.h" namespace skyline::service::sm { - IUserInterface::IUserInterface(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IUserInterface::Initialize)}, - {0x1, SFUNC(IUserInterface::GetService)} - }) {} + IUserInterface::IUserInterface(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IUserInterface::Initialize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; diff --git a/app/src/main/cpp/skyline/services/sm/IUserInterface.h b/app/src/main/cpp/skyline/services/sm/IUserInterface.h index 8ea176ad..1586d9b1 100644 --- a/app/src/main/cpp/skyline/services/sm/IUserInterface.h +++ b/app/src/main/cpp/skyline/services/sm/IUserInterface.h @@ -35,5 +35,10 @@ namespace skyline::service::sm { * @brief This returns a handle to a service with it's name passed in as an argument (https://switchbrew.org/wiki/Services_API#GetService) */ Result GetService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IUserInterface, Initialize), + SFUNC(0x1, IUserInterface, GetService) + ) }; } diff --git a/app/src/main/cpp/skyline/services/socket/bsd/IClient.cpp b/app/src/main/cpp/skyline/services/socket/bsd/IClient.cpp index dfa38f96..97975da0 100644 --- a/app/src/main/cpp/skyline/services/socket/bsd/IClient.cpp +++ b/app/src/main/cpp/skyline/services/socket/bsd/IClient.cpp @@ -4,10 +4,7 @@ #include "IClient.h" namespace skyline::service::socket { - IClient::IClient(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IClient::RegisterClient)}, - {0x1, SFUNC(IClient::StartMonitoring)}, - }) {} + IClient::IClient(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IClient::RegisterClient(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { response.Push(0); @@ -17,4 +14,4 @@ namespace skyline::service::socket { Result IClient::StartMonitoring(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; } -} \ No newline at end of file +} diff --git a/app/src/main/cpp/skyline/services/socket/bsd/IClient.h b/app/src/main/cpp/skyline/services/socket/bsd/IClient.h index e2a9e27f..eb0cff77 100644 --- a/app/src/main/cpp/skyline/services/socket/bsd/IClient.h +++ b/app/src/main/cpp/skyline/services/socket/bsd/IClient.h @@ -23,5 +23,10 @@ namespace skyline::service::socket { * @brief This starts the monitoring of the socket */ Result StartMonitoring(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IClient, RegisterClient), + SFUNC(0x1, IClient, StartMonitoring) + ) }; -} \ No newline at end of file +} diff --git a/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp b/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp index 3877b48d..4c4c6484 100644 --- a/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp +++ b/app/src/main/cpp/skyline/services/ssl/ISslContext.cpp @@ -4,6 +4,5 @@ #include "ISslContext.h" namespace skyline::service::ssl { - ISslContext::ISslContext(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - }) {} + ISslContext::ISslContext(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} } diff --git a/app/src/main/cpp/skyline/services/ssl/ISslService.cpp b/app/src/main/cpp/skyline/services/ssl/ISslService.cpp index 4b7f999f..81e7a407 100644 --- a/app/src/main/cpp/skyline/services/ssl/ISslService.cpp +++ b/app/src/main/cpp/skyline/services/ssl/ISslService.cpp @@ -5,10 +5,7 @@ #include "ISslService.h" namespace skyline::service::ssl { - ISslService::ISslService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(ISslService::CreateContext)}, - {0x5, SFUNC(ISslService::SetInterfaceVersion)} - }) {} + ISslService::ISslService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result ISslService::CreateContext(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(ISslContext), session, response); diff --git a/app/src/main/cpp/skyline/services/ssl/ISslService.h b/app/src/main/cpp/skyline/services/ssl/ISslService.h index f948b93c..a3209ce5 100644 --- a/app/src/main/cpp/skyline/services/ssl/ISslService.h +++ b/app/src/main/cpp/skyline/services/ssl/ISslService.h @@ -23,5 +23,10 @@ namespace skyline::service::ssl { * @brief This sets the SSL interface version (https://switchbrew.org/wiki/SSL_services#SetInterfaceVersion) */ Result SetInterfaceVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ISslService, CreateContext), + SFUNC(0x5, ISslService, SetInterfaceVersion) + ) }; } diff --git a/app/src/main/cpp/skyline/services/timesrv/IStaticService.cpp b/app/src/main/cpp/skyline/services/timesrv/IStaticService.cpp index f35ea7af..a77b4ccb 100644 --- a/app/src/main/cpp/skyline/services/timesrv/IStaticService.cpp +++ b/app/src/main/cpp/skyline/services/timesrv/IStaticService.cpp @@ -7,13 +7,7 @@ #include "IStaticService.h" namespace skyline::service::timesrv { - IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(IStaticService::GetStandardUserSystemClock)}, - {0x1, SFUNC(IStaticService::GetStandardNetworkSystemClock)}, - {0x2, SFUNC(IStaticService::GetStandardSteadyClock)}, - {0x3, SFUNC(IStaticService::GetTimeZoneService)}, - {0x4, SFUNC(IStaticService::GetStandardLocalSystemClock)} - }) {} + IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IStaticService::GetStandardUserSystemClock(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(std::make_shared(SystemClockType::User, state, manager), session, response); diff --git a/app/src/main/cpp/skyline/services/timesrv/IStaticService.h b/app/src/main/cpp/skyline/services/timesrv/IStaticService.h index 283ca0fb..17abadab 100644 --- a/app/src/main/cpp/skyline/services/timesrv/IStaticService.h +++ b/app/src/main/cpp/skyline/services/timesrv/IStaticService.h @@ -38,5 +38,13 @@ namespace skyline::service::timesrv { * @brief This returns a handle to a ISystemClock for local time */ Result GetStandardLocalSystemClock(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IStaticService, GetStandardUserSystemClock), + SFUNC(0x1, IStaticService, GetStandardNetworkSystemClock), + SFUNC(0x2, IStaticService, GetStandardSteadyClock), + SFUNC(0x3, IStaticService, GetTimeZoneService), + SFUNC(0x4, IStaticService, GetStandardLocalSystemClock) + ) }; } diff --git a/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.cpp b/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.cpp index dd2d3245..c5c0528e 100644 --- a/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.cpp +++ b/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.cpp @@ -4,9 +4,7 @@ #include "ISteadyClock.h" namespace skyline::service::timesrv { - ISteadyClock::ISteadyClock(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x0, SFUNC(ISteadyClock::GetCurrentTimePoint)} - }) {} + ISteadyClock::ISteadyClock(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result ISteadyClock::GetCurrentTimePoint(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { response.Push(SteadyClockTimePoint{static_cast(std::time(nullptr))}); diff --git a/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.h b/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.h index 75469f84..9f6d5280 100644 --- a/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.h +++ b/app/src/main/cpp/skyline/services/timesrv/ISteadyClock.h @@ -26,5 +26,9 @@ namespace skyline::service::timesrv { * @brief This returns the current value of the steady clock */ Result GetCurrentTimePoint(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ISteadyClock, GetCurrentTimePoint) + ) }; } diff --git a/app/src/main/cpp/skyline/services/timesrv/ISystemClock.cpp b/app/src/main/cpp/skyline/services/timesrv/ISystemClock.cpp index 192e4acb..d8d7aced 100644 --- a/app/src/main/cpp/skyline/services/timesrv/ISystemClock.cpp +++ b/app/src/main/cpp/skyline/services/timesrv/ISystemClock.cpp @@ -5,10 +5,7 @@ #include "ISystemClock.h" namespace skyline::service::timesrv { - ISystemClock::ISystemClock(const SystemClockType clockType, const DeviceState &state, ServiceManager &manager) : type(clockType), BaseService(state, manager, { - {0x0, SFUNC(ISystemClock::GetCurrentTime)}, - {0x2, SFUNC(ISystemClock::GetSystemClockContext)} - }) {} + ISystemClock::ISystemClock(const SystemClockType clockType, const DeviceState &state, ServiceManager &manager) : type(clockType), BaseService(state, manager) {} Result ISystemClock::GetCurrentTime(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { response.Push(static_cast(std::time(nullptr))); diff --git a/app/src/main/cpp/skyline/services/timesrv/ISystemClock.h b/app/src/main/cpp/skyline/services/timesrv/ISystemClock.h index 1c5c12ea..6faa13c6 100644 --- a/app/src/main/cpp/skyline/services/timesrv/ISystemClock.h +++ b/app/src/main/cpp/skyline/services/timesrv/ISystemClock.h @@ -34,5 +34,10 @@ namespace skyline::service::timesrv { * @brief This returns the system clock context */ Result GetSystemClockContext(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, ISystemClock, GetCurrentTime), + SFUNC(0x2, ISystemClock, GetSystemClockContext) + ) }; } diff --git a/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.cpp b/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.cpp index a47efa26..cb205488 100644 --- a/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.cpp +++ b/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.cpp @@ -4,9 +4,7 @@ #include "ITimeZoneService.h" namespace skyline::service::timesrv { - ITimeZoneService::ITimeZoneService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x65, SFUNC(ITimeZoneService::ToCalendarTimeWithMyRule)} - }) {} + ITimeZoneService::ITimeZoneService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result ITimeZoneService::ToCalendarTimeWithMyRule(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { auto curTime = std::time(nullptr); diff --git a/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.h b/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.h index 06c2915f..f1bf3b16 100644 --- a/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.h +++ b/app/src/main/cpp/skyline/services/timesrv/ITimeZoneService.h @@ -45,5 +45,9 @@ namespace skyline::service::timesrv { * @brief This receives a u64 #PosixTime (https://switchbrew.org/wiki/PSC_services#PosixTime), and returns a #CalendarTime (https://switchbrew.org/wiki/PSC_services#CalendarTime), #CalendarAdditionalInfo (https://switchbrew.org/wiki/PSC_services#CalendarAdditionalInfo) */ Result ToCalendarTimeWithMyRule(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x65, ITimeZoneService, ToCalendarTimeWithMyRule) + ) }; } diff --git a/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.cpp b/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.cpp index bb3ba2b9..51143d06 100644 --- a/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.cpp +++ b/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.cpp @@ -10,20 +10,7 @@ #include "IManagerDisplayService.h" namespace skyline::service::visrv { - IApplicationDisplayService::IApplicationDisplayService(const DeviceState &state, ServiceManager &manager) : IDisplayService(state, manager, { - {0x64, SFUNC(IApplicationDisplayService::GetRelayService)}, - {0x65, SFUNC(IApplicationDisplayService::GetSystemDisplayService)}, - {0x66, SFUNC(IApplicationDisplayService::GetManagerDisplayService)}, - {0x67, SFUNC(IApplicationDisplayService::GetIndirectDisplayTransactionService)}, - {0x3F2, SFUNC(IApplicationDisplayService::OpenDisplay)}, - {0x3FC, SFUNC(IApplicationDisplayService::CloseDisplay)}, - {0x7E4, SFUNC(IApplicationDisplayService::OpenLayer)}, - {0x7E5, SFUNC(IApplicationDisplayService::CloseLayer)}, - {0x7EE, SFUNC(IDisplayService::CreateStrayLayer)}, - {0x7EF, SFUNC(IDisplayService::DestroyStrayLayer)}, - {0x835, SFUNC(IApplicationDisplayService::SetLayerScalingMode)}, - {0x1452, SFUNC(IApplicationDisplayService::GetDisplayVsyncEvent)}, - }) {} + IApplicationDisplayService::IApplicationDisplayService(const DeviceState &state, ServiceManager &manager) : IDisplayService(state, manager) {} Result IApplicationDisplayService::GetRelayService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(hosbinder::IHOSBinderDriver), session, response); diff --git a/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.h b/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.h index aab12bfb..a2f30fae 100644 --- a/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.h +++ b/app/src/main/cpp/skyline/services/visrv/IApplicationDisplayService.h @@ -62,5 +62,20 @@ namespace skyline::service::visrv { * @brief Returns a handle to a KEvent which is triggered every time a frame is drawn (https://switchbrew.org/wiki/Display_services#GetDisplayVsyncEvent) */ Result GetDisplayVsyncEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x64, IApplicationDisplayService, GetRelayService), + SFUNC(0x65, IApplicationDisplayService, GetSystemDisplayService), + SFUNC(0x66, IApplicationDisplayService, GetManagerDisplayService), + SFUNC(0x67, IApplicationDisplayService, GetIndirectDisplayTransactionService), + SFUNC(0x3F2, IApplicationDisplayService, OpenDisplay), + SFUNC(0x3FC, IApplicationDisplayService, CloseDisplay), + SFUNC(0x7E4, IApplicationDisplayService, OpenLayer), + SFUNC(0x7E5, IApplicationDisplayService, CloseLayer), + SFUNC_BASE(0x7EE, IApplicationDisplayService, IDisplayService, CreateStrayLayer), + SFUNC_BASE(0x7EF, IApplicationDisplayService, IDisplayService, DestroyStrayLayer), + SFUNC(0x835, IApplicationDisplayService, SetLayerScalingMode), + SFUNC(0x1452, IApplicationDisplayService, GetDisplayVsyncEvent) + ) }; } diff --git a/app/src/main/cpp/skyline/services/visrv/IDisplayService.cpp b/app/src/main/cpp/skyline/services/visrv/IDisplayService.cpp index ca287197..0802f404 100644 --- a/app/src/main/cpp/skyline/services/visrv/IDisplayService.cpp +++ b/app/src/main/cpp/skyline/services/visrv/IDisplayService.cpp @@ -6,7 +6,7 @@ #include "IDisplayService.h" namespace skyline::service::visrv { - IDisplayService::IDisplayService(const DeviceState &state, ServiceManager &manager, const std::unordered_map> &vTable) : BaseService(state, manager, vTable) {} + IDisplayService::IDisplayService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IDisplayService::CreateStrayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { request.Skip(); diff --git a/app/src/main/cpp/skyline/services/visrv/IDisplayService.h b/app/src/main/cpp/skyline/services/visrv/IDisplayService.h index 902e750e..093ecfa1 100644 --- a/app/src/main/cpp/skyline/services/visrv/IDisplayService.h +++ b/app/src/main/cpp/skyline/services/visrv/IDisplayService.h @@ -27,7 +27,7 @@ namespace skyline::service::visrv { static_assert(sizeof(LayerParcel) == 0x28); public: - IDisplayService(const DeviceState &state, ServiceManager &manager, const std::unordered_map> &vTable); + IDisplayService(const DeviceState &state, ServiceManager &manager); /** * @brief This creates a stray layer using a display's ID and returns a layer ID and the corresponding buffer ID diff --git a/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.cpp b/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.cpp index 919c97ac..e40131d1 100644 --- a/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.cpp +++ b/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.cpp @@ -6,12 +6,7 @@ #include "IManagerDisplayService.h" namespace skyline::service::visrv { - IManagerDisplayService::IManagerDisplayService(const DeviceState &state, ServiceManager &manager) : IDisplayService(state, manager, { - {0x7DA, SFUNC(IManagerDisplayService::CreateManagedLayer)}, - {0x7DB, SFUNC(IManagerDisplayService::DestroyManagedLayer)}, - {0x7DC, SFUNC(IDisplayService::CreateStrayLayer)}, - {0x1770, SFUNC(IManagerDisplayService::AddToLayerStack)} - }) {} + IManagerDisplayService::IManagerDisplayService(const DeviceState &state, ServiceManager &manager) : IDisplayService(state, manager) {} Result IManagerDisplayService::CreateManagedLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { request.Skip(); diff --git a/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.h b/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.h index 1e05f259..16fd075a 100644 --- a/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.h +++ b/app/src/main/cpp/skyline/services/visrv/IManagerDisplayService.h @@ -27,5 +27,12 @@ namespace skyline::service::visrv { * @brief This takes a layer's ID and adds it to the layer stack */ Result AddToLayerStack(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x7DA, IManagerDisplayService, CreateManagedLayer), + SFUNC(0x7DB, IManagerDisplayService, DestroyManagedLayer), + SFUNC_BASE(0x7DC, IManagerDisplayService, IDisplayService, CreateStrayLayer), + SFUNC(0x1770, IManagerDisplayService, AddToLayerStack) + ) }; } diff --git a/app/src/main/cpp/skyline/services/visrv/IManagerRootService.cpp b/app/src/main/cpp/skyline/services/visrv/IManagerRootService.cpp index cb9f4b61..95b4fb36 100644 --- a/app/src/main/cpp/skyline/services/visrv/IManagerRootService.cpp +++ b/app/src/main/cpp/skyline/services/visrv/IManagerRootService.cpp @@ -6,9 +6,7 @@ #include "IApplicationDisplayService.h" namespace skyline::service::visrv { - IManagerRootService::IManagerRootService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, { - {0x2, SFUNC(IManagerRootService::GetDisplayService)} - }) {} + IManagerRootService::IManagerRootService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} Result IManagerRootService::GetDisplayService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IApplicationDisplayService), session, response); diff --git a/app/src/main/cpp/skyline/services/visrv/IManagerRootService.h b/app/src/main/cpp/skyline/services/visrv/IManagerRootService.h index ce84a731..b25c40bf 100644 --- a/app/src/main/cpp/skyline/services/visrv/IManagerRootService.h +++ b/app/src/main/cpp/skyline/services/visrv/IManagerRootService.h @@ -19,5 +19,9 @@ namespace skyline::service::visrv { * @brief This returns an handle to #IApplicationDisplayService (https://switchbrew.org/wiki/Display_services#GetDisplayService) */ Result GetDisplayService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x2, IManagerRootService, GetDisplayService) + ) }; } diff --git a/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.cpp b/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.cpp index df7b27cf..d72d26f2 100644 --- a/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.cpp +++ b/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.cpp @@ -4,10 +4,7 @@ #include "ISystemDisplayService.h" namespace skyline::service::visrv { - ISystemDisplayService::ISystemDisplayService(const DeviceState &state, ServiceManager &manager) : IDisplayService(state, manager, { - {0x89D, SFUNC(ISystemDisplayService::SetLayerZ)}, - {0x908, SFUNC(IDisplayService::CreateStrayLayer)} - }) {} + ISystemDisplayService::ISystemDisplayService(const DeviceState &state, ServiceManager &manager) : IDisplayService(state, manager) {} Result ISystemDisplayService::SetLayerZ(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { return {}; diff --git a/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.h b/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.h index a537bb00..27ddfb0f 100644 --- a/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.h +++ b/app/src/main/cpp/skyline/services/visrv/ISystemDisplayService.h @@ -17,5 +17,10 @@ namespace skyline::service::visrv { * @brief Sets the Z index of a layer */ Result SetLayerZ(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x89D, ISystemDisplayService, SetLayerZ), + SFUNC_BASE(0x908, ISystemDisplayService, IDisplayService, CreateStrayLayer) + ) }; }