Change GLSL to use bsnes 071's unified XML files

This commit is contained in:
OV2 2010-10-22 21:51:50 +02:00
parent 3018f8dac0
commit f2e5dc3136
8 changed files with 118 additions and 91 deletions

View File

@ -4,6 +4,7 @@
#include "../gfx.h" #include "../gfx.h"
#include "../display.h" #include "../display.h"
#include "wsnes9x.h" #include "wsnes9x.h"
#include <msxml2.h>
#include "../filter/hq2x.h" #include "../filter/hq2x.h"
#include "../filter/2xsai.h" #include "../filter/2xsai.h"
@ -113,7 +114,7 @@ void COpenGL::DeInitialize()
{ {
initDone = false; initDone = false;
if(shaderCompiled) if(shaderCompiled)
SetShaders(NULL,NULL); SetShaders(NULL);
DestroyDrawSurface(); DestroyDrawSurface();
wglMakeCurrent(NULL,NULL); wglMakeCurrent(NULL,NULL);
if(hRC) { if(hRC) {
@ -304,10 +305,10 @@ bool COpenGL::ApplyDisplayChanges(void)
if(wglSwapIntervalEXT) { if(wglSwapIntervalEXT) {
wglSwapIntervalEXT(GUI.Vsync?1:0); wglSwapIntervalEXT(GUI.Vsync?1:0);
} }
if(GUI.shaderEnabled && GUI.GLSLvertexShaderFileName && GUI.GLSLfragmentShaderFileName) if(GUI.shaderEnabled && GUI.GLSLshaderFileName)
SetShaders(GUI.GLSLfragmentShaderFileName,GUI.GLSLvertexShaderFileName); SetShaders(GUI.GLSLshaderFileName);
else else
SetShaders(NULL,NULL); SetShaders(NULL);
RECT windowSize; RECT windowSize;
GetClientRect(hWnd,&windowSize); GetClientRect(hWnd,&windowSize);
@ -480,9 +481,13 @@ char *ReadFileContents(const TCHAR *filename)
} }
bool COpenGL::SetShaders(const TCHAR *fragmentFileName,const TCHAR *vertexFileName) bool COpenGL::SetShaders(const TCHAR *glslFileName)
{ {
char *fragment=NULL, *vertex=NULL; char *fragment=NULL, *vertex=NULL;
IXMLDOMDocument * pXMLDoc = NULL;
IXMLDOMNode * pXDN = NULL;
HRESULT hr;
BSTR queryString, nodeContent;
shaderCompiled = false; shaderCompiled = false;
@ -502,7 +507,7 @@ bool COpenGL::SetShaders(const TCHAR *fragmentFileName,const TCHAR *vertexFileNa
shaderProgram = 0; shaderProgram = 0;
} }
if(fragmentFileName==NULL||vertexFileName==NULL) if(glslFileName==NULL || *glslFileName==TEXT('\0'))
return true; return true;
if(!LoadShaderFunctions()) { if(!LoadShaderFunctions()) {
@ -511,24 +516,76 @@ bool COpenGL::SetShaders(const TCHAR *fragmentFileName,const TCHAR *vertexFileNa
return false; return false;
} }
if(*fragmentFileName!=TEXT('\0')) { hr = CoCreateInstance(CLSID_DOMDocument,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&pXMLDoc));
fragment = ReadFileContents(fragmentFileName);
if (!fragment) { if(FAILED(hr)) {
TCHAR errorMsg[MAX_PATH + 50]; MessageBox(NULL, TEXT("Error creating XML Parser"), TEXT("Shader Loading Error"),
_stprintf(errorMsg,TEXT("Error loading GLSL fragment shader file:\n%s"),fragmentFileName);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION); MB_OK|MB_ICONEXCLAMATION);
} return false;
} }
if(*vertexFileName!=TEXT('\0')) { VARIANT fileName;
vertex = ReadFileContents (vertexFileName); VARIANT_BOOL ret;
if (!vertex) { fileName.vt = VT_BSTR;
#ifdef UNICODE
fileName.bstrVal = SysAllocString(glslFileName);
#else
wchar_t tempfilename[MAX_PATH];
MultiByteToWideChar(CP_UTF8,0,glslFileName,-1,tempfilename,MAX_PATH);
fileName.bstrVal = SysAllocString(tempfilename);
#endif
hr = pXMLDoc->load(fileName,&ret);
SysFreeString(fileName.bstrVal);
if(FAILED(hr) || hr==S_FALSE) {
TCHAR errorMsg[MAX_PATH + 50]; TCHAR errorMsg[MAX_PATH + 50];
_stprintf(errorMsg,TEXT("Error loading GLSL vertex shader file:\n%s"),vertexFileName); _stprintf(errorMsg,TEXT("Error loading GLSL shader file:\n%s"),glslFileName);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION); MB_OK|MB_ICONEXCLAMATION);
pXMLDoc->Release();
return false;
} }
queryString=SysAllocString(L"/shader/fragment");
hr = pXMLDoc->selectSingleNode(queryString,&pXDN);
SysFreeString(queryString);
if(hr == S_OK) {
hr = pXDN->get_text(&nodeContent);
if(hr == S_OK) {
int requiredChars = WideCharToMultiByte(CP_ACP,0,nodeContent,-1,fragment,0,NULL,NULL);
fragment = new char[requiredChars];
WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,fragment,requiredChars,NULL,NULL);
}
SysFreeString(nodeContent);
pXDN->Release();
pXDN = NULL;
}
queryString=SysAllocString(L"/shader/vertex");
hr = pXMLDoc->selectSingleNode(queryString,&pXDN);
SysFreeString(queryString);
if(hr == S_OK) {
hr = pXDN->get_text(&nodeContent);
if(hr == S_OK) {
int requiredChars = WideCharToMultiByte(CP_ACP,0,nodeContent,-1,vertex,0,NULL,NULL);
vertex = new char[requiredChars];
WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,vertex,requiredChars,NULL,NULL);
}
SysFreeString(nodeContent);
pXDN->Release();
pXDN = NULL;
}
pXMLDoc->Release();
if(!fragment && !vertex) {
TCHAR errorMsg[MAX_PATH + 50];
_stprintf(errorMsg,TEXT("No vertex or fragment program in file:\n%s"),glslFileName);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION);
return false;
} }
shaderProgram = glCreateProgram (); shaderProgram = glCreateProgram ();

