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 6dd5346f..e8193543 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ISelfController.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/ISelfController.cpp @@ -7,7 +7,7 @@ #include "ISelfController.h" namespace skyline::service::am { - ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared(state)), BaseService(state, manager, Service::am_ISelfController, "am:ISelfController", { + ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared(state)), accumulatedSuspendedTickChangedEvent(std::make_shared(state)), BaseService(state, manager, Service::am_ISelfController, "am:ISelfController", { {0x1, SFUNC(ISelfController::LockExit)}, {0x2, SFUNC(ISelfController::UnlockExit)}, {0x9, SFUNC(ISelfController::GetLibraryAppletLaunchableEvent)}, @@ -16,7 +16,8 @@ namespace skyline::service::am { {0xD, SFUNC(ISelfController::SetFocusHandlingMode)}, {0xE, SFUNC(ISelfController::SetRestartMessageEnabled)}, {0x10, SFUNC(ISelfController::SetOutOfFocusSuspendingEnabled)}, - {0x28, SFUNC(ISelfController::CreateManagedDisplayLayer)} + {0x28, SFUNC(ISelfController::CreateManagedDisplayLayer)}, + {0x5b, SFUNC(ISelfController::GetLibraryAppletLaunchableEvent)} }) {} void ISelfController::LockExit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {} @@ -52,4 +53,11 @@ namespace skyline::service::am { response.Push(0); } + + void ISelfController::GetAccumulatedSuspendedTickChangedEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + auto handle = state.process->InsertItem(accumulatedSuspendedTickChangedEvent); + state.logger->Debug("Accumulated Suspended Tick Event Handle: 0x{:X}", handle); + + response.copyHandles.push_back(handle); + } } 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 3177c653..379a4080 100644 --- a/app/src/main/cpp/skyline/services/am/controller/ISelfController.h +++ b/app/src/main/cpp/skyline/services/am/controller/ISelfController.h @@ -13,6 +13,7 @@ namespace skyline::service::am { class ISelfController : public BaseService { private: std::shared_ptr libraryAppletLaunchableEvent; //!< This KEvent is triggered when the library applet is launchable + std::shared_ptr accumulatedSuspendedTickChangedEvent; //!< This KEvent is triggered when the time the system has spent in suspend is updated public: ISelfController(const DeviceState &state, ServiceManager &manager); @@ -61,5 +62,10 @@ namespace skyline::service::am { * @brief This function returns an output u64 LayerId (https://switchbrew.org/wiki/Applet_Manager_services#CreateManagedDisplayLayer) */ void CreateManagedDisplayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** + * @brief This obtains a handle to the system sleep time change KEvent (https://switchbrew.org/wiki/Applet_Manager_services#GetAccumulatedSuspendedTickChangedEvent) + */ + void GetAccumulatedSuspendedTickChangedEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); }; }