2010-04-25 00:31:27 +00:00
/*
2009-02-09 21:15:56 +00:00
* Copyright ( C ) 2007 - 2009 Gabest
* 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
2010-04-25 00:31:27 +00:00
* the Free Software Foundation , 675 Mass Ave , Cambridge , MA 0213 9 , 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"
2009-06-03 12:09:04 +00:00
# include "resource.h"
2009-02-09 21:15:56 +00:00
2011-01-02 10:24:36 +00:00
# include "GSDevice9.h"
2009-02-09 21:15:56 +00:00
GSSetting GSSettingsDlg : : g_renderers [ ] =
{
2010-06-23 05:32:50 +00:00
{ 0 , " Direct3D9 (Hardware) " , " " } ,
{ 1 , " Direct3D9 (Software) " , " " } ,
{ 2 , " Direct3D9 (Null) " , " " } ,
{ 3 , " Direct3D%d " , " Hardware " } ,
{ 4 , " Direct3D%d " , " Software " } ,
{ 5 , " Direct3D%d " , " Null " } ,
{ 12 , " Null (Software) " , " " } ,
{ 13 , " Null (Null) " , " " } ,
2009-02-09 21:15:56 +00:00
} ;
GSSetting GSSettingsDlg : : g_interlace [ ] =
{
2010-06-23 05:32:50 +00:00
{ 0 , " None " , " " } ,
2009-06-03 12:09:04 +00:00
{ 1 , " Weave tff " , " saw-tooth " } ,
{ 2 , " Weave bff " , " saw-tooth " } ,
{ 3 , " Bob tff " , " use blend if shaking " } ,
{ 4 , " Bob bff " , " use blend if shaking " } ,
{ 5 , " Blend tff " , " slight blur, 1/2 fps " } ,
{ 6 , " Blend bff " , " slight blur, 1/2 fps " } ,
2009-02-09 21:15:56 +00:00
} ;
GSSetting GSSettingsDlg : : g_aspectratio [ ] =
{
2010-06-23 05:32:50 +00:00
{ 0 , " Stretch " , " " } ,
{ 1 , " 4:3 " , " " } ,
{ 2 , " 16:9 " , " " } ,
2009-02-09 21:15:56 +00:00
} ;
2009-10-26 15:52:45 +00:00
GSSetting GSSettingsDlg : : g_upscale_multiplier [ ] =
2009-10-23 14:32:01 +00:00
{
2011-01-02 10:24:36 +00:00
{ 1 , " Custom " , " " } ,
{ 2 , " 2x Native " , " " } ,
{ 3 , " 3x Native " , " " } ,
{ 4 , " 4x Native " , " " } ,
{ 5 , " 5x Native " , " " } ,
{ 6 , " 6x Native " , " " } ,
2009-10-23 14:32:01 +00:00
} ;
2010-01-28 02:53:10 +00:00
GSSettingsDlg : : GSSettingsDlg ( bool isOpen2 )
: GSDialog ( isOpen2 ? IDD_CONFIG2 : IDD_CONFIG )
, m_IsOpen2 ( isOpen2 )
2009-02-09 21:15:56 +00:00
{
}
2010-02-19 22:01:28 +00:00
bool allowHacks = false ;
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
2009-05-11 08:18:00 +00:00
m_modes . clear ( ) ;
2009-02-09 21:15:56 +00:00
2010-01-28 02:53:10 +00:00
if ( ! m_IsOpen2 )
2009-02-09 21:15:56 +00:00
{
D3DDISPLAYMODE mode ;
memset ( & mode , 0 , sizeof ( mode ) ) ;
2009-05-11 08:18:00 +00:00
m_modes . push_back ( mode ) ;
2009-02-09 21:15:56 +00:00
2009-07-17 23:45:32 +00:00
ComboBoxAppend ( IDC_RESOLUTION , " Please select... " , ( LPARAM ) & m_modes . back ( ) , true ) ;
2009-02-09 21:15:56 +00:00
2010-12-20 07:14:18 +00:00
CComPtr < IDirect3D9 > d3d ;
2011-02-07 01:59:05 +00:00
2010-12-20 07:14:18 +00:00
d3d . Attach ( Direct3DCreate9 ( D3D_SDK_VERSION ) ) ;
2011-02-07 01:59:05 +00:00
2010-12-20 07:14:18 +00:00
if ( d3d )
2009-02-09 21:15:56 +00:00
{
2009-06-03 12:09:04 +00:00
uint32 w = theApp . GetConfig ( " ModeWidth " , 0 ) ;
uint32 h = theApp . GetConfig ( " ModeHeight " , 0 ) ;
uint32 hz = theApp . GetConfig ( " ModeRefreshRate " , 0 ) ;
2009-09-20 20:54:45 +00:00
uint32 n = d3d - > GetAdapterModeCount ( D3DADAPTER_DEFAULT , D3DFMT_R5G6B5 ) ;
2009-02-09 21:15:56 +00:00
2009-06-03 12:09:04 +00:00
for ( uint32 i = 0 ; i < n ; i + + )
2009-02-09 21:15:56 +00:00
{
2009-09-20 20:54:45 +00:00
if ( S_OK = = d3d - > EnumAdapterModes ( D3DADAPTER_DEFAULT , D3DFMT_R5G6B5 , i , & mode ) )
2009-06-03 12:09:04 +00:00
{
m_modes . push_back ( mode ) ;
2009-02-09 21:15:56 +00:00
2009-06-03 12:09:04 +00:00
string str = format ( " %dx%d %dHz " , mode . Width , mode . Height , mode . RefreshRate ) ;
2009-02-09 21:15:56 +00:00
2009-06-19 00:11:56 +00:00
ComboBoxAppend ( IDC_RESOLUTION , str . c_str ( ) , ( LPARAM ) & m_modes . back ( ) , w = = mode . Width & & h = = mode . Height & & hz = = mode . RefreshRate ) ;
2009-02-09 21:15:56 +00:00
}
}
2009-06-03 12:09:04 +00:00
}
2009-02-09 21:15:56 +00:00
}
2010-07-28 19:00:42 +00:00
bool isdx11avail_config = GSUtil : : IsDirect3D11Available ( ) ;
2009-02-09 21:15:56 +00:00
2009-06-04 08:32:31 +00:00
vector < GSSetting > renderers ;
2009-02-09 21:15:56 +00:00
2009-06-04 08:32:31 +00:00
for ( size_t i = 0 ; i < countof ( g_renderers ) ; i + + )
{
2010-06-23 05:32:50 +00:00
if ( i > = 3 & & i < = 5 )
{
2010-07-28 19:00:42 +00:00
if ( ! isdx11avail_config ) continue ;
2010-07-08 23:24:36 +00:00
g_renderers [ i ] . name = std : : string ( " Direct3D " ) + ( GSUtil : : HasD3D11Features ( ) ? " 11 " : " 10 " ) ;
2010-06-23 05:32:50 +00:00
}
2009-02-09 21:15:56 +00:00
2009-06-04 08:32:31 +00:00
renderers . push_back ( g_renderers [ i ] ) ;
2009-06-03 12:09:04 +00:00
}
2009-02-09 21:15:56 +00:00
2009-06-19 00:11:56 +00:00
ComboBoxInit ( IDC_RENDERER , & renderers [ 0 ] , renderers . size ( ) , theApp . GetConfig ( " Renderer " , 0 ) ) ;
ComboBoxInit ( IDC_INTERLACE , g_interlace , countof ( g_interlace ) , theApp . GetConfig ( " Interlace " , 0 ) ) ;
ComboBoxInit ( IDC_ASPECTRATIO , g_aspectratio , countof ( g_aspectratio ) , theApp . GetConfig ( " AspectRatio " , 1 ) ) ;
2009-10-26 15:52:45 +00:00
ComboBoxInit ( IDC_UPSCALE_MULTIPLIER , g_upscale_multiplier , countof ( g_upscale_multiplier ) , theApp . GetConfig ( " upscale_multiplier " , 1 ) ) ;
2009-02-09 21:15:56 +00:00
2009-07-17 23:45:32 +00:00
CheckDlgButton ( m_hWnd , IDC_WINDOWED , theApp . GetConfig ( " windowed " , 1 ) ) ;
2009-07-08 16:15:33 +00:00
CheckDlgButton ( m_hWnd , IDC_FILTER , theApp . GetConfig ( " filter " , 2 ) ) ;
2009-10-26 15:52:45 +00:00
CheckDlgButton ( m_hWnd , IDC_PALTEX , theApp . GetConfig ( " paltex " , 0 ) ) ;
2009-06-03 12:09:04 +00:00
CheckDlgButton ( m_hWnd , IDC_VSYNC , theApp . GetConfig ( " vsync " , 0 ) ) ;
2009-07-08 16:15:33 +00:00
CheckDlgButton ( m_hWnd , IDC_LOGZ , theApp . GetConfig ( " logz " , 1 ) ) ;
2009-06-03 12:09:04 +00:00
CheckDlgButton ( m_hWnd , IDC_FBA , theApp . GetConfig ( " fba " , 1 ) ) ;
CheckDlgButton ( m_hWnd , IDC_AA1 , theApp . GetConfig ( " aa1 " , 0 ) ) ;
CheckDlgButton ( m_hWnd , IDC_NATIVERES , theApp . GetConfig ( " nativeres " , 0 ) ) ;
2010-02-19 10:37:31 +00:00
// Hacks
CheckDlgButton ( m_hWnd , IDC_ALPHAHACK , theApp . GetConfig ( " UserHacks_AlphaHack " , 0 ) ) ;
CheckDlgButton ( m_hWnd , IDC_OFFSETHACK , theApp . GetConfig ( " UserHacks_HalfPixelOffset " , 0 ) ) ;
SendMessage ( GetDlgItem ( m_hWnd , IDC_SKIPDRAWHACK ) , UDM_SETRANGE , 0 , MAKELPARAM ( 1000 , 0 ) ) ;
SendMessage ( GetDlgItem ( m_hWnd , IDC_SKIPDRAWHACK ) , UDM_SETPOS , 0 , MAKELPARAM ( theApp . GetConfig ( " UserHacks_SkipDraw " , 0 ) , 0 ) ) ;
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 ) ) ;
2009-06-03 12:09:04 +00:00
SendMessage ( GetDlgItem ( m_hWnd , IDC_RESX ) , UDM_SETPOS , 0 , MAKELPARAM ( theApp . GetConfig ( " resx " , 1024 ) , 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 ) ) ;
2009-06-03 12:09:04 +00:00
SendMessage ( GetDlgItem ( m_hWnd , IDC_RESY ) , UDM_SETPOS , 0 , MAKELPARAM ( theApp . GetConfig ( " resy " , 1024 ) , 0 ) ) ;
2009-02-09 21:15:56 +00:00
2011-02-07 01:59:05 +00:00
int r = theApp . GetConfig ( " Renderer " , 0 ) ;
if ( r > = 0 & & r < = 2 ) // DX9
{
2011-01-02 10:24:36 +00:00
GSDevice9 : : ForceValidMsaaConfig ( ) ;
2011-02-07 01:59:05 +00:00
m_lastValidMsaa = theApp . GetConfig ( " msaa " , 0 ) ;
2011-01-02 10:24:36 +00:00
}
2010-02-19 15:45:23 +00:00
SendMessage ( GetDlgItem ( m_hWnd , IDC_MSAA ) , UDM_SETRANGE , 0 , MAKELPARAM ( 16 , 0 ) ) ;
SendMessage ( GetDlgItem ( m_hWnd , IDC_MSAA ) , UDM_SETPOS , 0 , MAKELPARAM ( theApp . GetConfig ( " msaa " , 0 ) , 0 ) ) ;
2009-06-03 12:09:04 +00:00
SendMessage ( GetDlgItem ( m_hWnd , IDC_SWTHREADS ) , UDM_SETRANGE , 0 , MAKELPARAM ( 16 , 1 ) ) ;
SendMessage ( GetDlgItem ( m_hWnd , IDC_SWTHREADS ) , UDM_SETPOS , 0 , MAKELPARAM ( theApp . GetConfig ( " swthreads " , 1 ) , 0 ) ) ;
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
{
2011-02-18 01:56:05 +00:00
if ( id = = IDC_MSAAEDIT & & code = = EN_CHANGE ) // validate and possibly warn user when changing msaa
{
//post change
2011-01-02 10:24:36 +00:00
bool dx9 = false ;
INT_PTR i ;
2011-02-18 01:56:05 +00:00
2011-01-02 10:24:36 +00:00
if ( ComboBoxGetSelData ( IDC_RENDERER , i ) )
2011-02-18 01:56:05 +00:00
{
2011-01-02 10:24:36 +00:00
dx9 = i > = 0 & & i < = 2 ;
2011-02-18 01:56:05 +00:00
}
2011-01-02 10:24:36 +00:00
2011-02-18 01:56:05 +00:00
if ( dx9 )
{
uint32 requestedMsaa = ( int ) SendMessage ( GetDlgItem ( m_hWnd , IDC_MSAA ) , UDM_GETPOS , 0 , 0 ) ; // valid from OnCommand?
uint32 derivedDepth = GSDevice9 : : GetMaxDepth ( requestedMsaa ) ;
2011-01-02 10:24:36 +00:00
2011-02-18 01:56:05 +00:00
if ( derivedDepth = = 0 )
{
2011-01-02 10:24:36 +00:00
//FIXME: Ugly UI: HW AA is currently a uint spinbox but usually only some values are supported (e.g. only 2/4/8 or a similar set).
// Better solution would be to use a drop-down with only valid msaa values such that we don't need this. Maybe some day.
// Known bad behavior: When manually deleting a HW AA value to put another instead (e.g. 2 -> delete -> 4)
// it's registered as 0 after the deletion (with possible higher derived z bits), and might issue
// a warning when the new value is registered (i.e. 4 in our example) since it might result in fewer
// z bits than 0, even if it's not different than the previous value (i.e. 2 in our example) z bits.
//Find valid msaa values, regardless of derived z buffer bits
2011-02-18 01:56:05 +00:00
string supportedAa = " " ;
for ( int i = 2 ; i < = 16 ; i + + )
{
if ( GSDevice9 : : GetMaxDepth ( i ) )
{
if ( supportedAa . length ( ) ) supportedAa + = " / " ;
2011-01-02 10:24:36 +00:00
supportedAa + = format ( " %d " , i ) ;
}
2011-02-18 01:56:05 +00:00
}
2011-01-02 10:24:36 +00:00
2011-02-18 01:56:05 +00:00
if ( ! supportedAa . length ( ) )
{
2011-01-02 10:24:36 +00:00
supportedAa = " None " ;
2011-02-18 01:56:05 +00:00
}
string s = format ( " AA=%d is not supported. \n Supported AA values: %s. " , ( int ) requestedMsaa , supportedAa . c_str ( ) ) ;
MessageBox ( hWnd , s . c_str ( ) , " Warning " , MB_OK | MB_ICONWARNING ) ;
SendMessage ( GetDlgItem ( m_hWnd , IDC_MSAA ) , UDM_SETPOS , 0 , requestedMsaa = m_lastValidMsaa ) ; // revert value from inside OnCommand? is this OK?
}
else if ( derivedDepth < GSDevice9 : : GetMaxDepth ( m_lastValidMsaa ) )
{
string s = format ( " AA=%d will force GSdx to degrade Z buffer \n from 32 to 24 bit, which will probably cause glitches \n (changing 'Logarithmic Z' might help some). \n \n Continue? " , ( int ) requestedMsaa ) ;
2011-01-02 10:24:36 +00:00
//s+= format("\nlastMsaa=%d, lastDepth=%d, newMsaa=%d, newDepth=%d", (int)m_lastValidMsaa, (int)GSDevice9::GetMaxDepth(m_lastValidMsaa), (int)requestedMsaa, (int)GSDevice9::GetMaxDepth(requestedMsaa));
2011-02-18 01:56:05 +00:00
if ( IDOK ! = MessageBox ( hWnd , s . c_str ( ) , " Warning " , MB_OKCANCEL | MB_ICONWARNING ) )
{
SendMessage ( GetDlgItem ( m_hWnd , IDC_MSAA ) , UDM_SETPOS , 0 , requestedMsaa = m_lastValidMsaa ) ; // revert value from inside OnCommand? is this OK?
}
2011-01-02 10:24:36 +00:00
}
2011-02-18 01:56:05 +00:00
2011-01-02 10:24:36 +00:00
m_lastValidMsaa = requestedMsaa ;
UpdateControls ( ) ;
}
}
else if ( id = = IDC_UPSCALE_MULTIPLIER & & code = = CBN_SELCHANGE )
{
UpdateControls ( ) ;
}
2009-06-03 12:09:04 +00:00
if ( id = = IDC_RENDERER & & code = = CBN_SELCHANGE )
2009-02-09 21:15:56 +00:00
{
2009-06-04 08:32:31 +00:00
UpdateControls ( ) ;
}
else if ( id = = IDC_NATIVERES & & code = = BN_CLICKED )
{
UpdateControls ( ) ;
2009-02-09 21:15:56 +00:00
}
2009-06-03 12:09:04 +00:00
else if ( id = = IDOK )
2009-02-09 21:15:56 +00:00
{
2009-06-03 12:09:04 +00:00
INT_PTR data ;
2009-02-09 21:15:56 +00:00
2010-01-28 04:44:07 +00:00
if ( ! m_IsOpen2 & & ComboBoxGetSelData ( IDC_RESOLUTION , data ) )
2009-06-03 12:09:04 +00:00
{
const D3DDISPLAYMODE * mode = ( D3DDISPLAYMODE * ) data ;
2009-02-09 21:15:56 +00:00
2009-06-03 12:09:04 +00:00
theApp . SetConfig ( " ModeWidth " , ( int ) mode - > Width ) ;
theApp . SetConfig ( " ModeHeight " , ( int ) mode - > Height ) ;
theApp . SetConfig ( " ModeRefreshRate " , ( int ) mode - > RefreshRate ) ;
}
2009-02-09 21:15:56 +00:00
2009-06-19 00:11:56 +00:00
if ( ComboBoxGetSelData ( IDC_RENDERER , data ) )
2009-06-03 12:09:04 +00:00
{
theApp . SetConfig ( " Renderer " , ( int ) data ) ;
}
2009-02-09 21:15:56 +00:00
2009-06-19 00:11:56 +00:00
if ( ComboBoxGetSelData ( IDC_INTERLACE , data ) )
2009-06-03 12:09:04 +00:00
{
theApp . SetConfig ( " Interlace " , ( int ) data ) ;
}
2009-02-09 21:15:56 +00:00
2009-06-19 00:11:56 +00:00
if ( ComboBoxGetSelData ( IDC_ASPECTRATIO , data ) )
2009-06-03 12:09:04 +00:00
{
theApp . SetConfig ( " AspectRatio " , ( int ) data ) ;
}
2010-04-25 00:31:27 +00:00
2009-10-26 15:52:45 +00:00
if ( ComboBoxGetSelData ( IDC_UPSCALE_MULTIPLIER , data ) )
2009-10-23 14:32:01 +00:00
{
2009-10-26 15:52:45 +00:00
theApp . SetConfig ( " upscale_multiplier " , ( int ) data ) ;
}
else
{
theApp . SetConfig ( " upscale_multiplier " , 1 ) ;
2009-10-23 14:32:01 +00:00
}
2010-04-25 00:31:27 +00:00
2009-07-17 23:45:32 +00:00
theApp . SetConfig ( " windowed " , ( int ) IsDlgButtonChecked ( m_hWnd , IDC_WINDOWED ) ) ;
2009-06-03 12:09:04 +00:00
theApp . SetConfig ( " filter " , ( int ) IsDlgButtonChecked ( m_hWnd , IDC_FILTER ) ) ;
2009-07-06 16:35:06 +00:00
theApp . SetConfig ( " paltex " , ( int ) IsDlgButtonChecked ( m_hWnd , IDC_PALTEX ) ) ;
2009-06-03 12:09:04 +00:00
theApp . SetConfig ( " vsync " , ( int ) IsDlgButtonChecked ( m_hWnd , IDC_VSYNC ) ) ;
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 ) ) ;
theApp . SetConfig ( " nativeres " , ( int ) IsDlgButtonChecked ( m_hWnd , IDC_NATIVERES ) ) ;
theApp . SetConfig ( " resx " , ( int ) SendMessage ( GetDlgItem ( m_hWnd , IDC_RESX ) , UDM_GETPOS , 0 , 0 ) ) ;
theApp . SetConfig ( " resy " , ( int ) SendMessage ( GetDlgItem ( m_hWnd , IDC_RESY ) , UDM_GETPOS , 0 , 0 ) ) ;
theApp . SetConfig ( " swthreads " , ( int ) SendMessage ( GetDlgItem ( m_hWnd , IDC_SWTHREADS ) , UDM_GETPOS , 0 , 0 ) ) ;
2010-02-19 15:45:23 +00:00
theApp . SetConfig ( " msaa " , ( int ) SendMessage ( GetDlgItem ( m_hWnd , IDC_MSAA ) , UDM_GETPOS , 0 , 0 ) ) ;
2010-02-19 10:37:31 +00:00
// Hacks
2010-04-25 00:31:27 +00:00
theApp . SetConfig ( " UserHacks_AlphaHack " , ( int ) IsDlgButtonChecked ( m_hWnd , IDC_ALPHAHACK ) ) ;
2010-02-19 10:37:31 +00:00
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 ) ) ;
2010-08-27 13:48:41 +00:00
bool allowHacks = ! ! theApp . GetConfig ( " allowHacks " , 0 ) ;
theApp . SetConfig ( " allowHacks " , allowHacks ) ;
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
}
2011-01-02 10:24:36 +00:00
2009-06-04 08:32:31 +00:00
void GSSettingsDlg : : UpdateControls ( )
{
INT_PTR i ;
2010-02-19 22:01:28 +00:00
bool allowHacks = ! ! theApp . GetConfig ( " allowHacks " , 0 ) ;
2011-02-12 21:45:16 +00:00
int scaling = 1 ; // in case reading the combo doesn't work, enable the custom res control anyway
if ( ComboBoxGetSelData ( IDC_UPSCALE_MULTIPLIER , i ) )
{
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
{
bool dx9 = i > = 0 & & i < = 2 ;
bool dx10 = i > = 3 & & i < = 5 ;
2009-06-19 20:24:18 +00:00
bool dx11 = i > = 6 & & i < = 8 ;
2011-02-12 21:45:16 +00:00
bool hw = i = = 0 | | i = = 3 | | i = = 6 ;
bool sw = i = = 1 | | i = = 4 | | i = = 7 ;
2009-06-04 08:32:31 +00:00
bool native = ! ! IsDlgButtonChecked ( m_hWnd , IDC_NATIVERES ) ;
ShowWindow ( GetDlgItem ( m_hWnd , IDC_LOGO9 ) , dx9 ? SW_SHOW : SW_HIDE ) ;
2011-02-12 21:45:16 +00:00
ShowWindow ( GetDlgItem ( m_hWnd , IDC_LOGO11 ) , dx10 ? SW_SHOW : SW_HIDE ) ;
2009-06-04 08:32:31 +00:00
2009-07-17 23:45:32 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_WINDOWED ) , dx9 ) ;
2011-02-12 21:45:16 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_RESX ) , hw & & ! native & & scaling = = 1 ) ;
EnableWindow ( GetDlgItem ( m_hWnd , IDC_RESX_EDIT ) , hw & & ! native & & scaling = = 1 ) ;
EnableWindow ( GetDlgItem ( m_hWnd , IDC_RESY ) , hw & & ! native & & scaling = = 1 ) ;
EnableWindow ( GetDlgItem ( m_hWnd , IDC_RESY_EDIT ) , hw & & ! native & & scaling = = 1 ) ;
2009-10-26 15:52:45 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_UPSCALE_MULTIPLIER ) , hw & & ! native ) ;
2009-06-04 08:32:31 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_NATIVERES ) , hw ) ;
2010-04-25 00:31:27 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_FILTER ) , hw & & ! native ) ;
2009-07-06 16:35:06 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_PALTEX ) , hw ) ;
2011-02-12 21:45:16 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_LOGZ ) , dx9 & & hw & & GSDevice9 : : GetMaxDepth ( m_lastValidMsaa ) < 32 ) ;
2009-06-04 08:32:31 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_FBA ) , dx9 & & hw ) ;
EnableWindow ( GetDlgItem ( m_hWnd , IDC_AA1 ) , sw ) ;
EnableWindow ( GetDlgItem ( m_hWnd , IDC_SWTHREADS_EDIT ) , sw ) ;
EnableWindow ( GetDlgItem ( m_hWnd , IDC_SWTHREADS ) , sw ) ;
2010-02-19 22:01:28 +00:00
EnableWindow ( GetDlgItem ( m_hWnd , IDC_MSAAEDIT ) , hw ) ;
EnableWindow ( GetDlgItem ( m_hWnd , IDC_MSAA ) , hw ) ;
2011-02-12 21:45:16 +00:00
//ShowWindow(GetDlgItem(m_hWnd, IDC_USERHACKS), allowHacks && hw) ? SW_SHOW : SW_HIDE; //Don't disable the "Hacks" frame
ShowWindow ( GetDlgItem ( m_hWnd , IDC_MSAAEDIT ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
ShowWindow ( GetDlgItem ( m_hWnd , IDC_MSAA ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
ShowWindow ( GetDlgItem ( m_hWnd , IDC_STATIC_TEXT_HWAA ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
2010-08-27 13:48:41 +00:00
2011-02-12 21:45:16 +00:00
ShowWindow ( GetDlgItem ( m_hWnd , IDC_ALPHAHACK ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
ShowWindow ( GetDlgItem ( m_hWnd , IDC_OFFSETHACK ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
2010-08-27 13:48:41 +00:00
2011-02-12 21:45:16 +00:00
ShowWindow ( GetDlgItem ( m_hWnd , IDC_SKIPDRAWHACKEDIT ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
ShowWindow ( GetDlgItem ( m_hWnd , IDC_SKIPDRAWHACK ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
ShowWindow ( GetDlgItem ( m_hWnd , IDC_STATIC_TEXT_SKIPDRAW ) , allowHacks & & hw ) ? SW_SHOW : SW_HIDE ;
2009-06-04 08:32:31 +00:00
}
2009-06-16 01:42:08 +00:00
}