Adapt examples to the changes (not tested).
hidInit(NULL);
- aptSetupEventHandler();
-
APP_STATUS status;
while((status=aptGetStatus())!=APP_EXITING)
{
GPU_SetFaceCulling(GPU_CULL_BACK_CCW);
GPU_SetStencilTest(false, GPU_ALWAYS, 0x00);
- GPU_SetDepthTest(true, GPU_GREATER, 0x1F);
+ GPU_SetDepthTestAndWriteMask(true, GPU_GREATER, GPU_WRITE_ALL);
// ?
GPUCMD_AddSingleParam(0x00010062, 0x00000000); //param always 0x0 according to code
GPU_DrawArray(GPU_TRIANGLES, mdlFaces*3);
//finalize stuff ?
- GPUCMD_AddSingleParam(0x000F0111, 0x00000001);
- GPUCMD_AddSingleParam(0x000F0110, 0x00000001);
- GPUCMD_AddSingleParam(0x0008025E, 0x00000000);
+ GPU_FinishDrawing();
}
void demoControls(void)
aptInit();
gfxInit();
hidInit(NULL);
- aptSetupEventHandler();
GPU_Init(NULL);
shader=SHDR_ParseSHBIN((u32*)test_vsh_shbin,test_vsh_shbin_size);
GX_SetMemoryFill(gxCmdBuf, (u32*)gpuOut, 0x404040FF, (u32*)&gpuOut[0x2EE00], 0x201, (u32*)gpuDOut, 0x00000000, (u32*)&gpuDOut[0x2EE00], 0x201);
+ gspWaitForPSC0();
gfxSwapBuffersGpu();
APP_STATUS status;
demoControls();
GX_SetMemoryFill(gxCmdBuf, (u32*)gpuOut, 0x404040FF, (u32*)&gpuOut[0x2EE00], 0x201, (u32*)gpuDOut, 0x00000000, (u32*)&gpuDOut[0x2EE00], 0x201);
+ gspWaitForPSC0();
GPUCMD_SetBuffer(gpuCmd, gpuCmdSize, 0);
doFrame1();
GPUCMD_Finalize();
GPUCMD_Run(gxCmdBuf);
+ gspWaitForP3D();
gfxSwapBuffersGpu();
GX_SetDisplayTransfer(gxCmdBuf, (u32*)gpuOut, 0x019001E0, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 0x019001E0, 0x01001000);
+ gspWaitForPPF();
}
gspWaitForVBlank();
}
aptInit();
gfxInit();
hidInit(NULL);
- aptSetupEventHandler();
CSND_initialize(NULL);
FSUSER_OpenFileDirectly(fsuHandle, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
FSFILE_Read(fileHandle, &bytesRead, 0x0, (u32*)gspHeap, 0x46500);
FSFILE_Close(fileHandle);
-
- aptSetupEventHandler();
APP_STATUS status;
while((status=aptGetStatus())!=APP_EXITING)
void aptExit();
void aptOpenSession();
void aptCloseSession();
-void aptSetupEventHandler();
void aptSetStatus(APP_STATUS status);
APP_STATUS aptGetStatus();
u32 aptGetStatusPower();//This can be used when the status is APP_SUSPEND* to check how the return-to-menu was triggered: 0 = home-button, 1 = power-button.
switch(type)
{
case 0x1: // Application just started.
+ aptAppStarted();
return true;
case 0xB: // Just returned from menu.
aptOpenSession();
if((ret=APT_NotifyToWait(NULL, currentAppId)))return ret;
aptCloseSession();
+
+ // create APT event handler thread
+ svcCreateThread(&aptEventHandlerThread, aptEventHandler, 0x0,
+ (u32*)(&aptEventHandlerStack[APT_HANDLER_STACKSIZE/8]), 0x31, 0xfffffffe);
}
svcCreateEvent(&aptStatusEvent, 0);
svcCloseHandle(aptStatusEvent);
}
-void aptSetupEventHandler()
+void aptAppStarted()
{
u8 buf1[4], buf2[4];
- /*buf1[0]=0x02; buf1[1]=0x00; buf1[2]=0x00; buf1[3]=0x04;
- aptOpenSession();
- APT_AppletUtility(NULL, NULL, 0x7, 0x4, buf1, 0x1, buf2);
- aptCloseSession();
-
- aptOpenSession();
- APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
- aptCloseSession();
-
- aptOpenSession();
- APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
- aptCloseSession();
-
- buf1[0]=0x13; buf1[1]=0x00; buf1[2]=0x10; buf1[3]=0x00;
- aptOpenSession();
- APT_AppletUtility(NULL, NULL, 0x7, 0x4, buf1, 0x1, buf2);
- aptCloseSession();
-
- aptOpenSession();
- APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
- aptCloseSession();*/
-
svcCreateMutex(&aptStatusMutex, true);
aptStatus=0;
svcReleaseMutex(aptStatusMutex);
aptOpenSession();
APT_AppletUtility(NULL, NULL, 0x4, 0x1, buf1, 0x1, buf2);
aptCloseSession();
-
- // Create thread for stuff handling APT events.
- svcCreateThread(&aptEventHandlerThread, aptEventHandler, 0x0,
- (u32*)(&aptEventHandlerStack[APT_HANDLER_STACKSIZE/8]), 0x31, 0xfffffffe);
}
}