diff --git a/console/rarch_console.h b/console/rarch_console.h index ee6871bdfd..27e2974eb3 100644 --- a/console/rarch_console.h +++ b/console/rarch_console.h @@ -68,13 +68,13 @@ enum { enum { - MODE_EMULATION = 1 << 0, - MODE_LOAD_GAME = 1 << 1, - MODE_INIT = 1 << 2, - MODE_MENU = 1 << 3, - MODE_EXIT = 1 << 4, - MODE_LOAD_FIRST_SHADER = 1 << 5, - MODE_LOAD_SECOND_SHADER = 1 << 6, + MODE_EMULATION = 0, + MODE_LOAD_GAME, + MODE_INIT, + MODE_MENU, + MODE_EXIT, + MODE_LOAD_FIRST_SHADER, + MODE_LOAD_SECOND_SHADER, }; enum diff --git a/frontend/menu/rmenu_xui.cpp b/frontend/menu/rmenu_xui.cpp index 64fe618cd7..0608c4d076 100644 --- a/frontend/menu/rmenu_xui.cpp +++ b/frontend/menu/rmenu_xui.cpp @@ -38,7 +38,6 @@ CRetroArch app; HXUIOBJ hCur; filebrowser_t *browser; filebrowser_t *tmp_browser; -uint32_t set_shader = 0; wchar_t strw_buffer[PATH_MAX]; char str_buffer[PATH_MAX]; @@ -437,7 +436,7 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled rarch_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180); break; case SETTING_SHADER: - set_shader = 1; + g_extern.lifecycle_menu_state |= (1 << MODE_LOAD_FIRST_SHADER); 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) @@ -451,7 +450,7 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled NavigateForward(app.hShaderBrowser); break; case SETTING_SHADER_2: - set_shader = 2; + g_extern.lifecycle_menu_state |= (1 << MODE_LOAD_SECOND_SHADER); 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"); @@ -871,9 +870,8 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand { convert_wchar_to_char(str_buffer, (const wchar_t *)m_shaderlist.GetText(index), sizeof(str_buffer)); - switch(set_shader) + if (g_extern.lifecycle_menu_state & (1 << MODE_LOAD_FIRST_SHADER)) { - case 1: snprintf(g_settings.video.cg_shader_path, sizeof(g_settings.video.cg_shader_path), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer); if (g_settings.video.shader_type != RARCH_SHADER_NONE) { @@ -883,8 +881,11 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand } else RARCH_ERR("Shaders are unsupported on this platform.\n"); - break; - case 2: + g_extern.lifecycle_menu_state &= ~(1 << MODE_LOAD_FIRST_SHADER); + } + + if (g_extern.lifecycle_menu_state & (1 << MODE_LOAD_SECOND_SHADER)) + { snprintf (g_settings.video.second_pass_shader, sizeof(g_settings.video.second_pass_shader), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer); if (g_settings.video.shader_type != RARCH_SHADER_NONE) { @@ -894,9 +895,7 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand } else RARCH_ERR("Shaders are unsupported on this platform.\n"); - break; - default: - break; + g_extern.lifecycle_menu_state &= ~(1 << MODE_LOAD_SECOND_SHADER); } } else if(tmp_browser->current_dir.list->elems[index].attr.b) diff --git a/general.h b/general.h index eeee513f8a..3066a27891 100644 --- a/general.h +++ b/general.h @@ -564,7 +564,7 @@ struct global bool draw_menu; uint64_t lifecycle_state; - unsigned lifecycle_menu_state; + uint32_t lifecycle_menu_state; struct {