s32 main (void) { // Initialize services srvInit(); aptInit(); hidInit(NULL); gfxInitDefault(); fsInit(); sdmcInit(); hbInit(); qtmInit(); Handle fileHandle; u32 bytesRead; FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}}; FS_path filePath=FS_makePath(PATH_CHAR, "/rxTools.dat"); Result ret=FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE); if(ret) goto EXIT; FSFILE_Read(fileHandle, &bytesRead, 0x20000, 0x14400000, 320*1024); FSFILE_Close(fileHandle); consoleInit(GFX_BOTTOM, NULL); if (brahma_init()) { quick_boot_firm(1); printf("[!] Quickload failed\n"); brahma_exit(); } else { printf("* BRAHMA *\n\n[!]Not enough memory\n"); wait_any_key(); } EXIT: hbExit(); sdmcExit(); fsExit(); gfxExit(); hidExit(); aptExit(); srvExit(); // Return to hbmenu return 0; }
s32 main(void) { // Initialize services srvInit(); aptInit(); hidInit(NULL); gfxInitDefault(); gfxSet3D(true); fsInit(); sdmcInit(); hbInit(); qtmInit(); gfxSwapBuffers(); Handle fileHandle; u32 bytesRead; FS_archive sdmcArchive = (FS_archive){ ARCH_SDMC, (FS_path){ PATH_EMPTY, 1, (u8*)"" } }; FS_path filePath = FS_makePath(PATH_CHAR, "/" CODE_PATH); Result ret = FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE); if (ret) goto EXIT; FSFILE_Read(fileHandle, &bytesRead, 0x14000, 0x14400000, 320 * 1024); FSFILE_Close(fileHandle); if (brahma_init()) { quick_boot_firm(1); brahma_exit(); } EXIT: hbExit(); sdmcExit(); fsExit(); gfxExit(); hidExit(); aptExit(); srvExit(); // Return to hbmenu return 0; }
int main() { // Initialize services srvInit(); aptInit(); hidInit(NULL); gfxInitDefault(); fsInit(); sdmcInit(); hbInit(); qtmInit(); hidScanInput(); u32 kDown = hidKeysDown(); u32 kHeld = hidKeysHeld(); //Load the configuration loadConfiguration(); //Check kernel version getSystemVersion(); //checks if the CFW has to boot right away or open the GUI if(auto_boot == '2') auto_boot = '2'; //here it checks if the "force GUI" is set, and preservs it if it is set else if(kHeld & KEY_L) auto_boot = '0'; //here it will start the GUI only this time else auto_boot = '1'; //here it won't show the GUI //checks if the CFW has to disable firmlaunch if (kHeld & KEY_R && firmlaunch == '0') firmlaunch = '2'; //here we enable the firmlaunch only this time else if (kHeld & KEY_R && firmlaunch == '1')firmlaunch = '3'; //here we disable the firmlaunch only this time //Then we save the configuration saveConfiguration(); //Proceeds to launch the loader.bin bootCFW_FirstStage(); }
int main() { u32 pos; u32 x, y; Result ret; bool qtm_usable; qtmHeadtrackingInfo qtminfo; u32 colors[4] = {0x0000FF, 0x00FF00, 0xFF0000, 0xFFFFFF}; gfxInitDefault(); //gfxSet3D(true); // uncomment if using stereoscopic 3D qtmInit(); consoleInit(GFX_BOTTOM, NULL); printf("qtm example\n"); qtm_usable = qtmCheckInitialized(); if(!qtm_usable)printf("QTM is not usable, therefore this example won't do anything with QTM.\n"); // Main loop while (aptMainLoop()) { gspWaitForVBlank(); hidScanInput(); u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu if(qtm_usable) { u8* fb = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL); memset(fb, 0, 400*240*3); ret = qtmGetHeadtrackingInfo(0, &qtminfo); if(ret==0) { consoleClear(); for(pos=0; pos<5; pos++) { printf("flags[%x]=0x%x", (unsigned int)pos, qtminfo.flags[pos]); if(pos<4)printf(", "); } printf("\nfloatdata_x08: %f\n", qtminfo.floatdata_x08); printf("coords0: "); for(pos=0; pos<4; pos++) { printf("[%x].x=%f, y=%f", (unsigned int)pos, qtminfo.coords0[pos].x, qtminfo.coords0[pos].y); if(pos<3)printf(", "); } printf("\n"); if(qtmCheckHeadFullyDetected(&qtminfo)) { for(pos=0; pos<4; pos++) { ret = qtmConvertCoordToScreen(&qtminfo.coords0[pos], NULL, NULL, &x, &y); if(ret==0)memcpy(&fb[(x*240 + y) * 3], &colors[pos], 3); } } } } // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); } // Exit services qtmExit(); gfxExit(); return 0; }