win32: add shader parameters dialog

This commit is contained in:
OV2 2018-05-24 11:55:17 +02:00
parent e3a86417b8
commit 06f84ee6b3
6 changed files with 155 additions and 61 deletions

View File

@ -1,3 +1,6 @@
#ifndef __GLSL_H
#define __GLSL_H
#include <vector>
#include <deque>
#include <limits.h>
@ -142,3 +145,5 @@ typedef struct
GLfloat *fa;
} GLSLShader;
#endif

View File

@ -3,6 +3,8 @@
// Used by snes9x.rc
//
#define IDR_RT_MANIFEST2 1
#define IDCANCEL2 3
#define IDAPPLY 3
#define IDR_MENU_US 101
#define IDC_CURSOR_SCOPE 101
#define IDC_CURSOR_BLANK 102
@ -37,6 +39,7 @@
#define IDB_LOCKEDFOLDER 148
#define IDB_HIDDENFOLDER 149
#define IDD_MULTICART 150
#define IDD_DIALOG_SHADER_PARAMS 155
#define IDC_DRIVER 1001
#define IDC_BUFLEN 1002
#define IDC_RATE 1003
@ -55,6 +58,7 @@
#define IDC_MUTE 1016
#define IDC_SKIP_TYPE 1017
#define IDC_SCROLLBAR1 1018
#define IDC_SCROLLBAR_PARAMS 1018
#define IDC_VRAM_DISPLAY 1019
#define IDC_WIP1 1019
#define IDC_ADDRESS 1020
@ -368,8 +372,10 @@
#define IDC_SHADER_GLSL_BROWSE 3018
#define IDC_SLIDER_VOLUME_REGULAR 3018
#define IDC_EDIT_VOLUME_REGULAR 3019
#define IDC_SHADER_GLSL_PARAMETERS 3019
#define IDC_SLIDER_VOLUME_TURBO 3020
#define IDC_EDIT_VOLUME_TURBO 3021
#define IDC_STATIC_CONTAINER 3022
#define ID_FILE_EXIT 40001
#define ID_WINDOW_HIDEMENUBAR 40004
#define ID_FILE_AVI_RECORDING 40005
@ -516,9 +522,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 155
#define _APS_NEXT_RESOURCE_VALUE 157
#define _APS_NEXT_COMMAND_VALUE 40178
#define _APS_NEXT_CONTROL_VALUE 3022
#define _APS_NEXT_CONTROL_VALUE 3023
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -14,6 +14,65 @@
/////////////////////////////////////////////////////////////////////////////
#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
@ -21,37 +80,6 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
//
IDC_CURSOR_SCOPE CURSOR "nodrop.cur"
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_SNES9X_ACCELERATORS ACCELERATORS
BEGIN
"G", ID_CHEAT_ENTER, VIRTKEY, ALT, NOINVERT
"A", ID_CHEAT_SEARCH, VIRTKEY, ALT, NOINVERT
"O", ID_FILE_LOAD_GAME, VIRTKEY, CONTROL, NOINVERT
VK_F5, ID_OPTIONS_DISPLAY, VIRTKEY, ALT, NOINVERT
VK_F7, ID_OPTIONS_JOYPAD, VIRTKEY, ALT, NOINVERT
VK_F9, ID_OPTIONS_KEYCUSTOM, VIRTKEY, ALT, NOINVERT
VK_F8, ID_OPTIONS_SETTINGS, VIRTKEY, ALT, NOINVERT
"[", ID_SOUND_INTERPOLATED, ASCII, ALT, NOINVERT
"T", ID_SOUND_OPTIONS, VIRTKEY, ALT, NOINVERT
"R", ID_SOUND_REVERSE_STEREO, VIRTKEY, ALT, NOINVERT
"]", ID_SOUND_SYNC, ASCII, ALT, NOINVERT
VK_RETURN, ID_WINDOW_FULLSCREEN, VIRTKEY, ALT, NOINVERT
VK_BACK, ID_WINDOW_STRETCH, VIRTKEY, ALT, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
@ -193,7 +221,7 @@ BEGIN
END
IDD_NEWDISPLAY DIALOGEX 0, 0, 353, 283
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION
CAPTION "Display Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
@ -242,9 +270,10 @@ BEGIN
LTEXT "OpenGL Shader File",IDC_STATIC,13,224,104,8
CONTROL "Blend Hi-Res Images",IDC_HIRESBLEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,135,82,10
CONTROL "VSync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,102,37,10
CONTROL "Reduce Input Lag", IDC_REDUCEINPUTLAG, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 11, 113, 76, 10
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
END
IDD_CHEATER DIALOGEX 0, 0, 375, 194
@ -700,6 +729,63 @@ END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// AFX_DIALOG_LAYOUT
//
IDD_SOUND_OPTS AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_NEWDISPLAY AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_CHEATER AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_KEYCUSTOM AFX_DIALOG_LAYOUT
BEGIN
0
END
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
//
IDC_CURSOR_SCOPE CURSOR "nodrop.cur"
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_SNES9X_ACCELERATORS ACCELERATORS
BEGIN
"G", ID_CHEAT_ENTER, VIRTKEY, ALT, NOINVERT
"A", ID_CHEAT_SEARCH, VIRTKEY, ALT, NOINVERT
"O", ID_FILE_LOAD_GAME, VIRTKEY, CONTROL, NOINVERT
VK_F5, ID_OPTIONS_DISPLAY, VIRTKEY, ALT, NOINVERT
VK_F7, ID_OPTIONS_JOYPAD, VIRTKEY, ALT, NOINVERT
VK_F9, ID_OPTIONS_KEYCUSTOM, VIRTKEY, ALT, NOINVERT
VK_F8, ID_OPTIONS_SETTINGS, VIRTKEY, ALT, NOINVERT
"[", ID_SOUND_INTERPOLATED, ASCII, ALT, NOINVERT
"T", ID_SOUND_OPTIONS, VIRTKEY, ALT, NOINVERT
"R", ID_SOUND_REVERSE_STEREO, VIRTKEY, ALT, NOINVERT
"]", ID_SOUND_SYNC, ASCII, ALT, NOINVERT
VK_RETURN, ID_WINDOW_FULLSCREEN, VIRTKEY, ALT, NOINVERT
VK_BACK, ID_WINDOW_STRETCH, VIRTKEY, ALT, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
@ -990,32 +1076,6 @@ BEGIN
END
END
/////////////////////////////////////////////////////////////////////////////
//
// AFX_DIALOG_LAYOUT
//
IDD_SOUND_OPTS AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_NEWDISPLAY AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_CHEATER AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_KEYCUSTOM AFX_DIALOG_LAYOUT
BEGIN
0
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -427,6 +427,7 @@
<ClInclude Include="CGLCG.h" />
<ClInclude Include="cgMini.h" />
<ClInclude Include="COpenGL.h" />
<ClInclude Include="CShaderParamDlg.h" />
<ClInclude Include="CXAudio2.h" />
<ClInclude Include="CXML.h" />
<ClInclude Include="dxerr.h" />
@ -559,6 +560,7 @@
<ClCompile Include="cgFunctions.cpp" />
<ClCompile Include="CGLCG.cpp" />
<ClCompile Include="COpenGL.cpp" />
<ClCompile Include="CShaderParamDlg.cpp" />
<ClCompile Include="CXAudio2.cpp" />
<ClCompile Include="CXML.cpp" />
<ClCompile Include="DumpAtEnd.cpp" />

