HRESULT CRetroArchCoreBrowser::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(tmp_browser.current_dir.list->elems[index].data)) { snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer); rarch_settings_change(S_RETURN_TO_LAUNCHER); } else if(tmp_browser.current_dir.list->elems[index].attr.b) { snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer); filebrowser_set_root_and_ext(&tmp_browser, "xex|XEX", path); uint64_t action = (1ULL << RMENU_DEVICE_NAV_B); filebrowser_fetch_directory_entries(&tmp_browser, action, &m_romlist, &m_rompathtitle); } } bHandled = TRUE; return 0; }
rgui_handle_t *rgui_init(const char *base_path, uint16_t *framebuf, size_t framebuf_pitch, const uint8_t *font_bmp_buf, const uint8_t *font_bin_buf, rgui_folder_enum_cb_t folder_cb, void *userdata) { rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui)); rgui->frame_buf = framebuf; rgui->frame_buf_pitch = framebuf_pitch; rgui->folder_cb = folder_cb; rgui->userdata = userdata; rgui->path_stack = rgui_list_new(); rgui->folder_buf = rgui_list_new(); rgui_list_push(rgui->path_stack, base_path, RGUI_FILE_DIRECTORY, 0); if (font_bmp_buf) init_font(rgui, font_bmp_buf); else if (font_bin_buf) rgui->font = font_bin_buf; else { RARCH_ERR("no font bmp or bin, abort"); rarch_settings_change(S_QUIT); } return rgui; }
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; }
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata) { (void) param; (void) userdata; gl_t *gl = driver.video_data; switch (status) { case CELL_SYSUTIL_REQUEST_EXITGAME: gl->quitting = true; rarch_settings_change(S_QUIT); break; #ifdef HAVE_OSKUTIL case CELL_SYSUTIL_OSKDIALOG_FINISHED: oskutil_close(&g_console.oskutil_handle); oskutil_finished(&g_console.oskutil_handle); break; case CELL_SYSUTIL_OSKDIALOG_UNLOADED: oskutil_unload(&g_console.oskutil_handle); break; #endif } }
HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled ) { char path[PATH_MAX]; if(hObjPressed == m_romlist) { int index = m_romlist.GetCurSel(); if(path_file_exists(tmp_browser.current_dir.list->elems[index].data)) { const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index)); snprintf(g_console.launch_app_on_exit, sizeof(g_console.launch_app_on_exit), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), strbuffer); rarch_settings_change(S_RETURN_TO_LAUNCHER); } else if(tmp_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(&tmp_browser), strbuffer); filebrowser_fetch_directory_entries(path, &tmp_browser, &m_romlist, &m_rompathtitle); } } bHandled = TRUE; return 0; }
int main(int argc, char *argv[]) { #ifdef HAVE_SYSUTILS RARCH_LOG("Registering system utility callback...\n"); cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); #endif #ifdef HAVE_SYSMODULES cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT); cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); #endif sys_net_initialize_network(); #ifdef HAVE_LOGGER logger_init(); #endif sceNpInit(NP_POOL_SIZE, np_pool); rarch_main_clear_state(); get_environment_settings(argc, argv); config_set_defaults(); input_ps3.init(); char tmp_path[PATH_MAX]; snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir); rarch_configure_libretro(&input_ps3, tmp_path, default_paths.executable_extension); #if(CELL_SDK_VERSION > 0x340000) if (g_console.screenshots_enable) { #ifdef HAVE_SYSMODULES cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); #endif #ifdef HAVE_SYSUTILS CellScreenShotSetParam screenshot_param = {0, 0, 0, 0}; screenshot_param.photo_title = "RetroArch PS3"; screenshot_param.game_title = "RetroArch PS3"; cellScreenShotSetParameter (&screenshot_param); cellScreenShotEnable(); #endif } #ifdef HAVE_SYSUTILS if (g_console.custom_bgm_enable) cellSysutilEnableBgmPlayback(); #endif #endif video_gl.start(); #ifdef HAVE_OSKUTIL oskutil_init(&g_console.oskutil_handle, 0); #endif rarch_input_set_default_keybind_names_for_emulator(); menu_init(); switch(g_console.external_launcher_support) { case EXTERN_LAUNCHER_SALAMANDER: g_console.mode_switch = MODE_MENU; break; #ifdef HAVE_MULTIMAN case EXTERN_LAUNCHER_MULTIMAN: RARCH_LOG("Started from multiMAN, will auto-start game.\n"); strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path)); rarch_settings_change(S_START_RARCH); rarch_startup(default_paths.config_file); break; #endif default: break; } begin_loop: if(g_console.mode_switch == MODE_EMULATION) { bool repeat = false; input_ps3.poll(NULL); rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height); do{ repeat = rarch_main_iterate(); }while(repeat && !g_console.frame_advance_enable); } else if(g_console.mode_switch == MODE_MENU) { menu_loop(); rarch_startup(default_paths.config_file); } else goto begin_shutdown; goto begin_loop; begin_shutdown: if(path_file_exists(default_paths.config_file)) rarch_config_save(default_paths.config_file); if(g_console.emulator_initialized) rarch_main_deinit(); input_ps3.free(NULL); video_gl.stop(); menu_free(); #ifdef HAVE_OSKUTIL if(g_console.oskutil_handle.is_running) oskutil_unload(&g_console.oskutil_handle); #endif #ifdef HAVE_LOGGER logger_shutdown(); #endif #ifdef HAVE_SYSMODULES if(g_console.screenshots_enable) cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); #endif #ifdef HAVE_HDD_CACHE_PARTITION int ret = cellSysCacheClear(); if(ret != CELL_SYSCACHE_RET_OK_CLEARED) { RARCH_ERR("System cache partition could not be cleared on exit.\n"); } #endif rarch_exec(); return 1; }
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 CRetroArchQuickMenu::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) { bool aspectratio_changed = false; int current_index; xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data; current_index = m_quickmenulist.GetCurSel(); switch(pControlNavigateData->nControlNavigate) { case XUI_CONTROL_NAVIGATE_LEFT: switch(current_index) { case MENU_ITEM_LOAD_STATE: case MENU_ITEM_SAVE_STATE: rarch_state_slot_decrease(); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_LOAD_STATE, strw_buffer); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_SAVE_STATE, strw_buffer); break; case MENU_ITEM_KEEP_ASPECT_RATIO: rarch_settings_change(S_ASPECT_RATIO_DECREMENT); aspectratio_changed = true; break; case MENU_ITEM_ORIENTATION: rarch_settings_change(S_ROTATION_DECREMENT); 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; default: break; } break; case XUI_CONTROL_NAVIGATE_RIGHT: switch(current_index) { case MENU_ITEM_LOAD_STATE: case MENU_ITEM_SAVE_STATE: rarch_state_slot_increase(); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_LOAD_STATE, strw_buffer); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer)); m_quickmenulist.SetText(MENU_ITEM_SAVE_STATE, strw_buffer); break; case MENU_ITEM_KEEP_ASPECT_RATIO: rarch_settings_change(S_ASPECT_RATIO_INCREMENT); aspectratio_changed = true; break; case MENU_ITEM_ORIENTATION: rarch_settings_change(S_ROTATION_INCREMENT); 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; default: break; } break; case XUI_CONTROL_NAVIGATE_UP: case XUI_CONTROL_NAVIGATE_DOWN: break; } if(aspectratio_changed) { 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); } 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::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; }
static void rarch_console_load_game(const char *path) { snprintf(g_extern.file_state.rom_path, sizeof(g_extern.file_state.rom_path), path); rarch_settings_change(S_START_RARCH); }
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; }
HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) { int current_index; xdk360_video_t *vid = (xdk360_video_t*)driver.video_data; current_index = m_settingslist.GetCurSel(); switch(pControlNavigateData->nControlNavigate) { case XUI_CONTROL_NAVIGATE_LEFT: switch(current_index) { case SETTING_SCALE_FACTOR: if(vid->fbo_enabled) { if((g_settings.video.fbo_scale_x > MIN_SCALING_FACTOR)) { rarch_settings_change(S_SCALE_FACTOR_DECREMENT); //xdk360_gfx_init_fbo(vid); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer); } } default: break; } break; case XUI_CONTROL_NAVIGATE_RIGHT: switch(current_index) { case SETTING_SCALE_FACTOR: if(vid->fbo_enabled) { if((g_settings.video.fbo_scale_x < MAX_SCALING_FACTOR)) { rarch_settings_change(S_SCALE_FACTOR_INCREMENT); //xdk360_gfx_init_fbo(vid); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer)); m_settingslist.SetText(SETTING_SCALE_FACTOR, strw_buffer); } } 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; } return 0; }