void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode, unsigned delay) { const char *game_to_load; char first_file_inzip[PATH_MAX]; char rom_path_temp[PATH_MAX]; char dir_path_temp[PATH_MAX]; struct retro_system_info info; bool block_zip_extract = false; bool extract_zip_cond = false; bool extract_zip_and_load_game_cond = false; bool load_game = !extract_zip_cond; retro_get_system_info(&info); block_zip_extract = info.block_extract; snprintf(rom_path_temp, sizeof(rom_path_temp), path); #ifdef HAVE_ZLIB extract_zip_cond = (strstr(rom_path_temp, ".zip") || strstr(rom_path_temp, ".ZIP")) && !block_zip_extract; if(extract_zip_cond) { fill_pathname_basedir(dir_path_temp, rom_path_temp, sizeof(dir_path_temp)); rarch_extract_zipfile(rom_path_temp, dir_path_temp, first_file_inzip, sizeof(first_file_inzip), extract_zip_mode); if(g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180); } extract_zip_and_load_game_cond = (extract_zip_cond && g_extern.file_state.zip_extract_mode == ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE); load_game = (extract_zip_and_load_game_cond) || (!extract_zip_cond); if(extract_zip_and_load_game_cond) game_to_load = first_file_inzip; else #endif game_to_load = path; if(load_game) { rarch_console_load_game(game_to_load); if(g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_LOADING_ROM, delay); } }
int rarch_extract_zipfile(const char *zip_path) { unzFile uf = unzOpen(zip_path); unz_global_info gi; int err = unzGetGlobalInfo(uf, &gi); if (err != UNZ_OK) RARCH_ERR("error %d with ZIP file in unzGetGlobalInfo \n",err); for (unsigned i = 0; i < gi.number_entry; i++) { if (rarch_extract_currentfile_in_zip(uf) != UNZ_OK) break; if ((i + 1) < gi.number_entry) { err = unzGoToNextFile(uf); if (err != UNZ_OK) { RARCH_ERR("error %d with ZIP file in unzGoToNextFile\n",err); break; } } } if(g_console.info_msg_enable) rarch_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180); return 0; }
static void browser_update(filebrowser_t * b, uint64_t input, const char *extensions) { bool ret = true; filebrowser_action_t action = FILEBROWSER_ACTION_NOOP; if (input & (1ULL << RMENU_DEVICE_NAV_DOWN)) action = FILEBROWSER_ACTION_DOWN; else if (input & (1ULL << RMENU_DEVICE_NAV_UP)) action = FILEBROWSER_ACTION_UP; else if (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) action = FILEBROWSER_ACTION_RIGHT; else if (input & (1ULL << RMENU_DEVICE_NAV_LEFT)) action = FILEBROWSER_ACTION_LEFT; else if (input & (1ULL << RMENU_DEVICE_NAV_R2)) action = FILEBROWSER_ACTION_SCROLL_DOWN; else if (input & (1ULL << RMENU_DEVICE_NAV_L2)) action = FILEBROWSER_ACTION_SCROLL_UP; else if (input & (1ULL << RMENU_DEVICE_NAV_A)) action = FILEBROWSER_ACTION_CANCEL; else if (input & (1ULL << RMENU_DEVICE_NAV_START)) { action = FILEBROWSER_ACTION_RESET; filebrowser_set_root(b, default_paths.filesystem_root_dir); strlcpy(b->extensions, extensions, sizeof(b->extensions)); } if(action != FILEBROWSER_ACTION_NOOP) ret = filebrowser_iterate(b, action); if(!ret) rarch_settings_msg(S_MSG_DIR_LOADING_ERROR, S_DELAY_180); }
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 rarch_load_shader(unsigned slot, const char *path) { #if defined(HAVE_HLSL) hlsl_load_shader(slot, path); #elif defined(HAVE_CG) && defined(HAVE_OPENGL) gl_cg_load_shader(slot, path); #else RARCH_WARN("Shader support is not implemented for this build.\n"); #endif #if defined(HAVE_HLSL) || defined(HAVE_CG) if (g_console.info_msg_enable) rarch_settings_msg(S_MSG_SHADER_LOADING_SUCCEEDED, S_DELAY_180); #endif }
HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { char path[PATH_MAX]; if(hObjPressed == m_romlist) { int index = m_romlist.GetCurSel(); convert_wchar_to_char(str_buffer, (const wchar_t *)m_romlist.GetText(index), sizeof(str_buffer)); if(path_file_exists(browser.current_dir.list->elems[index].data)) { snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&browser), str_buffer); rarch_console_load_game_wrap(path, g_extern.file_state.zip_extract_mode, S_DELAY_45); } else if(browser.current_dir.list->elems[index].attr.b) { snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&browser), str_buffer); uint64_t action = (1ULL << RMENU_DEVICE_NAV_B); filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), path); filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle); } } else if (hObjPressed == m_dir_game) { filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), g_extern.console.main_wrap.paths.default_rom_startup_dir); uint64_t action = (1ULL << RMENU_DEVICE_NAV_B); filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle); } #ifdef HAVE_HDD_CACHE_PARTITION else if (hObjPressed == m_dir_cache) { filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), "cache:"); uint64_t action = (1ULL << RMENU_DEVICE_NAV_B); filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle); if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_CACHE_PARTITION, S_DELAY_180); } #endif bHandled = TRUE; return 0; }
bool rarch_startup (const char * config_path) { bool retval = false; if(g_console.initialize_rarch_enable) { if(g_console.emulator_initialized) rarch_main_deinit(); struct rarch_main_wrap args = {0}; args.verbose = g_extern.verbose; args.config_path = config_path; args.sram_path = g_console.default_sram_dir_enable ? g_console.default_sram_dir : NULL, args.state_path = g_console.default_savestate_dir_enable ? g_console.default_savestate_dir : NULL, args.rom_path = g_console.rom_path; int init_ret = rarch_main_init_wrap(&args); (void)init_ret; if(init_ret == 0) { g_console.emulator_initialized = 1; g_console.initialize_rarch_enable = 0; retval = true; } else { //failed to load the ROM for whatever reason g_console.emulator_initialized = 0; g_console.mode_switch = MODE_MENU; rarch_settings_msg(S_MSG_ROM_LOADING_ERROR, S_DELAY_180); } } return retval; }
HRESULT CRetroArchMain::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { xdk_d3d_video_t *vid = (xdk_d3d_video_t*)driver.video_data; bool hdmenus_allowed = g_extern.console.rmenu.state.rmenu_hd.enable; HRESULT hr; if ( hObjPressed == m_filebrowser ) { g_extern.console.rmenu.input_loop = INPUT_LOOP_FILEBROWSER; hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_filebrowser.xur", NULL, &app.hFileBrowser); if (hr < 0) RARCH_ERR("Failed to load scene.\n"); hCur = app.hFileBrowser; NavigateForward(app.hFileBrowser); } else if ( hObjPressed == m_quick_menu) { hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_quickmenu.xur", NULL, &app.hQuickMenu); if (hr < 0) { RARCH_ERR("Failed to load scene.\n"); } hCur = app.hQuickMenu; NavigateForward(app.hQuickMenu); } else if ( hObjPressed == m_controls) { hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_controls.xur", NULL, &app.hControlsMenu); if (hr < 0) { RARCH_ERR("Failed to load scene.\n"); } hCur = app.hControlsMenu; if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_CHANGE_CONTROLS, S_DELAY_180); NavigateForward(app.hControlsMenu); } else if ( hObjPressed == m_change_libretro_core ) { hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_libretrocore_browser.xur", NULL, &app.hCoreBrowser); if (hr < 0) { RARCH_ERR("Failed to load scene.\n"); } hCur = app.hCoreBrowser; if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_SELECT_LIBRETRO_CORE, S_DELAY_180); NavigateForward(app.hCoreBrowser); } else if ( hObjPressed == m_settings ) { hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_settings.xur", NULL, &app.hRetroArchSettings); if (hr < 0) RARCH_ERR("Failed to load scene.\n"); hCur = app.hRetroArchSettings; NavigateForward(app.hRetroArchSettings); } else if ( hObjPressed == m_quit ) rarch_settings_change(S_QUIT_RARCH); bHandled = TRUE; return 0; }
HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data; int current_index; if ( hObjPressed == m_quickmenulist) { current_index = m_quickmenulist.GetCurSel(); switch(current_index) { case MENU_ITEM_LOAD_STATE: if (g_extern.console.emulator_initialized) { rarch_load_state(); rarch_settings_change(S_RETURN_TO_GAME); } break; case MENU_ITEM_SAVE_STATE: if (g_extern.console.emulator_initialized) { rarch_save_state(); rarch_settings_change(S_RETURN_TO_GAME); } break; case MENU_ITEM_KEEP_ASPECT_RATIO: rarch_settings_default(S_DEF_ASPECT_RATIO); driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_KEEP_ASPECT_RATIO, strw_buffer); break; case MENU_ITEM_OVERSCAN_AMOUNT: if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_NOT_IMPLEMENTED, S_DELAY_180); break; case MENU_ITEM_ORIENTATION: rarch_settings_default(S_DEF_ROTATION); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, strw_buffer); video_xdk_d3d.set_rotation(driver.video_data, g_extern.console.screen.orientation); break; case MENU_ITEM_RESIZE_MODE: g_extern.console.rmenu.input_loop = INPUT_LOOP_RESIZE_MODE; if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_RESIZE_SCREEN, S_DELAY_270); break; case MENU_ITEM_FRAME_ADVANCE: if (g_extern.console.emulator_initialized) { g_extern.lifecycle_state |= (1ULL << RARCH_FRAMEADVANCE); rarch_settings_change(S_FRAME_ADVANCE); } break; case MENU_ITEM_SCREENSHOT_MODE: if (g_extern.console.rmenu.state.msg_info.enable) device_ptr->ctx_driver->rmenu_screenshot_dump(NULL); break; case MENU_ITEM_RESET: if (g_extern.console.emulator_initialized) { rarch_settings_change(S_RETURN_TO_GAME); rarch_game_reset(); } break; case MENU_ITEM_RETURN_TO_GAME: if (g_extern.console.emulator_initialized) rarch_settings_change(S_RETURN_TO_GAME); break; case MENU_ITEM_QUIT_RARCH: rarch_settings_change(S_QUIT_RARCH); break; } } bHandled = TRUE; return 0; }
HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) { int current_index; xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data; current_index = m_settingslist.GetCurSel(); switch(pControlNavigateData->nControlNavigate) { case XUI_CONTROL_NAVIGATE_LEFT: switch(current_index) { case SETTING_EMU_REWIND_ENABLED: rarch_settings_change(S_REWIND); m_settingslist.SetText(SETTING_EMU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF"); if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_EMU_SHOW_INFO_MSG: g_extern.console.rmenu.state.msg_info.enable = !g_extern.console.rmenu.state.msg_info.enable; m_settingslist.SetText(SETTING_EMU_SHOW_INFO_MSG, g_extern.console.rmenu.state.msg_info.enable ? L"Info messages: ON" : L"Info messages: OFF"); break; case SETTING_EMU_SHOW_DEBUG_INFO_MSG: g_extern.console.rmenu.state.msg_fps.enable = !g_extern.console.rmenu.state.msg_fps.enable; m_settingslist.SetText(SETTING_EMU_SHOW_DEBUG_INFO_MSG, g_extern.console.rmenu.state.msg_fps.enable ? L"Debug Info messages: ON" : L"Debug Info messages: OFF"); break; case SETTING_EMU_MENUS: g_extern.console.rmenu.state.rmenu_hd.enable = !g_extern.console.rmenu.state.rmenu_hd.enable; m_settingslist.SetText(SETTING_EMU_MENUS, g_extern.console.rmenu.state.rmenu_hd.enable ? L"Menus: HD" : L"Menus: SD"); break; case SETTING_GAMMA_CORRECTION_ENABLED: g_extern.console.screen.gamma_correction = g_extern.console.screen.gamma_correction ? 0 : 1; m_settingslist.SetText(SETTING_GAMMA_CORRECTION_ENABLED, g_extern.console.screen.gamma_correction ? L"Gamma correction: ON" : L"Gamma correction: OFF"); if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_SCALE_FACTOR: if(device_ptr->fbo_inited) { if((g_settings.video.fbo.scale_x > MIN_SCALING_FACTOR)) { rarch_settings_change(S_SCALE_FACTOR_DECREMENT); device_ptr->ctx_driver->set_fbo(FBO_REINIT); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer); } } break; case SETTING_ZIP_EXTRACT: if(g_extern.file_state.zip_extract_mode) g_extern.file_state.zip_extract_mode--; rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer); break; case SETTING_HW_TEXTURE_FILTER: g_settings.video.smooth = !g_settings.video.smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering"); break; case SETTING_HW_TEXTURE_FILTER_2: g_settings.video.second_pass_smooth = !g_settings.video.second_pass_smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER_2, g_settings.video.second_pass_smooth ? L"Hardware filtering shader #2: Linear interpolation" : L"Hardware filtering shader #2: Point filtering"); break; case SETTING_SCALE_ENABLED: g_settings.video.render_to_texture = !g_settings.video.render_to_texture; m_settingslist.SetText(SETTING_SCALE_ENABLED, g_settings.video.render_to_texture ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF"); if(g_settings.video.render_to_texture) device_ptr->ctx_driver->set_fbo(FBO_INIT); else device_ptr->ctx_driver->set_fbo(FBO_DEINIT); break; default: break; } break; case XUI_CONTROL_NAVIGATE_RIGHT: switch(current_index) { case SETTING_EMU_SHOW_INFO_MSG: g_extern.console.rmenu.state.msg_info.enable = !g_extern.console.rmenu.state.msg_info.enable; m_settingslist.SetText(SETTING_EMU_SHOW_INFO_MSG, g_extern.console.rmenu.state.msg_info.enable ? L"Info messages: ON" : L"Info messages: OFF"); break; case SETTING_EMU_SHOW_DEBUG_INFO_MSG: g_extern.console.rmenu.state.msg_fps.enable = !g_extern.console.rmenu.state.msg_fps.enable; m_settingslist.SetText(SETTING_EMU_SHOW_DEBUG_INFO_MSG, g_extern.console.rmenu.state.msg_fps.enable ? L"Debug Info messages: ON" : L"Debug Info messages: OFF"); break; case SETTING_EMU_MENUS: g_extern.console.rmenu.state.rmenu_hd.enable = !g_extern.console.rmenu.state.rmenu_hd.enable; m_settingslist.SetText(SETTING_EMU_MENUS, g_extern.console.rmenu.state.rmenu_hd.enable ? L"Menus: HD" : L"Menus: SD"); break; case SETTING_GAMMA_CORRECTION_ENABLED: g_extern.console.screen.gamma_correction = g_extern.console.screen.gamma_correction ? 0 : 1; m_settingslist.SetText(SETTING_GAMMA_CORRECTION_ENABLED, g_extern.console.screen.gamma_correction ? L"Gamma correction: ON" : L"Gamma correction: OFF"); if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_EMU_REWIND_ENABLED: rarch_settings_change(S_REWIND); m_settingslist.SetText(SETTING_EMU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF"); if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_SCALE_FACTOR: if(device_ptr->fbo_inited) { if((g_settings.video.fbo.scale_x < MAX_SCALING_FACTOR)) { rarch_settings_change(S_SCALE_FACTOR_INCREMENT); device_ptr->ctx_driver->set_fbo(FBO_REINIT); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer); } } break; case SETTING_ZIP_EXTRACT: if(g_extern.file_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) g_extern.file_state.zip_extract_mode++; rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer); break; case SETTING_HW_TEXTURE_FILTER: g_settings.video.smooth = !g_settings.video.smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering"); break; case SETTING_HW_TEXTURE_FILTER_2: g_settings.video.second_pass_smooth = !g_settings.video.second_pass_smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER_2, g_settings.video.second_pass_smooth ? L"Hardware filtering shader #2: Linear interpolation" : L"Hardware filtering shader #2: Point filtering"); break; case SETTING_SCALE_ENABLED: g_settings.video.render_to_texture = !g_settings.video.render_to_texture; m_settingslist.SetText(SETTING_SCALE_ENABLED, g_settings.video.render_to_texture ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF"); if(g_settings.video.render_to_texture) device_ptr->ctx_driver->set_fbo(FBO_INIT); else device_ptr->ctx_driver->set_fbo(FBO_DEINIT); break; default: break; } break; case XUI_CONTROL_NAVIGATE_UP: case XUI_CONTROL_NAVIGATE_DOWN: break; } bHandled = TRUE; switch(pControlNavigateData->nControlNavigate) { case XUI_CONTROL_NAVIGATE_LEFT: case XUI_CONTROL_NAVIGATE_RIGHT: case XUI_CONTROL_NAVIGATE_UP: case XUI_CONTROL_NAVIGATE_DOWN: pControlNavigateData->hObjDest = pControlNavigateData->hObjSource; break; default: break; } return 0; }
HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data; int current_index; HRESULT hr; if ( hObjPressed == m_settingslist) { current_index = m_settingslist.GetCurSel(); switch(current_index) { case SETTING_EMU_REWIND_ENABLED: rarch_settings_change(S_REWIND); m_settingslist.SetText(SETTING_EMU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF"); if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_EMU_SHOW_INFO_MSG: g_extern.console.rmenu.state.msg_info.enable = !g_extern.console.rmenu.state.msg_info.enable; m_settingslist.SetText(SETTING_EMU_SHOW_INFO_MSG, g_extern.console.rmenu.state.msg_info.enable ? L"Info messages: ON" : L"Info messages: OFF"); break; case SETTING_EMU_SHOW_DEBUG_INFO_MSG: g_extern.console.rmenu.state.msg_fps.enable = !g_extern.console.rmenu.state.msg_fps.enable; m_settingslist.SetText(SETTING_EMU_SHOW_DEBUG_INFO_MSG, g_extern.console.rmenu.state.msg_fps.enable ? L"Debug Info messages: ON" : L"Debug Info messages: OFF"); break; case SETTING_EMU_MENUS: g_extern.console.rmenu.state.rmenu_hd.enable = !g_extern.console.rmenu.state.rmenu_hd.enable; m_settingslist.SetText(SETTING_EMU_MENUS, g_extern.console.rmenu.state.rmenu_hd.enable ? L"Menus: HD" : L"Menus: SD"); break; case SETTING_GAMMA_CORRECTION_ENABLED: g_extern.console.screen.gamma_correction = g_extern.console.screen.gamma_correction ? 0 : 1; m_settingslist.SetText(SETTING_GAMMA_CORRECTION_ENABLED, g_extern.console.screen.gamma_correction ? L"Gamma correction: ON" : L"Gamma correction: OFF"); if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_SHADER: set_shader = 1; hr = XuiSceneCreate(g_extern.console.rmenu.state.rmenu_hd.enable ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_shader_browser.xur", NULL, &app.hShaderBrowser); if (hr < 0) RARCH_ERR("Failed to load scene.\n"); hCur = app.hShaderBrowser; if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_SELECT_SHADER, S_DELAY_180); NavigateForward(app.hShaderBrowser); break; case SETTING_SHADER_2: set_shader = 2; hr = XuiSceneCreate(g_extern.console.rmenu.state.rmenu_hd.enable ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_shader_browser.xur", NULL, &app.hShaderBrowser); if (hr < 0) RARCH_ERR("Failed to load scene.\n"); hCur = app.hShaderBrowser; if (g_extern.console.rmenu.state.msg_info.enable) rarch_settings_msg(S_MSG_SELECT_SHADER, S_DELAY_180); NavigateForward(app.hShaderBrowser); break; case SETTING_HW_TEXTURE_FILTER: g_settings.video.smooth = !g_settings.video.smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering"); break; case SETTING_HW_TEXTURE_FILTER_2: g_settings.video.second_pass_smooth = !g_settings.video.second_pass_smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER_2, g_settings.video.second_pass_smooth ? L"Hardware filtering shader #2: Linear interpolation" : L"Hardware filtering shader #2: Point filtering"); break; case SETTING_SCALE_ENABLED: g_settings.video.render_to_texture = !g_settings.video.render_to_texture; m_settingslist.SetText(SETTING_SCALE_ENABLED, g_settings.video.render_to_texture ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF"); if(g_settings.video.render_to_texture) device_ptr->ctx_driver->set_fbo(FBO_INIT); else device_ptr->ctx_driver->set_fbo(FBO_DEINIT); break; case SETTING_ZIP_EXTRACT: if(g_extern.file_state.zip_extract_mode < ZIP_EXTRACT_TO_CACHE_DIR) g_extern.file_state.zip_extract_mode++; else g_extern.file_state.zip_extract_mode = 0; rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ZIP_EXTRACT, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_ZIP_EXTRACT, strw_buffer); break; } } bHandled = TRUE; return 0; }
HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { int current_index; HRESULT hr; if ( hObjPressed == m_settingslist) { current_index = m_settingslist.GetCurSel(); switch(current_index) { case SETTING_EMU_REWIND_ENABLED: rarch_settings_change(S_REWIND); m_settingslist.SetText(SETTING_EMU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF"); if (g_console.info_msg_enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_EMU_SHOW_INFO_MSG: g_console.info_msg_enable = !g_console.info_msg_enable; m_settingslist.SetText(SETTING_EMU_SHOW_INFO_MSG, g_console.info_msg_enable ? L"Info messages: ON" : L"Info messages: OFF"); break; case SETTING_EMU_MENUS: g_console.menus_hd_enable = !g_console.menus_hd_enable; m_settingslist.SetText(SETTING_EMU_MENUS, g_console.menus_hd_enable ? L"Menus: HD" : L"Menus: SD"); break; case SETTING_GAMMA_CORRECTION_ENABLED: g_console.gamma_correction_enable = !g_console.gamma_correction_enable; m_settingslist.SetText(SETTING_GAMMA_CORRECTION_ENABLED, g_console.gamma_correction_enable ? L"Gamma correction: ON" : L"Gamma correction: OFF"); if(g_console.info_msg_enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_COLOR_FORMAT: g_console.color_format = !g_console.color_format; m_settingslist.SetText(SETTING_COLOR_FORMAT, g_console.color_format ? L"Color format: 32bit ARGB" : L"Color format: 16bit RGBA"); if(g_console.info_msg_enable) rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_SHADER: set_shader = 1; hr = XuiSceneCreate(g_console.menus_hd_enable ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_shader_browser.xur", NULL, &app.hShaderBrowser); if (hr < 0) { RARCH_ERR("Failed to load scene.\n"); } hCur = app.hShaderBrowser; if (g_console.info_msg_enable) rarch_settings_msg(S_MSG_SELECT_SHADER, S_DELAY_180); NavigateForward(app.hShaderBrowser); break; case SETTING_SHADER_2: set_shader = 2; hr = XuiSceneCreate(g_console.menus_hd_enable ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_shader_browser.xur", NULL, &app.hShaderBrowser); if (hr < 0) { RARCH_ERR("Failed to load scene.\n"); } hCur = app.hShaderBrowser; if (g_console.info_msg_enable) rarch_settings_msg(S_MSG_SELECT_SHADER, S_DELAY_180); NavigateForward(app.hShaderBrowser); break; case SETTING_HW_TEXTURE_FILTER: g_settings.video.smooth = !g_settings.video.smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER, g_settings.video.smooth ? L"Hardware filtering shader #1: Linear interpolation" : L"Hardware filtering shader #1: Point filtering"); break; case SETTING_HW_TEXTURE_FILTER_2: g_settings.video.second_pass_smooth = !g_settings.video.second_pass_smooth; m_settingslist.SetText(SETTING_HW_TEXTURE_FILTER_2, g_settings.video.second_pass_smooth ? L"Hardware filtering shader #2: Linear interpolation" : L"Hardware filtering shader #2: Point filtering"); break; case SETTING_SCALE_ENABLED: g_console.fbo_enabled = !g_console.fbo_enabled; m_settingslist.SetText(SETTING_SCALE_ENABLED, g_console.fbo_enabled ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF"); gfx_ctx_set_fbo(g_console.fbo_enabled); break; } } bHandled = TRUE; return 0; }
HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data; int current_index; if ( hObjPressed == m_quickmenulist) { current_index = m_quickmenulist.GetCurSel(); switch(current_index) { case MENU_ITEM_LOAD_STATE: if (g_console.emulator_initialized) { rarch_load_state(); rarch_settings_change(S_RETURN_TO_GAME); } break; case MENU_ITEM_SAVE_STATE: if (g_console.emulator_initialized) { rarch_save_state(); rarch_settings_change(S_RETURN_TO_GAME); } break; case MENU_ITEM_KEEP_ASPECT_RATIO: { rarch_settings_default(S_DEF_ASPECT_RATIO); gfx_ctx_set_aspect_ratio(d3d9, g_console.aspect_ratio_index); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_KEEP_ASPECT_RATIO, strw_buffer); } break; case MENU_ITEM_OVERSCAN_AMOUNT: if(g_console.info_msg_enable) rarch_settings_msg(S_MSG_NOT_IMPLEMENTED, S_DELAY_180); break; case MENU_ITEM_ORIENTATION: rarch_settings_default(S_DEF_ROTATION); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, strw_buffer); video_xdk360.set_rotation(driver.video_data, g_console.screen_orientation); break; case MENU_ITEM_RESIZE_MODE: g_console.input_loop = INPUT_LOOP_RESIZE_MODE; if (g_console.info_msg_enable) rarch_settings_msg(S_MSG_RESIZE_SCREEN, S_DELAY_270); break; case MENU_ITEM_FRAME_ADVANCE: if (g_console.emulator_initialized) rarch_settings_change(S_FRAME_ADVANCE); break; case MENU_ITEM_SCREENSHOT_MODE: if (g_console.info_msg_enable) rarch_settings_msg(S_MSG_NOT_IMPLEMENTED, S_DELAY_180); break; case MENU_ITEM_RESET: if (g_console.emulator_initialized) { rarch_settings_change(S_RETURN_TO_GAME); rarch_game_reset(); } break; case MENU_ITEM_RETURN_TO_GAME: if (g_console.emulator_initialized) rarch_settings_change(S_RETURN_TO_GAME); break; case MENU_ITEM_RETURN_TO_DASHBOARD: rarch_settings_change(S_RETURN_TO_DASHBOARD); break; } } bHandled = TRUE; return 0; }