Allow blocking HOME button
Signed-off-by: Alex Taber <alexftaber@gmail.com>
This commit is contained in:
parent
510504a853
commit
8b334ae2ef
@ -158,6 +158,18 @@ bool aptIsSleepAllowed(void);
|
|||||||
*/
|
*/
|
||||||
void aptSetSleepAllowed(bool allowed);
|
void aptSetSleepAllowed(bool allowed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets whether to allow the system to go back to HOME menu.
|
||||||
|
* @return Whether going back to HOME menu is allowed.
|
||||||
|
*/
|
||||||
|
bool aptIsHomeAllowed(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets whether to allow the system to go back to HOME menu.
|
||||||
|
* @param allowed Whether going back to HOME menu is allowed.
|
||||||
|
*/
|
||||||
|
void aptSetHomeAllowed(bool allowed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Processes the current APT status. Generally used within a main loop.
|
* @brief Processes the current APT status. Generally used within a main loop.
|
||||||
* @return Whether the application should continue running.
|
* @return Whether the application should continue running.
|
||||||
|
@ -41,6 +41,7 @@ enum
|
|||||||
|
|
||||||
static u8 aptHomeButtonState;
|
static u8 aptHomeButtonState;
|
||||||
static u32 aptFlags = FLAG_ALLOWSLEEP;
|
static u32 aptFlags = FLAG_ALLOWSLEEP;
|
||||||
|
static bool home_allowed = false;
|
||||||
static u32 aptParameters[0x1000/4];
|
static u32 aptParameters[0x1000/4];
|
||||||
static u64 aptChainloadTid;
|
static u64 aptChainloadTid;
|
||||||
static u8 aptChainloadMediatype;
|
static u8 aptChainloadMediatype;
|
||||||
@ -267,6 +268,16 @@ void aptSetSleepAllowed(bool allowed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool aptIsHomeAllowed(void)
|
||||||
|
{
|
||||||
|
return home_allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void aptSetHomeAllowed(bool allowed)
|
||||||
|
{
|
||||||
|
home_allowed = allowed;
|
||||||
|
}
|
||||||
|
|
||||||
void aptSetChainloader(u64 programID, u8 mediatype)
|
void aptSetChainloader(u64 programID, u8 mediatype)
|
||||||
{
|
{
|
||||||
aptChainloadTid = programID;
|
aptChainloadTid = programID;
|
||||||
@ -338,10 +349,10 @@ void aptEventHandler(void *arg)
|
|||||||
switch (signal)
|
switch (signal)
|
||||||
{
|
{
|
||||||
case APTSIGNAL_HOMEBUTTON:
|
case APTSIGNAL_HOMEBUTTON:
|
||||||
if (!aptHomeButtonState) aptHomeButtonState = 1;
|
if (!aptHomeButtonState && aptIsHomeAllowed()) aptHomeButtonState = 1;
|
||||||
break;
|
break;
|
||||||
case APTSIGNAL_HOMEBUTTON2:
|
case APTSIGNAL_HOMEBUTTON2:
|
||||||
if (!aptHomeButtonState) aptHomeButtonState = 2;
|
if (!aptHomeButtonState && aptIsHomeAllowed()) aptHomeButtonState = 2;
|
||||||
break;
|
break;
|
||||||
case APTSIGNAL_SLEEP_QUERY:
|
case APTSIGNAL_SLEEP_QUERY:
|
||||||
APT_ReplySleepQuery(envGetAptAppId(), aptIsSleepAllowed() ? APTREPLY_ACCEPT : APTREPLY_REJECT);
|
APT_ReplySleepQuery(envGetAptAppId(), aptIsSleepAllowed() ? APTREPLY_ACCEPT : APTREPLY_REJECT);
|
||||||
|
Loading…
Reference in New Issue
Block a user