With RUNFLAG_APTWORKAROUND enabled, at the start of aptReturnToMenu just set the status to APP_EXITING then return(this func won't actually get executed with RUNFLAG_APTWORKAROUND atm). Updated __handle_notification() to check for errors from APT_InquireNotification. In aptExit only call the applet-utility code when RUNFLAG_APTWORKAROUND is not set. Minor other changes. Fixed APT_CheckNew3DS code so that it properly only uses one of the APT cmds.
This commit is contained in:
parent
8a3f532967
commit
c60bdb3670
@ -145,6 +145,13 @@ void aptReturnToMenu()
|
|||||||
u32 ns_capinfo[0x20>>2];
|
u32 ns_capinfo[0x20>>2];
|
||||||
u32 tmp_params[0x20>>2];
|
u32 tmp_params[0x20>>2];
|
||||||
|
|
||||||
|
if(__system_runflags&RUNFLAG_APTWORKAROUND)
|
||||||
|
{
|
||||||
|
svcClearEvent(aptStatusEvent);
|
||||||
|
aptSetStatus(APP_EXITING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// This is only executed when ret-to-menu was triggered via the home-button, not the power-button.
|
// This is only executed when ret-to-menu was triggered via the home-button, not the power-button.
|
||||||
if(aptGetStatusPower() == 0)
|
if(aptGetStatusPower() == 0)
|
||||||
{
|
{
|
||||||
@ -209,12 +216,15 @@ void aptReturnToMenu()
|
|||||||
|
|
||||||
static void __handle_notification() {
|
static void __handle_notification() {
|
||||||
u8 type;
|
u8 type;
|
||||||
|
Result ret=0;
|
||||||
|
|
||||||
// Get notification type.
|
// Get notification type.
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
APT_InquireNotification(NULL, currentAppId, &type);
|
ret = APT_InquireNotification(NULL, currentAppId, &type);
|
||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
|
|
||||||
|
if(ret!=0)return;
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case APTSIGNAL_HOMEBUTTON:
|
case APTSIGNAL_HOMEBUTTON:
|
||||||
@ -367,7 +377,7 @@ Result aptInit(void)
|
|||||||
|
|
||||||
void aptExit()
|
void aptExit()
|
||||||
{
|
{
|
||||||
aptAppletUtility_Exit_RetToApp();
|
if(!(__system_runflags&RUNFLAG_APTWORKAROUND))aptAppletUtility_Exit_RetToApp();
|
||||||
|
|
||||||
// This is only executed when application-termination was triggered via the home-menu power-off screen.
|
// This is only executed when application-termination was triggered via the home-menu power-off screen.
|
||||||
if(aptGetStatusPower() == 1)
|
if(aptGetStatusPower() == 1)
|
||||||
@ -399,6 +409,8 @@ bool aptMainLoop()
|
|||||||
{
|
{
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
//if(__system_runflags&RUNFLAG_APTWORKAROUND)__handle_notification();
|
||||||
|
|
||||||
switch(aptGetStatus())
|
switch(aptGetStatus())
|
||||||
{
|
{
|
||||||
case APP_RUNNING:
|
case APP_RUNNING:
|
||||||
@ -461,11 +473,8 @@ APP_STATUS aptGetStatus()
|
|||||||
|
|
||||||
void aptSetStatus(APP_STATUS status)
|
void aptSetStatus(APP_STATUS status)
|
||||||
{
|
{
|
||||||
u32 prevstatus;
|
|
||||||
|
|
||||||
svcWaitSynchronization(aptStatusMutex, U64_MAX);
|
svcWaitSynchronization(aptStatusMutex, U64_MAX);
|
||||||
|
|
||||||
prevstatus = aptStatus;
|
|
||||||
aptStatus = status;
|
aptStatus = status;
|
||||||
|
|
||||||
//if(prevstatus != APP_NOTINITIALIZED)
|
//if(prevstatus != APP_NOTINITIALIZED)
|
||||||
@ -876,8 +885,14 @@ Result APT_CheckNew3DS(Handle* handle, u8 *out)
|
|||||||
}
|
}
|
||||||
|
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
if(currentAppId==APPID_APPLICATION)ret = APT_CheckNew3DS_Application(NULL, out);
|
if(currentAppId==APPID_APPLICATION)
|
||||||
ret = APT_CheckNew3DS_System(NULL, out);
|
{
|
||||||
|
ret = APT_CheckNew3DS_Application(NULL, out);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = APT_CheckNew3DS_System(NULL, out);
|
||||||
|
}
|
||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
|
|
||||||
__apt_new3dsflag_initialized = 1;
|
__apt_new3dsflag_initialized = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user