APT WORKAROUND (update 3dsx_crt0.s to https://gist.github.com/smealum/305802b2b9bf4c877ddb and recompile everything please)
This commit is contained in:
parent
fb1dc89eab
commit
4c9abef1a9
@ -1,6 +1,9 @@
|
|||||||
#ifndef APT_H
|
#ifndef APT_H
|
||||||
#define APT_H
|
#define APT_H
|
||||||
|
|
||||||
|
// TODO : find a better place to put this
|
||||||
|
#define RUNFLAG_APTWORKAROUND (BIT(0))
|
||||||
|
|
||||||
typedef enum{
|
typedef enum{
|
||||||
APPID_HOMEMENU = 0x101, // Home Menu
|
APPID_HOMEMENU = 0x101, // Home Menu
|
||||||
APPID_CAMERA = 0x110, // Camera applet
|
APPID_CAMERA = 0x110, // Camera applet
|
||||||
@ -35,7 +38,7 @@ enum {
|
|||||||
|
|
||||||
extern Handle aptEvents[3];
|
extern Handle aptEvents[3];
|
||||||
|
|
||||||
Result aptInit(NS_APPID appID);
|
Result aptInit();
|
||||||
void aptExit();
|
void aptExit();
|
||||||
void aptOpenSession();
|
void aptOpenSession();
|
||||||
void aptCloseSession();
|
void aptCloseSession();
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
#define APT_HANDLER_STACKSIZE (0x1000)
|
#define APT_HANDLER_STACKSIZE (0x1000)
|
||||||
|
|
||||||
|
//TODO : better place to put this ?
|
||||||
|
extern u32 __apt_appid;
|
||||||
|
extern u32 __system_runflags;
|
||||||
|
|
||||||
NS_APPID currentAppId;
|
NS_APPID currentAppId;
|
||||||
|
|
||||||
Handle aptLockHandle;
|
Handle aptLockHandle;
|
||||||
@ -292,7 +296,7 @@ void aptEventHandler(u32 arg)
|
|||||||
svcExitThread();
|
svcExitThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result aptInit(NS_APPID appID)
|
Result aptInit(void)
|
||||||
{
|
{
|
||||||
Result ret=0;
|
Result ret=0;
|
||||||
|
|
||||||
@ -301,19 +305,22 @@ Result aptInit(NS_APPID appID)
|
|||||||
if((ret=APT_GetLockHandle(&aptuHandle, 0x0, &aptLockHandle)))return ret;
|
if((ret=APT_GetLockHandle(&aptuHandle, 0x0, &aptLockHandle)))return ret;
|
||||||
svcCloseHandle(aptuHandle);
|
svcCloseHandle(aptuHandle);
|
||||||
|
|
||||||
currentAppId = appID;
|
currentAppId = __apt_appid;
|
||||||
|
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
if((ret=APT_Initialize(NULL, currentAppId, &aptEvents[0], &aptEvents[1])))return ret;
|
if((ret=APT_Initialize(NULL, currentAppId, &aptEvents[0], &aptEvents[1])))return ret;
|
||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
|
|
||||||
aptOpenSession();
|
if(!(__system_runflags&RUNFLAG_APTWORKAROUND))
|
||||||
if((ret=APT_Enable(NULL, 0x0)))return ret;
|
{
|
||||||
aptCloseSession();
|
aptOpenSession();
|
||||||
|
if((ret=APT_Enable(NULL, 0x0)))return ret;
|
||||||
aptOpenSession();
|
aptCloseSession();
|
||||||
if((ret=APT_NotifyToWait(NULL, currentAppId)))return ret;
|
|
||||||
aptCloseSession();
|
aptOpenSession();
|
||||||
|
if((ret=APT_NotifyToWait(NULL, currentAppId)))return ret;
|
||||||
|
aptCloseSession();
|
||||||
|
}
|
||||||
|
|
||||||
svcCreateEvent(&aptStatusEvent, 0);
|
svcCreateEvent(&aptStatusEvent, 0);
|
||||||
return 0;
|
return 0;
|
||||||
@ -331,13 +338,16 @@ void aptExit()
|
|||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
aptOpenSession();
|
if(!(__system_runflags&RUNFLAG_APTWORKAROUND))
|
||||||
APT_PrepareToCloseApplication(NULL, 0x1);
|
{
|
||||||
aptCloseSession();
|
aptOpenSession();
|
||||||
|
APT_PrepareToCloseApplication(NULL, 0x1);
|
||||||
aptOpenSession();
|
aptCloseSession();
|
||||||
APT_CloseApplication(NULL, 0x0, 0x0, 0x0);
|
|
||||||
aptCloseSession();
|
aptOpenSession();
|
||||||
|
APT_CloseApplication(NULL, 0x0, 0x0, 0x0);
|
||||||
|
aptCloseSession();
|
||||||
|
}
|
||||||
|
|
||||||
svcCloseHandle(aptStatusMutex);
|
svcCloseHandle(aptStatusMutex);
|
||||||
//svcCloseHandle(aptLockHandle);
|
//svcCloseHandle(aptLockHandle);
|
||||||
@ -370,21 +380,24 @@ void aptSetupEventHandler()
|
|||||||
APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
|
APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
|
||||||
aptCloseSession();*/
|
aptCloseSession();*/
|
||||||
|
|
||||||
memset(buf1, 0, 4);
|
if(!(__system_runflags&RUNFLAG_APTWORKAROUND))
|
||||||
|
{
|
||||||
|
memset(buf1, 0, 4);
|
||||||
|
|
||||||
buf1[0] = 0x10;
|
buf1[0] = 0x10;
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
APT_AppletUtility(NULL, NULL, 0x7, 0x4, buf1, 0x1, buf2);
|
APT_AppletUtility(NULL, NULL, 0x7, 0x4, buf1, 0x1, buf2);
|
||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
|
|
||||||
buf1[0] = 0x00;
|
buf1[0] = 0x00;
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
|
APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
|
||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
|
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
|
APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
|
||||||
aptCloseSession();
|
aptCloseSession();
|
||||||
|
}
|
||||||
|
|
||||||
svcCreateMutex(&aptStatusMutex, true);
|
svcCreateMutex(&aptStatusMutex, true);
|
||||||
aptStatus=0;
|
aptStatus=0;
|
||||||
|
Loading…
Reference in New Issue
Block a user