From 2a685b558c19ab2b36b7547a3f23bf554d1e266f Mon Sep 17 00:00:00 2001 From: OV2 Date: Fri, 25 May 2018 20:55:57 +0200 Subject: [PATCH] win32: hide gfx dialog while displaying parameter dialog, disable button when shaders are disabled --- win32/CShaderParamDlg.cpp | 4 +- win32/rsrc/snes9x.rc | 82 +++++++++++---------------------------- win32/wsnes9x.cpp | 4 ++ 3 files changed, 28 insertions(+), 62 deletions(-) diff --git a/win32/CShaderParamDlg.cpp b/win32/CShaderParamDlg.cpp index 3a0f0c92..47b39042 100644 --- a/win32/CShaderParamDlg.cpp +++ b/win32/CShaderParamDlg.cpp @@ -170,12 +170,12 @@ void CShaderParamDlg::createContent(HWND hDlg) GLSLParam &p = shader.param[i]; TCHAR desc[270]; _stprintf(desc, TEXT("%s [%g-%g]"), (TCHAR*)_tFromChar(p.name), p.min, p.max); - HWND item = CreateWindow(TEXT("STATIC"), desc, SS_LEFTNOWORDWRAP | WS_VISIBLE | WS_CHILD, LEFT_OFFSET, top, DESC_WIDTH_CHARS * avgCharWidth, avgCharHeight, parent, (HMENU)(IDC_PARAMS_START_STATIC + i), GUI.hInstance, NULL); + HWND item = CreateWindow(TEXT("STATIC"), desc, SS_LEFTNOWORDWRAP | WS_VISIBLE | WS_CHILD, LEFT_OFFSET, top, DESC_WIDTH_CHARS * avgCharWidth, avgCharHeight, parent, (HMENU)(UINT_PTR)(IDC_PARAMS_START_STATIC + i), GUI.hInstance, NULL); SendMessage(item, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(FALSE, 0)); TCHAR val[100]; _stprintf(val, TEXT("%g"), p.val); unsigned int edit_left = LEFT_OFFSET + DESC_WIDTH_CHARS * avgCharWidth + HORIZONTAL_SPACE; - item = CreateWindow(TEXT("EDIT"), val, ES_AUTOHSCROLL | WS_VISIBLE | WS_CHILD | WS_TABSTOP, edit_left , top, EDIT_WIDTH_CHARS * avgCharWidth, avgCharHeight, parent, (HMENU)(IDC_PARAMS_START_EDIT + i), GUI.hInstance, NULL); + item = CreateWindow(TEXT("EDIT"), val, ES_AUTOHSCROLL | WS_VISIBLE | WS_CHILD | WS_TABSTOP, edit_left , top, EDIT_WIDTH_CHARS * avgCharWidth, avgCharHeight, parent, (HMENU)(UINT_PTR)(IDC_PARAMS_START_EDIT + i), GUI.hInstance, NULL); SendMessage(item, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(FALSE, 0)); top += avgCharHeight + VERTICAL_SPACE; } diff --git a/win32/rsrc/snes9x.rc b/win32/rsrc/snes9x.rc index b5cfe36b..e7df5dd6 100644 --- a/win32/rsrc/snes9x.rc +++ b/win32/rsrc/snes9x.rc @@ -14,64 +14,6 @@ ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// German (Germany) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DIALOG_SHADER_PARAMS DIALOGEX 0, 0, 309, 205 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Shader Paramaters" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,144,184,50,14 - PUSHBUTTON "Cancel",IDCANCEL,198,184,50,14 - LTEXT "",IDC_STATIC_CONTAINER,7,35,282,142,WS_BORDER - SCROLLBAR IDC_SCROLLBAR_PARAMS,289,35,12,142,SBS_VERT - PUSHBUTTON "Apply",IDAPPLY,253,184,50,14 - LTEXT "Changing these parameters will create a new ""custom_shader_params.glslp"" file in the snes9x directory that contains the parameters and references to your currently loaded shader. This will then be used as your current OpenGL shader.",IDC_STATIC,7,7,295,28 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DIALOG_SHADER_PARAMS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 302 - TOPMARGIN, 7 - BOTTOMMARGIN, 198 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// AFX_DIALOG_LAYOUT -// - -IDD_DIALOG_SHADER_PARAMS AFX_DIALOG_LAYOUT -BEGIN - 0 -END - -#endif // German (Germany) resources -///////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////// // English (United States) resources @@ -99,7 +41,7 @@ BEGIN COMBOBOX IDC_RATE,177,40,106,171,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Playback Rate:",IDC_STATIC,125,41,49,11 CONTROL "&Dynamic Rate Control",IDC_DYNRATECONTROL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,295,90,96,10 - CONTROL "&Automatic Input Rate",IDC_AUTOMATICINPUTRATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,295,105,96,10 + CONTROL "&Automatic Input Rate",IDC_AUTOMATICINPUTRATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,295,105,96,10 CONTROL "&Stereo",IDC_STEREO,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,295,15,93,10 CONTROL "&Reverse Stereo",IDC_REV_STEREO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,295,30,94,10 CONTROL "&Synchronize with sound core",IDC_SYNC_TO_SOUND_CPU, @@ -274,7 +216,7 @@ BEGIN CONTROL "Reduce Input Lag",IDC_REDUCEINPUTLAG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,113,76,10 CONTROL "Scale messages with EPX if possible",IDC_MESSAGES_SCALE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,168,131,10 - PUSHBUTTON "Parameters",IDC_SHADER_GLSL_PARAMETERS,112,222,49,12 + PUSHBUTTON "Parameters",IDC_SHADER_GLSL_PARAMETERS,112,222,49,12,WS_DISABLED END IDD_CHEATER DIALOGEX 0, 0, 375, 194 @@ -592,6 +534,18 @@ BEGIN COMBOBOX IDC_HOSTNAME,60,5,110,40,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP END +IDD_DIALOG_SHADER_PARAMS DIALOGEX 0, 0, 309, 205 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Shader Paramaters" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 144, 184, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 184, 50, 14 + LTEXT "", IDC_STATIC_CONTAINER, 7, 35, 282, 142, WS_BORDER + SCROLLBAR IDC_SCROLLBAR_PARAMS, 289, 35, 12, 142, SBS_VERT + PUSHBUTTON "Apply", IDAPPLY, 253, 184, 50, 14 + LTEXT "Changing these parameters will create a new ""custom_shader_params.glslp"" file in the snes9x directory that contains the parameters and references to your currently loaded shader. This will then be used as your current OpenGL shader.", IDC_STATIC, 7, 7, 295, 28 +END ///////////////////////////////////////////////////////////////////////////// // @@ -726,6 +680,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 83 END + + IDD_DIALOG_SHADER_PARAMS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 302 + TOPMARGIN, 7 + BOTTOMMARGIN, 198 + END END #endif // APSTUDIO_INVOKED diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 504e48a4..37c4e584 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -7486,6 +7486,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FILE), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_BROWSE), TRUE); + EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_PARAMETERS), TRUE); } SetDlgItemText(hDlg, IDC_SHADER_HLSL_FILE, GUI.D3DshaderFileName); SetDlgItemText(hDlg, IDC_SHADER_GLSL_FILE, GUI.OGLshaderFileName); @@ -7671,6 +7672,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE),GUI.shaderEnabled); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FILE),GUI.shaderEnabled); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_BROWSE),GUI.shaderEnabled); + EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_PARAMETERS), GUI.shaderEnabled); GetDlgItemText(hDlg,IDC_SHADER_HLSL_FILE,GUI.D3DshaderFileName,MAX_PATH); GetDlgItemText(hDlg,IDC_SHADER_GLSL_FILE,GUI.OGLshaderFileName,MAX_PATH); @@ -7722,6 +7724,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) MessageBox(GUI.hWnd, TEXT("Parameters are only supported for .glsl shaders"), TEXT("No Parameters"), MB_OK | MB_ICONINFORMATION); break; } + ShowWindow(hDlg, SW_HIDE); GLSLShader shader; shader.load_shader(_tToChar(GUI.OGLshaderFileName)); CShaderParamDlg dlg(shader); @@ -7730,6 +7733,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) WinDisplayApplyChanges(); WinRefreshDisplay(); } + ShowWindow(hDlg, SW_SHOW); break; } case IDC_FILTERBOX: