From 3734599615deae0ef7008bd32fa10de162e900fa Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Thu, 9 Jul 2020 20:41:25 +0100 Subject: [PATCH] Extend the IAudioController implementation with volume stubs This is used by ARMS. --- .../am/controller/IAudioController.cpp | 16 ++++++++++++++++ .../services/am/controller/IAudioController.h | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) 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 99c9995d..1bec0df0 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IAudioController.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IAudioController.cpp @@ -5,5 +5,21 @@ namespace skyline::service::am { IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAudioController, "am:IAudioController", { + {0x0, SFUNC(IAudioController::SetExpectedMasterVolume)}, + {0x1, SFUNC(IAudioController::GetMainAppletExpectedMasterVolume)}, + {0x2, SFUNC(IAudioController::GetLibraryAppletExpectedMasterVolume)} }) {} + + void IAudioController::SetExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + mainAppletVolume = request.Pop(); + libraryAppletVolume = request.Pop(); + } + + void IAudioController::GetMainAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(mainAppletVolume); + } + + void IAudioController::GetLibraryAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(libraryAppletVolume); + } } 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 e272bce9..0d8d1326 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IAudioController.h +++ b/app/src/main/cpp/skyline/services/am/controller/IAudioController.h @@ -11,7 +11,26 @@ namespace skyline::service::am { * @brief This has functions relating to volume control (https://switchbrew.org/wiki/Applet_Manager_services#IAudioController) */ class IAudioController : public BaseService { + private: + float mainAppletVolume{1.0f}; //!< The volume that is expected to be used for the main applet + float libraryAppletVolume{1.0f}; //!< The volume that is expected to be used for the library applet + public: IAudioController(const DeviceState &state, ServiceManager &manager); + + /** + * @brief This sets the expected volumes for an application (https://switchbrew.org/wiki/Applet_Manager_services#SetExpectedMasterVolume) + */ + void SetExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** + * @brief This returns the main applet volume that is expected by the application (https://switchbrew.org/wiki/Applet_Manager_services#GetMainAppletExpectedMasterVolume) + */ + void GetMainAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** + * @brief This returns the library applet volume that is expected by the application (https://switchbrew.org/wiki/Applet_Manager_services#GetLibraryAppletExpectedMasterVolume) + */ + void GetLibraryAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); }; }