int main(int argc, char **argv) { // Initialize services gfxInitDefault(); //Initialize console on top screen. Using NULL as the second argument tells the console library to use the internal console structure as current one consoleInit(GFX_TOP, NULL); //Move the cursor to row 15 and column 19 and then prints "Hello World!" //To move the cursor you have tu print "\x1b[r;cH", where r and c are respectively //the row and column where you want your cursor to move //The top screen has 30 rows and 50 columns //The bottom screen has 30 rows and 40 columns printf("\x1b[15;19HHello World!"); //Move the cursor to the top left corner of the screen printf("\x1b[0;0H"); //Print a REALLY crappy poeam with colored text //\x1b[cm set a SGR (Select Graphic Rendition) parameter, where c is the parameter that you want to set //Please refer to http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes to see all the possible SGR parameters //As of now ctrulib support only these parameters: //Reset (0), Half bright colors (2), Reverse (7), Text color (30-37) and Background color (40-47) printf("Roses are \x1b[31mred\x1b[0m\n"); printf("Violets are \x1b[34mblue\x1b[0m\n"); printf("Piracy is bad\n"); printf("While homebrews are good\n\n"); //Black text on white background //In this example we set two parameter in a single escape sequence by separating them by a semicolon //\x1b[47;30m means that it will set a white background (47) and it will print white characters (30) //In this we also could have used the printf("\x1b[47;30mBlack text on white background\x1b[0m"); printf("\x1b[29;15HPress Start to exit."); // Main loop while (aptMainLoop()) { //Scan all the inputs. This should be done once for each frame hidScanInput(); //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); //Wait for VBlank gspWaitForVBlank(); } // Exit services gfxExit(); return 0; }
int main() { gfxInitDefault(); //gfxSet3D(true); // uncomment if using stereoscopic 3D // Main loop while (aptMainLoop()) { gspWaitForVBlank(); hidScanInput(); // Your code goes here u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu // Example rendering code that displays a white pixel // Please note that the 3DS screens are sideways (thus 240x400 and 240x320) u8* fb = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, nullptr, nullptr); memset(fb, 127, 240*400*3); fb[3*(10+10*240)] = 0xFF; fb[3*(10+10*240)+1] = 0xFF; fb[3*(10+10*240)+2] = 0xFF; // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); } gfxExit(); return 0; }
int main(int argc, char *argv[]) { // Initialize basic libctru stuff gfxInitDefault(); cfguInit(); osSetSpeedupEnable(true); // consoleInit(GFX_TOP, NULL); g_system = new _3DS::OSystem_3DS(); assert(g_system); // Invoke the actual ScummVM main entry point // if (argc > 2) // res = scummvm_main(argc-2, &argv[2]); // else // res = scummvm_main(argc, argv); scummvm_main(0, nullptr); delete dynamic_cast<_3DS::OSystem_3DS*>(g_system); // Turn on both screen backlights before exiting. if (R_SUCCEEDED(gspLcdInit())) { GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTH); gspLcdExit(); } cfguExit(); gfxExit(); return 0; }
int main(void) { gfxInitDefault(); if(R_FAILED(ndspInit())) return 0; #ifdef DEBUG LightLock_Init(&debug_lock); consoleInit(GFX_BOTTOM, &bottomScreen); consoleDebugInit(debugDevice_CONSOLE); #endif consoleInit(GFX_TOP, &topScreen); //aptHook(&hookCookie, AptEventHook, NULL); svcCreateEvent(&bufferReadyConsumeRequest, RESET_STICKY); svcCreateEvent(&bufferReadyProduceRequest, RESET_STICKY); getFiles(); bool exit = false; while (!exit) { std::string filename = select_file(); exit = stream_file(filename); } ndspExit(); gfxExit(); return 0; }
int main() { suInit(); gfxInitDefault(); consoleInit(GFX_TOP, &topConsole); consoleSelect(&topConsole); cfguInit(); fsInit(); amInit(); fbTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL); fbTopRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL); fbBottom = gfxGetFramebuffer(GFX_BOTTOM, 0, NULL, NULL); u8 next = mainMenu(); while (aptMainLoop()) { switch (next) { case 0: break; case 1: next = mainMenu(); break; //case 2: next = legitInstallMenu(); break; case 3: next = downgradeMenu(); break; //case 4: next = downgradeMSETMenu(); break; //case 5: next = downgradeBrowserMenu(); break; default: next = mainMenu(); } if (next == 0) break; } gfxExit(); return 0; }
int main(int argc, const char* argv[]) { gfxInitDefault(); Result setCpuTimeRes = APT_SetAppCpuTimeLimit(30); if(R_FAILED(setCpuTimeRes)) { util_panic("Failed to set syscore CPU time limit: %08lX", setCpuTimeRes); return 1; } romfsInit(); cfguInit(); acInit(); ptmuInit(); httpcInit(0); amInit(); AM_InitializeExternalTitleDatabase(false); soc_buffer = memalign(0x1000, 0x100000); if(soc_buffer != NULL) { socInit(soc_buffer, 0x100000); } screen_init(); ui_init(); mainmenu_open(); while(aptMainLoop() && ui_update()); cleanup(); return 0; }
int main() { gfxInitDefault(); consoleInit(GFX_TOP, NULL); Result rc = romfsInit(); if (rc) printf("romfsInit: %08lX\n", rc); else { printf("romfs Init Successful!\n"); printfile("romfs:/folder/file.txt"); // Test reading a file with non-ASCII characters in the name printfile("romfs:/フォルダ/ファイル.txt"); } // Main loop while (aptMainLoop()) { gspWaitForVBlank(); hidScanInput(); u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu } romfsExit(); gfxExit(); return 0; }
void Console::enable(Screen screen, Color color) { if (m_enabledBasic) return; if (!m_enabled) { m_enabled = true; #ifndef EMULATION gfxInitDefault(); devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); #endif Console& console = getInstance(); priv::ResourceInfo font = priv::core_resources["opensans.ttf"]; console.m_font.loadFromMemory(font.data, font.size); console.m_memoryText.setFont(console.m_font); console.m_memoryText.setCharacterSize(12); console.m_screen = screen; console.m_color = color; console.m_limit = 1000; } }
STATIC mp_obj_t mod_citrus_gfx_init_default(void) { INIT_ONCE(_mod_citrus_gfx_is_init); gfxInitDefault(); return mp_const_none; }
void app() { gfxInitDefault(); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); // Initialize the render target C3D_RenderTarget *target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8); C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS); init_gpu_stuff(); //consoleInit(GFX_BOTTOM, NULL); // Main loop while (aptMainLoop()) { hidScanInput(); // Refresh Inputs // Process one frame menu.update(); // Draw C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C3D_RenderTargetClear(target, C3D_CLEAR_ALL, 0x000000FF, 0); C3D_FrameDrawOn(target); menu.draw(); C3D_FrameEnd(0); } end_gpu_stuff(); // Deinitialize graphics C3D_Fini(); gfxExit(); }
int main(int argc, char **argv) { //Initialize some sounds for high quality sounding moans and SCREAMS from the ACTION! srvInit(); aptInit(); hidInit(); csndInit(); gfxInitDefault(); consoleInit(GFX_TOP, NULL); printf("\x1b[1;5HGuess who is the freshest squid around?"); wait(10000); printf(" "); printf("\x1b[5;19H\x1b[32m\ Marie Squid\x1b[0m\n"); printf("\x1b[16;3HPress Start to know that such fresh exists."); printf("\x1b[17;3HPress A to get INTO IT!"); // Main loop while (aptMainLoop()) { //Scan all the inputs. This should be done once for each frame mostly for the shoots hidScanInput(); //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) hidScanInput(); u32 kDown = hidKeysDown(); if (kDown & KEY_START){ //PRESS START TO RETURN TO HBL } if (kDown & KEY_A){ // PRESS A TO PLAY audio_load("squit.bin"); } // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); //Wait for VBlank gspWaitForVBlank(); } // Exit services... I know you want to come back... audio_stop(); audio_stop(); csndExit(); gfxExit(); hidExit(); aptExit(); srvExit(); return 0; }
void __appInit() { // Initialize services srvInit(); aptInit(); gfxInitDefault(); hidInit(); fsInit(); sdmcInit(); pxiDevInit(); consoleInit(GFX_TOP, NULL); }
int main(int argc, char** argv) { gfxInitDefault(); InitOutput(); consoleClear(); Print("Press A to begin...\n"); // unsigned int test_counter = 0; // Moving it here causes this app to refuse to boot at all. while (aptMainLoop()) { gfxFlushBuffers(); gfxSwapBuffers(); hidScanInput(); u32 kDown = hidKeysDown(); if (kDown & KEY_START) { break; } else if (kDown & KEY_A) { consoleClear(); unsigned int test_counter = 0; // This configuration works, but obviously only test 0 would run. TestCaller tests[] = { FS::TestAll, CPU::Integer::TestAll, CPU::Memory::TestAll, Kernel::TestAll, GPU::TestAll }; if (test_counter < (sizeof(tests) / sizeof(tests[0]))) { tests[test_counter](); test_counter++; } else { break; } Log("\n"); Print("Press A to continue...\n"); } gspWaitForVBlank(); } consoleClear(); gfxExit(); DeinitOutput(); return 0; }
int main(int argc, char** argv) { gfxInitDefault(); consoleInit(GFX_TOP, NULL); svcCreateEvent(&threadRequest,0); u32 *threadStack = memalign(32, STACKSIZE); Result ret = svcCreateThread(&threadHandle, threadMain, 0, &threadStack[STACKSIZE/4], 0x3f, 0); printf("thread create returned %x\n", ret); // Main loop while (aptMainLoop()) { gspWaitForVBlank(); hidScanInput(); printf("\x1b[5;0H"); printf("thread counter = %d\n",threadcount); u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu if (kDown & KEY_A) svcSignalEvent(threadRequest); // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); } // tell thread to exit threadExit = true; // signal the thread svcSignalEvent(threadRequest); // give it time to exit svcSleepThread(10000000ULL); // close handles and free allocated stack svcCloseHandle(threadRequest); svcCloseHandle(threadHandle); free(threadStack); gfxExit(); return 0; }
s32 main (void) { gfxInitDefault(); consoleInit(GFX_BOTTOM, NULL); if (brahma_init()) { printf(" "); load_arm9_payload_from_mem (starter_bin, starter_bin_size); printf("%08X\n", firm_reboot ()); brahma_exit(); } gfxExit(); return 0; }
int sf2d_init_advanced(int gpucmd_size, int temppool_size) { if (sf2d_initialized) return 0; gpu_fb_addr = vramMemAlign(400*240*8, 0x100); gpu_depth_fb_addr = vramMemAlign(400*240*8, 0x100); gpu_cmd = linearAlloc(gpucmd_size * 4); pool_addr = linearAlloc(temppool_size); pool_size = temppool_size; gpu_cmd_size = gpucmd_size; gfxInitDefault(); GPU_Init(NULL); gfxSet3D(false); GPU_Reset(NULL, gpu_cmd, gpucmd_size); //Setup the shader dvlb = DVLB_ParseFile((u32 *)shader_vsh_shbin, shader_vsh_shbin_size); shaderProgramInit(&shader); shaderProgramSetVsh(&shader, &dvlb->DVLE[0]); //Get shader uniform descriptors projection_desc = shaderInstanceGetUniformLocation(shader.vertexShader, "projection"); shaderProgramUse(&shader); matrix_init_orthographic(ortho_matrix_top, 0.0f, 400.0f, 0.0f, 240.0f, 0.0f, 1.0f); matrix_init_orthographic(ortho_matrix_bot, 0.0f, 320.0f, 0.0f, 240.0f, 0.0f, 1.0f); matrix_gpu_set_uniform(ortho_matrix_top, projection_desc); //Register the apt callback hook aptHook(&apt_hook_cookie, apt_hook_func, NULL); vblank_wait = 1; current_fps = 0.0f; frames = 0; last_time = osGetTime(); cur_screen = GFX_TOP; cur_side = GFX_LEFT; GPUCMD_Finalize(); GPUCMD_FlushAndRun(NULL); gspWaitForP3D(); sf2d_pool_reset(); sf2d_initialized = 1; return 1; }
s32 main (void) { // Initialize services //gfxInitDefault(); //gfxSwapBuffers(); Result res; gfxInitDefault(); gfxSwapBuffers(); consoleInit(GFX_TOP,NULL); //printf("miniPasta2\n\n"); res=suInit(); printf("su init: %08X\n",res); //res=khaxInit(); //printf("khax init: %08X\n",res); res=brahma_init(); printf("brahma init: %08X\n",res); load_arm9_payload_from_mem (arm9payload_bin, arm9payload_bin_size); printf("payload loaded to RAM\n"); res=firm_reboot(); printf("firm reboot: %08X\n",res); while (aptMainLoop()) { //Scan all the inputs. This should be done once for each frame hidScanInput(); //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); //Wait for VBlank gspWaitForVBlank(); } gfxExit(); // Return to hbmenu return 0; }
void Console::enableBasic(Screen screen) { if (m_enabled) return; if (!m_enabledBasic) { m_enabledBasic = true; Console& console = getInstance(); console.m_screen = screen; #ifndef EMULATION gfxInitDefault(); consoleInit(screen == TopScreen ? GFX_TOP : GFX_BOTTOM, nullptr); #endif } }
int main() { gfxInitDefault(); consoleInit(GFX_TOP, NULL); Filesystem fs; std::string path = "pk/save/main"; if( fs.isInitialized() ) std::cout << "X: Export save file\nY: Inject save file\n\nSTART: Exit\n\n"; else std::cout << "Failed to initialize filesystem, press START to exit."; while(aptMainLoop()) { hidScanInput(); u32 kDown = hidKeysDown(); if( fs.isInitialized() ) { if(kDown & KEY_X) { if( fs.exportSaveFile(path) ) std::cout << "Success! Savefile exported in " << path << ".\n"; else std:: cout << "Failed!"; waitA(); consoleClear(); std::cout << "X: Export save file\nY: Inject save file\n\nSTART: Exit\n\n"; } if(kDown & KEY_Y) { if( fs.exportSaveFile(path) ) std::cout << "Success! Savefile imported\n"; else std:: cout << "Failed!"; waitA(); consoleClear(); std::cout << "X: Export save file\nY: Inject save file\n\nSTART: Exit\n\n"; } } if(kDown & KEY_START) break; gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); } gfxExit(); return 0; }
int main() { srvInit(); aptInit(); hidInit(NULL); irrstInit(NULL); gfxInitDefault(); yeti_init( &yeti, (framebuffer_t*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), (framebuffer_t*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), textures, palette, lua ); gfxSet3D(true); game_init(&yeti); while(aptMainLoop()) { int i; for(i=0;i<2;i++) { yeti.viewport.front = yeti.viewport.back; yeti.viewport.back = (framebuffer_t*)gfxGetFramebuffer(GFX_TOP, leftOrRight?GFX_LEFT:GFX_RIGHT, NULL, NULL); game_draw(&yeti); leftOrRight^=1; } yetiUpdateKeyboard(&yeti); game_tick(&yeti); if(hidKeysDown()&KEY_START)break; gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForEvent(GSPEVENT_VBlank0, true); } gfxExit(); irrstExit(); hidExit(); aptExit(); srvExit(); return 0; }
int main() { gfxInitDefault(); hidInit(NULL); void* device = gfxCreateDevice(240, 400); gfxMakeCurrent(device); glViewport(0, 0, 240, 400); glMatrixMode(GL_PROJECTION); glLoadIdentity(); float near = 0.1f; float far = 100.0f; float fov = 90.0f; float aspect = 240.0f / 400.0f; float t = tan(fov * 3.14159 / 360.0) * near; float b = -t; float l = aspect * b; float r = aspect * t; glFrustumf(l, r, b, t, near, far); //3DS' framebuffers are sideways glRotatef(-90.0f, 0.0f, 0.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glEnable(GL_DEPTH_TEST); while (aptMainLoop()) { hidScanInput(); if (keysDown() & KEY_START) break; DrawGLScene(); gfxFlush(gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL)); gfxFlushBuffers(); gfxSwapBuffersGpu(); gspWaitForVBlank(); } // Exit services gfxExit(); hidExit(); return 0; }
int main(int argc, char **argv) { // Initialize services gfxInitDefault(); //Initialize console on top screen. Using NULL as the second argument tells the console library to use the internal console structure as current one consoleInit(GFX_TOP, NULL); // Main loop while (aptMainLoop()) { //Scan all the inputs. This should be done once for each frame hidScanInput(); //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu printf("\x1b[0;0H shared page:\n"); volatile u8 *spbase; spbase = (volatile u8 *)0x1FF81000; for(int i = 0; i<16; ++i){ for(int j = 0; j<16; ++j){ printf("%02X ", *spbase); ++spbase; } printf("\n"); } // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); //Wait for VBlank gspWaitForVBlank(); } // Exit services gfxExit(); return 0; }
void initServices() { hidInit(); sdmcInit(); gfxInitDefault(); consoleInit(GFX_BOTTOM, NULL); // gfxInit(GSP_RGBA8_OES,GSP_BGR8_OES,false); // gfxInit(GSP_BGR8_OES,GSP_BGR8_OES,false); printf("Initializing the GPU...\n"); gpuInit(); printf("Done.\n"); printf("This App is a modded version of 3Damnesic, by Dr.Hacknik.\n"); }
int main(int argc, char **argv) { // Initialize services gfxInitDefault(); //Initialize console on top screen. Using NULL as the second argument tells the console library to use the internal console structure as current one consoleInit(GFX_TOP, NULL); printf("\x1b[29;15HPress Start to exit."); // Main loop while (aptMainLoop()) { //Scan all the inputs. This should be done once for each frame hidScanInput(); //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu //Print current time time_t unixTime = time(NULL); struct tm* timeStruct = gmtime((const time_t *)&unixTime); int hours = timeStruct->tm_hour; int minutes = timeStruct->tm_min; int seconds = timeStruct->tm_sec; int day = timeStruct->tm_mday; int month = timeStruct->tm_mon; int year = timeStruct->tm_year +1900; printf("\x1b[Hello, World!", hours, minutes, seconds); printf("\x1b[Hello, Earth!", day, month, year); // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); //Wait for VBlank gspWaitForVBlank(); } // Exit services gfxExit(); return 0; }
int main(int argc, char **argv) { // init ctr shell gfxInitDefault(); consoleInit(GFX_TOP, NULL); ctr_shell_init(NULL, SHELL_PORT); // Main loop while (1) { hidScanInput(); u32 kDown = hidKeysDown(); if (kDown & KEY_START || kDown & KEY_B) break; // break in order to return to hbmenu if (kDown & KEY_A) { /* Result res = nsInit(); if(res!=0) { ctr_shell_print("Err: nsInit\n"); ctr_shell_print_res(res); continue; } u32 procid = 0; res = NS_LaunchTitle(0x0004000000980300, 0, &procid); if(res!=0) { ctr_shell_print("Err: NS_LaunchTitle\n"); ctr_shell_print_res(res); continue; } ctr_shell_print("NS_LaunchTitle: procid=%i\n", procid); */ } ctr_sleep(100); consoleClear(); u32 ip = gethostid(); printf("ip: %d.%d.%d.%d\n", (int)ip & 0xFF, (int)(ip>>8)&0xFF, (int)(ip>>16)&0xFF, (int)(ip>>24)&0xFF); gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); } gfxExit(); ctr_shell_exit(); return 0; }
s32 main (void) { // Initialize services gfxInitDefault(); gfxSwapBuffers(); //consoleInit(GFX_TOP,NULL); brahma_init(); load_arm9_payload_from_mem (arm9payload_bin, arm9payload_bin_size); firm_reboot(); gfxExit(); // Return to hbmenu return 0; }
s32 main (void) { // Initialize services gfxInitDefault(); // Make sure the settings applied by gfxInitDefault come into effect gfxSwapBuffers(); // Memory for the arm9 payload u32 payload_size = 0x10000; void *payload = malloc(payload_size); if (!payload) goto error; int rc; // Load the arm9 payload into memory FILE *file = fopen("/" LAUNCHER_PATH, "r"); if (!file) goto error; rc = fseek(file, 0x12000, SEEK_SET); if (rc != 0) goto error; fread(payload, payload_size, 1, file); if (ferror(file) != 0) goto error; fclose(file); if (brahma_init()) { rc = load_arm9_payload_from_mem(payload, payload_size); if (rc != 1) goto error; firm_reboot(); brahma_exit(); } free(payload); gfxExit(); // Return to hbmenu return 0; error: consoleInit(GFX_BOTTOM, NULL); printf("An error occurred while loading the payload.\nMake sure your launcher is located at:\n/" LAUNCHER_PATH); wait_any_key(); if (payload) free(payload); gfxExit(); return 1; }
int main(int argc, const char* argv[]) { gfxInitDefault(); gfxSet3D(false); if(argc > 0) { svchax_init(true); if(!__ctr_svchax || !__ctr_svchax_srv) { util_panic("Failed to acquire kernel access."); return 1; } } aptOpenSession(); Result setCpuTimeRes = APT_SetAppCpuTimeLimit(30); aptCloseSession(); if(R_FAILED(setCpuTimeRes)) { util_panic("Failed to set syscore CPU time limit: %08lX", setCpuTimeRes); return 1; } romfsInit(); cfguInit(); acInit(); ptmuInit(); httpcInit(0); amInit(); AM_InitializeExternalTitleDatabase(false); soc_buffer = memalign(0x1000, 0x100000); if(soc_buffer != NULL) { socInit(soc_buffer, 0x100000); } screen_init(); ui_init(); task_init(); mainmenu_open(); while(aptMainLoop() && ui_update()); cleanup(); return 0; }
int main() { // Initialize graphics gfxInitDefault(); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); // Initialize the renderbuffer static C3D_RenderBuf rb; C3D_RenderBufInit(&rb, 240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8); rb.clearColor = CLEAR_COLOR; C3D_RenderBufClear(&rb); C3D_RenderBufBind(&rb); // Initialize the scene sceneInit(); // Main loop while (aptMainLoop()) { C3D_VideoSync(); hidScanInput(); // Respond to user input u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; // break in order to return to hbmenu // Render the scene sceneRender(); C3D_Flush(); C3D_RenderBufTransfer(&rb, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), DISPLAY_TRANSFER_FLAGS); C3D_RenderBufClear(&rb); } // Deinitialize the scene sceneExit(); // Deinitialize graphics C3D_Fini(); gfxExit(); return 0; }
int main() { // Initialize services srvInit(); aptInit(); hidInit(NULL); gfxInitDefault(); // Main loop while (aptMainLoop()) { //As nop90 suggested getFB(); //Gets input (keys and touch) getInput(); //Prints the GUI printGUI(); //Do stuff app(); //Exit code if (input & KEY_START) break; // Flush and swap framebuffers gfxFlushBuffers(); gfxSwapBuffers(); //Wait for VBlank gspWaitForVBlank(); } // Exit services gfxExit(); hidExit(); aptExit(); srvExit(); return 0; }