2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2015-05-26 13:36:47 +00:00
|
|
|
* Copyright (C) 2007-2015 Gabest
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "GSdx.h"
|
|
|
|
#include "GSSettingsDlg.h"
|
|
|
|
#include "GSUtil.h"
|
2011-01-02 10:24:36 +00:00
|
|
|
#include "GSDevice9.h"
|
2011-02-19 03:36:30 +00:00
|
|
|
#include "GSDevice11.h"
|
|
|
|
#include "resource.h"
|
2015-04-16 17:20:17 +00:00
|
|
|
#include "GSSetting.h"
|
2009-10-23 14:32:01 +00:00
|
|
|
|
2015-07-13 05:41:48 +00:00
|
|
|
|
|
|
|
GSSettingsDlg::GSSettingsDlg()
|
2016-05-01 23:00:00 +00:00
|
|
|
: GSDialog(IDD_CONFIG)
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2014-12-22 18:02:35 +00:00
|
|
|
#ifdef ENABLE_OPENCL
|
2014-09-22 07:15:25 +00:00
|
|
|
list<OCLDeviceDesc> ocldevs;
|
2014-09-22 03:29:40 +00:00
|
|
|
|
2014-09-22 07:15:25 +00:00
|
|
|
GSUtil::GetDeviceDescs(ocldevs);
|
2014-09-22 03:29:40 +00:00
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
for(auto dev : ocldevs)
|
|
|
|
{
|
|
|
|
m_ocl_devs.push_back(GSSetting(index++, dev.name.c_str(), ""));
|
|
|
|
}
|
2014-12-22 18:02:35 +00:00
|
|
|
#endif
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
2011-02-20 16:09:46 +00:00
|
|
|
|
2009-06-03 12:09:04 +00:00
|
|
|
void GSSettingsDlg::OnInit()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2009-06-03 12:09:04 +00:00
|
|
|
__super::OnInit();
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
CComPtr<IDirect3D9> d3d9;
|
2014-09-22 00:50:51 +00:00
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
d3d9.Attach(Direct3DCreate9(D3D_SDK_VERSION));
|
|
|
|
|
|
|
|
CComPtr<IDXGIFactory1> dxgi_factory;
|
2014-09-22 00:50:51 +00:00
|
|
|
|
|
|
|
if(GSUtil::CheckDXGI())
|
|
|
|
{
|
2012-08-06 05:26:44 +00:00
|
|
|
CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&dxgi_factory);
|
2014-09-22 00:50:51 +00:00
|
|
|
}
|
2016-05-01 23:00:00 +00:00
|
|
|
adapters.clear();
|
2012-08-06 05:26:44 +00:00
|
|
|
adapters.push_back(Adapter("Default Hardware Device", "default", GSUtil::CheckDirect3D11Level(NULL, D3D_DRIVER_TYPE_HARDWARE)));
|
|
|
|
adapters.push_back(Adapter("Reference Device", "ref", GSUtil::CheckDirect3D11Level(NULL, D3D_DRIVER_TYPE_REFERENCE)));
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2014-09-22 00:50:51 +00:00
|
|
|
if(dxgi_factory)
|
2009-06-04 08:32:31 +00:00
|
|
|
{
|
2014-09-22 00:50:51 +00:00
|
|
|
for(int i = 0;; i++)
|
2010-06-23 05:32:50 +00:00
|
|
|
{
|
2012-08-06 05:26:44 +00:00
|
|
|
CComPtr<IDXGIAdapter1> adapter;
|
2014-09-22 00:50:51 +00:00
|
|
|
|
|
|
|
if(S_OK != dxgi_factory->EnumAdapters1(i, &adapter))
|
2012-08-06 05:26:44 +00:00
|
|
|
break;
|
2014-09-22 00:50:51 +00:00
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
DXGI_ADAPTER_DESC1 desc;
|
2016-05-01 23:00:00 +00:00
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
HRESULT hr = adapter->GetDesc1(&desc);
|
2016-05-01 23:00:00 +00:00
|
|
|
|
2014-09-22 00:50:51 +00:00
|
|
|
if(S_OK == hr)
|
2012-08-06 05:26:44 +00:00
|
|
|
{
|
|
|
|
D3D_FEATURE_LEVEL level = GSUtil::CheckDirect3D11Level(adapter, D3D_DRIVER_TYPE_UNKNOWN);
|
2014-09-22 00:50:51 +00:00
|
|
|
// GSDX isn't unicode!?
|
2012-08-06 05:26:44 +00:00
|
|
|
#if 1
|
2014-09-22 00:50:51 +00:00
|
|
|
int size = WideCharToMultiByte(CP_ACP, 0, desc.Description, sizeof(desc.Description), NULL, 0, NULL, NULL);
|
2012-08-06 05:26:44 +00:00
|
|
|
char *buf = new char[size];
|
2014-09-22 00:50:51 +00:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, desc.Description, sizeof(desc.Description), buf, size, NULL, NULL);
|
2012-08-06 05:26:44 +00:00
|
|
|
adapters.push_back(Adapter(buf, GSAdapter(desc), level));
|
2014-09-22 00:50:51 +00:00
|
|
|
delete[] buf;
|
2012-08-06 05:26:44 +00:00
|
|
|
#else
|
|
|
|
adapters.push_back(Adapter(desc.Description, GSAdapter(desc), level));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-22 00:50:51 +00:00
|
|
|
else if(d3d9)
|
2012-08-06 05:26:44 +00:00
|
|
|
{
|
|
|
|
int n = d3d9->GetAdapterCount();
|
2014-09-22 00:50:51 +00:00
|
|
|
for(int i = 0; i < n; i++)
|
2012-08-06 05:26:44 +00:00
|
|
|
{
|
|
|
|
D3DADAPTER_IDENTIFIER9 desc;
|
2014-09-22 00:50:51 +00:00
|
|
|
|
|
|
|
if(D3D_OK != d3d9->GetAdapterIdentifier(i, 0, &desc))
|
2012-08-06 05:26:44 +00:00
|
|
|
break;
|
2014-09-22 00:50:51 +00:00
|
|
|
|
|
|
|
// GSDX isn't unicode!?
|
2012-08-06 05:26:44 +00:00
|
|
|
#if 0
|
|
|
|
wchar_t buf[sizeof desc.Description * sizeof(WCHAR)];
|
2014-09-22 00:50:51 +00:00
|
|
|
MultiByteToWideChar(CP_ACP /* I have no idea if this is right */, 0, desc.Description, sizeof(desc.Description), buf, sizeof buf / sizeof *buf);
|
2012-08-06 05:26:44 +00:00
|
|
|
adapters.push_back(Adapter(buf, GSAdapter(desc), (D3D_FEATURE_LEVEL)0));
|
|
|
|
#else
|
|
|
|
adapters.push_back(Adapter(desc.Description, GSAdapter(desc), (D3D_FEATURE_LEVEL)0));
|
|
|
|
#endif
|
2010-06-23 05:32:50 +00:00
|
|
|
}
|
2012-08-06 05:26:44 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2016-05-24 19:52:06 +00:00
|
|
|
std::string adapter_setting = theApp.GetConfigS("Adapter");
|
2012-08-06 05:26:44 +00:00
|
|
|
vector<GSSetting> adapter_settings;
|
2014-09-22 00:50:51 +00:00
|
|
|
unsigned int adapter_sel = 0;
|
2012-08-06 05:26:44 +00:00
|
|
|
|
2014-09-22 00:50:51 +00:00
|
|
|
for(unsigned int i = 0; i < adapters.size(); i++)
|
2012-08-06 05:26:44 +00:00
|
|
|
{
|
2014-09-22 00:50:51 +00:00
|
|
|
if(adapters[i].id == adapter_setting)
|
|
|
|
{
|
2012-08-06 05:26:44 +00:00
|
|
|
adapter_sel = i;
|
2014-09-22 00:50:51 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
adapter_settings.push_back(GSSetting(i, adapters[i].name.c_str(), ""));
|
2009-06-03 12:09:04 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2016-05-24 19:52:06 +00:00
|
|
|
std::string ocldev = theApp.GetConfigS("ocldev");
|
2014-09-22 00:50:51 +00:00
|
|
|
|
|
|
|
unsigned int ocl_sel = 0;
|
|
|
|
|
2014-09-22 03:29:40 +00:00
|
|
|
for(unsigned int i = 0; i < m_ocl_devs.size(); i++)
|
2014-09-22 00:50:51 +00:00
|
|
|
{
|
2014-09-22 03:29:40 +00:00
|
|
|
if(ocldev == m_ocl_devs[i].name)
|
2014-09-22 00:50:51 +00:00
|
|
|
{
|
|
|
|
ocl_sel = i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
ComboBoxInit(IDC_ADAPTER, adapter_settings, adapter_sel);
|
2014-09-22 03:29:40 +00:00
|
|
|
ComboBoxInit(IDC_OPENCL_DEVICE, m_ocl_devs, ocl_sel);
|
2012-08-06 05:26:44 +00:00
|
|
|
UpdateRenderers();
|
2015-08-09 08:56:05 +00:00
|
|
|
|
2016-05-30 07:29:41 +00:00
|
|
|
ComboBoxInit(IDC_INTERLACE, theApp.m_gs_interlace, theApp.GetConfigI("interlace"));
|
2016-05-24 19:52:06 +00:00
|
|
|
ComboBoxInit(IDC_UPSCALE_MULTIPLIER, theApp.m_gs_upscale_multiplier, theApp.GetConfigI("upscale_multiplier"));
|
|
|
|
ComboBoxInit(IDC_AFCOMBO, theApp.m_gs_max_anisotropy, theApp.GetConfigI("MaxAnisotropy"));
|
|
|
|
ComboBoxInit(IDC_FILTER, theApp.m_gs_filter, theApp.GetConfigI("filter"));
|
|
|
|
ComboBoxInit(IDC_ACCURATE_BLEND_UNIT, theApp.m_gs_acc_blend_level, theApp.GetConfigI("accurate_blending_unit"));
|
|
|
|
ComboBoxInit(IDC_CRC_LEVEL, theApp.m_gs_crc_level, theApp.GetConfigI("crc_hack_level"));
|
|
|
|
|
|
|
|
CheckDlgButton(m_hWnd, IDC_PALTEX, theApp.GetConfigB("paltex"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_LARGE_FB, theApp.GetConfigB("large_framebuffer"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfigB("logz"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfigB("fba"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfigB("aa1"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_MIPMAP, theApp.GetConfigB("mipmap"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_ACCURATE_DATE, theApp.GetConfigB("accurate_date"));
|
|
|
|
|
2012-03-06 19:39:05 +00:00
|
|
|
// Hacks
|
2016-05-24 19:52:06 +00:00
|
|
|
CheckDlgButton(m_hWnd, IDC_HACKS_ENABLED, theApp.GetConfigB("UserHacks"));
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2009-10-24 18:39:36 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETRANGE, 0, MAKELPARAM(8192, 256));
|
2016-05-24 19:52:06 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("resx"), 0));
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-10-24 18:39:36 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETRANGE, 0, MAKELPARAM(8192, 256));
|
2016-05-24 19:52:06 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("resy"), 0));
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2011-12-20 14:33:28 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 0));
|
2016-05-24 19:52:06 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("extrathreads"), 0));
|
2009-06-04 08:32:31 +00:00
|
|
|
|
2015-08-08 18:16:13 +00:00
|
|
|
AddTooltip(IDC_FILTER);
|
|
|
|
AddTooltip(IDC_CRC_LEVEL);
|
|
|
|
AddTooltip(IDC_PALTEX);
|
|
|
|
AddTooltip(IDC_ACCURATE_DATE);
|
|
|
|
AddTooltip(IDC_ACCURATE_BLEND_UNIT);
|
gsdx: Add new tooltips and descriptions.
For Linux and Windows, add tooltip descriptions for AF, AA1, extra
rendering threads, Enable Shade Boost, FX Shader/External Shader, FXAA.
For Windows, also add Alpha Correction and Logarithmic Z tooltips.
For Linux, add software mipmap tooltip.
Thanks to tsunami2311, ssakash, gregory38 and whoever did the wiki for
helping with descriptions.
2015-08-26 22:22:36 +00:00
|
|
|
AddTooltip(IDC_AFCOMBO);
|
|
|
|
AddTooltip(IDC_AA1);
|
2015-10-21 14:49:32 +00:00
|
|
|
AddTooltip(IDC_MIPMAP);
|
gsdx: Add new tooltips and descriptions.
For Linux and Windows, add tooltip descriptions for AF, AA1, extra
rendering threads, Enable Shade Boost, FX Shader/External Shader, FXAA.
For Windows, also add Alpha Correction and Logarithmic Z tooltips.
For Linux, add software mipmap tooltip.
Thanks to tsunami2311, ssakash, gregory38 and whoever did the wiki for
helping with descriptions.
2015-08-26 22:22:36 +00:00
|
|
|
AddTooltip(IDC_SWTHREADS);
|
|
|
|
AddTooltip(IDC_SWTHREADS_EDIT);
|
|
|
|
AddTooltip(IDC_FBA);
|
|
|
|
AddTooltip(IDC_LOGZ);
|
2016-05-25 16:33:32 +00:00
|
|
|
AddTooltip(IDC_LARGE_FB);
|
2015-08-08 18:16:13 +00:00
|
|
|
|
2009-06-04 08:32:31 +00:00
|
|
|
UpdateControls();
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2009-06-03 12:09:04 +00:00
|
|
|
bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2012-08-06 05:26:44 +00:00
|
|
|
switch (id)
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2012-08-06 05:26:44 +00:00
|
|
|
case IDC_ADAPTER:
|
|
|
|
if (code == CBN_SELCHANGE)
|
|
|
|
{
|
|
|
|
UpdateRenderers();
|
|
|
|
UpdateControls();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDC_RENDERER:
|
|
|
|
case IDC_UPSCALE_MULTIPLIER:
|
2015-08-09 08:56:05 +00:00
|
|
|
case IDC_FILTER:
|
2012-08-06 05:26:44 +00:00
|
|
|
if (code == CBN_SELCHANGE)
|
|
|
|
UpdateControls();
|
|
|
|
break;
|
2015-08-13 07:12:12 +00:00
|
|
|
case IDC_PALTEX:
|
2012-08-06 05:26:44 +00:00
|
|
|
case IDC_HACKS_ENABLED:
|
|
|
|
if (code == BN_CLICKED)
|
|
|
|
UpdateControls();
|
|
|
|
break;
|
|
|
|
case IDC_SHADEBUTTON:
|
|
|
|
if (code == BN_CLICKED)
|
2015-11-21 15:51:09 +00:00
|
|
|
ShaderDlg.DoModal();
|
2012-08-06 05:26:44 +00:00
|
|
|
break;
|
|
|
|
case IDC_HACKSBUTTON:
|
|
|
|
if (code == BN_CLICKED)
|
|
|
|
HacksDlg.DoModal();
|
|
|
|
break;
|
|
|
|
case IDOK:
|
2009-06-03 12:09:04 +00:00
|
|
|
{
|
2012-08-06 05:26:44 +00:00
|
|
|
INT_PTR data;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_ADAPTER, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("Adapter", adapters[(int)data].id.c_str());
|
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2014-09-22 00:50:51 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_OPENCL_DEVICE, data))
|
|
|
|
{
|
2016-04-14 10:00:58 +00:00
|
|
|
if ((UINT)data < m_ocl_devs.size()) {
|
2015-01-16 08:38:23 +00:00
|
|
|
theApp.SetConfig("ocldev", m_ocl_devs[(int)data].name.c_str());
|
|
|
|
}
|
2014-09-22 00:50:51 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_RENDERER, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("Renderer", (int)data);
|
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_INTERLACE, data))
|
|
|
|
{
|
2016-05-30 07:29:41 +00:00
|
|
|
theApp.SetConfig("interlace", (int)data);
|
2012-08-06 05:26:44 +00:00
|
|
|
}
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_UPSCALE_MULTIPLIER, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("upscale_multiplier", (int)data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
theApp.SetConfig("upscale_multiplier", 1);
|
|
|
|
}
|
2015-08-09 08:56:05 +00:00
|
|
|
|
|
|
|
if (ComboBoxGetSelData(IDC_FILTER, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("filter", (int)data);
|
|
|
|
}
|
|
|
|
|
2015-08-08 18:01:02 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_ACCURATE_BLEND_UNIT, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("accurate_blending_unit", (int)data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ComboBoxGetSelData(IDC_CRC_LEVEL, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("crc_hack_level", (int)data);
|
|
|
|
}
|
|
|
|
|
2014-09-22 00:50:51 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_AFCOMBO, data))
|
2014-02-03 16:58:11 +00:00
|
|
|
{
|
|
|
|
theApp.SetConfig("MaxAnisotropy", (int)data);
|
|
|
|
}
|
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
|
2016-05-25 16:33:32 +00:00
|
|
|
theApp.SetConfig("large_framebuffer", (int)IsDlgButtonChecked(m_hWnd, IDC_LARGE_FB));
|
2012-08-06 05:26:44 +00:00
|
|
|
theApp.SetConfig("logz", (int)IsDlgButtonChecked(m_hWnd, IDC_LOGZ));
|
|
|
|
theApp.SetConfig("fba", (int)IsDlgButtonChecked(m_hWnd, IDC_FBA));
|
|
|
|
theApp.SetConfig("aa1", (int)IsDlgButtonChecked(m_hWnd, IDC_AA1));
|
2015-10-21 14:49:32 +00:00
|
|
|
theApp.SetConfig("mipmap", (int)IsDlgButtonChecked(m_hWnd, IDC_MIPMAP));
|
2015-05-29 04:00:48 +00:00
|
|
|
theApp.SetConfig("accurate_date", (int)IsDlgButtonChecked(m_hWnd, IDC_ACCURATE_DATE));
|
2012-08-06 05:26:44 +00:00
|
|
|
theApp.SetConfig("UserHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
|
2016-07-03 21:04:16 +00:00
|
|
|
|
|
|
|
// The LOWORD returned by UDM_GETPOS automatically restricts the value to its input range.
|
|
|
|
theApp.SetConfig("extrathreads", LOWORD(SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0)));
|
|
|
|
theApp.SetConfig("resx", LOWORD(SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_GETPOS, 0, 0)));
|
|
|
|
theApp.SetConfig("resy", LOWORD(SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_GETPOS, 0, 0)));
|
2012-08-06 05:26:44 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-06-03 12:09:04 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-06-03 12:09:04 +00:00
|
|
|
return __super::OnCommand(hWnd, id, code);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
void GSSettingsDlg::UpdateRenderers()
|
|
|
|
{
|
|
|
|
INT_PTR i;
|
|
|
|
|
|
|
|
if (!ComboBoxGetSelData(IDC_ADAPTER, i))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Ugggh
|
|
|
|
HacksDlg.SetAdapter(adapters[(int)i].id);
|
|
|
|
|
|
|
|
D3D_FEATURE_LEVEL level = adapters[(int)i].level;
|
|
|
|
|
|
|
|
vector<GSSetting> renderers;
|
|
|
|
|
2016-01-02 22:20:30 +00:00
|
|
|
GSRendererType renderer_setting;
|
|
|
|
|
|
|
|
if (ComboBoxGetSelData(IDC_RENDERER, i))
|
2016-05-01 16:33:53 +00:00
|
|
|
{
|
2016-01-02 22:20:30 +00:00
|
|
|
renderer_setting = static_cast<GSRendererType>(i);
|
2016-05-01 16:33:53 +00:00
|
|
|
}
|
2016-01-02 22:20:30 +00:00
|
|
|
else
|
2016-05-01 16:33:53 +00:00
|
|
|
{
|
2016-06-03 07:39:50 +00:00
|
|
|
GSRendererType ini_renderer = GSRendererType(theApp.GetConfigI("Renderer"));
|
|
|
|
renderer_setting = (ini_renderer == GSRendererType::Undefined) ? GSUtil::GetBestRenderer() : ini_renderer;
|
2016-05-01 16:33:53 +00:00
|
|
|
}
|
2016-01-02 22:20:30 +00:00
|
|
|
|
2015-10-26 21:30:34 +00:00
|
|
|
GSRendererType renderer_sel = GSRendererType::Default;
|
2012-08-06 05:26:44 +00:00
|
|
|
|
|
|
|
for(size_t i = 0; i < theApp.m_gs_renderers.size(); i++)
|
|
|
|
{
|
|
|
|
GSSetting r = theApp.m_gs_renderers[i];
|
|
|
|
|
2016-01-18 22:59:27 +00:00
|
|
|
GSRendererType renderer = static_cast<GSRendererType>(r.value);
|
|
|
|
|
2016-05-01 16:33:53 +00:00
|
|
|
if(renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::DX1011_SW || renderer == GSRendererType::DX1011_OpenCL)
|
2012-08-06 05:26:44 +00:00
|
|
|
{
|
|
|
|
if(level < D3D_FEATURE_LEVEL_10_0) continue;
|
2014-09-15 13:49:16 +00:00
|
|
|
r.name += (level >= D3D_FEATURE_LEVEL_11_0 ? "11" : "10");
|
2015-12-21 18:53:36 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
renderers.push_back(r);
|
2014-09-15 13:49:16 +00:00
|
|
|
|
2016-01-18 22:59:27 +00:00
|
|
|
if (static_cast<GSRendererType>(r.value) == renderer_setting)
|
2014-09-15 13:49:16 +00:00
|
|
|
{
|
2012-08-06 05:26:44 +00:00
|
|
|
renderer_sel = renderer_setting;
|
2014-09-15 13:49:16 +00:00
|
|
|
}
|
2012-08-06 05:26:44 +00:00
|
|
|
}
|
|
|
|
|
2016-01-18 22:59:27 +00:00
|
|
|
ComboBoxInit(IDC_RENDERER, renderers, static_cast<int32_t>(renderer_sel));
|
2012-08-06 05:26:44 +00:00
|
|
|
}
|
|
|
|
|
2009-06-04 08:32:31 +00:00
|
|
|
void GSSettingsDlg::UpdateControls()
|
|
|
|
{
|
|
|
|
INT_PTR i;
|
|
|
|
|
2015-09-21 20:26:00 +00:00
|
|
|
int integer_scaling = 0; // in case reading the combo doesn't work, enable the custom res control anyway
|
2011-02-12 21:45:16 +00:00
|
|
|
|
|
|
|
if(ComboBoxGetSelData(IDC_UPSCALE_MULTIPLIER, i))
|
|
|
|
{
|
2015-09-21 20:26:00 +00:00
|
|
|
integer_scaling = (int)i;
|
2011-01-02 10:24:36 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 00:11:56 +00:00
|
|
|
if(ComboBoxGetSelData(IDC_RENDERER, i))
|
2009-06-04 08:32:31 +00:00
|
|
|
{
|
2015-10-26 21:30:34 +00:00
|
|
|
GSRendererType renderer = static_cast<GSRendererType>(i);
|
2016-05-01 16:33:53 +00:00
|
|
|
D3D_FEATURE_LEVEL level = GSUtil::CheckDirect3D11Level();
|
2015-10-26 21:30:34 +00:00
|
|
|
|
2016-05-01 16:33:53 +00:00
|
|
|
bool dx9 = renderer == GSRendererType::DX9_HW || renderer == GSRendererType::DX9_SW || renderer == GSRendererType::DX9_OpenCL;
|
|
|
|
bool dx11 = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::DX1011_SW || renderer == GSRendererType::DX1011_OpenCL;
|
2015-10-26 21:30:34 +00:00
|
|
|
bool ogl = renderer == GSRendererType::OGL_HW || renderer == GSRendererType::OGL_SW || renderer == GSRendererType::OGL_OpenCL;
|
2014-09-22 00:50:51 +00:00
|
|
|
|
2016-05-01 16:33:53 +00:00
|
|
|
bool hw = renderer == GSRendererType::DX9_HW || renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::OGL_HW;
|
|
|
|
bool sw = renderer == GSRendererType::DX9_SW || renderer == GSRendererType::DX1011_SW || renderer == GSRendererType::OGL_SW;
|
|
|
|
bool ocl = renderer == GSRendererType::DX9_OpenCL || renderer == GSRendererType::DX1011_OpenCL || renderer == GSRendererType::OGL_OpenCL;
|
|
|
|
bool null = renderer == GSRendererType::Null;
|
2009-06-04 08:32:31 +00:00
|
|
|
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE);
|
2016-05-01 16:33:53 +00:00
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), (dx11 && level >= D3D_FEATURE_LEVEL_11_0) ? SW_SHOW : SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), (dx11 && level < D3D_FEATURE_LEVEL_11_0) ? SW_SHOW : SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_NULL), null ? SW_SHOW : SW_HIDE);
|
2015-05-19 15:23:58 +00:00
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGOGL), ogl ? SW_SHOW : SW_HIDE);
|
2015-12-21 20:28:44 +00:00
|
|
|
#ifndef ENABLE_OPENCL
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_OPENCL_DEVICE), SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_OPENCL_TEXT), SW_HIDE);
|
|
|
|
#endif
|
2015-08-09 08:56:05 +00:00
|
|
|
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9? SW_SHOW: SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 ? SW_SHOW : SW_HIDE);
|
|
|
|
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl ? SW_SHOW : SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl ? SW_SHOW : SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl ? SW_SHOW : SW_HIDE);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), ogl ? SW_SHOW : SW_HIDE);
|
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_CRC_LEVEL), hw);
|
2016-05-25 16:33:32 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_LARGE_FB), integer_scaling > 1 && hw);
|
2015-08-09 08:56:05 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_CRC_LEVEL_TEXT), hw);
|
2014-09-22 00:50:51 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_OPENCL_DEVICE), ocl);
|
2015-09-21 20:26:00 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_RESX), hw && !integer_scaling);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !integer_scaling);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_RESY), hw && !integer_scaling);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_RESY_EDIT), hw && !integer_scaling);
|
2015-09-27 22:12:52 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_CUSTOM_TEXT), hw && !integer_scaling);
|
2015-09-08 12:55:01 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER), hw);
|
2015-09-27 22:12:52 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER_TEXT), hw);
|
2011-05-09 01:36:57 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER), hw);
|
2009-07-06 16:35:06 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw);
|
2012-02-08 16:57:14 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw);
|
2009-06-04 08:32:31 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw);
|
2015-08-09 08:56:05 +00:00
|
|
|
|
|
|
|
INT_PTR filter;
|
|
|
|
if (ComboBoxGetSelData(IDC_FILTER, filter))
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO), hw && filter && !IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
|
|
|
|
}
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO_TEXT), hw);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER_TEXT), hw);
|
2015-05-29 04:00:48 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl && hw);
|
2015-07-26 04:23:26 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl && hw);
|
2015-08-09 08:56:05 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl && hw);
|
2016-05-01 23:00:00 +00:00
|
|
|
|
2015-12-23 06:52:01 +00:00
|
|
|
// Software mode settings
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_AA1), sw);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_MIPMAP), sw);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_TEXT), sw);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw);
|
2012-03-06 19:39:05 +00:00
|
|
|
|
|
|
|
// Hacks
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_HACKS_ENABLED), hw);
|
gsdx: Add new tooltips and descriptions.
For Linux and Windows, add tooltip descriptions for AF, AA1, extra
rendering threads, Enable Shade Boost, FX Shader/External Shader, FXAA.
For Windows, also add Alpha Correction and Logarithmic Z tooltips.
For Linux, add software mipmap tooltip.
Thanks to tsunami2311, ssakash, gregory38 and whoever did the wiki for
helping with descriptions.
2015-08-26 22:22:36 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_HACKSBUTTON), hw && IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
|
2009-06-04 08:32:31 +00:00
|
|
|
}
|
2015-09-21 21:32:11 +00:00
|
|
|
|
2009-06-16 01:42:08 +00:00
|
|
|
}
|
2012-02-29 00:29:29 +00:00
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
// Shader Configuration Dialog
|
2012-02-29 00:29:29 +00:00
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
GSShaderDlg::GSShaderDlg() :
|
|
|
|
GSDialog(IDD_SHADER)
|
2012-02-29 00:29:29 +00:00
|
|
|
{}
|
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
void GSShaderDlg::OnInit()
|
2012-02-29 00:29:29 +00:00
|
|
|
{
|
2015-11-21 15:51:09 +00:00
|
|
|
//TV Shader
|
2016-05-31 17:35:35 +00:00
|
|
|
ComboBoxInit(IDC_TVSHADER, theApp.m_gs_tv_shaders, theApp.GetConfigI("TVShader"));
|
2015-11-21 15:51:09 +00:00
|
|
|
|
|
|
|
//Shade Boost
|
2016-05-24 19:52:06 +00:00
|
|
|
CheckDlgButton(m_hWnd, IDC_SHADEBOOST, theApp.GetConfigB("ShadeBoost"));
|
|
|
|
contrast = theApp.GetConfigI("ShadeBoost_Contrast");
|
|
|
|
brightness = theApp.GetConfigI("ShadeBoost_Brightness");
|
|
|
|
saturation = theApp.GetConfigI("ShadeBoost_Saturation");
|
2012-02-29 00:29:29 +00:00
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
// External FX shader
|
2016-05-24 19:52:06 +00:00
|
|
|
CheckDlgButton(m_hWnd, IDC_SHADER_FX, theApp.GetConfigB("shaderfx"));
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfigS("shaderfx_glsl").c_str());
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfigS("shaderfx_conf").c_str());
|
2015-11-21 15:51:09 +00:00
|
|
|
|
|
|
|
// FXAA shader
|
2016-05-24 19:52:06 +00:00
|
|
|
CheckDlgButton(m_hWnd, IDC_FXAA, theApp.GetConfigB("fxaa"));
|
2015-11-21 15:51:09 +00:00
|
|
|
|
|
|
|
AddTooltip(IDC_SHADEBOOST);
|
|
|
|
AddTooltip(IDC_SHADER_FX);
|
|
|
|
AddTooltip(IDC_FXAA);
|
|
|
|
|
2012-02-29 00:29:29 +00:00
|
|
|
UpdateControls();
|
|
|
|
}
|
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
void GSShaderDlg::UpdateControls()
|
2012-02-29 00:29:29 +00:00
|
|
|
{
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER), TBM_SETRANGE, TRUE, MAKELONG(0, 100));
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER), TBM_SETRANGE, TRUE, MAKELONG(0, 100));
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER), TBM_SETRANGE, TRUE, MAKELONG(0, 100));
|
|
|
|
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER), TBM_SETPOS, TRUE, saturation);
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER), TBM_SETPOS, TRUE, brightness);
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER), TBM_SETPOS, TRUE, contrast);
|
|
|
|
|
|
|
|
char text[8] = {0};
|
|
|
|
|
|
|
|
sprintf(text, "%d", saturation);
|
|
|
|
SetDlgItemText(m_hWnd, IDC_SATURATION_TEXT, text);
|
|
|
|
sprintf(text, "%d", brightness);
|
|
|
|
SetDlgItemText(m_hWnd, IDC_BRIGHTNESS_TEXT, text);
|
|
|
|
sprintf(text, "%d", contrast);
|
|
|
|
SetDlgItemText(m_hWnd, IDC_CONTRAST_TEXT, text);
|
2015-11-21 15:51:09 +00:00
|
|
|
|
|
|
|
// Shader Settings
|
|
|
|
bool external_shader_selected = IsDlgButtonChecked(m_hWnd, IDC_SHADER_FX) == BST_CHECKED;
|
|
|
|
bool shadeboost_selected = IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST) == BST_CHECKED;
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER), shadeboost_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER), shadeboost_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER), shadeboost_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SATURATION_TEXT), shadeboost_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_TEXT), shadeboost_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_CONTRAST_TEXT), shadeboost_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_TEXT), external_shader_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), external_shader_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_BUTTON), external_shader_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_TEXT), external_shader_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), external_shader_selected);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_BUTTON), external_shader_selected);
|
2012-02-29 00:29:29 +00:00
|
|
|
}
|
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
bool GSShaderDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
2012-02-29 00:29:29 +00:00
|
|
|
{
|
|
|
|
switch(message)
|
|
|
|
{
|
2016-05-01 23:00:00 +00:00
|
|
|
case WM_HSCROLL:
|
|
|
|
{
|
2012-02-29 00:29:29 +00:00
|
|
|
if((HWND)lParam == GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER))
|
2016-05-01 23:00:00 +00:00
|
|
|
{
|
2012-02-29 00:29:29 +00:00
|
|
|
char text[8] = {0};
|
|
|
|
|
2016-05-01 23:00:00 +00:00
|
|
|
saturation = SendMessage(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER),TBM_GETPOS,0,0);
|
|
|
|
|
2012-02-29 00:29:29 +00:00
|
|
|
sprintf(text, "%d", saturation);
|
|
|
|
SetDlgItemText(m_hWnd, IDC_SATURATION_TEXT, text);
|
|
|
|
}
|
|
|
|
else if((HWND)lParam == GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER))
|
2016-05-01 23:00:00 +00:00
|
|
|
{
|
2012-02-29 00:29:29 +00:00
|
|
|
char text[8] = {0};
|
|
|
|
|
2016-05-01 23:00:00 +00:00
|
|
|
brightness = SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER),TBM_GETPOS,0,0);
|
|
|
|
|
2012-02-29 00:29:29 +00:00
|
|
|
sprintf(text, "%d", brightness);
|
|
|
|
SetDlgItemText(m_hWnd, IDC_BRIGHTNESS_TEXT, text);
|
|
|
|
}
|
|
|
|
else if((HWND)lParam == GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER))
|
2016-05-01 23:00:00 +00:00
|
|
|
{
|
2012-02-29 00:29:29 +00:00
|
|
|
char text[8] = {0};
|
|
|
|
|
|
|
|
contrast = SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER),TBM_GETPOS,0,0);
|
2016-05-01 23:00:00 +00:00
|
|
|
|
2012-02-29 00:29:29 +00:00
|
|
|
sprintf(text, "%d", contrast);
|
|
|
|
SetDlgItemText(m_hWnd, IDC_CONTRAST_TEXT, text);
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
{
|
|
|
|
int id = LOWORD(wParam);
|
|
|
|
|
|
|
|
switch(id)
|
|
|
|
{
|
2015-11-21 15:51:09 +00:00
|
|
|
case IDOK:
|
2012-02-29 00:29:29 +00:00
|
|
|
{
|
2015-11-21 15:51:09 +00:00
|
|
|
INT_PTR data;
|
|
|
|
//TV Shader
|
|
|
|
if (ComboBoxGetSelData(IDC_TVSHADER, data))
|
|
|
|
{
|
2016-05-31 17:35:35 +00:00
|
|
|
theApp.SetConfig("TVShader", (int)data);
|
2015-11-21 15:51:09 +00:00
|
|
|
}
|
|
|
|
// Shade Boost
|
|
|
|
theApp.SetConfig("ShadeBoost", (int)IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST));
|
2012-02-29 00:29:29 +00:00
|
|
|
theApp.SetConfig("ShadeBoost_Contrast", contrast);
|
|
|
|
theApp.SetConfig("ShadeBoost_Brightness", brightness);
|
|
|
|
theApp.SetConfig("ShadeBoost_Saturation", saturation);
|
2015-11-21 15:51:09 +00:00
|
|
|
|
|
|
|
// FXAA shader
|
|
|
|
theApp.SetConfig("Fxaa", (int)IsDlgButtonChecked(m_hWnd, IDC_FXAA));
|
|
|
|
|
|
|
|
// External FX Shader
|
|
|
|
theApp.SetConfig("shaderfx", (int)IsDlgButtonChecked(m_hWnd, IDC_SHADER_FX));
|
|
|
|
|
|
|
|
// External FX Shader(OpenGL)
|
|
|
|
int shader_fx_length = (int)SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_GETTEXTLENGTH, 0, 0);
|
|
|
|
int shader_fx_conf_length = (int)SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_GETTEXTLENGTH, 0, 0);
|
|
|
|
int length = std::max(shader_fx_length, shader_fx_conf_length) + 1;
|
|
|
|
char *buffer = new char[length];
|
|
|
|
|
|
|
|
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_GETTEXT, (WPARAM)length, (LPARAM)buffer);
|
|
|
|
theApp.SetConfig("shaderfx_glsl", buffer); // Not really glsl only ;)
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_GETTEXT, (WPARAM)length, (LPARAM)buffer);
|
|
|
|
theApp.SetConfig("shaderfx_conf", buffer);
|
|
|
|
delete[] buffer;
|
|
|
|
|
2016-05-01 23:00:00 +00:00
|
|
|
EndDialog(m_hWnd, id);
|
2012-02-29 00:29:29 +00:00
|
|
|
} break;
|
2015-11-21 15:51:09 +00:00
|
|
|
case IDC_SHADEBOOST:
|
|
|
|
UpdateControls();
|
|
|
|
case IDC_SHADER_FX:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
|
|
|
UpdateControls();
|
|
|
|
break;
|
|
|
|
case IDC_SHADER_FX_BUTTON:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
|
|
|
OpenFileDialog(IDC_SHADER_FX_EDIT, "Select External Shader");
|
|
|
|
break;
|
2012-02-29 00:29:29 +00:00
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
case IDC_SHADER_FX_CONF_BUTTON:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
|
|
|
OpenFileDialog(IDC_SHADER_FX_CONF_EDIT, "Select External Shader Config");
|
|
|
|
break;
|
2012-02-29 00:29:29 +00:00
|
|
|
|
2015-11-21 15:51:09 +00:00
|
|
|
case IDCANCEL:
|
|
|
|
{
|
|
|
|
EndDialog(m_hWnd, IDCANCEL);
|
2012-02-29 00:29:29 +00:00
|
|
|
} break;
|
|
|
|
}
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WM_CLOSE:EndDialog(m_hWnd, IDCANCEL); break;
|
|
|
|
|
|
|
|
default: return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
2012-03-06 19:39:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Hacks Dialog
|
|
|
|
|
2016-05-01 23:00:00 +00:00
|
|
|
GSHacksDlg::GSHacksDlg() :
|
2012-03-06 19:39:05 +00:00
|
|
|
GSDialog(IDD_HACKS)
|
|
|
|
{
|
|
|
|
memset(msaa2cb, 0, sizeof(msaa2cb));
|
|
|
|
memset(cb2msaa, 0, sizeof(cb2msaa));
|
|
|
|
}
|
2015-08-09 15:20:05 +00:00
|
|
|
|
2012-03-06 19:39:05 +00:00
|
|
|
void GSHacksDlg::OnInit()
|
2015-08-08 18:17:26 +00:00
|
|
|
{
|
|
|
|
HWND hwnd_renderer = GetDlgItem(GetParent(m_hWnd), IDC_RENDERER);
|
2016-05-01 16:33:53 +00:00
|
|
|
HWND hwnd_upscaling = GetDlgItem(GetParent(m_hWnd), IDC_UPSCALE_MULTIPLIER);
|
2015-10-26 21:30:34 +00:00
|
|
|
GSRendererType renderer = static_cast<GSRendererType>(SendMessage(hwnd_renderer, CB_GETITEMDATA, SendMessage(hwnd_renderer, CB_GETCURSEL, 0, 0), 0));
|
2016-05-01 16:33:53 +00:00
|
|
|
unsigned short upscaling_multiplier = static_cast<unsigned short>(SendMessage(hwnd_upscaling, CB_GETITEMDATA, SendMessage(hwnd_upscaling, CB_GETCURSEL, 0, 0), 0));
|
|
|
|
unsigned short cb = 0;
|
|
|
|
|
2015-08-08 18:17:26 +00:00
|
|
|
// It can only be accessed with a HW renderer, so this is sufficient.
|
2015-10-26 21:30:34 +00:00
|
|
|
bool dx9 = renderer == GSRendererType::DX9_HW;
|
|
|
|
bool ogl = renderer == GSRendererType::OGL_HW;
|
2016-05-01 16:33:53 +00:00
|
|
|
bool native = upscaling_multiplier == 1;
|
2012-03-06 19:39:05 +00:00
|
|
|
|
|
|
|
if(dx9) for(unsigned short i = 0; i < 17; i++)
|
|
|
|
{
|
|
|
|
if( i == 1) continue;
|
|
|
|
|
2012-08-06 05:26:44 +00:00
|
|
|
int depth = GSDevice9::GetMaxDepth(i, adapter_id);
|
2012-03-06 19:39:05 +00:00
|
|
|
|
|
|
|
if(depth)
|
|
|
|
{
|
|
|
|
char text[32] = {0};
|
|
|
|
sprintf(text, depth == 32 ? "%dx Z-32" : "%dx Z-24", i);
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_ADDSTRING, 0, (LPARAM)text);
|
|
|
|
|
|
|
|
msaa2cb[i] = cb;
|
|
|
|
cb2msaa[cb] = i;
|
|
|
|
cb++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else for(unsigned short j = 0; j < 5; j++) // TODO: Make the same kind of check for d3d11, eventually....
|
|
|
|
{
|
|
|
|
unsigned short i = j == 0 ? 0 : 1 << j;
|
2016-05-01 23:00:00 +00:00
|
|
|
|
2012-03-06 19:39:05 +00:00
|
|
|
msaa2cb[i] = j;
|
|
|
|
cb2msaa[j] = i;
|
2016-05-01 23:00:00 +00:00
|
|
|
|
2012-03-06 19:39:05 +00:00
|
|
|
char text[32] = {0};
|
2012-03-07 09:58:38 +00:00
|
|
|
sprintf(text, "%dx ", i);
|
2012-03-06 19:39:05 +00:00
|
|
|
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_ADDSTRING, 0, (LPARAM)text);
|
|
|
|
}
|
|
|
|
|
2016-05-24 19:52:06 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_SETCURSEL, msaa2cb[min(theApp.GetConfigI("UserHacks_MSAA"), 16)], 0);
|
2012-03-06 19:39:05 +00:00
|
|
|
|
2016-05-24 19:52:06 +00:00
|
|
|
CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfigB("UserHacks_AlphaHack"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfigB("UserHacks_HalfPixelOffset"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfigI("UserHacks_WildHack"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfigB("UserHacks_AlphaStencil"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_PRELOAD_GS, theApp.GetConfigB("preload_frame_with_gs_data"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfigB("UserHacks_align_sprite_X"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_SAFE_FBMASK, theApp.GetConfigB("UserHacks_safe_fbmask"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_TC_DEPTH, theApp.GetConfigB("UserHacks_DisableDepthSupport"));
|
|
|
|
CheckDlgButton(m_hWnd, IDC_FAST_TC_INV, theApp.GetConfigB("UserHacks_DisablePartialInvalidation"));
|
2012-03-06 19:39:05 +00:00
|
|
|
|
2016-05-24 19:52:06 +00:00
|
|
|
ComboBoxInit(IDC_ROUND_SPRITE, theApp.m_gs_hack, theApp.GetConfigI("UserHacks_round_sprite_offset"));
|
|
|
|
ComboBoxInit(IDC_SPRITEHACK, theApp.m_gs_hack, theApp.GetConfigI("UserHacks_SpriteHack"));
|
2015-08-08 18:17:26 +00:00
|
|
|
|
2012-03-06 19:39:05 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETRANGE, 0, MAKELPARAM(1000, 0));
|
2016-05-24 19:52:06 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("UserHacks_SkipDraw"), 0));
|
2012-03-07 09:58:38 +00:00
|
|
|
|
2013-02-12 10:57:48 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETRANGE, 0, MAKELPARAM(10000, 0));
|
2016-05-24 19:52:06 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("UserHacks_TCOffset") & 0xFFFF, 0));
|
2013-02-12 10:57:48 +00:00
|
|
|
|
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETRANGE, 0, MAKELPARAM(10000, 0));
|
2016-05-24 19:52:06 +00:00
|
|
|
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETPOS, 0, MAKELPARAM((theApp.GetConfigI("UserHacks_TCOffset") >> 16) & 0xFFFF, 0));
|
2012-03-07 09:58:38 +00:00
|
|
|
|
2015-08-08 18:17:26 +00:00
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHASTENCIL), ogl ? SW_HIDE : SW_SHOW);
|
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHAHACK), ogl ? SW_HIDE : SW_SHOW);
|
2016-02-17 20:59:03 +00:00
|
|
|
ShowWindow(GetDlgItem(m_hWnd, IDC_SAFE_FBMASK), ogl ? SW_SHOW : SW_HIDE);
|
2016-06-03 07:46:58 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), ogl);
|
2016-03-05 16:54:00 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_MSAACB), !ogl);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_MSAA_TEXT), !ogl);
|
2016-05-01 16:33:53 +00:00
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SPRITEHACK), !native);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_WILDHACK), !native);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_OFFSETHACK), !native);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ALIGN_SPRITE), !native);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ROUND_SPRITE), !native);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_SPRITEHACK_TEXT), !native);
|
|
|
|
EnableWindow(GetDlgItem(m_hWnd, IDC_ROUND_SPRITE_TEXT), !native);
|
2015-08-08 18:17:26 +00:00
|
|
|
|
|
|
|
AddTooltip(IDC_SKIPDRAWHACKEDIT);
|
|
|
|
AddTooltip(IDC_SKIPDRAWHACK);
|
|
|
|
AddTooltip(IDC_ALPHAHACK);
|
|
|
|
AddTooltip(IDC_OFFSETHACK);
|
|
|
|
AddTooltip(IDC_SPRITEHACK);
|
|
|
|
AddTooltip(IDC_WILDHACK);
|
|
|
|
AddTooltip(IDC_MSAACB);
|
|
|
|
AddTooltip(IDC_ALPHASTENCIL);
|
|
|
|
AddTooltip(IDC_ALIGN_SPRITE);
|
|
|
|
AddTooltip(IDC_ROUND_SPRITE);
|
|
|
|
AddTooltip(IDC_TCOFFSETX);
|
|
|
|
AddTooltip(IDC_TCOFFSETX2);
|
|
|
|
AddTooltip(IDC_TCOFFSETY);
|
|
|
|
AddTooltip(IDC_TCOFFSETY2);
|
2015-10-21 14:49:32 +00:00
|
|
|
AddTooltip(IDC_PRELOAD_GS);
|
2016-02-17 20:59:03 +00:00
|
|
|
AddTooltip(IDC_SAFE_FBMASK);
|
2016-05-01 23:00:00 +00:00
|
|
|
AddTooltip(IDC_TC_DEPTH);
|
|
|
|
AddTooltip(IDC_FAST_TC_INV);
|
2012-03-06 19:39:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GSHacksDlg::UpdateControls()
|
|
|
|
{}
|
|
|
|
|
2012-03-07 09:58:38 +00:00
|
|
|
bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
2016-05-01 23:00:00 +00:00
|
|
|
{
|
2012-04-23 18:46:09 +00:00
|
|
|
switch(message)
|
2012-03-06 19:39:05 +00:00
|
|
|
{
|
|
|
|
case WM_COMMAND:
|
|
|
|
{
|
|
|
|
int id = LOWORD(wParam);
|
|
|
|
|
|
|
|
switch(id)
|
|
|
|
{
|
|
|
|
case IDOK:
|
|
|
|
{
|
2015-08-08 18:17:26 +00:00
|
|
|
INT_PTR data;
|
|
|
|
if (ComboBoxGetSelData(IDC_ROUND_SPRITE, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("UserHacks_round_sprite_offset", (int)data);
|
|
|
|
}
|
|
|
|
if (ComboBoxGetSelData(IDC_SPRITEHACK, data))
|
|
|
|
{
|
|
|
|
theApp.SetConfig("UserHacks_SpriteHack", (int)data);
|
|
|
|
}
|
2012-03-06 19:39:05 +00:00
|
|
|
theApp.SetConfig("UserHacks_MSAA", cb2msaa[(int)SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_GETCURSEL, 0, 0)]);
|
|
|
|
theApp.SetConfig("UserHacks_AlphaHack", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHAHACK));
|
|
|
|
theApp.SetConfig("UserHacks_HalfPixelOffset", (int)IsDlgButtonChecked(m_hWnd, IDC_OFFSETHACK));
|
|
|
|
theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0));
|
2012-03-06 21:36:59 +00:00
|
|
|
theApp.SetConfig("UserHacks_WildHack", (int)IsDlgButtonChecked(m_hWnd, IDC_WILDHACK));
|
2012-07-24 02:20:07 +00:00
|
|
|
theApp.SetConfig("UserHacks_AlphaStencil", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHASTENCIL));
|
2015-10-21 14:49:32 +00:00
|
|
|
theApp.SetConfig("preload_frame_with_gs_data", (int)IsDlgButtonChecked(m_hWnd, IDC_PRELOAD_GS));
|
2015-04-05 22:15:53 +00:00
|
|
|
theApp.SetConfig("Userhacks_align_sprite_X", (int)IsDlgButtonChecked(m_hWnd, IDC_ALIGN_SPRITE));
|
2016-02-17 20:59:03 +00:00
|
|
|
theApp.SetConfig("UserHacks_safe_fbmask", (int)IsDlgButtonChecked(m_hWnd, IDC_SAFE_FBMASK));
|
2016-05-01 23:00:00 +00:00
|
|
|
theApp.SetConfig("UserHacks_DisableDepthSupport", (int)IsDlgButtonChecked(m_hWnd, IDC_TC_DEPTH));
|
|
|
|
theApp.SetConfig("UserHacks_DisablePartialInvalidation", (int)IsDlgButtonChecked(m_hWnd, IDC_FAST_TC_INV));
|
2013-02-12 10:57:48 +00:00
|
|
|
|
|
|
|
unsigned int TCOFFSET = SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0) & 0xFFFF;
|
|
|
|
TCOFFSET |= (SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_GETPOS, 0, 0) & 0xFFFF) << 16;
|
|
|
|
|
|
|
|
theApp.SetConfig("UserHacks_TCOffset", TCOFFSET);
|
|
|
|
|
2012-03-06 19:39:05 +00:00
|
|
|
EndDialog(m_hWnd, id);
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WM_CLOSE:EndDialog(m_hWnd, IDCANCEL); break;
|
|
|
|
|
|
|
|
default: return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|