win32: let shader param dialog save slangp

This commit is contained in:
OV2 2019-02-01 22:33:24 +01:00
parent 47dce09600
commit 1ea9bcf560
3 changed files with 12 additions and 5 deletions

View File

@ -258,7 +258,13 @@ void CShaderParamDlg::get_changed_parameters(HWND hDlg)
void CShaderParamDlg::save_custom_shader()
{
TCHAR save_path[MAX_PATH];
int len = lstrlen(GUI.OGLshaderFileName);
if (len > 5 && !_tcsncicmp(&GUI.OGLshaderFileName[len - 6], TEXT(".glslp"), 6)) {
_stprintf(save_path, TEXT("%s\\custom_shader_params.glslp"), S9xGetDirectoryT(DEFAULT_DIR));
}
else {
_stprintf(save_path, TEXT("%s\\custom_shader_params.slangp"), S9xGetDirectoryT(DEFAULT_DIR));
}
shader.save(_tToChar(save_path));
lstrcpy(GUI.OGLshaderFileName, save_path);
}
@ -267,6 +273,5 @@ void CShaderParamDlg::apply_changes(HWND hDlg)
{
get_changed_parameters(hDlg);
save_custom_shader();
WinDisplayApplyChanges();
WinRefreshDisplay();
}

View File

@ -550,7 +550,7 @@ BEGIN
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
LTEXT "Changing these parameters will create a new ""custom_shader_params.glslp / .slangp"" 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
IDD_DIALOG_XAUDIO2_INIT_ERROR DIALOGEX 0, 0, 277, 92

View File

@ -7733,8 +7733,10 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
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);
int len = lstrlen(GUI.OGLshaderFileName);
if((len < 6 || _tcsncicmp(&GUI.OGLshaderFileName[len - 6], TEXT(".glslp"), 6)) &&
(len < 7 || _tcsncicmp(&GUI.OGLshaderFileName[len - 7], TEXT(".slangp"), 7))) {
MessageBox(GUI.hWnd, TEXT("Parameters are only supported for .glslp and .slangp shaders"), TEXT("No Parameters"), MB_OK | MB_ICONINFORMATION);
break;
}
ShowWindow(hDlg, SW_HIDE);