From 93a4cdea96345423695b4622955039f9d2cea555 Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sat, 2 Feb 2019 16:50:24 -0600 Subject: [PATCH] win32: Shaders: Save parameters and restore on cancel. Also, change "Parameters" button to "Parameters..." to indicate it opens a dialog box. --- win32/CShaderParamDlg.cpp | 5 +++++ win32/CShaderParamDlg.h | 1 + win32/rsrc/snes9x.rc | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/win32/CShaderParamDlg.cpp b/win32/CShaderParamDlg.cpp index 4365f2dd..ea6f516c 100644 --- a/win32/CShaderParamDlg.cpp +++ b/win32/CShaderParamDlg.cpp @@ -164,11 +164,16 @@ CShaderParamDlg::~CShaderParamDlg() bool CShaderParamDlg::show() { + saved_parameters = shader.param; + if(DialogBoxParam(GUI.hInstance, MAKEINTRESOURCE(IDD_DIALOG_SHADER_PARAMS), GUI.hWnd, DlgShaderParams, (LPARAM)this) == IDOK) { save_custom_shader(); return true; } + + shader.param = saved_parameters; + WinRefreshDisplay(); return false; } diff --git a/win32/CShaderParamDlg.h b/win32/CShaderParamDlg.h index a6f7be1b..e2540bff 100644 --- a/win32/CShaderParamDlg.h +++ b/win32/CShaderParamDlg.h @@ -20,6 +20,7 @@ private: unsigned int avgCharWidth; unsigned int avgCharHeight; int scrollpos; + std::vector saved_parameters; WNDPROC oldStaticProc; diff --git a/win32/rsrc/snes9x.rc b/win32/rsrc/snes9x.rc index 0743c65e..e23de0cb 100644 --- a/win32/rsrc/snes9x.rc +++ b/win32/rsrc/snes9x.rc @@ -222,7 +222,7 @@ BEGIN CONTROL "Reduce Input Lag",IDC_REDUCEINPUTLAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,118,76,10 CONTROL "Scale messages with EPX if possible",IDC_MESSAGES_SCALE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,162,153,10 - PUSHBUTTON "Parameters",IDC_SHADER_GLSL_PARAMETERS,112,222,49,12,WS_DISABLED + PUSHBUTTON "Parameters...",IDC_SHADER_GLSL_PARAMETERS,112,222,60,12,WS_DISABLED END IDD_CHEATER DIALOGEX 0, 0, 375, 194