static void select_directory(uint32_t menu_id) { char path[1024], newpath[1024]; uint64_t state, diff_state, button_was_pressed; static uint64_t old_state = 0; state = cell_pad_input_poll_device(0); diff_state = old_state ^ state; button_was_pressed = old_state & diff_state; if(set_initial_dir_tmpbrowser) { filebrowser_new(&tmpBrowser, "/\0", "empty"); set_initial_dir_tmpbrowser = false; } browser_update(&tmpBrowser); if (CTRL_START(button_was_pressed)) filebrowser_reset_start_directory(&tmpBrowser, "/","empty"); if (CTRL_SQUARE(button_was_pressed)) { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(tmpBrowser)) { snprintf(path, sizeof(path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); switch(menu_id) { case PATH_SAVESTATES_DIR_CHOICE: strcpy(Settings.PS3PathSaveStates, path); break; case PATH_SRAM_DIR_CHOICE: strcpy(Settings.PS3PathSRAM, path); break; case PATH_DEFAULT_ROM_DIR_CHOICE: strcpy(Settings.PS3PathROMDirectory, path); break; } menuStackindex--; } } if (CTRL_TRIANGLE(button_was_pressed)) { strcpy(path, usrDirPath); switch(menu_id) { case PATH_SAVESTATES_DIR_CHOICE: strcpy(Settings.PS3PathSaveStates, path); break; case PATH_SRAM_DIR_CHOICE: strcpy(Settings.PS3PathSRAM, path); break; case PATH_DEFAULT_ROM_DIR_CHOICE: strcpy(Settings.PS3PathROMDirectory, path); break; } menuStackindex--; } if (CTRL_CROSS(button_was_pressed)) { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(tmpBrowser)) { /* if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path */ if(tmpBrowser.currently_selected == 0) { old_state = state; filebrowser_pop_directory(&tmpBrowser); } else { const char * separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; snprintf(newpath, sizeof(newpath), "%s%s%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), separatorslash, FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); filebrowser_push_directory(&tmpBrowser, newpath, false); } } } cellDbgFontPrintf (0.09f, 0.09f, Emulator_GetFontSize(), YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser)); cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), RED, "DIRECTORY SELECTION"); cellDbgFontPuts(0.09f, 0.93f, 0.92f, YELLOW, "X - Enter dir /\\ - return to settings START - Reset Startdir"); cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "%s", "INFO - Browse to a directory and assign it as the path by\npressing SQUARE button."); cellDbgFontDraw(); browser_render(&tmpBrowser); old_state = state; }
static void select_file(uint32_t menu_id) { char extensions[256], title[256], object[256], comment[256], dir_path[MAX_PATH_LENGTH], path[MAX_PATH_LENGTH]; uint64_t state, diff_state, button_was_pressed; static uint64_t old_state = 0; state = cell_pad_input_poll_device(0); diff_state = old_state ^ state; button_was_pressed = old_state & diff_state; switch(menu_id) { #ifdef HAVE_GAMEAWARE case GAME_AWARE_SHADER_CHOICE: strncpy(dir_path, GAME_AWARE_SHADER_DIR_PATH, sizeof(dir_path)); strncpy(extensions, "cfg|CFG", sizeof(extensions)); strncpy(title, "GAME AWARE SHADER SELECTION", sizeof(title)); strncpy(object, "Game Aware Shader", sizeof(object)); strncpy(comment, "INFO - Select a 'Game Aware Shader' script from the menu by pressing X.", sizeof(comment)); break; #endif case SHADER_CHOICE: strncpy(dir_path, SHADERS_DIR_PATH, sizeof(dir_path)); strncpy(extensions, "cg|CG", sizeof(extensions)); strncpy(title, "SHADER SELECTION", sizeof(title)); strncpy(object, "Shader", sizeof(object)); strncpy(comment, "INFO - Select a shader from the menu by pressing the X button.", sizeof(comment)); break; case PRESET_CHOICE: strncpy(dir_path, PRESETS_DIR_PATH, sizeof(dir_path)); strncpy(extensions, "conf|CONF", sizeof(extensions)); strncpy(title, "SHADER PRESETS SELECTION", sizeof(title)); strncpy(object, "Shader", sizeof(object)); strncpy(object, "Shader preset", sizeof(object)); strncpy(comment, "INFO - Select a shader preset from the menu by pressing the X button. ", sizeof(comment)); break; case INPUT_PRESET_CHOICE: strncpy(dir_path, INPUT_PRESETS_DIR_PATH, sizeof(dir_path)); strncpy(extensions, "conf|CONF", sizeof(extensions)); strncpy(title, "INPUT PRESETS SELECTION", sizeof(title)); strncpy(object, "Input", sizeof(object)); strncpy(object, "Input preset", sizeof(object)); strncpy(comment, "INFO - Select an input preset from the menu by pressing the X button. ", sizeof(comment)); break; case BORDER_CHOICE: strncpy(dir_path, BORDERS_DIR_PATH, sizeof(dir_path)); strncpy(extensions, "png|PNG|jpg|JPG|JPEG|jpeg", sizeof(extensions)); strncpy(title, "BORDER SELECTION", sizeof(title)); strncpy(object, "Border", sizeof(object)); strncpy(object, "Border image file", sizeof(object)); strncpy(comment, "INFO - Select a border image file from the menu by pressing the X button. ", sizeof(comment)); break; EXTRA_SELECT_FILE_PART1(); } if(set_initial_dir_tmpbrowser) { filebrowser_new(&tmpBrowser, dir_path, extensions); set_initial_dir_tmpbrowser = false; } browser_update(&tmpBrowser); if (CTRL_START(button_was_pressed)) filebrowser_reset_start_directory(&tmpBrowser, "/", extensions); if (CTRL_CROSS(button_was_pressed)) { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(tmpBrowser)) { /*if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path */ if(tmpBrowser.currently_selected == 0) { old_state = state; filebrowser_pop_directory(&tmpBrowser); } else { const char * separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; snprintf(path, sizeof(path), "%s%s%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), separatorslash, FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); filebrowser_push_directory(&tmpBrowser, path, true); } } else if (FILEBROWSER_IS_CURRENT_A_FILE(tmpBrowser)) { snprintf(path, sizeof(path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser), FILEBROWSER_GET_CURRENT_FILENAME(tmpBrowser)); printf("path: %s\n", path); switch(menu_id) { #ifdef HAVE_GAMEAWARE case GAME_AWARE_SHADER_CHOICE: emulator_implementation_set_gameaware(path); strncpy(Settings.GameAwareShaderPath, path, sizeof(Settings.GameAwareShaderPath)); break; #endif case SHADER_CHOICE: if(set_shader) strncpy(Settings.PS3CurrentShader2, path, sizeof(Settings.PS3CurrentShader2)); else strncpy(Settings.PS3CurrentShader, path, sizeof(Settings.PS3CurrentShader)); ps3graphics_load_fragment_shader(path, set_shader); break; case PRESET_CHOICE: emulator_implementation_set_shader_preset(path); break; case INPUT_PRESET_CHOICE: emulator_set_controls(path, READ_CONTROLS, ""); break; case BORDER_CHOICE: strncpy(Settings.PS3CurrentBorder, path, sizeof(Settings.PS3CurrentBorder)); emulator_implementation_set_texture(path); break; EXTRA_SELECT_FILE_PART2(); } menuStackindex--; } } if (CTRL_TRIANGLE(button_was_pressed)) menuStackindex--; cellDbgFontPrintf(0.09f, 0.09f, Emulator_GetFontSize(), YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser)); cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), RED, title); cellDbgFontPrintf(0.09f, 0.92f, 0.92, YELLOW, "X - Select %s /\\ - return to settings START - Reset Startdir", object); cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "%s", comment); cellDbgFontDraw(); browser_render(&tmpBrowser); old_state = state; }
void PS3Graphics::DrawHUD() { static uint8_t intensity; static uint32_t led_color; int enabled; float yPos=0.00f; float ybrk=0.03f; if (ui.display_drives) { resources_get_int("Drive8Type", &enabled); if (enabled) { intensity = ((ui.drive8.led_pwm1 * 0xff) / 1000) & 0xff; if (intensity > 0) { yPos+=ybrk; led_color = (ui.drive8.led_color == DRIVE_ACTIVE_RED) ? (0xff000000 | intensity) : (0xff000000 | (intensity << 8)); cellDbgFontPrintf(0.85f, yPos, Emulator_GetFontSize(), led_color, "D8 TRK %u", ui.drive8.half_track_number/2); } } resources_get_int("Drive9Type", &enabled); if (enabled) { if (intensity > 0) { yPos+=ybrk; led_color = (ui.drive9.led_color == DRIVE_ACTIVE_RED) ? (0xff000000 | intensity) : (0xff000000 | (intensity << 8)); cellDbgFontPrintf(0.85f, yPos, Emulator_GetFontSize(), led_color, "D9 TRK %u", ui.drive9.half_track_number/2); } } resources_get_int("Drive10Type", &enabled); if (enabled) { if (intensity > 0) { yPos+=ybrk; led_color = (ui.drive10.led_color == DRIVE_ACTIVE_RED) ? (0xff000000 | intensity) : (0xff000000 | (intensity << 8)); cellDbgFontPrintf(0.85f, yPos, Emulator_GetFontSize(), led_color, "D10 TRK %u", ui.drive10.half_track_number/2); } } resources_get_int("Drive11Type", &enabled); if (enabled) { if (intensity > 0) { yPos+=ybrk; led_color = (ui.drive11.led_color == DRIVE_ACTIVE_RED) ? (0xff000000 | intensity) : (0xff000000 | (intensity << 8)); cellDbgFontPrintf(0.85f, yPos, Emulator_GetFontSize(), led_color, "D11 TRK %u", ui.drive11.half_track_number/2); } } } if (ui.tape.status) { if (tape_get_file_name() != NULL) { yPos+=ybrk; cellDbgFontPrintf (0.80f, yPos, Emulator_GetFontSize(), (ui.tape.motor) ? GREEN : PURPLE, "TAPE %d", ui.tape.counter); switch (ui.tape.control) { case DATASETTE_CONTROL_STOP: cellDbgFontPuts(0.80f, yPos, Emulator_GetFontSize(), PURPLE, " STOP"); break; case DATASETTE_CONTROL_START: cellDbgFontPuts(0.80f, yPos, Emulator_GetFontSize(), PURPLE, " PLAY"); break; case DATASETTE_CONTROL_FORWARD: cellDbgFontPuts(0.80f, yPos, Emulator_GetFontSize(), PURPLE, " FWD"); break; case DATASETTE_CONTROL_REWIND: cellDbgFontPuts(0.80f, yPos, Emulator_GetFontSize(), PURPLE, " REW"); break; case DATASETTE_CONTROL_RECORD: cellDbgFontPuts(0.80f, yPos, Emulator_GetFontSize(), PURPLE, " REC"); break; case DATASETTE_CONTROL_RESET: cellDbgFontPuts(0.80f, yPos, Emulator_GetFontSize(), PURPLE, " RESET"); break; case DATASETTE_CONTROL_RESET_COUNTER: cellDbgFontPuts(0.80f, yPos, Emulator_GetFontSize(), PURPLE, " RESETCNT"); break; } } } if (ui.display_speed) { cellDbgFontPrintf(0.09f, 0.92f, Emulator_GetFontSize(), PURPLE, "Speed = %f, FPS = %f, Warp = %s", ui.speed, ui.frame_rate, (ui.warp_enabled == 1) ? "On" : "Off"); } cellDbgFontDraw(); }
static void select_rom(void) { char newpath[1024]; uint64_t state, diff_state, button_was_pressed; static uint64_t old_state = 0; state = cell_pad_input_poll_device(0); diff_state = old_state ^ state; button_was_pressed = old_state & diff_state; browser_update(&browser); if (CTRL_SELECT(button_was_pressed)) { menuStackindex++; menuStack[menuStackindex] = menu_generalvideosettings; } if (CTRL_START(button_was_pressed)) filebrowser_reset_start_directory(&browser, "/", ROM_EXTENSIONS); if (CTRL_CROSS(button_was_pressed)) { if(FILEBROWSER_IS_CURRENT_A_DIRECTORY(browser)) { /*if 'filename' is in fact '..' - then pop back directory instead of adding '..' to filename path */ if(browser.currently_selected == 0) { old_state = state; filebrowser_pop_directory(&browser); } else { const char * separatorslash = (strcmp(FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmpBrowser),"/") == 0) ? "" : "/"; snprintf(newpath, sizeof(newpath), "%s%s%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), separatorslash, FILEBROWSER_GET_CURRENT_FILENAME(browser)); filebrowser_push_directory(&browser, newpath, true); } } else if (FILEBROWSER_IS_CURRENT_A_FILE(browser)) { char rom_path_temp[MAX_PATH_LENGTH]; snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); if (strcmp(rom_path_temp, current_rom) != 0 || sgb_border_change) { snprintf(current_rom, sizeof(current_rom), rom_path_temp); vba_init_rom(); } else { if(Settings.EmulatedSystem == IMAGE_GBA) CPUReset(); else gbReset(); } menu_is_running = 0; is_running =1; mode_switch = MODE_EMULATION; old_state = state; return; } } if (FILEBROWSER_IS_CURRENT_A_DIRECTORY(browser)) { if(!strcmp(FILEBROWSER_GET_CURRENT_FILENAME(browser),"app_home") || !strcmp(FILEBROWSER_GET_CURRENT_FILENAME(browser),"host_root")) cellDbgFontPrintf(0.09f, 0.83f, 0.91f, RED, "WARNING - This path only works on DEX PS3 systems. Do not attempt to open\n this directory on CEX PS3 systems, or you might have to restart!"); else if(!strcmp(FILEBROWSER_GET_CURRENT_FILENAME(browser),"..")) cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Press X to go back to the previous directory."); else cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Press X to enter the directory."); } if (FILEBROWSER_IS_CURRENT_A_FILE(browser)) cellDbgFontPrintf(0.09f, 0.83f, 0.91f, LIGHTBLUE, "INFO - Press X to load the game. "); cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), RED, "FILE BROWSER"); cellDbgFontPrintf (0.7f, 0.05f, 0.82f, WHITE, "%s v%s", EMULATOR_NAME, EMULATOR_VERSION); cellDbgFontPrintf (0.09f, 0.09f, Emulator_GetFontSize(), YELLOW, "PATH: %s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser)); cellDbgFontPuts (0.09f, 0.93f, Emulator_GetFontSize(), YELLOW, "L3 + R3 - resume game SELECT - Settings screen"); cellDbgFontDraw(); browser_render(&browser); old_state = state; }
void render(bool bClearOnly) { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(bClearOnly == false) { textures[0]->Render(0,0,0,0); // ============================================================================================= // TITLE // ============================================================================================= double xPos, yPos; xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_1, // font size (in pixels) strlen(szTitle), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); yPos = DbgFontY(50.0, render_height); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_1), 0xFFFFFFFF, "%s", szTitle); yPos += DbgFontY(FONT_SIZE_1 + FONT_SPACING, render_height); // ============================================================================================= // DATE // ============================================================================================= char szDate[128]; char szTime[128]; memset(&szDate, 0, sizeof(szDate)); memset(&szTime, 0, sizeof(szTime)); GetDateTimeStr((char*)szDate, (char*)szTime, false); xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_2, // font size (in pixels) strlen(szDate), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", szDate); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // ============================================================================================= // TIME // ============================================================================================= xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_1, // font size (in pixels) strlen(szTime), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_1), 0xFFFFFFFF, "%s", szTime); yPos += DbgFontY(FONT_SIZE_1 + FONT_SPACING, render_height); // ============================================================================================= static uint64_t nInterval = 30; // 0.5 second @ 60 FPS static uint64_t nFrameCheckpoint = nFrame; if(nFrame >= (nFrameCheckpoint + nInterval)) { nFrameCheckpoint = nFrame; sys_game_get_temperature(0, &temp_cpu); sys_game_get_temperature(1, &temp_rsx); } char szTemperature[256]; memset(&szTemperature, 0, sizeof(szTemperature)); sprintf(szTemperature, "Temperature: (CPU: %d' C) (RSX: %d' C)", temp_cpu, temp_rsx); xPos = DbgFontCenterX( 0, // x left (as in RECT) render_width, // x right (as in RECT) FONT_SIZE_2, // font size (in pixels) strlen(szTemperature), // text length (num. chars) REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) render_width, render_height // currently active resolution ); cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", szTemperature); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // === yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // === //xPos = DbgFontCenterX( // 0, // x left (as in RECT) // render_width, // x right (as in RECT) // FONT_SIZE_2, // font size (in pixels) // strlen((char*)"..::[ ISO LIST ] [ PS3ISO / PSXISO / BDISO / DVDISO ] ::.."), // text length (num. chars) // REFERENCE_WIDTH, REFERENCE_HEIGHT, // reference width / height (should not be changed) // render_width, render_height // currently active resolution //); // //cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), 0xFFFFFFFF, "%s", (char*)"..::[ ISO LIST ] [ PS3ISO / PSXISO / BDISO / DVDISO ] ::.."); // yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); // ================ xPos = DbgFontX(100.0, render_width); int nMenuItem = main_menu->UpdateTopItem(); while(nMenuItem <= (main_menu->nTopItem + main_menu->nListMax)) { if(nMenuItem == main_menu->nTotalItem) break; if(main_menu->nTotalItem <= 0) break; // normal unsigned int nColor = 0xFFFFFFFF; // selected if(nMenuItem == main_menu->nSelectedItem) { nColor = 0xFF00CCFF; } //if(nFrameStep == 0) { nColor = g_opt_nFontShadowColor; } // Shadow color cellDbgFontPrintf(xPos, yPos, debug_font_size(FONT_SIZE_2), nColor, "%s", main_menu->item[nMenuItem]->szMenuLabel/*, main_menu->item[nMenuItem]->szData_1*/); yPos += DbgFontY(FONT_SIZE_2 + FONT_SPACING, render_height); nMenuItem++; } (void)font_render(); } nFrame++; psglSwap(); }