Add aptMainLoop() for handling APT events in main()
This commit is contained in:
parent
3135d1c344
commit
7f10ad4097
@ -177,10 +177,7 @@ int main()
|
|||||||
gspWaitForPSC0();
|
gspWaitForPSC0();
|
||||||
gfxSwapBuffersGpu();
|
gfxSwapBuffersGpu();
|
||||||
|
|
||||||
APP_STATUS status;
|
while(aptMainLoop())
|
||||||
while((status=aptGetStatus())!=APP_EXITING)
|
|
||||||
{
|
|
||||||
if(status==APP_RUNNING)
|
|
||||||
{
|
{
|
||||||
demoControls();
|
demoControls();
|
||||||
|
|
||||||
@ -196,7 +193,6 @@ int main()
|
|||||||
gfxSwapBuffersGpu();
|
gfxSwapBuffersGpu();
|
||||||
GX_SetDisplayTransfer(gxCmdBuf, (u32*)gpuOut, 0x019001E0, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 0x019001E0, 0x01001000);
|
GX_SetDisplayTransfer(gxCmdBuf, (u32*)gpuOut, 0x019001E0, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 0x019001E0, 0x01001000);
|
||||||
gspWaitForPPF();
|
gspWaitForPPF();
|
||||||
}
|
|
||||||
gspWaitForVBlank();
|
gspWaitForVBlank();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,10 +24,7 @@ int main()
|
|||||||
|
|
||||||
MIC_Initialize(sharedmem, sharedmem_size, control, 0, 3, 1, 1);//See mic.h.
|
MIC_Initialize(sharedmem, sharedmem_size, control, 0, 3, 1, 1);//See mic.h.
|
||||||
|
|
||||||
APP_STATUS status;
|
while(aptMainLoop())
|
||||||
while((status=aptGetStatus())!=APP_EXITING)
|
|
||||||
{
|
|
||||||
if(status==APP_RUNNING)
|
|
||||||
{
|
{
|
||||||
framebuf = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
|
framebuf = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
@ -69,15 +66,6 @@ int main()
|
|||||||
|
|
||||||
gfxFlushBuffers();
|
gfxFlushBuffers();
|
||||||
gfxSwapBuffers();
|
gfxSwapBuffers();
|
||||||
}
|
|
||||||
else if(status == APP_SUSPENDING)
|
|
||||||
{
|
|
||||||
aptReturnToMenu();
|
|
||||||
}
|
|
||||||
else if(status == APP_SLEEPMODE)
|
|
||||||
{
|
|
||||||
aptWaitStatusEvent();
|
|
||||||
}
|
|
||||||
gspWaitForVBlank();
|
gspWaitForVBlank();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ void aptReturnToMenu();//This should be called by the user application when aptG
|
|||||||
void aptWaitStatusEvent();
|
void aptWaitStatusEvent();
|
||||||
void aptSignalReadyForSleep();
|
void aptSignalReadyForSleep();
|
||||||
NS_APPID aptGetMenuAppID();
|
NS_APPID aptGetMenuAppID();
|
||||||
|
bool aptMainLoop(); // Use like this in your main(): while (aptMainLoop()) { your code here... }
|
||||||
|
|
||||||
Result APT_GetLockHandle(Handle* handle, u16 flags, Handle* lockHandle);
|
Result APT_GetLockHandle(Handle* handle, u16 flags, Handle* lockHandle);
|
||||||
Result APT_Initialize(Handle* handle, NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2);
|
Result APT_Initialize(Handle* handle, NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2);
|
||||||
|
@ -394,6 +394,25 @@ void aptExit()
|
|||||||
svcCloseHandle(aptStatusEvent);
|
svcCloseHandle(aptStatusEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool aptMainLoop()
|
||||||
|
{
|
||||||
|
for (;;) switch (aptGetStatus())
|
||||||
|
{
|
||||||
|
case APP_RUNNING:
|
||||||
|
return true;
|
||||||
|
case APP_SUSPENDING:
|
||||||
|
aptReturnToMenu();
|
||||||
|
break;
|
||||||
|
case APP_SLEEPMODE:
|
||||||
|
aptWaitStatusEvent();
|
||||||
|
break;
|
||||||
|
case APP_EXITING:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void aptAppStarted()
|
void aptAppStarted()
|
||||||
{
|
{
|
||||||
u8 buf1[4], buf2[4];
|
u8 buf1[4], buf2[4];
|
||||||
|
Loading…
Reference in New Issue
Block a user