void exitServices() { if (titlemenuIsUpdating) { //Stop the title menu loading process, causing the thread to exit cancelTitleLoading(); //Wait a little bit (two seconds) longer to allow the thread to actually terminate svcSleepThread(2000000000ULL); } if (titleThreadNeedsRelease) { releaseTitleThread(); } // cleanup whatever we have to cleanup audio_stop(); csndExit(); freeThemeImages(); netloader_exit(); titlesExit(); ptmuExit(); acExit(); hidExit(); gfxExit(); closeSDArchive(); exitFilesystem(); aptExit(); srvExit(); }
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 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() { 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; }
void Sys_Quit (void) { aptUnhook(&sysAptCookie); Host_Shutdown(); gfxExit(); exit (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; }
mp_obj_t mod_citrus_gfx_exit(void) { EXIT_ONCE(_mod_citrus_gfx_is_init); gfxExit(); return mp_const_none; }
void Sys_Error (char *error, ...) { va_list argptr; printf ("Sys_Error: "); va_start (argptr,error); vprintf (error,argptr); va_end (argptr); printf ("\n"); printf("Press START to exit"); while(1){ hidScanInput(); u32 kDown = hidKeysDown(); if (kDown & KEY_START) break; } if(hostInitialized) Sys_Quit(); else { gfxExit(); exit (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 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(); }
static void frontend_ctr_deinit(void *data) { (void)data; #ifndef IS_SALAMANDER global_t *global = global_get_ptr(); global->verbosity = true; #ifdef HAVE_FILE_LOGGER if (global->log_file) fclose(global->log_file); global->log_file = NULL; #endif wait_for_input(); csndExit(); gfxExit(); #if 0 sdmcExit(); fsExit(); hidExit(); aptExit(); srvExit(); #endif #endif }
STATIC bool fatal_error(bool restart) { bool should_restart = false; if (restart) { printf("\x1b[28;12HPress Select to restart."); } printf("\x1b[29;12H Press Start to exit. "); while (aptMainLoop()) { hidScanInput(); int down = hidKeysDown(); if (down & KEY_START) { break; } else if (restart && (down & KEY_SELECT)) { should_restart = true; break; } gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); } gfxExit(); return should_restart; }
void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); // For now, use 8-bit rendering but default 24-bit framebuffer mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } // reset video modes gfxExit(); // disable console Done_ConsoleWin(); gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false); I_ClearFrameBuffer(GFX_TOP, GFX_LEFT); I_ClearFrameBuffer(GFX_TOP, GFX_RIGHT); I_ClearFrameBuffer(GFX_BOTTOM, 0); V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
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; }
void exitServices() { gpuExit(); gfxExit(); sdmcExit(); hidExit(); }
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; }
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; }
// // I_Quit // void I_Quit (void) { D_QuitNetGame (); I_ShutdownSound(); I_ShutdownMusic(); M_SaveDefaults (); I_ShutdownGraphics(); gfxExit(); }
void __appExit() { // Exit services pxiDevExit(); sdmcExit(); fsExit(); hidExit(); gfxExit(); aptExit(); srvExit(); }
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 pchexexit(struct s_pchex *pch) { consoleSelect(&pch->bot); consoleClear(); printf("\x1B[15;2H"); printf("Program ended, press A to finish\n"); waitKey(KEY_A); free(pch->save); gfxExit(); filesysExit(&pch->sd.handle, &pch->sav.handle, &pch->sd.arch, &pch->sav.arch); return (0); }
void Cleanup() { te->Cleanup(); entries.clear(); if(currentViewer != NULL) { cleanViewer(); } C3D_Fini(); gfxExit(); }
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; }
void system_cleanup() { mgr_save(); mgr_exit(); CSND_shutdown(); fsExit(); gfxExit(); hidExit(); aptExit(); srvExit(); }
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; }
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(); 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() { 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; }