View File

@ -240,7 +240,7 @@ private:
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
bool SetShaders(const TCHAR *fragment,const TCHAR *vertex); bool SetShaders(const TCHAR *glslFileName);
bool LoadShaderFunctions(); bool LoadShaderFunctions();
bool LoadPBOFunctions(); bool LoadPBOFunctions();
void CreateDrawSurface(void); void CreateDrawSurface(void);

View File

@ -101,10 +101,9 @@
#define IDC_MULTICART_EDITB 1092 #define IDC_MULTICART_EDITB 1092
#define IDC_PAUSESPIN 1093 #define IDC_PAUSESPIN 1093
#define IDC_DWNRIGHT 1093 #define IDC_DWNRIGHT 1093
#define IDC_SHADER_GLSL_VERTEX_FILE 1093 #define IDC_SHADER_GLSL_FILE 1093
#define IDC_SYNCBYRESET 1094 #define IDC_SYNCBYRESET 1094
#define IDC_DOWN 1094 #define IDC_DOWN 1094
#define IDC_SHADER_GLSL_FRAGMENT_FILE 1094
#define IDC_SENDROM 1095 #define IDC_SENDROM 1095
#define IDC_DWNLEFT 1095 #define IDC_DWNLEFT 1095
#define IDC_ACTASSERVER 1096 #define IDC_ACTASSERVER 1096
@ -350,8 +349,7 @@
#define IDC_SHADER_ENABLED 3015 #define IDC_SHADER_ENABLED 3015
#define IDC_SHADER_HLSL_BROWSE 3016 #define IDC_SHADER_HLSL_BROWSE 3016
#define IDC_SHADER_GROUP 3017 #define IDC_SHADER_GROUP 3017
#define IDC_SHADER_GLSL_VERTEX_BROWSE 3018 #define IDC_SHADER_GLSL_BROWSE 3018
#define IDC_SHADER_GLSL_FRAGMENT_BROWSE 3019
#define ID_FILE_EXIT 40001 #define ID_FILE_EXIT 40001
#define ID_WINDOW_HIDEMENUBAR 40004 #define ID_WINDOW_HIDEMENUBAR 40004
#define ID_FILE_AVI_RECORDING 40005 #define ID_FILE_AVI_RECORDING 40005

View File

@ -173,13 +173,13 @@ BEGIN
CONTROL "Sync By Reset",IDC_SYNCBYRESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,90,174,15 CONTROL "Sync By Reset",IDC_SYNCBYRESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,90,174,15
END END
IDD_NEWDISPLAY DIALOGEX 0, 0, 353, 285 IDD_NEWDISPLAY DIALOGEX 0, 0, 353, 259
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION
CAPTION "Display Settings" CAPTION "Display Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x1 FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,239,263,50,14 DEFPUSHBUTTON "OK",IDOK,239,237,50,14
PUSHBUTTON "Cancel",IDCANCEL,296,263,50,14 PUSHBUTTON "Cancel",IDCANCEL,296,237,50,14
COMBOBOX IDC_OUTPUTMETHOD,68,17,101,38,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_OUTPUTMETHOD,68,17,101,38,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Fullscreen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,36,48,10 CONTROL "Fullscreen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,36,48,10
CONTROL "Emulate Fullscreen",IDC_EMUFULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,75,10 CONTROL "Emulate Fullscreen",IDC_EMUFULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,75,10
@ -205,7 +205,7 @@ BEGIN
CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,135,111,10 CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,135,111,10
CONTROL "Display messages before applying filters",IDC_MESSAGES_IN_IMAGE, CONTROL "Display messages before applying filters",IDC_MESSAGES_IN_IMAGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,140,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,140,10
GROUPBOX "",IDC_SHADER_GROUP,8,162,338,97,0,WS_EX_TRANSPARENT GROUPBOX "",IDC_SHADER_GROUP,8,162,338,71,0,WS_EX_TRANSPARENT
EDITTEXT IDC_SHADER_HLSL_FILE,13,184,306,14,ES_AUTOHSCROLL | WS_DISABLED EDITTEXT IDC_SHADER_HLSL_FILE,13,184,306,14,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "...",IDC_SHADER_HLSL_BROWSE,322,184,19,14,WS_DISABLED PUSHBUTTON "...",IDC_SHADER_HLSL_BROWSE,322,184,19,14,WS_DISABLED
GROUPBOX "Frame Skipping:",IDC_STATIC,7,113,167,46,0,WS_EX_TRANSPARENT GROUPBOX "Frame Skipping:",IDC_STATIC,7,113,167,46,0,WS_EX_TRANSPARENT
@ -219,12 +219,9 @@ BEGIN
LTEXT "Output Method",IDC_STATIC,10,19,51,11 LTEXT "Output Method",IDC_STATIC,10,19,51,11
CONTROL "Use Shader",IDC_SHADER_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,162,52,9 CONTROL "Use Shader",IDC_SHADER_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,162,52,9
LTEXT "HLSL Effect File",IDC_STATIC,13,173,104,8 LTEXT "HLSL Effect File",IDC_STATIC,13,173,104,8
EDITTEXT IDC_SHADER_GLSL_VERTEX_FILE,13,213,306,14,ES_AUTOHSCROLL | WS_DISABLED EDITTEXT IDC_SHADER_GLSL_FILE,13,213,306,14,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "...",IDC_SHADER_GLSL_VERTEX_BROWSE,322,213,19,14,WS_DISABLED PUSHBUTTON "...",IDC_SHADER_GLSL_BROWSE,322,213,19,14,WS_DISABLED
LTEXT "GLSL vertex shader",IDC_STATIC,13,202,104,8 LTEXT "GLSL shader",IDC_STATIC,13,202,104,8
EDITTEXT IDC_SHADER_GLSL_FRAGMENT_FILE,13,240,306,14,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "...",IDC_SHADER_GLSL_FRAGMENT_BROWSE,322,240,19,14,WS_DISABLED
LTEXT "GLSL fragment shader",IDC_STATIC,13,229,104,8
END END
IDD_CHEATER DIALOGEX 0, 0, 262, 218 IDD_CHEATER DIALOGEX 0, 0, 262, 218
@ -592,7 +589,7 @@ BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 346 RIGHTMARGIN, 346
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 277 BOTTOMMARGIN, 251
END END
IDD_CHEATER, DIALOG IDD_CHEATER, DIALOG

View File

@ -85,7 +85,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmt.lib" AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmt.lib msxml2.lib"
OutputFile=".\snes9x.exe" OutputFile=".\snes9x.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -187,7 +187,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib xapobase.lib zlibmtx64.lib" AdditionalDependencies="libpngmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtx64.lib msxml2.lib"
OutputFile=".\snes9x-x64.exe" OutputFile=".\snes9x-x64.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -284,7 +284,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngdmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmt.lib" AdditionalDependencies="libpngdmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmt.lib msxml2.lib"
OutputFile=".\snes9x-debug.exe" OutputFile=".\snes9x-debug.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -383,7 +383,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngdmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib xapobase.lib zlibdmtx64.lib" AdditionalDependencies="libpngdmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtx64.lib msxml2.lib"
OutputFile=".\snes9x-debug-x64.exe" OutputFile=".\snes9x-debug-x64.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -480,7 +480,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmt.lib" AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmt.lib msxml2.lib"
OutputFile=".\snes9x-debug.exe" OutputFile=".\snes9x-debug.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -676,7 +676,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmt.lib" AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmt.lib msxml2.lib"
OutputFile=".\snes9x.exe" OutputFile=".\snes9x.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -872,7 +872,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngdmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtu.lib" AdditionalDependencies="libpngdmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtu.lib msxml2.lib"
OutputFile=".\snes9x-debug.exe" OutputFile=".\snes9x-debug.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -972,7 +972,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngdmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib xapobase.lib zlibdmtux64.lib" AdditionalDependencies="libpngdmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtux64.lib msxml2.lib"
OutputFile=".\snes9x-debug-x64.exe" OutputFile=".\snes9x-debug-x64.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -1078,7 +1078,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtu.lib" AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtu.lib msxml2.lib"
OutputFile=".\snes9x.exe" OutputFile=".\snes9x.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -1182,7 +1182,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libpngmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib xapobase.lib zlibmtux64.lib" AdditionalDependencies="libpngmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtux64.lib msxml2.lib"
OutputFile=".\snes9x-x64.exe" OutputFile=".\snes9x-x64.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"

View File

@ -899,8 +899,7 @@ void WinRegisterConfigItems()
AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2); AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2);
AddBoolC("ShaderEnabled", GUI.shaderEnabled, false, "true to use pixel shader (if supported by output method)"); AddBoolC("ShaderEnabled", GUI.shaderEnabled, false, "true to use pixel shader (if supported by output method)");
AddStringC("Direct3D:HLSLFileName", GUI.HLSLshaderFileName, MAX_PATH, "", "shader filename for Direct3D mode"); AddStringC("Direct3D:HLSLFileName", GUI.HLSLshaderFileName, MAX_PATH, "", "shader filename for Direct3D mode");
AddStringC("OpenGL:GLSLvertexFileName", GUI.GLSLvertexShaderFileName, MAX_PATH, "", "vertex shader filename for OpenGL mode"); AddStringC("OpenGL:GLSLFileName", GUI.GLSLshaderFileName, MAX_PATH, "", "shader filename for OpenGL mode (bsnes-style XML shader)");
AddStringC("OpenGL:GLSLfragmentFileName", GUI.GLSLfragmentShaderFileName, MAX_PATH, "", "fragment shader filename for OpenGL mode");
AddBoolC("ExtendHeight", GUI.HeightExtend, false, "true to display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240."); AddBoolC("ExtendHeight", GUI.HeightExtend, false, "true to display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240.");
AddBoolC("AlwaysCenterImage", GUI.AlwaysCenterImage,false, "true to center the image even if larger than window"); AddBoolC("AlwaysCenterImage", GUI.AlwaysCenterImage,false, "true to center the image even if larger than window");
AddIntC("Window:Width", GUI.window_size.right, 512, "256=1x, 512=2x, 768=3x, 1024=4x, etc. (usually)"); AddIntC("Window:Width", GUI.window_size.right, 512, "256=1x, 512=2x, 768=3x, 1024=4x, etc. (usually)");

View File

@ -4025,6 +4025,7 @@ void S9xRemoveFromRecentGames (int i)
} }
} }
#ifdef UNICODE
HRESULT Win7_JLSetRecentGames(ICustomDestinationList *pcdl, IObjectArray *poaRemoved, UINT maxSlots) HRESULT Win7_JLSetRecentGames(ICustomDestinationList *pcdl, IObjectArray *poaRemoved, UINT maxSlots)
{ {
IObjectCollection *poc; IObjectCollection *poc;
@ -4076,6 +4077,7 @@ void Win7_CreateJumpList()
pcdl->Release(); pcdl->Release();
} }
} }
#endif
void S9xSetRecentGames () void S9xSetRecentGames ()
{ {
@ -4130,7 +4132,9 @@ void S9xSetRecentGames ()
InsertMenuItem (recent, 0xFF00 + i, FALSE, &mii); InsertMenuItem (recent, 0xFF00 + i, FALSE, &mii);
} }
#ifdef UNICODE
Win7_CreateJumpList(); Win7_CreateJumpList();
#endif
} }
} }
} }
@ -6923,7 +6927,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
static bool prevStretch, prevAspectRatio, prevHeightExtend, prevAutoDisplayMessages, prevVideoMemory, prevShaderEnabled; static bool prevStretch, prevAspectRatio, prevHeightExtend, prevAutoDisplayMessages, prevVideoMemory, prevShaderEnabled;
static int prevAspectWidth; static int prevAspectWidth;
static OutputMethod prevOutputMethod; static OutputMethod prevOutputMethod;
static TCHAR prevHLSLShaderFile[MAX_PATH],prevGLSLvertexShaderFile[MAX_PATH],prevGLSLfragmentShaderFile[MAX_PATH]; static TCHAR prevHLSLShaderFile[MAX_PATH],prevGLSLShaderFile[MAX_PATH];
switch(msg) switch(msg)
{ {
@ -6952,8 +6956,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0; prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0;
prevShaderEnabled = GUI.shaderEnabled; prevShaderEnabled = GUI.shaderEnabled;
lstrcpy(prevHLSLShaderFile,GUI.HLSLshaderFileName); lstrcpy(prevHLSLShaderFile,GUI.HLSLshaderFileName);
lstrcpy(prevGLSLvertexShaderFile,GUI.GLSLvertexShaderFileName); lstrcpy(prevGLSLShaderFile,GUI.GLSLshaderFileName);
lstrcpy(prevGLSLfragmentShaderFile,GUI.GLSLfragmentShaderFileName);
_stprintf(s,TEXT("Current: %dx%d %dbit %dHz"),GUI.FullscreenMode.width,GUI.FullscreenMode.height,GUI.FullscreenMode.depth,GUI.FullscreenMode.rate); _stprintf(s,TEXT("Current: %dx%d %dbit %dHz"),GUI.FullscreenMode.width,GUI.FullscreenMode.height,GUI.FullscreenMode.depth,GUI.FullscreenMode.rate);
@ -7025,14 +7028,11 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hDlg, IDC_SHADER_ENABLED, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_SHADER_ENABLED, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_FILE),TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_FILE),TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE),TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE),TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FRAGMENT_FILE),TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FILE),TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FRAGMENT_BROWSE),TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_BROWSE),TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_VERTEX_FILE),TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_VERTEX_BROWSE),TRUE);
} }
SetDlgItemText(hDlg,IDC_SHADER_HLSL_FILE,GUI.HLSLshaderFileName); SetDlgItemText(hDlg,IDC_SHADER_HLSL_FILE,GUI.HLSLshaderFileName);
SetDlgItemText(hDlg,IDC_SHADER_GLSL_VERTEX_FILE,GUI.GLSLvertexShaderFileName); SetDlgItemText(hDlg,IDC_SHADER_GLSL_FILE,GUI.GLSLshaderFileName);
SetDlgItemText(hDlg,IDC_SHADER_GLSL_FRAGMENT_FILE,GUI.GLSLfragmentShaderFileName);
lpfnOldWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg,IDC_SHADER_GROUP),GWLP_WNDPROC,(LONG_PTR)GroupBoxCheckBoxTitle); lpfnOldWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg,IDC_SHADER_GROUP),GWLP_WNDPROC,(LONG_PTR)GroupBoxCheckBoxTitle);
@ -7189,14 +7189,11 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GROUP),GUI.shaderEnabled); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GROUP),GUI.shaderEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_FILE),GUI.shaderEnabled); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_FILE),GUI.shaderEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE),GUI.shaderEnabled); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_HLSL_BROWSE),GUI.shaderEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_VERTEX_FILE),GUI.shaderEnabled); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FILE),GUI.shaderEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_VERTEX_BROWSE),GUI.shaderEnabled); EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_BROWSE),GUI.shaderEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FRAGMENT_FILE),GUI.shaderEnabled);
EnableWindow(GetDlgItem(hDlg, IDC_SHADER_GLSL_FRAGMENT_BROWSE),GUI.shaderEnabled);
GetDlgItemText(hDlg,IDC_SHADER_HLSL_FILE,GUI.HLSLshaderFileName,MAX_PATH); GetDlgItemText(hDlg,IDC_SHADER_HLSL_FILE,GUI.HLSLshaderFileName,MAX_PATH);
GetDlgItemText(hDlg,IDC_SHADER_GLSL_VERTEX_FILE,GUI.GLSLvertexShaderFileName,MAX_PATH); GetDlgItemText(hDlg,IDC_SHADER_GLSL_FILE,GUI.GLSLshaderFileName,MAX_PATH);
GetDlgItemText(hDlg,IDC_SHADER_GLSL_FRAGMENT_FILE,GUI.GLSLfragmentShaderFileName,MAX_PATH);
WinDisplayApplyChanges(); WinDisplayApplyChanges();
WinRefreshDisplay(); WinRefreshDisplay();
break; break;
@ -7219,8 +7216,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
WinRefreshDisplay(); WinRefreshDisplay();
} }
break; break;
case IDC_SHADER_GLSL_VERTEX_BROWSE: case IDC_SHADER_GLSL_BROWSE:
GetDlgItemText(hDlg,IDC_SHADER_GLSL_VERTEX_FILE,openFileName,MAX_PATH); GetDlgItemText(hDlg,IDC_SHADER_GLSL_FILE,openFileName,MAX_PATH);
ZeroMemory((LPVOID)&ofn, sizeof(OPENFILENAME)); ZeroMemory((LPVOID)&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
@ -7232,27 +7229,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
if(GetOpenFileName(&ofn)) { if(GetOpenFileName(&ofn)) {
SetDlgItemText(hDlg,IDC_SHADER_GLSL_VERTEX_FILE,openFileName); SetDlgItemText(hDlg,IDC_SHADER_GLSL_FILE,openFileName);
lstrcpy(GUI.GLSLvertexShaderFileName,openFileName); lstrcpy(GUI.GLSLshaderFileName,openFileName);
WinDisplayApplyChanges();
WinRefreshDisplay();
}
break;
case IDC_SHADER_GLSL_FRAGMENT_BROWSE:
GetDlgItemText(hDlg,IDC_SHADER_GLSL_FRAGMENT_FILE,openFileName,MAX_PATH);
ZeroMemory((LPVOID)&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = TEXT("All Files\0*.*\0\0");
ofn.lpstrFile = openFileName;
ofn.lpstrTitle = TEXT("Select Shader");
ofn.lpstrDefExt = TEXT("*.*");
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
if(GetOpenFileName(&ofn)) {
SetDlgItemText(hDlg,IDC_SHADER_GLSL_FRAGMENT_FILE,openFileName);
lstrcpy(GUI.GLSLfragmentShaderFileName,openFileName);
WinDisplayApplyChanges(); WinDisplayApplyChanges();
WinRefreshDisplay(); WinRefreshDisplay();
} }
@ -7432,8 +7410,7 @@ updateFilterBox2:
GUI.HeightExtend = prevHeightExtend; GUI.HeightExtend = prevHeightExtend;
GUI.shaderEnabled = prevShaderEnabled; GUI.shaderEnabled = prevShaderEnabled;
lstrcpy(GUI.HLSLshaderFileName,prevHLSLShaderFile); lstrcpy(GUI.HLSLshaderFileName,prevHLSLShaderFile);
lstrcpy(GUI.GLSLvertexShaderFileName,prevGLSLvertexShaderFile); lstrcpy(GUI.GLSLshaderFileName,prevGLSLShaderFile);
lstrcpy(GUI.GLSLfragmentShaderFileName,prevGLSLfragmentShaderFile);
} }
EndDialog(hDlg,0); EndDialog(hDlg,0);

View File

@ -315,8 +315,7 @@ struct sGUI {
bool Vsync; bool Vsync;
bool shaderEnabled; bool shaderEnabled;
TCHAR HLSLshaderFileName[MAX_PATH]; TCHAR HLSLshaderFileName[MAX_PATH];
TCHAR GLSLvertexShaderFileName[MAX_PATH]; TCHAR GLSLshaderFileName[MAX_PATH];
TCHAR GLSLfragmentShaderFileName[MAX_PATH];
bool IgnoreNextMouseMove; bool IgnoreNextMouseMove;
RECT window_size; RECT window_size;