View File

@ -270,6 +270,7 @@
<ClInclude Include="gl_core_3_1.h">
<Filter>GUI\VideoDriver</Filter>
</ClInclude>
<ClInclude Include="CShaderParamDlg.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\bsx.cpp">
@ -581,6 +582,7 @@
<ClCompile Include="gl_core_3_1.c">
<Filter>GUI\VideoDriver</Filter>
</ClCompile>
<ClCompile Include="CShaderParamDlg.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="rsrc\nodrop.cur">

View File

@ -217,6 +217,8 @@
#include "win32_sound.h"
#include "win32_display.h"
#include "CCGShader.h"
#include "../shaders/glsl.h"
#include "CShaderParamDlg.h"
#include "../snes9x.h"
#include "../memmap.h"
#include "../cpuexec.h"
@ -7675,6 +7677,23 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
WinRefreshDisplay();
}
break;
case IDC_SHADER_GLSL_PARAMETERS:
{
GetDlgItemText(hDlg, IDC_SHADER_GLSL_FILE, GUI.OGLshaderFileName, MAX_PATH);
if(lstrlen(GUI.OGLshaderFileName) < 6 || _tcsncicmp(&GUI.OGLshaderFileName[lstrlen(GUI.OGLshaderFileName) - 6], TEXT(".glslp"), 6)) {
MessageBox(GUI.hWnd, TEXT("Parameters are only supported for .glsl shaders"), TEXT("No Parameters"), MB_OK | MB_ICONINFORMATION);
break;
}
GLSLShader shader;
shader.load_shader(_tToChar(GUI.OGLshaderFileName));
CShaderParamDlg dlg(shader);
if(dlg.show()) {
SetDlgItemText(hDlg, IDC_SHADER_GLSL_FILE, GUI.OGLshaderFileName);
WinDisplayApplyChanges();
WinRefreshDisplay();
}
break;
}
case IDC_FILTERBOX:
if(HIWORD(wParam)==CBN_SELCHANGE) {
int scale = (int)SendDlgItemMessage(hDlg,IDC_FILTERBOX,CB_GETCURSEL,0,0);