void Emulator_ToggleSound() { LOG_DBG("Emulator_ToggleSound()\n"); if(CellAudio) { delete CellAudio; } if((Settings.RSoundEnabled) && (strlen(Settings.RSoundServerIPAddress) > 0)) { CellAudio = new Audio::RSound<int16_t>(Settings.RSoundServerIPAddress, 2, SAMPLERATE_48KHZ); // If we couldn't connect, fall back to normal audio... if (!CellAudio->alive()) { delete CellAudio; CellAudio = new Audio::AudioPort<int16_t>(2, SAMPLERATE_48KHZ); Settings.RSoundEnabled = false; Graphics->Clear(); cellDbgFontPuts(0.09f, 0.4f, 1.0f, 0xffffffff, "Couldn't connect to RSound server.\nFalling back to regular audio..."); Graphics->FlushDbgFont(); Graphics->Swap(); sys_timer_usleep(3000000); } } else { CellAudio = new Audio::AudioPort<int16_t>(2, SAMPLERATE_48KHZ); } }
static void display_menubar(uint32_t menu_enum) { cellDbgFontPuts (0.09f, 0.05f, Emulator_GetFontSize(), menu_enum == GENERAL_VIDEO_MENU ? RED : GREEN, menu_generalvideosettings.title); cellDbgFontPuts (0.19f, 0.05f, Emulator_GetFontSize(), menu_enum == GENERAL_AUDIO_MENU ? RED : GREEN, menu_generalaudiosettings.title); cellDbgFontPuts (0.29f, 0.05f, Emulator_GetFontSize(), menu_enum == EMU_GENERAL_MENU ? RED : GREEN, menu_emu_settings.title); cellDbgFontPuts (0.39f, 0.05f, Emulator_GetFontSize(), menu_enum == EMU_VIDEO_MENU ? RED : GREEN, menu_emu_videosettings.title); cellDbgFontPuts (0.57f, 0.05f, Emulator_GetFontSize(), menu_enum == EMU_AUDIO_MENU ? RED : GREEN, menu_emu_audiosettings.title); cellDbgFontPuts (0.75f, 0.05f, Emulator_GetFontSize(), menu_enum == PATH_MENU ? RED : GREEN, menu_pathsettings.title); cellDbgFontPuts (0.84f, 0.05f, Emulator_GetFontSize(), menu_enum == CONTROLS_MENU ? RED : GREEN, menu_controlssettings.title); cellDbgFontDraw(); }
void dprintf_noswap(float x, float y, float scale, const char* fmt, ...) { char buffer[512]; va_list ap; va_start(ap, fmt); vsnprintf(buffer, 512, fmt, ap); cellDbgFontPuts(x, y, scale, 0xffffffff, buffer); va_end(ap); cellDbgFontDraw(); }
void COLLADA_Viewer::onRender() { // base implementation clears screen and sets up camera FWGLApplication::onRender(); if (!load_ok) { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); Browser.onRender(); cellDbgFontPuts(0.5f, 0.5f, 1.0f, 0xff00ffff, "Load Error!"); cellDbgFontDraw(); return; } if (mRunning==false) return; glPushMatrix(); glEnable(GL_DEPTH_TEST); _CrtRender.Render(); glPopMatrix(); // FPS REPORTING glDisable(GL_VSYNC_SCE); // get current timing info FWTimeVal timeNow = FWTime::getCurrentTime(); float fElapsedInFrame = (float)(timeNow - mLastTime); mLastTime = timeNow; ++frames; timeElapsed+=fElapsedInFrame; // report fps at appropriate interval if (timeElapsed>=timeReport) { //printf("FPS: %.2f\n",(frames-framesLastReport)*1.f/(float)(timeElapsed-timeLastReport)); timeReport+=REPORT_TIME; timeLastReport=timeElapsed; framesLastReport=frames; } glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); Browser.onRender(); cellDbgFontDraw(); }
static void browser_render(filebrowser_t * b) { uint32_t file_count = b->file_count; int current_index, page_number, page_base, i; float currentX, currentY, ySpacing; current_index = b->currently_selected; page_number = current_index / NUM_ENTRY_PER_PAGE; page_base = page_number * NUM_ENTRY_PER_PAGE; currentX = 0.09f; currentY = 0.09f; ySpacing = 0.035f; for ( i = page_base; i < file_count && i < page_base + NUM_ENTRY_PER_PAGE; ++i) { currentY = currentY + ySpacing; cellDbgFontPuts(currentX, currentY, Emulator_GetFontSize(), i == current_index ? RED : b->cur[i].d_type == CELL_FS_TYPE_DIRECTORY ? GREEN : WHITE, b->cur[i].d_name); cellDbgFontDraw(); } cellDbgFontDraw(); }
bool COLLADA_Viewer::onUpdate() { float tolerrance = 0.15; static float buttonTime = 0; static float cameraTime = 0; bool result = FWGLApplication::onUpdate(); if (mRunning==false) return result; FWTimeVal curTime = FWTime::getCurrentTime(); if ((float)curTime - buttonTime > 0.15) // execute these control base on time elapse, not frame rate { buttonTime = curTime; if(mpPad->getRawBool(FWInput::Channel_Button_Select)) { _CrtRender.SetNextCamera(); return result; } else if(mpPad->getRawBool(FWInput::Channel_Button_L3)) { if (Browser.IsVisible()) Browser.SetVisible(false); else Browser.SetVisible(true); } else if(mpPad->getRawBool(FWInput::Channel_Button_R3)) { if (togglewireframe) { togglewireframe = false; } else { togglewireframe = true; } } else if(mpPad->getRawBool(FWInput::Channel_Button_Square)) { if (togglelighting) { togglelighting = false; } else { togglelighting = true; } } else if(mpPad->getRawBool(FWInput::Channel_Button_Cross)) { mCurrentFile = Browser.GetThumbnail(Browser.GetSelection())->GetDocument(); load_ok = _CrtRender.Load(mCurrentFile, NULL); return result; } else if(mpPad->getRawBool(FWInput::Channel_Button_Up)) { Browser.SelectPrev(); } else if(mpPad->getRawBool(FWInput::Channel_Button_Down)) { Browser.SelectNext(); } } if ((float)curTime - cameraTime > 0.05) // execute these control base on time elapse, not frame rate { cameraTime = curTime; // Get the values from the analog sticks float conditioned_X_0 = mpPad->getRawFloat(FWInput::Channel_XAxis_0); float conditioned_Y_0 = mpPad->getRawFloat(FWInput::Channel_YAxis_0); float conditioned_X_1 = mpPad->getRawFloat(FWInput::Channel_XAxis_1); float conditioned_Y_1 = mpPad->getRawFloat(FWInput::Channel_YAxis_1); if (-tolerrance < conditioned_X_0 && conditioned_X_0 < tolerrance) conditioned_X_0 = 0.0f; if (-tolerrance < conditioned_Y_0 && conditioned_Y_0 < tolerrance) conditioned_Y_0 = 0.0f; if (-tolerrance < conditioned_X_1 && conditioned_X_1 < tolerrance) conditioned_X_1 = 0.0f; if (-tolerrance < conditioned_Y_1 && conditioned_Y_1 < tolerrance) conditioned_Y_1 = 0.0f; conditioned_X_0 = mpInputX0 ? -mpInputX0->getFloatValue() : 0.f; conditioned_Y_0 = mpInputY0 ? -mpInputY0->getFloatValue() : 0.f; conditioned_X_1 = mpInputX1 ? -mpInputX1->getFloatValue() : 0.f; conditioned_Y_1 = mpInputY1 ? -mpInputY1->getFloatValue() : 0.f; float multiplier = 10.0f; if (conditioned_X_0 != 0.0f || conditioned_Y_0 != 0.0f) { _CrtRender.ActiveInstanceCamera->MoveOrbit(conditioned_X_0 * multiplier, conditioned_Y_0 * multiplier); } if (conditioned_X_1 != 0.0f || conditioned_Y_1 != 0.0f) { _CrtRender.ActiveInstanceCamera->SetPanAndTilt(conditioned_X_1 * multiplier, conditioned_Y_1 * multiplier); } } if(mpPad->getRawBool(FWInput::Channel_Button_L2)) { // zoom in _CrtRender.ZoomIn(-0.005f); } else if(mpPad->getRawBool(FWInput::Channel_Button_L1)) { // zoom out _CrtRender.ZoomIn(0.005f); } if (togglewireframe) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } else { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } if (togglelighting) { glEnable(GL_LIGHTING); } else { glDisable(GL_LIGHTING); } #if defined SPU_BULLET || !defined (SN_TARGET_PS3) if (mpPad->getRawBool(FWInput::Channel_Button_Triangle)) { float fl_x, fl_y, fl_z, fl_g; fl_x = mpPad->getRawFloat(FWInput::Channel_XAxis_2); fl_y = mpPad->getRawFloat(FWInput::Channel_YAxis_2); fl_z = mpPad->getRawFloat(FWInput::Channel_ZAxis_2); fl_g = mpPad->getRawFloat(FWInput::Channel_Gyro); SixAxis(fl_x, fl_y, fl_z, fl_g); } else { _CrtRender.SetGravity(CrtVec3f(0.0f, -10.0f, 0.0f)); } #endif static const int CONS_PUTS_INTERVAL = 50; if (frames % CONS_PUTS_INTERVAL == 0){ } char title[1024]; const char * selectedfile = Browser.GetThumbnail(Browser.GetSelection())->GetDocument(); sprintf(title, "%s %s", "COLLADA Viewer", mCurrentFile); cellDbgFontPuts(0.1f, 0.1f, 1.0f, 0xffffffff, title); cellDbgFontPuts(0.1f, 0.9f, 1.0f, 0xffffffff, selectedfile); Browser.onUpdate(); return result; }
//----------------------------------------------------------------------------- // Purpose: Draws text to the screen inside the given rectangular region, using the given font //----------------------------------------------------------------------------- bool CGameEnginePS3::BDrawString( HGAMEFONT hFont, RECT rect, DWORD dwColor, DWORD dwFormat, const char *pchText ) { if ( !hFont ) { OutputDebugString( "Someone is calling BDrawString with a null font handle\n" ); return false; } float fCharWidth = m_nWindowWidth/80.0f; float fCharHeight = m_nWindowHeight/32.0f; // Find the font object for the passed handle std::map<HGAMEFONT, PS3DbgFont_t>::iterator iter; iter = m_MapGameFonts.find( hFont ); if ( iter == m_MapGameFonts.end() ) { OutputDebugString( "Invalid font handle passed to BDrawString()\n" ); return false; } fCharWidth *= iter->second.m_nScale; fCharHeight *= iter->second.m_nScale; // Compute width/height in chars/lines int nLinesInText = 1; int nCharsWideMax = 0; int nCharsLine = 0; for( int i=0; i < strlen(pchText); ++i ) { if ( pchText[i] == '\n' ) { ++nLinesInText; nCharsWideMax = MAX( nCharsLine, nCharsWideMax ); nCharsLine = 0; } else { // We assume all non linebreak chars are printable, don't pass others! ++nCharsLine; } } nCharsWideMax = MAX( nCharsLine, nCharsWideMax ); // Assume top left positioning float x = (float)rect.left; float y = (float)rect.top; if ( TEXTPOS_CENTER & dwFormat ) { float fTextWidth = nCharsWideMax * fCharWidth; x = (float)rect.left + ((float)( rect.right-rect.left) - fTextWidth)/2.0f; } else if ( TEXTPOS_RIGHT &dwFormat ) { float fTextWidth = nCharsWideMax * fCharWidth; x = (float)rect.right - fTextWidth; } if ( TEXTPOS_VCENTER & dwFormat ) { float fTextHeight = nLinesInText * fCharHeight; y = (float)rect.top + ((float)( rect.bottom-rect.top) - fTextHeight)/2.0f; } else if ( TEXTPOS_RIGHT &dwFormat ) { float fTextHeight = nLinesInText * fCharHeight; y = (float)rect.bottom - fTextHeight; } // Convert x/y to 0.0->1.0 range vs screen size x = x/(float)m_nWindowWidth; y = y/(float)m_nWindowHeight; // we have the font, try to draw with it if( cellDbgFontPuts( x, y, iter->second.m_nScale, DWARGB_TO_DWABGR(dwColor), pchText ) < 0 ) { OutputDebugString( "cellDbgFontPuts call failed\n" ); return false; } return true; }
static void select_setting(menu * menu_obj) { uint64_t state, diff_state, button_was_pressed, i; 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(frame_count < special_action_msg_expired) { } else { /* back to ROM menu if CIRCLE is pressed */ if (CTRL_L1(button_was_pressed) || CTRL_CIRCLE(button_was_pressed)) { menuStackindex--; old_state = state; return; } if (CTRL_R1(button_was_pressed)) { switch(menu_obj->enum_id) { case GENERAL_VIDEO_MENU: menuStackindex++; menuStack[menuStackindex] = menu_generalaudiosettings; old_state = state; break; case GENERAL_AUDIO_MENU: menuStackindex++; menuStack[menuStackindex] = menu_emu_settings; old_state = state; break; case EMU_GENERAL_MENU: menuStackindex++; menuStack[menuStackindex] = menu_emu_videosettings; old_state = state; break; case EMU_VIDEO_MENU: menuStackindex++; menuStack[menuStackindex] = menu_emu_audiosettings; old_state = state; break; case EMU_AUDIO_MENU: menuStackindex++; menuStack[menuStackindex] = menu_pathsettings; old_state = state; break; case PATH_MENU: menuStackindex++; menuStack[menuStackindex] = menu_controlssettings; old_state = state; break; case CONTROLS_MENU: break; } } /* down to next setting */ if (CTRL_DOWN(state) || CTRL_LSTICK_DOWN(state)) { menu_obj->selected++; if (menu_obj->selected >= menu_obj->max_settings) menu_obj->selected = menu_obj->first_setting; if (menu_obj->items[menu_obj->selected].page != menu_obj->page) menu_obj->page = menu_obj->items[menu_obj->selected].page; set_text_message("", 7); } /* up to previous setting */ if (CTRL_UP(state) || CTRL_LSTICK_UP(state)) { if (menu_obj->selected == menu_obj->first_setting) menu_obj->selected = menu_obj->max_settings-1; else menu_obj->selected--; if (menu_obj->items[menu_obj->selected].page != menu_obj->page) menu_obj->page = menu_obj->items[menu_obj->selected].page; set_text_message("", 7); } /* if a rom is loaded then resume it */ if (CTRL_L3(state) && CTRL_R3(state)) { if (emulator_initialized) { menu_is_running = 0; is_running = 1; mode_switch = MODE_EMULATION; set_text_message("", 15); } old_state = state; return; } producesettingentry(menu_obj, menu_obj->selected); } display_menubar(menu_obj->enum_id); cellDbgFontDraw(); for ( i = menu_obj->first_setting; i < menu_obj->max_settings; i++) { if(menu_obj->items[i].page == menu_obj->page) { cellDbgFontPuts(menu_obj->items[i].text_xpos, menu_obj->items[i].text_ypos, Emulator_GetFontSize(), menu_obj->selected == menu_obj->items[i].enum_id ? YELLOW : menu_obj->items[i].item_color, menu_obj->items[i].text); cellDbgFontPuts(0.5f, menu_obj->items[i].text_ypos, Emulator_GetFontSize(), menu_obj->items[i].text_color, menu_obj->items[i].setting_text); cellDbgFontDraw(); } } cellDbgFontPuts(0.09f, menu_obj->items[menu_obj->selected].comment_ypos, 0.86f, LIGHTBLUE, menu_obj->items[menu_obj->selected].comment); cellDbgFontPuts(0.09f, 0.91f, Emulator_GetFontSize(), YELLOW, "UP/DOWN - select L3+R3 - resume game X/LEFT/RIGHT - change"); cellDbgFontPuts(0.09f, 0.95f, Emulator_GetFontSize(), YELLOW, "START - default L1/CIRCLE - go back R1 - go forward"); cellDbgFontDraw(); old_state = state; }
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; }
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 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(); }