From fcac2d7e78cb3ef179b8871d827f839d6fe99f06 Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Mon, 26 Apr 2021 09:51:23 +0300 Subject: [PATCH] win_openg: Added menu item to remove active shader. --- src/include/86box/resource.h | 1 + src/win/86Box.rc | 1 + src/win/win_ui.c | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/src/include/86box/resource.h b/src/include/86box/resource.h index b5f9a6449..2d3fe763c 100644 --- a/src/include/86box/resource.h +++ b/src/include/86box/resource.h @@ -350,6 +350,7 @@ #define IDM_VID_GL_FPS_75 40105 #define IDM_VID_GL_VSYNC 40106 #define IDM_VID_GL_SHADER 40107 +#define IDM_VID_GL_NOSHADER 40108 #endif #define IDM_LOG_BREAKPOINT 51201 diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 24df898da..09c50f2b6 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -251,6 +251,7 @@ BEGIN END MENUITEM "&VSync", IDM_VID_GL_VSYNC MENUITEM "&Select shader...", IDM_VID_GL_SHADER + MENUITEM "&Remove shader", IDM_VID_GL_NOSHADER END #endif diff --git a/src/win/win_ui.c b/src/win/win_ui.c index ccf737f94..8093e7f8d 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -234,6 +234,7 @@ show_render_options_menu() CheckMenuItem(menuMain, IDM_VID_GL_FPS_60, video_framerate == 60 ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_GL_FPS_75, video_framerate == 75 ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_GL_VSYNC, video_vsync ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem(menuMain, IDM_VID_GL_NOSHADER, strlen(video_shader) > 0 ? MF_ENABLED : MF_DISABLED); break; } } @@ -778,10 +779,18 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_VID_GL_SHADER: win_notify_dlg_open(); if (file_dlg_st(hwnd, IDS_2143, video_shader, NULL, 0) == 0) + { strcpy_s(video_shader, sizeof(video_shader), openfilestring); + EnableMenuItem(menuMain, IDM_VID_GL_NOSHADER, strlen(video_shader) > 0 ? MF_ENABLED : MF_DISABLED); + } win_notify_dlg_closed(); plat_vid_reload_options(); break; + case IDM_VID_GL_NOSHADER: + video_shader[0] = '\0'; + EnableMenuItem(menuMain, IDM_VID_GL_NOSHADER, MF_DISABLED); + plat_vid_reload_options(); + break; #endif case IDM_VID_FULLSCREEN: