HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { char path[MAX_PATH_LENGTH]; if(hObjPressed == m_romlist) { int index = m_romlist.GetCurSel(); if(browser.cur[index].d_type != FILE_ATTRIBUTE_DIRECTORY) { struct retro_system_info info; retro_get_system_info(&info); bool block_zip_extract = info.block_extract; memset(strbuffer, 0, sizeof(strbuffer)); wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer)); if((strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP")) && !block_zip_extract) { char path_tmp[1024]; sprintf(path_tmp, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); rarch_extract_zipfile(path_tmp); } else { memset(g_console.rom_path, 0, sizeof(g_console.rom_path)); sprintf(g_console.rom_path, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); return_to_game(); g_console.initialize_rarch_enable = 1; } } else if(browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY) { memset(strbuffer, 0, sizeof(strbuffer)); wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer)); snprintf(path, sizeof(path), "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer); filebrowser_fetch_directory_entries(path, &browser, &m_romlist, &m_rompathtitle); } } else if (hObjPressed == m_dir_game) { filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext()); filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle); } else if (hObjPressed == m_dir_cache) { filebrowser_new(&browser, "cache:", rarch_console_get_rom_ext()); filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle); } else if(hObjPressed == m_back) NavigateBack(app.hMainScene); bHandled = TRUE; return S_OK; }
HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { char path[PATH_MAX]; if(hObjPressed == m_romlist) { int index = m_romlist.GetCurSel(); if(path_file_exists(browser.current_dir.list->elems[index].data)) { struct retro_system_info info; retro_get_system_info(&info); bool block_zip_extract = info.block_extract; const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t*)m_romlist.GetText(index)); if((strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP")) && !block_zip_extract) { char path_tmp[1024]; snprintf(path_tmp, sizeof(path_tmp), "%s\\%s", filebrowser_get_current_dir(&browser), strbuffer); rarch_extract_zipfile(path_tmp); } else { memset(g_console.rom_path, 0, sizeof(g_console.rom_path)); snprintf(g_console.rom_path, sizeof(g_console.rom_path), "%s\\%s", filebrowser_get_current_dir(&browser), strbuffer); rarch_settings_change(S_START_RARCH); } } else if(browser.current_dir.list->elems[index].attr.b) { const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index)); snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&browser), strbuffer); filebrowser_fetch_directory_entries(path, &browser, &m_romlist, &m_rompathtitle); } } else if (hObjPressed == m_dir_game) { filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext()); filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle); } else if (hObjPressed == m_dir_cache) { filebrowser_new(&browser, "cache:", rarch_console_get_rom_ext()); filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle); if (g_console.info_msg_enable) rarch_settings_msg(S_MSG_CACHE_PARTITION, S_DELAY_180); } bHandled = TRUE; return 0; }
void menu_init (void) { HRESULT hr; xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data; bool hdmenus_allowed = g_extern.console.rmenu.state.rmenu_hd.enable; D3DPRESENT_PARAMETERS d3dpp; video_info_t video_info = {0}; video_info.vsync = g_settings.video.vsync; video_info.force_aspect = false; video_info.smooth = g_settings.video.smooth; video_info.input_scale = 2; video_info.fullscreen = true; video_info.rgb32 = false; xdk_d3d_generate_pp(&d3dpp, &video_info); hr = app.InitShared(device_ptr->d3d_render_device, &d3dpp, XuiPNGTextureLoader); if (hr < 0) { RARCH_ERR("Failed initializing XUI application.\n"); return; } /* Register font */ hr = app.RegisterDefaultTypeface(L"Arial Unicode MS", L"file://game:/media/rarch.ttf" ); if (hr < 0) { RARCH_ERR("Failed to register default typeface.\n"); return; } hr = app.LoadSkin( L"file://game:/media/rarch_scene_skin.xur"); if (hr < 0) { RARCH_ERR("Failed to load skin.\n"); return; } hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_main.xur", NULL, &app.hMainScene); if (hr < 0) { RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n"); return; } hCur = app.hMainScene; XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS); filebrowser_new(&browser, g_extern.console.main_wrap.paths.default_rom_startup_dir, rarch_console_get_rom_ext()); }
HRESULT CRetroArchCoreBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled) { GetChildById(L"XuiRomList", &m_romlist); GetChildById(L"XuiBackButton1", &m_back); GetChildById(L"XuiTxtRomPath", &m_rompathtitle); filebrowser_new(&tmp_browser, "game:", "xex|XEX"); filebrowser_fetch_directory_entries("game:", &tmp_browser, &m_romlist, &m_rompathtitle); return S_OK; }
void menu_init (void) { HRESULT hr; context = (rmenu_context_t*)&rmenu_ctx_xdk; xdk_d3d_video_t *vid = (xdk_d3d_video_t*)driver.video_data; bool hdmenus_allowed = g_extern.console.rmenu.state.rmenu_hd.enable; hr = app.InitShared(vid->d3d_render_device, &vid->d3dpp, XuiPNGTextureLoader); if (hr < 0) { RARCH_ERR("Failed initializing XUI application.\n"); return; } /* Register font */ hr = app.RegisterDefaultTypeface(L"Arial Unicode MS", L"file://game:/media/rarch.ttf" ); if (hr < 0) { RARCH_ERR("Failed to register default typeface.\n"); return; } hr = app.LoadSkin( L"file://game:/media/rarch_scene_skin.xur"); if (hr < 0) { RARCH_ERR("Failed to load skin.\n"); return; } hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_main.xur", NULL, &app.hMainScene); if (hr < 0) { RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n"); return; } hCur = app.hMainScene; XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS); browser = (filebrowser_t*)malloc(1 * sizeof(filebrowser_t)); tmp_browser = (filebrowser_t*)malloc(1 * sizeof(filebrowser_t)); filebrowser_new(browser, g_extern.console.main_wrap.paths.default_rom_startup_dir, rarch_console_get_rom_ext()); }
int menu_init (void) { HRESULT hr; xdk360_video_t *vid = (xdk360_video_t*)g_d3d; hr = app.InitShared(vid->d3d_render_device, &vid->d3dpp, XuiPNGTextureLoader); if (FAILED(hr)) { RARCH_ERR("Failed initializing XUI application.\n"); return 1; } /* Register font */ hr = app.RegisterDefaultTypeface(L"Arial Unicode MS", L"file://game:/media/rarch.ttf" ); if (FAILED(hr)) { RARCH_ERR("Failed to register default typeface.\n"); return 1; } hr = app.LoadSkin( L"file://game:/media/rarch_scene_skin.xur"); if (FAILED(hr)) { RARCH_ERR("Failed to load skin.\n"); return 1; } hr = XuiSceneCreate(L"file://game:/media/sd/", L"rarch_main.xur", NULL, &app.hMainScene); if (FAILED(hr)) { RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n"); return 1; } XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS); filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext()); return 0; }
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 menu_init (void) { filebrowser_new(&browser, Settings.PS3PathROMDirectory, ROM_EXTENSIONS); }