diff --git a/libctru/include/3ds/APT.h b/libctru/include/3ds/APT.h index 5ce2fd6..3a42e9f 100644 --- a/libctru/include/3ds/APT.h +++ b/libctru/include/3ds/APT.h @@ -18,6 +18,21 @@ typedef enum{ APP_PREPARE_SLEEPMODE }APP_STATUS; +enum { + APTSIGNAL_HOMEBUTTON = 1, + // 2: sleep-mode related? + APTSIGNAL_PREPARESLEEP = 3, + // 4: triggered when ptm:s GetShellStatus() returns 5. + APTSIGNAL_ENTERSLEEP = 5, + APTSIGNAL_WAKEUP = 6, + APTSIGNAL_ENABLE = 7, + APTSIGNAL_POWERBUTTON = 8, + APTSIGNAL_UTILITY = 9, + APTSIGNAL_SLEEPSYSTEM = 10, + APTSIGNAL_ERROR = 11 +}; + + extern Handle aptEvents[3]; Result aptInit(NS_APPID appID); diff --git a/libctru/source/services/apt.c b/libctru/source/services/apt.c index 36b0951..8af4915 100644 --- a/libctru/source/services/apt.c +++ b/libctru/source/services/apt.c @@ -196,8 +196,8 @@ void aptEventHandler(u32 arg) switch(signalType) { - case 0x1: //home menu button got pressed - case 0x8: //power button got pressed + case APTSIGNAL_HOMEBUTTON: + case APTSIGNAL_POWERBUTTON: if(aptGetStatus()==APP_RUNNING) { aptOpenSession(); @@ -211,7 +211,7 @@ void aptEventHandler(u32 arg) break; - case 0x3: //preparing to enter sleep-mode + case APTSIGNAL_PREPARESLEEP: aptStatus_beforesleepmode = aptGetStatus(); aptOpenSession(); APT_ReplySleepQuery(NULL, currentAppId, 0x1); @@ -219,7 +219,7 @@ void aptEventHandler(u32 arg) aptSetStatus(APP_PREPARE_SLEEPMODE); break; - case 0x5: //entering sleep-mode + case APTSIGNAL_ENTERSLEEP: if(aptGetStatus()==APP_PREPARE_SLEEPMODE) { aptOpenSession(); @@ -229,7 +229,7 @@ void aptEventHandler(u32 arg) } break; - case 0x6: //leaving sleep-mode + case APTSIGNAL_WAKEUP: // Leaving sleep-mode. if(aptGetStatus()==APP_SLEEPMODE) { if(aptStatus_beforesleepmode == APP_RUNNING)GSPGPU_SetLcdForceBlack(NULL, 0);