Implement GetAccumulatedSuspendedTickChangedEvent

This commit is contained in:
Billy Laws 2020-08-09 14:52:43 +01:00 committed by ◱ PixelyIon
parent 6c9e0a943c
commit c69efed2ad
2 changed files with 16 additions and 2 deletions

View File

@ -7,7 +7,7 @@
#include "ISelfController.h"
namespace skyline::service::am {
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, Service::am_ISelfController, "am:ISelfController", {
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared<type::KEvent>(state)), accumulatedSuspendedTickChangedEvent(std::make_shared<type::KEvent>(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<u64>(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);
}
}

View File

@ -13,6 +13,7 @@ namespace skyline::service::am {
class ISelfController : public BaseService {
private:
std::shared_ptr<kernel::type::KEvent> libraryAppletLaunchableEvent; //!< This KEvent is triggered when the library applet is launchable
std::shared_ptr<kernel::type::KEvent> 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);
};
}