mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
applet: Added get-event funcs:
appletHolderGetExitEvent and expose appletHolderGetPopInteractiveOutDataEvent.
This commit is contained in:
parent
a0ce273019
commit
6620dfaa6f
@ -1138,6 +1138,14 @@ Result appletHolderRequestExitOrTerminate(AppletHolder *h, u64 timeout);
|
||||
*/
|
||||
void appletHolderJoin(AppletHolder *h);
|
||||
|
||||
/**
|
||||
* @brief Gets the LibraryApplet StateChangedEvent.
|
||||
* @param h AppletHolder object.
|
||||
*/
|
||||
NX_CONSTEXPR Event *appletHolderGetExitEvent(AppletHolder *h) {
|
||||
return &h->StateChangedEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Waits on the LibraryApplet StateChangedEvent with timeout=0, and returns whether it was successful.
|
||||
* @param h AppletHolder object.
|
||||
@ -1165,6 +1173,13 @@ Result appletHolderSetOutOfFocusApplicationSuspendingEnabled(AppletHolder *h, bo
|
||||
*/
|
||||
Result appletHolderPresetLibraryAppletGpuTimeSliceZero(AppletHolder *h);
|
||||
|
||||
/**
|
||||
* @brief Gets the PopInteractiveOutDataEvent.
|
||||
* @param h AppletHolder object.
|
||||
* @param[out] out_event Output Event.
|
||||
*/
|
||||
Result appletHolderGetPopInteractiveOutDataEvent(AppletHolder *h, Event **out_event);
|
||||
|
||||
/**
|
||||
* @brief Waits for the PopInteractiveOutDataEvent and StateChangedEvent.
|
||||
* @return false for error / when StateChangedEvent was signaled, and true when PopInteractiveOutDataEvent was signaled. The latter is signaled when a new storage is available with \ref appletHolderPopInteractiveOutData where previously no storage was available (this willl not clear the event), this event is automatically cleared by the system once the last storage is popped.
|
||||
|
@ -1654,20 +1654,23 @@ u32 appletHolderGetExitReason(AppletHolder *h) {
|
||||
IPC_MAKE_CMD_IMPL_INITEXPR(Result appletHolderSetOutOfFocusApplicationSuspendingEnabled(AppletHolder *h, bool flag), &h->s, 50, _appletCmdInBoolNoOut, !_appletIsApplication(), flag)
|
||||
IPC_MAKE_CMD_IMPL_HOSVER(Result appletHolderPresetLibraryAppletGpuTimeSliceZero(AppletHolder *h), &h->s, 60, _appletCmdNoIO, (10,0,0))
|
||||
|
||||
static Result _appletHolderGetPopInteractiveOutDataEvent(AppletHolder *h) {
|
||||
if (eventActive(&h->PopInteractiveOutDataEvent)) return 0;
|
||||
Result appletHolderGetPopInteractiveOutDataEvent(AppletHolder *h, Event **out_event) {
|
||||
Result rc=0;
|
||||
|
||||
return _appletCmdGetEvent(&h->s, &h->PopInteractiveOutDataEvent, false, 106);
|
||||
if (!eventActive(&h->PopInteractiveOutDataEvent)) rc = _appletCmdGetEvent(&h->s, &h->PopInteractiveOutDataEvent, false, 106);
|
||||
if (R_SUCCEEDED(rc) && out_event) *out_event = &h->PopInteractiveOutDataEvent;
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool appletHolderWaitInteractiveOut(AppletHolder *h) {
|
||||
Result rc=0;
|
||||
s32 idx = 0;
|
||||
Event *event = NULL;
|
||||
|
||||
rc = _appletHolderGetPopInteractiveOutDataEvent(h);
|
||||
rc = appletHolderGetPopInteractiveOutDataEvent(h, &event);
|
||||
if (R_FAILED(rc)) return false;
|
||||
|
||||
rc = waitMulti(&idx, UINT64_MAX, waiterForEvent(&h->PopInteractiveOutDataEvent), waiterForEvent(&h->StateChangedEvent));
|
||||
rc = waitMulti(&idx, UINT64_MAX, waiterForEvent(event), waiterForEvent(&h->StateChangedEvent));
|
||||
if (R_FAILED(rc)) return false;
|
||||
|
||||
return idx==0;
|
||||
|
Loading…
Reference in New Issue
Block a user