2017-04-26 10:23:36 +00:00
/***************************************************************************
* *
* Project64 - video - A Nintendo 64 gfx plugin . *
* http : //www.pj64-emu.com/ *
* Copyright ( C ) 2017 Project64 . All rights reserved . *
* Copyright ( C ) 2003 - 2009 Sergey ' Gonetz ' Lipski *
* Copyright ( C ) 2002 Dave2001 *
* *
* License : *
* GNU / GPLv2 http : //www.gnu.org/licenses/gpl-2.0.html *
* version 2 of the License , or ( at your option ) any later version . *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2015-10-09 00:07:09 +00:00
# include "Gfx_1.3.h"
2013-04-04 21:22:19 +00:00
# include "DepthBufferRender.h"
# include "Config.h"
2016-02-04 10:22:19 +00:00
# include "trace.h"
2017-01-31 10:37:16 +00:00
# include "ScreenResolution.h"
2016-04-19 10:37:41 +00:00
# include <Common/StdString.h>
2017-04-18 12:03:49 +00:00
# include <Settings/Settings.h>
# include "SettingsID.h"
2016-01-24 18:38:52 +00:00
# ifdef _WIN32
2016-01-25 09:33:04 +00:00
# include <Common/CriticalSection.h>
2016-03-08 22:22:28 +00:00
# include "resource.h"
# pragma warning(push)
2017-04-18 12:03:49 +00:00
# pragma warning(disable : 4091) // warning C4091: 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared
# pragma warning(disable : 4302) // warning C4302: 'type cast': truncation from 'LPCTSTR' to 'WORD'
# pragma warning(disable : 4458) // warning C4458: declaration of 'dwCommonButtons' hides class member
# pragma warning(disable : 4838) // warning C4838: conversion from 'int' to 'UINT' requires a narrowing conversion
2016-03-08 22:22:28 +00:00
# pragma warning(disable : 4996) // warning C4996: 'GetVersionExA': was declared deprecated
2017-04-18 12:03:49 +00:00
# pragma warning(disable : 4302) // warning C4302: 'type cast': truncation from 'LPCTSTR' to 'WORD'
# define _ATL_DISABLE_NOTHROW_NEW
# include <atlbase.h>
2016-03-08 22:22:28 +00:00
# include <wtl/atlapp.h>
# include <atlwin.h>
# include <wtl/atldlgs.h>
# include <wtl/atlctrls.h>
# include <wtl/atlcrack.h>
2017-04-18 12:03:49 +00:00
# pragma warning(pop)
2016-03-08 22:22:28 +00:00
extern HINSTANCE hinstDLL ;
2017-03-10 05:25:04 +00:00
extern bool g_ghq_use ;
2016-03-08 22:22:28 +00:00
2016-01-25 09:33:04 +00:00
extern CriticalSection * g_ProcessDListCS ;
2013-04-04 21:22:19 +00:00
2016-03-08 22:22:28 +00:00
class CGlide64WtlModule :
public CAppModule
{
public :
CGlide64WtlModule ( HINSTANCE hinst )
{
Init ( NULL , hinst ) ;
}
virtual ~ CGlide64WtlModule ( void )
{
Term ( ) ;
}
} ;
CGlide64WtlModule * WtlModule = NULL ;
2017-04-18 12:03:49 +00:00
void ConfigInit ( void * hinst )
2016-03-08 22:22:28 +00:00
{
2017-04-18 12:03:49 +00:00
WtlModule = new CGlide64WtlModule ( ( HINSTANCE ) hinst ) ;
2016-03-08 22:22:28 +00:00
}
void ConfigCleanup ( void )
{
if ( WtlModule )
{
delete WtlModule ;
WtlModule = NULL ;
}
}
2016-03-09 06:44:01 +00:00
# endif
void CloseConfig ( ) ;
# ifdef _WIN32
template < class T , class TT = CToolTipCtrl >
class CToolTipDialog
{
// Data declarations and members
public :
2017-04-18 12:03:49 +00:00
TT & GetTT ( ) { return m_TT ; }
2016-03-09 06:44:01 +00:00
protected :
TT m_TT ;
UINT m_uTTStyle ;
UINT m_uToolFlags ;
// Construction
CToolTipDialog ( UINT uTTSTyle = TTS_NOPREFIX | TTS_BALLOON , UINT uToolFlags = TTF_IDISHWND | TTF_SUBCLASS )
: m_TT ( NULL ) , m_uTTStyle ( uTTSTyle ) ,
m_uToolFlags ( uToolFlags | TTF_SUBCLASS )
{ }
void TTInit ( )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
T * pT = ( T * ) this ;
ATLASSERT ( : : IsWindow ( * pT ) ) ;
m_TT . Create ( * pT , NULL , NULL , m_uTTStyle ) ;
CToolInfo ToolInfo ( pT - > m_uToolFlags , * pT , 0 , 0 , MAKEINTRESOURCE ( pT - > IDD ) ) ;
m_TT . AddTool ( & ToolInfo ) ;
: : EnumChildWindows ( * pT , SetTool , ( LPARAM ) pT ) ;
TTSize ( 0 ) ;
TTActivate ( TRUE ) ;
}
// Operations
public :
void TTActivate ( BOOL bActivate )
{
m_TT . Activate ( bActivate ) ;
}
void TTSize ( int nPixel )
{
m_TT . SetMaxTipWidth ( nPixel ) ;
2016-01-20 08:39:07 +00:00
}
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
void TTSetTxt ( HWND hTool , _U_STRINGorID text )
2013-04-04 21:22:19 +00:00
{
2016-03-09 06:44:01 +00:00
m_TT . UpdateTipText ( text , hTool ) ;
}
void TTSetTxt ( UINT idTool , _U_STRINGorID text )
{
TTSetTxt ( GetHWND ( idTool ) , text ) ;
2013-04-04 21:22:19 +00:00
}
2016-03-09 06:44:01 +00:00
BOOL TTAdd ( HWND hTool )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
return SetTool ( hTool , ( LPARAM ) ( T * ) this ) ;
}
BOOL TTAdd ( UINT idTool )
{
return TTAdd ( GetHWND ( idTool ) ) ;
2016-01-20 08:39:07 +00:00
}
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
void TTRemove ( HWND hTool )
{
m_TT . DelTool ( hTool ) ;
}
void TTRemove ( UINT idTool )
{
TTRemove ( GetHWND ( idTool ) ) ;
}
// Message map and handlers
BEGIN_MSG_MAP ( CToolTipDialog )
MESSAGE_RANGE_HANDLER ( WM_MOUSEFIRST , WM_MOUSELAST , OnMouse )
MESSAGE_HANDLER ( WM_INITDIALOG , OnInitDialog )
END_MSG_MAP ( )
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
LRESULT OnInitDialog ( UINT , WPARAM , LPARAM , BOOL & bHandled )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
TTInit ( ) ;
bHandled = FALSE ;
return TRUE ;
2016-01-20 08:39:07 +00:00
}
2016-03-09 06:44:01 +00:00
LRESULT OnMouse ( UINT /*uMsg*/ , WPARAM /*wParam*/ , LPARAM /*lParam*/ , BOOL & bHandled )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
T * pT = ( T * ) this ;
bHandled = FALSE ;
if ( m_TT . IsWindow ( ) )
m_TT . RelayEvent ( ( LPMSG ) pT - > GetCurrentMessage ( ) ) ;
return 0 ;
}
// Implementation
private :
HWND GetHWND ( UINT idTool )
{
return : : GetDlgItem ( * ( T * ) this , idTool ) ;
2016-01-20 08:39:07 +00:00
}
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
static BOOL CALLBACK SetTool ( HWND hTool , LPARAM pDlg )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
T * pT = ( T * ) pDlg ;
int idTool = : : GetWindowLong ( hTool , GWL_ID ) ;
if ( idTool ! = IDC_STATIC )
{
CToolInfo ToolInfo ( pT - > m_uToolFlags , hTool , 0 , 0 , ( LPTSTR ) idTool ) ;
pT - > m_TT . AddTool ( & ToolInfo ) ;
}
return TRUE ;
2016-01-20 08:39:07 +00:00
}
2016-03-09 06:44:01 +00:00
} ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
void SetComboBoxIndex ( CComboBox & cmb , uint32_t data )
2013-04-04 21:22:19 +00:00
{
2016-03-09 06:44:01 +00:00
cmb . SetCurSel ( 0 ) ;
for ( DWORD i = 0 , n = cmb . GetCount ( ) ; i < n ; i + + )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
if ( cmb . GetItemData ( i ) = = data )
{
cmb . SetCurSel ( i ) ;
break ;
}
2016-01-20 08:39:07 +00:00
}
2013-04-04 21:22:19 +00:00
}
2016-03-09 06:44:01 +00:00
class CConfigBasicPage ;
class CConfigEmuSettings ;
2017-04-18 12:03:49 +00:00
class CDebugSettings ;
2016-03-09 06:44:01 +00:00
class CConfigTextureEnhancement ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
class COptionsSheet : public CPropertySheetImpl < COptionsSheet >
2013-04-04 21:22:19 +00:00
{
2016-03-09 06:44:01 +00:00
public :
// Construction
COptionsSheet ( _U_STRINGorID /*title*/ = ( LPCTSTR ) NULL , UINT /*uStartPage*/ = 0 , HWND /*hWndParent*/ = NULL ) ;
~ COptionsSheet ( ) ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
void UpdateTextureSettings ( void ) ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
// Maps
BEGIN_MSG_MAP ( COptionsSheet )
CHAIN_MSG_MAP ( CPropertySheetImpl < COptionsSheet > )
END_MSG_MAP ( )
private :
// Property pages
CConfigBasicPage * m_pgBasicPage ;
CConfigEmuSettings * m_pgEmuSettings ;
2017-04-18 12:03:49 +00:00
CDebugSettings * m_pgDebugSettings ;
2016-03-09 06:44:01 +00:00
CConfigTextureEnhancement * m_pgTextureEnhancement ;
HPROPSHEETPAGE m_hTextureEnhancement ;
} ;
class CConfigBasicPage :
public CPropertyPageImpl < CConfigBasicPage > ,
public CToolTipDialog < CConfigBasicPage >
2013-04-04 21:22:19 +00:00
{
2016-03-09 06:44:01 +00:00
public :
enum { IDD = IDD_CONFIG_BASIC } ;
CConfigBasicPage ( COptionsSheet * options_page ) :
m_options_page ( options_page )
{
2016-01-20 08:39:07 +00:00
}
2016-03-09 06:44:01 +00:00
BEGIN_MSG_MAP ( CConfigBasicPage )
MESSAGE_HANDLER ( WM_INITDIALOG , OnInitDialog )
COMMAND_HANDLER_EX ( IDC_CMB_WINDOW_RES , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_FS_RESOLUTION , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_VERTICAL_SYNC , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CBXANISOTROPIC , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_SHOW_TEXTURE_ENHANCEMENT , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_AUTODETECT_VRAM , BN_CLICKED , ItemChanged )
2016-12-02 20:16:47 +00:00
COMMAND_HANDLER_EX ( IDC_CHK_USE_FRAME_BUFFER_OBJECT , BN_CLICKED , ItemChanged )
2016-03-09 06:44:01 +00:00
CHAIN_MSG_MAP ( CToolTipDialog < CConfigBasicPage > )
CHAIN_MSG_MAP ( CPropertyPageImpl < CConfigBasicPage > )
END_MSG_MAP ( )
LRESULT OnInitDialog ( UINT /*uMsg*/ , WPARAM /*wParam*/ , LPARAM /*lParam*/ , BOOL & /*bHandled*/ )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
TTInit ( ) ;
2017-04-18 12:03:49 +00:00
TTSize ( 400 ) ;
2016-03-09 06:44:01 +00:00
m_WindowRes . Attach ( GetDlgItem ( IDC_CMB_WINDOW_RES ) ) ;
2017-01-31 10:37:16 +00:00
for ( uint32_t i = 0 , n = GetScreenResolutionCount ( ) ; i < n ; i + + )
{
m_WindowRes . SetItemData ( m_WindowRes . AddString ( GetScreenResolutionName ( i ) ) , i ) ;
}
2017-01-31 06:56:52 +00:00
SetComboBoxIndex ( m_WindowRes , g_settings - > ScreenRes ( ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CMB_WINDOW_RES , " Resolution: \n \n This option selects the windowed resolution. \n \n [Recommended: 640x480, 800x600, 1024x768] " ) ;
2016-03-09 06:44:01 +00:00
m_cbxVSync . Attach ( GetDlgItem ( IDC_CHK_VERTICAL_SYNC ) ) ;
2017-03-09 07:13:25 +00:00
m_cbxVSync . SetCheck ( g_settings - > vsync ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_VERTICAL_SYNC , " Vertical sync: \n \n This option will enable the vertical sync, which will prevent tearing. \n Note: this option will ONLY have effect if vsync is set to \" Software Controlled \" . " ) ;
2016-03-09 06:44:01 +00:00
m_cbxTextureSettings . Attach ( GetDlgItem ( IDC_CHK_SHOW_TEXTURE_ENHANCEMENT ) ) ;
2017-03-09 07:01:06 +00:00
m_cbxTextureSettings . SetCheck ( g_settings - > texenh_options ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cmbFSResolution . Attach ( GetDlgItem ( IDC_CMB_FS_RESOLUTION ) ) ;
int32_t size = 0 ;
char * * aRes = grQueryResolutionsExt ( & size ) ;
if ( aRes & & size )
{
for ( int r = 0 ; r < size ; r + + )
{
m_cmbFSResolution . AddString ( aRes [ r ] ) ;
}
2017-03-13 06:33:08 +00:00
m_cmbFSResolution . SetCurSel ( g_settings - > FullScreenRes ( ) < size ? g_settings - > FullScreenRes ( ) : 0 ) ;
2013-04-04 21:22:19 +00:00
}
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CMB_FS_RESOLUTION , " Full screen resolution: \n \n This sets the full screen resolution. \n All the resolutions that your video card / monitor support should be displayed. \n \n [Recommended:native(max) resolution of your monitor - unless performance becomes an issue] " ) ;
2016-03-09 06:44:01 +00:00
m_cbxAnisotropic . Attach ( GetDlgItem ( IDC_CBXANISOTROPIC ) ) ;
2017-03-13 06:46:14 +00:00
m_cbxAnisotropic . SetCheck ( g_settings - > wrpAnisotropic ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CBXANISOTROPIC , " Anisotropic filtering: \n \n This filter sharpens and brings out the details of textures that recede into the distance. \n When activated, it will use the max anisotropy your video card supports. \n However, this will override native way of texture filtering and may cause visual artifacts in some games. \n \n [Recommended: your preference, game dependant] " ) ;
2016-03-09 06:44:01 +00:00
m_cbxFBO . Attach ( GetDlgItem ( IDC_CHK_USE_FRAME_BUFFER_OBJECT ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_USE_FRAME_BUFFER_OBJECT , " Use frame buffer objects: \n \n Changes the way FB effects are rendered - with or without usage of the OpenGL Frame Buffer Objects (FBO) extension. \n The choice depends on game and your video card. FBO off is good for NVIDIA cards, while for ATI cards, it's usually best that FBOs are turned on. \n Also, some FB effects works only with one of the methods, no matter, which card you have. \n On the whole, with FBO off, compatibility/ accuracy is a bit better (which is the case for Resident Evil 2). \n However, with FBO on with some systems, it can actually be a bit faster in cases. \n \n [Recommended: video card and game dependant] " ) ;
2017-04-18 12:03:49 +00:00
m_cbxFBO . SetCheck ( g_settings - > wrpFBO ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxVRAM . Attach ( GetDlgItem ( IDC_CHK_AUTODETECT_VRAM ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_AUTODETECT_VRAM , " Autodetect VRAM Size: \n \n Since OpenGL cannot do this reliably at the moment, the option to set this manually is available. \n If checked, plugin will try to autodetect VRAM size. \n But if this appears wrong, please uncheck and set it to correct value. \n \n [Recommended: on] " ) ;
2016-03-09 06:44:01 +00:00
m_VramSize . Attach ( GetDlgItem ( IDC_SPIN_VRAM_SIZE ) ) ;
m_VramSize . SetBuddy ( GetDlgItem ( IDC_TXT_VRAM_SIZE ) ) ;
m_spinVRAM . Attach ( GetDlgItem ( IDC_TXT_VRAM_SIZE ) ) ;
2017-03-13 06:39:28 +00:00
m_cbxVRAM . SetCheck ( g_settings - > wrpVRAM ( ) = = 0 ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_lblMb . Attach ( GetDlgItem ( IDC_LBL_MB ) ) ;
AutoDetectChanged ( ) ;
return TRUE ;
2016-01-20 08:39:07 +00:00
}
2013-04-27 09:17:15 +00:00
2016-03-09 06:44:01 +00:00
bool OnApply ( )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
char spinVRAM [ 100 ] ;
m_spinVRAM . GetWindowText ( spinVRAM , sizeof ( spinVRAM ) ) ;
2017-01-31 06:56:52 +00:00
g_settings - > SetScreenRes ( m_WindowRes . GetCurSel ( ) ) ;
2017-03-09 07:13:25 +00:00
g_settings - > SetVsync ( m_cbxVSync . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-09 07:01:06 +00:00
g_settings - > SetTexenhOptions ( m_cbxTextureSettings . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-13 06:33:08 +00:00
g_settings - > SetFullScreenRes ( m_cmbFSResolution . GetCurSel ( ) ) ;
2017-03-13 06:46:14 +00:00
g_settings - > SetWrpAnisotropic ( m_cbxAnisotropic . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-13 06:39:28 +00:00
g_settings - > SetWrpVRAM ( m_cbxVRAM . GetCheck ( ) = = BST_CHECKED ? 0 : atoi ( spinVRAM ) ) ;
2017-03-13 06:42:49 +00:00
g_settings - > SetWrpFBO ( m_cbxFBO . GetCheck ( ) = = BST_CHECKED ) ;
2016-03-09 06:44:01 +00:00
2017-04-30 19:18:09 +00:00
if ( g_settings - > dirty ( ) )
2016-03-09 06:44:01 +00:00
{
2017-01-27 06:30:19 +00:00
g_settings - > WriteSettings ( ) ;
2016-03-09 06:44:01 +00:00
}
m_options_page - > UpdateTextureSettings ( ) ;
return true ;
2016-01-20 08:39:07 +00:00
}
2016-03-09 06:44:01 +00:00
private :
void ItemChanged ( UINT /*Code*/ , int id , HWND /*ctl*/ )
2013-04-04 21:22:19 +00:00
{
2016-03-09 06:44:01 +00:00
SendMessage ( GetParent ( ) , PSM_CHANGED , ( WPARAM ) m_hWnd , 0 ) ;
if ( id = = IDC_CHK_AUTODETECT_VRAM )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
AutoDetectChanged ( ) ;
2016-01-20 08:39:07 +00:00
}
2013-04-04 21:22:19 +00:00
}
2016-03-09 06:44:01 +00:00
void AutoDetectChanged ( void )
2016-01-20 08:39:07 +00:00
{
2017-04-18 12:03:49 +00:00
m_spinVRAM . SetWindowText ( m_cbxVRAM . GetCheck ( ) = = BST_CHECKED ? " auto " : stdstr_f ( " %d " , g_settings - > wrpVRAM ( ) ! = 0 ? g_settings - > wrpVRAM ( ) : 32 ) . c_str ( ) ) ;
2016-03-09 06:44:01 +00:00
m_spinVRAM . EnableWindow ( m_cbxVRAM . GetCheck ( ) ! = BST_CHECKED ) ;
m_VramSize . EnableWindow ( m_cbxVRAM . GetCheck ( ) ! = BST_CHECKED ) ;
m_lblMb . EnableWindow ( m_cbxVRAM . GetCheck ( ) ! = BST_CHECKED ) ;
2016-01-20 08:39:07 +00:00
}
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
COptionsSheet * m_options_page ;
CComboBox m_WindowRes , m_cmbFSResolution ;
CButton m_cbxVSync ;
CButton m_cbxTextureSettings ;
CButton m_cbxAnisotropic ;
CButton m_cbxFBO ;
CButton m_cbxVRAM ;
CUpDownCtrl m_VramSize ;
CEdit m_spinVRAM ;
CStatic m_lblMb ;
} ;
class CConfigEmuSettings :
public CPropertyPageImpl < CConfigEmuSettings > ,
public CToolTipDialog < CConfigEmuSettings >
{
public :
enum { IDD = IDD_EMULATION_SETTINGS } ;
BEGIN_MSG_MAP ( CConfigEmuSettings )
MESSAGE_HANDLER ( WM_INITDIALOG , OnInitDialog )
COMMAND_HANDLER_EX ( IDC_CMB_FILTERING_MODE , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_BUFFER_SWAPPING , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_LOD_CALC , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_ASPECT_RATIO , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_FOG , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_BUFFER_CLEAR , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_FRAME_BUFFER_EMULATION , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_HARDWARE_FRAMEBUFFER , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_GET_FRAMEBUFFER , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_READ_EVERY_FRAME , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_RENDER_FRAME_AS_TEXTURE , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CHK_DETECT_CPU_WRITE , BN_CLICKED , ItemChanged )
COMMAND_HANDLER_EX ( IDC_SOFTWARE_DEPTH_BUFFER , BN_CLICKED , ItemChanged )
CHAIN_MSG_MAP ( CToolTipDialog < CConfigEmuSettings > )
CHAIN_MSG_MAP ( CPropertyPageImpl < CConfigEmuSettings > )
END_MSG_MAP ( )
LRESULT OnInitDialog ( UINT /*uMsg*/ , WPARAM /*wParam*/ , LPARAM /*lParam*/ , BOOL & /*bHandled*/ )
2016-01-20 08:39:07 +00:00
{
2016-03-09 06:44:01 +00:00
TTInit ( ) ;
2017-04-18 12:03:49 +00:00
TTSize ( 400 ) ;
2016-03-09 06:44:01 +00:00
if ( g_romopen )
{
: : SetWindowText ( GetDlgItem ( IDC_INFO ) , " Current game emulation settings. Change with care! " ) ;
}
else
{
: : SetWindowText ( GetDlgItem ( IDC_INFO ) , " Default emulation settings. Not recommended to change! " ) ;
}
2016-07-07 22:45:12 +00:00
std : : string tooltip = " Filtering mode: \n \n There are three filtering modes possible: \n \n * Automatic filtering - filter exactly how the N64 specifies. \n * Point-sampled filtering - causes texels to appear square and sharp. \n * Bilinear filtering - interpolates the texture to make it appear more smooth. \n \n [Recommended: Automatic] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_FILTERING_MODE , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CMB_FILTERING_MODE , tooltip . c_str ( ) ) ;
m_cmbFiltering . Attach ( GetDlgItem ( IDC_CMB_FILTERING_MODE ) ) ;
2017-01-29 09:10:32 +00:00
m_cmbFiltering . SetItemData ( m_cmbFiltering . AddString ( " Automatic " ) , CSettings : : Filter_Automatic ) ;
m_cmbFiltering . SetItemData ( m_cmbFiltering . AddString ( " Force Bilinear " ) , CSettings : : Filter_ForceBilinear ) ;
m_cmbFiltering . SetItemData ( m_cmbFiltering . AddString ( " Force Point-sampled " ) , CSettings : : Filter_ForcePointSampled ) ;
SetComboBoxIndex ( m_cmbFiltering , ( uint32_t ) g_settings - > filtering ( ) ) ;
2016-03-09 06:44:01 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Buffer swapping method: \n \n There are 3 buffer swapping methods: \n \n * old - swap buffers when vertical interrupt has occurred. \n * new - swap buffers when set of conditions is satisfied. Prevents flicker on some games. \n * hybrid - mix of first two methods. Can prevent even more flickering then previous method, but also can cause artefacts. \n If you have flickering problems in a game (or graphics that don't show), try to change swapping method. \n \n [Recommended: new (hybrid for Paper Mario)] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_BUFFER_SWAPPING , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CMB_BUFFER_SWAPPING , tooltip . c_str ( ) ) ;
m_cmbBufferSwap . Attach ( GetDlgItem ( IDC_CMB_BUFFER_SWAPPING ) ) ;
2017-01-29 18:05:06 +00:00
m_cmbBufferSwap . SetItemData ( m_cmbBufferSwap . AddString ( " Old " ) , CSettings : : SwapMode_Old ) ;
m_cmbBufferSwap . SetItemData ( m_cmbBufferSwap . AddString ( " New " ) , CSettings : : SwapMode_New ) ;
m_cmbBufferSwap . SetItemData ( m_cmbBufferSwap . AddString ( " Hybrid " ) , CSettings : : SwapMode_Hybrid ) ;
SetComboBoxIndex ( m_cmbBufferSwap , g_settings - > swapmode ( ) ) ;
2016-03-09 06:44:01 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Per-pixel level-of-detail calculation: \n \n N64 uses special mechanism for mip-mapping, which nearly impossible to reproduce correctly on PC hardware. \n This option enables approximate emulation of this feature. \n For example, it is required for the Peach/Bowser portrait's transition in Super Mario 64. \n There are 3 modes: \n \n * off - LOD is not calculated \n * fast - fast imprecise LOD calculation. \n * precise - most precise LOD calculation possible, but more slow. \n \n [Recommended: your preference] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_LOD_CALC , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CMB_LOD_CALC , tooltip . c_str ( ) ) ;
m_cmbLOD . Attach ( GetDlgItem ( IDC_CMB_LOD_CALC ) ) ;
2017-01-29 21:03:23 +00:00
m_cmbLOD . SetItemData ( m_cmbLOD . AddString ( " off " ) , CSettings : : LOD_Off ) ;
m_cmbLOD . SetItemData ( m_cmbLOD . AddString ( " fast " ) , CSettings : : LOD_Fast ) ;
m_cmbLOD . SetItemData ( m_cmbLOD . AddString ( " precise " ) , CSettings : : LOD_Precise ) ;
SetComboBoxIndex ( m_cmbLOD , g_settings - > lodmode ( ) ) ;
2016-03-09 06:44:01 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Aspect ratio of the output: \n \n Most N64 games use 4:3 aspect ratio, but some support widescreen too. \n You may select appropriate aspect here and set widescreen mode in game settings-> \n In \" Stretch \" mode the output will be stretched to the entire screen, other modes may add black borders if necessary " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_ASPECT_RATIO , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CMB_ASPECT_RATIO , tooltip . c_str ( ) ) ;
m_cmbAspect . Attach ( GetDlgItem ( IDC_CMB_ASPECT_RATIO ) ) ;
2017-01-29 06:47:28 +00:00
m_cmbAspect . SetItemData ( m_cmbAspect . AddString ( " 4:3 (default) " ) , CSettings : : Aspect_4x3 ) ;
m_cmbAspect . SetItemData ( m_cmbAspect . AddString ( " Force 16:9 " ) , CSettings : : Aspect_16x9 ) ;
m_cmbAspect . SetItemData ( m_cmbAspect . AddString ( " Stretch " ) , CSettings : : Aspect_Stretch ) ;
m_cmbAspect . SetItemData ( m_cmbAspect . AddString ( " Original " ) , CSettings : : Aspect_Original ) ;
SetComboBoxIndex ( m_cmbAspect , ( uint32_t ) g_settings - > aspectmode ( ) ) ;
2016-03-09 06:44:01 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Fog enabled: \n \n Sets fog emulation on//off. \n \n [Recommended: on] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_CHK_FOG , tooltip . c_str ( ) ) ;
m_cbxFog . Attach ( GetDlgItem ( IDC_CHK_FOG ) ) ;
2017-04-18 12:03:49 +00:00
m_cbxFog . SetCheck ( g_settings - > fog ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Buffer clear on every frame: \n \n Forces the frame buffer to be cleared every frame drawn. \n Usually frame buffer clear is controlled by the game. \n However, in some cases it is not well emulated, and some garbage may be left on the screen. \n In such cases, this option must be set on. \n \n [Recommended: on] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_CHK_BUFFER_CLEAR , tooltip . c_str ( ) ) ;
m_cbxBuffer . Attach ( GetDlgItem ( IDC_CHK_BUFFER_CLEAR ) ) ;
2017-03-09 21:06:58 +00:00
m_cbxBuffer . SetCheck ( g_settings - > buff_clear ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxFBEnable . Attach ( GetDlgItem ( IDC_CHK_FRAME_BUFFER_EMULATION ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_FRAME_BUFFER_EMULATION , " Enable frame buffer emulation: \n \n If on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation. \n \n [Recommended: on for games which use frame buffer effects] " ) ;
2017-01-24 19:08:33 +00:00
m_cbxFBEnable . SetCheck ( g_settings - > fb_emulation_enabled ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxFBHWFBE . Attach ( GetDlgItem ( IDC_CHK_HARDWARE_FRAMEBUFFER ) ) ;
2017-04-18 12:03:49 +00:00
TTSetTxt ( IDC_CHK_HARDWARE_FRAMEBUFFER , " Enable hardware frame buffer emulation: \n \n If this option is on, plugin will create auxiliary frame buffers in video memory instead of copying frame buffer content into main memory. \n This allows plugin to run frame buffer effects without slowdown and without scaling image down to N64's native resolution. \n Modern cards also fully support it. \n \n [Recommended: on, if supported by your hardware] " ) ;
2017-01-24 19:08:33 +00:00
m_cbxFBHWFBE . SetCheck ( g_settings - > fb_hwfbe_set ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxFBGetFBI . Attach ( GetDlgItem ( IDC_CHK_GET_FRAMEBUFFER ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_GET_FRAMEBUFFER , " Get information about frame buffers: \n \n This is compatibility option. It must be set on for Mupen64 and off for 1964 " ) ;
2017-01-24 19:08:33 +00:00
m_cbxFBGetFBI . SetCheck ( g_settings - > fb_get_info_enabled ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxFBReadEveryFrame . Attach ( GetDlgItem ( IDC_CHK_READ_EVERY_FRAME ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_READ_EVERY_FRAME , " Read every frame: \n \n In some games plugin can't detect frame buffer usage. \n In such cases you need to enable this option to see frame buffer effects. \n Every drawn frame will be read from video card -> it works very slow. \n \n [Recommended: mostly off (needed only for a few games)] " ) ;
2017-01-24 19:08:33 +00:00
m_cbxFBReadEveryFrame . SetCheck ( g_settings - > fb_ref_enabled ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxFBasTex . Attach ( GetDlgItem ( IDC_RENDER_FRAME_AS_TEXTURE ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_RENDER_FRAME_AS_TEXTURE , " Render N64 frame buffer as texture: \n \n When this option is enabled, content of each N64 frame buffer is rendered as texture over the frame, rendered by the plugin. \n This prevents graphics lost, but may cause slowdowns and various glitches in some games. \n \n [Recommended: mostly off] " ) ;
2017-01-24 19:08:33 +00:00
m_cbxFBasTex . SetCheck ( g_settings - > fb_read_back_to_screen_enabled ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxDetect . Attach ( GetDlgItem ( IDC_CHK_DETECT_CPU_WRITE ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_DETECT_CPU_WRITE , " Detect CPU write to the N64 frame buffer: \n \n This option works as the previous options, but the plugin is trying to detect, when game uses CPU writes to N64 frame buffer. \n The N64 frame buffer is rendered only when CPU writes is detected. \n Use this option for those games, in which you see still image or no image at all for some time with no reason. \n \n [Recommended: mostly off] " ) ;
2017-01-24 19:08:33 +00:00
m_cbxDetect . SetCheck ( g_settings - > fb_cpu_write_hack_enabled ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxFBDepthBuffer . Attach ( GetDlgItem ( IDC_SOFTWARE_DEPTH_BUFFER ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_SOFTWARE_DEPTH_BUFFER , " Enable depth buffer rendering: \n \n This option is used to fully emulate N64 depth buffer. \n It is required for correct emulation of depth buffer based effects. \n However, it requires fast (>1GHz) CPU to work full speed. \n \n [Recommended: on for fast PC] " ) ;
2017-01-24 19:08:33 +00:00
m_cbxFBDepthBuffer . SetCheck ( g_settings - > fb_depth_render_enabled ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
return TRUE ;
2016-01-20 08:39:07 +00:00
}
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
bool OnApply ( )
2016-01-20 08:39:07 +00:00
{
2017-01-29 09:10:32 +00:00
g_settings - > SetFiltering ( ( CSettings : : Filtering_t ) m_cmbFiltering . GetItemData ( m_cmbFiltering . GetCurSel ( ) ) ) ;
2017-01-29 06:47:28 +00:00
g_settings - > SetAspectmode ( ( CSettings : : AspectMode_t ) m_cmbAspect . GetItemData ( m_cmbAspect . GetCurSel ( ) ) ) ;
2017-01-29 18:05:06 +00:00
g_settings - > SetSwapMode ( ( CSettings : : SwapMode_t ) m_cmbBufferSwap . GetItemData ( m_cmbBufferSwap . GetCurSel ( ) ) ) ;
2017-03-09 20:54:56 +00:00
g_settings - > SetFog ( m_cbxFog . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-09 21:06:58 +00:00
g_settings - > SetBuffClear ( m_cbxBuffer . GetCheck ( ) = = BST_CHECKED ) ;
2017-01-29 21:03:23 +00:00
g_settings - > SetLODmode ( ( CSettings : : PixelLevelOfDetail_t ) m_cmbLOD . GetItemData ( m_cmbLOD . GetCurSel ( ) ) ) ;
2016-03-09 06:44:01 +00:00
2017-01-24 19:08:33 +00:00
CButton * fb_buttons [ ] =
{
& m_cbxFBEnable , & m_cbxFBHWFBE , & m_cbxFBReadEveryFrame ,
& m_cbxFBasTex , & m_cbxDetect ,
& m_cbxFBGetFBI , & m_cbxFBDepthBuffer
} ;
CSettings : : fb_bits_t bits [ ] =
{
CSettings : : fb_emulation , CSettings : : fb_hwfbe , CSettings : : fb_ref ,
CSettings : : fb_read_back_to_screen , CSettings : : fb_cpu_write_hack ,
CSettings : : fb_get_info , CSettings : : fb_depth_render
} ;
uint32_t fb_add_bits = 0 , fb_remove_bits = 0 ;
for ( int i = 0 ; i < ( sizeof ( fb_buttons ) / sizeof ( fb_buttons [ 0 ] ) ) ; i + + )
{
if ( fb_buttons [ i ] - > GetCheck ( ) = = BST_CHECKED )
{
fb_add_bits | = bits [ i ] ;
}
else
{
fb_remove_bits | = bits [ i ] ;
}
}
g_settings - > UpdateFrameBufferBits ( fb_add_bits , fb_remove_bits ) ;
2017-04-30 19:18:09 +00:00
if ( g_settings - > dirty ( ) )
2016-01-20 08:39:07 +00:00
{
2017-01-27 06:30:19 +00:00
g_settings - > WriteSettings ( ) ;
2016-01-20 17:12:15 +00:00
}
2016-03-09 06:44:01 +00:00
return true ;
2013-04-04 21:22:19 +00:00
}
2016-03-09 06:44:01 +00:00
private :
void ItemChanged ( UINT /*Code*/ , int /*id*/ , HWND /*ctl*/ )
{
SendMessage ( GetParent ( ) , PSM_CHANGED , ( WPARAM ) m_hWnd , 0 ) ;
}
CComboBox m_cmbFiltering ;
CComboBox m_cmbBufferSwap ;
CComboBox m_cmbLOD ;
CComboBox m_cmbAspect ;
CButton m_cbxFog ;
CButton m_cbxBuffer ;
CButton m_cbxFBEnable ;
CButton m_cbxFBHWFBE ;
CButton m_cbxFBGetFBI ;
CButton m_cbxFBReadEveryFrame ;
CButton m_cbxFBasTex ;
CButton m_cbxDetect ;
CButton m_cbxFBDepthBuffer ;
} ;
2013-04-04 21:22:19 +00:00
2017-04-18 12:03:49 +00:00
class CDebugSettings :
public CPropertyPageImpl < CDebugSettings > ,
public CToolTipDialog < CDebugSettings >
{
public :
enum { IDD = IDD_DEBUG_SETTINGS } ;
BEGIN_MSG_MAP ( CDebugSettings )
MESSAGE_HANDLER ( WM_INITDIALOG , OnInitDialog )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_SETTINGS , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_UNKNOWN , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_GLIDE64 , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_INTERFACE , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_RESOLUTION , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_GLITCH , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_RDP , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_TLUT , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_PNG , CBN_SELCHANGE , ItemChanged )
COMMAND_HANDLER_EX ( IDC_CMB_TRACE_OGLWRAPPER , CBN_SELCHANGE , ItemChanged )
CHAIN_MSG_MAP ( CToolTipDialog < CDebugSettings > )
CHAIN_MSG_MAP ( CPropertyPageImpl < CDebugSettings > )
END_MSG_MAP ( )
LRESULT OnInitDialog ( UINT /*uMsg*/ , WPARAM /*wParam*/ , LPARAM /*lParam*/ , BOOL & /*bHandled*/ )
{
TTInit ( ) ;
TTSize ( 400 ) ;
m_cmbTraceSettings . Attach ( GetDlgItem ( IDC_CMB_TRACE_SETTINGS ) ) ;
m_cmbTraceUnknown . Attach ( GetDlgItem ( IDC_CMB_TRACE_UNKNOWN ) ) ;
m_cmbTraceGlide64 . Attach ( GetDlgItem ( IDC_CMB_TRACE_GLIDE64 ) ) ;
m_cmbTraceInterface . Attach ( GetDlgItem ( IDC_CMB_TRACE_INTERFACE ) ) ;
m_cmbTraceresolution . Attach ( GetDlgItem ( IDC_CMB_TRACE_RESOLUTION ) ) ;
m_cmbTraceGlitch . Attach ( GetDlgItem ( IDC_CMB_TRACE_GLITCH ) ) ;
m_cmbTraceRDP . Attach ( GetDlgItem ( IDC_CMB_TRACE_RDP ) ) ;
m_cmbTraceTLUT . Attach ( GetDlgItem ( IDC_CMB_TRACE_TLUT ) ) ;
m_cmbTracePNG . Attach ( GetDlgItem ( IDC_CMB_TRACE_PNG ) ) ;
m_cmbTraceOGLWrapper . Attach ( GetDlgItem ( IDC_CMB_TRACE_OGLWRAPPER ) ) ;
m_cmbTraceRDPCommands . Attach ( GetDlgItem ( IDC_CMB_TRACE_RDP_COMMANDS ) ) ;
struct {
CComboBox & cmb ;
uint16_t SettingId ;
} TraceCMB [ ] =
2017-04-30 19:18:09 +00:00
{
2017-04-18 12:03:49 +00:00
{ m_cmbTraceSettings , Set_Logging_Settings } ,
{ m_cmbTraceUnknown , Set_Logging_Unknown } ,
{ m_cmbTraceGlide64 , Set_Logging_Glide64 } ,
{ m_cmbTraceInterface , Set_Logging_Interface } ,
{ m_cmbTraceresolution , Set_Logging_Resolution } ,
{ m_cmbTraceGlitch , Set_Logging_Glitch } ,
{ m_cmbTraceRDP , Set_Logging_VideoRDP } ,
{ m_cmbTraceTLUT , Set_Logging_TLUT } ,
{ m_cmbTracePNG , Set_Logging_PNG } ,
{ m_cmbTraceOGLWrapper , Set_Logging_OGLWrapper } ,
{ m_cmbTraceRDPCommands , Set_Logging_RDPCommands } ,
} ;
for ( size_t i = 0 , n = sizeof ( TraceCMB ) / sizeof ( TraceCMB [ 0 ] ) ; i < n ; i + + )
{
TraceCMB [ i ] . cmb . SetItemData ( TraceCMB [ i ] . cmb . AddString ( " Error " ) , TraceError ) ;
TraceCMB [ i ] . cmb . SetItemData ( TraceCMB [ i ] . cmb . AddString ( " Warning " ) , TraceWarning ) ;
TraceCMB [ i ] . cmb . SetItemData ( TraceCMB [ i ] . cmb . AddString ( " Notice " ) , TraceNotice ) ;
TraceCMB [ i ] . cmb . SetItemData ( TraceCMB [ i ] . cmb . AddString ( " Info " ) , TraceInfo ) ;
TraceCMB [ i ] . cmb . SetItemData ( TraceCMB [ i ] . cmb . AddString ( " Debug " ) , TraceDebug ) ;
TraceCMB [ i ] . cmb . SetItemData ( TraceCMB [ i ] . cmb . AddString ( " Verbose " ) , TraceVerbose ) ;
SetComboBoxIndex ( TraceCMB [ i ] . cmb , ( uint32_t ) GetSetting ( TraceCMB [ i ] . SettingId ) ) ;
}
return TRUE ;
}
bool OnApply ( )
{
struct {
CComboBox & cmb ;
uint16_t SettingId ;
} TraceCMB [ ] =
{
{ m_cmbTraceSettings , Set_Logging_Settings } ,
{ m_cmbTraceUnknown , Set_Logging_Unknown } ,
{ m_cmbTraceGlide64 , Set_Logging_Glide64 } ,
{ m_cmbTraceInterface , Set_Logging_Interface } ,
{ m_cmbTraceresolution , Set_Logging_Resolution } ,
{ m_cmbTraceGlitch , Set_Logging_Glitch } ,
{ m_cmbTraceRDP , Set_Logging_VideoRDP } ,
{ m_cmbTraceTLUT , Set_Logging_TLUT } ,
{ m_cmbTracePNG , Set_Logging_PNG } ,
{ m_cmbTraceOGLWrapper , Set_Logging_OGLWrapper } ,
{ m_cmbTraceRDPCommands , Set_Logging_RDPCommands } ,
} ;
for ( size_t i = 0 , n = sizeof ( TraceCMB ) / sizeof ( TraceCMB [ 0 ] ) ; i < n ; i + + )
{
SetSetting ( TraceCMB [ i ] . SettingId , TraceCMB [ i ] . cmb . GetItemData ( TraceCMB [ i ] . cmb . GetCurSel ( ) ) ) ;
}
return true ;
}
private :
void ItemChanged ( UINT /*Code*/ , int /*id*/ , HWND /*ctl*/ )
{
SendMessage ( GetParent ( ) , PSM_CHANGED , ( WPARAM ) m_hWnd , 0 ) ;
}
CComboBox m_cmbTraceSettings ;
CComboBox m_cmbTraceUnknown ;
CComboBox m_cmbTraceGlide64 ;
CComboBox m_cmbTraceInterface ;
CComboBox m_cmbTraceresolution ;
CComboBox m_cmbTraceGlitch ;
CComboBox m_cmbTraceRDP ;
CComboBox m_cmbTraceTLUT ;
CComboBox m_cmbTracePNG ;
CComboBox m_cmbTraceOGLWrapper ;
CComboBox m_cmbTraceRDPCommands ;
} ;
2016-03-09 06:44:01 +00:00
class CConfigTextureEnhancement :
public CPropertyPageImpl < CConfigTextureEnhancement > ,
public CToolTipDialog < CConfigTextureEnhancement >
2013-04-04 21:22:19 +00:00
{
2016-03-09 06:44:01 +00:00
public :
enum { IDD = IDD_TEXTURE_ENHANCEMENT } ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
BEGIN_MSG_MAP ( CConfigTextureEnhancement )
MESSAGE_HANDLER ( WM_INITDIALOG , OnInitDialog )
CHAIN_MSG_MAP ( CToolTipDialog < CConfigTextureEnhancement > )
CHAIN_MSG_MAP ( CPropertyPageImpl < CConfigTextureEnhancement > )
END_MSG_MAP ( )
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
LRESULT OnInitDialog ( UINT /*uMsg*/ , WPARAM /*wParam*/ , LPARAM /*lParam*/ , BOOL & /*bHandled*/ )
{
TTInit ( ) ;
2017-04-18 12:03:49 +00:00
TTSize ( 400 ) ;
2016-03-09 06:44:01 +00:00
2016-07-07 22:45:12 +00:00
std : : string tooltip = " Filters: \n \n Apply a filter to either smooth or sharpen textures. \n There are 4 different smoothing filters and 2 different sharpening filters. \n The higher the number, the stronger the effect, \n i.e. \" Smoothing filter 4 \" will have a much more noticeable effect than \" Smoothing filter 1 \" . \n Be aware that performance may have an impact depending on the game and/or the PC. \n \n [Recommended: your preference] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_ENH_FILTER , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CMB_ENH_FILTER , tooltip . c_str ( ) ) ;
m_cmbEnhFilter . Attach ( GetDlgItem ( IDC_CMB_ENH_FILTER ) ) ;
2017-01-30 06:51:54 +00:00
m_cmbEnhFilter . SetItemData ( m_cmbEnhFilter . AddString ( " None " ) , CSettings : : TextureFilter_None ) ;
m_cmbEnhFilter . SetItemData ( m_cmbEnhFilter . AddString ( " Smooth filtering 1 " ) , CSettings : : TextureFilter_SmoothFiltering ) ;
m_cmbEnhFilter . SetItemData ( m_cmbEnhFilter . AddString ( " Smooth filtering 2 " ) , CSettings : : TextureFilter_SmoothFiltering2 ) ;
m_cmbEnhFilter . SetItemData ( m_cmbEnhFilter . AddString ( " Smooth filtering 3 " ) , CSettings : : TextureFilter_SmoothFiltering3 ) ;
m_cmbEnhFilter . SetItemData ( m_cmbEnhFilter . AddString ( " Smooth filtering 4 " ) , CSettings : : TextureFilter_SmoothFiltering4 ) ;
m_cmbEnhFilter . SetItemData ( m_cmbEnhFilter . AddString ( " Sharp filtering 1 " ) , CSettings : : TextureFilter_SharpFiltering1 ) ;
m_cmbEnhFilter . SetItemData ( m_cmbEnhFilter . AddString ( " Sharp filtering 2 " ) , CSettings : : TextureFilter_SharpFiltering2 ) ;
SetComboBoxIndex ( m_cmbEnhFilter , g_settings - > ghq_fltr ( ) ) ;
2013-04-04 21:22:19 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Texture enhancement: \n \n 7 different filters are selectable here, each one with a distinctive look. \n Be aware of possible performance impacts. \n \n IMPORTANT: 'Store' mode - saves textures in cache 'as is'. \n It can improve performance in games, which load many textures. \n Disable 'Ignore backgrounds' option for better result. \n \n [Recommended: your preference] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_ENHANCEMENT , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CMB_ENHANCEMENT , tooltip . c_str ( ) ) ;
m_cmbEnhEnhancement . Attach ( GetDlgItem ( IDC_CMB_ENHANCEMENT ) ) ;
2017-01-30 07:01:22 +00:00
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " None " ) , CSettings : : TextureEnht_None ) ;
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " X2 " ) , CSettings : : TextureEnht_X2 ) ;
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " X2SAI " ) , CSettings : : TextureEnht_X2SAI ) ;
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " HQ2X " ) , CSettings : : TextureEnht_HQ2X ) ;
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " HQ2XS " ) , CSettings : : TextureEnht_HQ2XS ) ;
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " LQ2X " ) , CSettings : : TextureEnht_LQ2X ) ;
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " LQ2XS " ) , CSettings : : TextureEnht_LQ2XS ) ;
m_cmbEnhEnhancement . SetItemData ( m_cmbEnhEnhancement . AddString ( " HQ4X " ) , CSettings : : TextureEnht_HQ4X ) ;
SetComboBoxIndex ( m_cmbEnhEnhancement , g_settings - > ghq_enht ( ) ) ;
2013-04-04 21:22:19 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Hi-res pack format: \n \n Choose which method is to be used for loading Hi-res texture packs. \n Only Rice's format is available currently. \n Leave on \" None \" if you will not be needing to load hi-res packs. \n \n [Recommended: Rice's format. Default: \" None \" ] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_FORMAT_CHOICES , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CMB_FORMAT_CHOICES , tooltip . c_str ( ) ) ;
m_cmbHrsFormat . Attach ( GetDlgItem ( IDC_CMB_FORMAT_CHOICES ) ) ;
2017-03-09 21:37:26 +00:00
m_cmbHrsFormat . SetItemData ( m_cmbHrsFormat . AddString ( " None " ) , CSettings : : HiResPackFormat_None ) ;
m_cmbHrsFormat . SetItemData ( m_cmbHrsFormat . AddString ( " Rice format " ) , CSettings : : HiResPackFormat_Riceformat ) ;
SetComboBoxIndex ( m_cmbHrsFormat , g_settings - > ghq_hirs ( ) ) ;
2016-03-09 06:44:01 +00:00
m_cmbTextureCompression . Attach ( GetDlgItem ( IDC_CMB_TEX_COMPRESS_MEHTOD ) ) ;
2017-03-13 06:55:09 +00:00
m_cmbTextureCompression . SetItemData ( m_cmbTextureCompression . AddString ( " S3TC " ) , CSettings : : TextureCompression_S3TC ) ;
m_cmbTextureCompression . SetItemData ( m_cmbTextureCompression . AddString ( " FXT1 " ) , CSettings : : TextureCompression_FXT1 ) ;
2017-03-09 21:21:52 +00:00
SetComboBoxIndex ( m_cmbTextureCompression , g_settings - > ghq_cmpr ( ) ) ;
2013-04-04 21:22:19 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Texture cache size: \n \n Enhanced and filtered textures can be cached to aid performance. \n This setting will adjust how much PC memory will be dedicated for texture cache. \n This helps boost performance if there are subsequent requests for the same texture (usually the case). \n Normally, 128MB should be more than enough but there is a sweet spot for each game. \n Super Mario may not need more than 32megs, but Conker streams a lot of textures, so setting 256+ megs can boost performance. \n Adjust accordingly if you are encountering speed issues. \n '0' disables cache. \n \n [Recommended: PC and game dependant] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_TXT_TEXTURE_CACHE , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_SPIN_TEXTURE_CACHE , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_TEXT_MB , tooltip . c_str ( ) ) ;
m_textTexCache . Attach ( GetDlgItem ( IDC_TXT_TEXTURE_CACHE ) ) ;
2017-03-12 17:49:23 +00:00
m_textTexCache . SetWindowTextA ( stdstr_f ( " %d " , g_settings - > ghq_cache_size ( ) ) . c_str ( ) ) ;
2016-03-09 06:44:01 +00:00
m_spinEnhCacheSize . Attach ( GetDlgItem ( IDC_SPIN_TEXTURE_CACHE ) ) ;
m_spinEnhCacheSize . SetBuddy ( m_textTexCache ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_IGNORE_BACKGROUND , " Ignore Backgrounds: \n \n It is used to skip enhancement for long narrow textures, usually used for backgrounds. \n This may save texture memory greatly and increase performance. \n \n [Recommended: on (off for 'Store' mode)] " ) ;
2016-03-09 06:44:01 +00:00
m_cbxEnhIgnoreBG . Attach ( GetDlgItem ( IDC_CHK_IGNORE_BACKGROUND ) ) ;
2017-04-18 12:03:49 +00:00
m_cbxEnhIgnoreBG . SetCheck ( g_settings - > ghq_enht_nobg ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2013-04-04 21:22:19 +00:00
2016-07-07 22:45:12 +00:00
tooltip = " Texture compression: \n \n Textures will be compressed using selected texture compression method. \n The overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC. \n In addition to saving space on the texture cache, the space occupied on the GFX hardware's texture RAM, by the enhanced textures, will be greatly reduced. \n This minimizes texture RAM usage, decreasing the number of texture swaps to the GFX hardware leading to performance gains. \n However, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradation of small size textures and color banding of gradient colored textures. \n \n [Recommended: off] " ;
2016-03-09 06:44:01 +00:00
TTSetTxt ( IDC_CHK_TEX_COMPRESSION , tooltip . c_str ( ) ) ;
TTSetTxt ( IDC_CHK_HIRES_TEX_COMPRESSION , tooltip . c_str ( ) ) ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
m_cbxEnhTexCompression . Attach ( GetDlgItem ( IDC_CHK_TEX_COMPRESSION ) ) ;
2017-04-18 12:03:49 +00:00
m_cbxEnhTexCompression . SetCheck ( g_settings - > ghq_enht_cmpr ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxHrsTexCompression . Attach ( GetDlgItem ( IDC_CHK_HIRES_TEX_COMPRESSION ) ) ;
2017-03-10 06:01:41 +00:00
m_cbxHrsTexCompression . SetCheck ( g_settings - > ghq_hirs_cmpr ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2013-04-04 21:22:19 +00:00
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_COMPRESS_CACHE , " Compress texture cache: \n \n Memory will be compressed so that more textures can be held in the texture cache. \n The compression ratio varies with each texture, but 1/5 of the original size would be a modest approximation. \n They will be decompressed on-the-fly, before being downloaded to the gfx hardware. \n This option will still help save memory space even when using texture compression. \n \n [Recommended: on] " ) ;
2016-03-09 06:44:01 +00:00
m_cbxEnhCompressCache . Attach ( GetDlgItem ( IDC_CHK_COMPRESS_CACHE ) ) ;
2017-04-18 12:03:49 +00:00
m_cbxEnhCompressCache . SetCheck ( g_settings - > ghq_enht_gz ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
m_cbxHrsTile . Attach ( GetDlgItem ( IDC_CHK_TILE_TEX ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_TILE_TEX , " Tile textures: \n \n When on, wide texture will be split on several tiles to fit in one 256-width texture. \n This tiled texture takes much less video memory space and thus overall performance will increase. \n However, corresponding polygons must be split too, and this is not polished yet - various issues are possible, including black lines and polygons distortions. \n \n [Recommended: off] " ) ;
2017-03-10 06:10:09 +00:00
m_cbxHrsTile . SetCheck ( g_settings - > ghq_hirs_tile ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
m_cbxHrsForce16 . Attach ( GetDlgItem ( IDC_CHK_FORCE_16BPP_TEXT ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_FORCE_16BPP_TEXT , " Force 16bpp textures: \n \n The color of the textures will be reduced to 16bpp. \n This is another space saver and performance enhancer. \n This halves the space used on the texture cache and the GFX hardware's texture RAM. \n Color reduction is done so that the original quality is preserved as much as possible. \n Depending on the texture, this usually is hardly noticeable. \n Sometimes though, it can be: skies are a good example. \n \n [Recommended: off] " ) ;
2017-04-18 12:03:49 +00:00
m_cbxHrsForce16 . SetCheck ( g_settings - > ghq_hirs_f16bpp ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxHrsTexEdit . Attach ( GetDlgItem ( IDC_CHK_TEX_DUMP_EDIT ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_TEX_DUMP_EDIT , " Texture dumping mode: \n \n In this mode, you have that ability to dump textures on screen to the appropriate folder. \n You can also reload textures while the game is running to see how they look instantly - big time saver! \n \n Hotkeys: \n \" R \" reloads hires textures from the texture pack \n \" D \" toggles texture dumps on/off. " ) ;
2017-04-18 12:03:49 +00:00
m_cbxHrsTexEdit . SetCheck ( g_settings - > ghq_hirs_dump ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxHrsAltCRC . Attach ( GetDlgItem ( IDC_CHK_ALT_CRC ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_ALT_CRC , " Alternative CRC calculation: \n \n This option enables emulation of a palette CRC calculation bug in RiceVideo. \n If some textures are not loaded, try to set this option on/off. \n \n [Recommended: texture pack dependant, mostly on] " ) ;
2017-04-18 12:03:49 +00:00
m_cbxHrsAltCRC . SetCheck ( g_settings - > ghq_hirs_altcrc ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2017-03-12 17:57:37 +00:00
if ( g_settings - > ghq_hirs_dump ( ) )
2016-03-09 06:44:01 +00:00
{
m_cbxHrsAltCRC . EnableWindow ( false ) ;
}
m_cbxHrsCompressCache . Attach ( GetDlgItem ( IDC_CHK_HRS_COMPRESS_CACHE ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_HRS_COMPRESS_CACHE , " Compress texture cache: \n \n When game started, plugin loads all its hi-resolution textures into PC memory. \n Since hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory. \n Cache compression allows save memory space greatly. \n Textures will be decompressed on-the-fly, before being downloaded to the gfx hardware. \n This option will still help save memory space even when using texture compression. \n \n [Recommended: on] " ) ;
2017-04-18 12:03:49 +00:00
m_cbxHrsCompressCache . SetCheck ( g_settings - > ghq_hirs_gz ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxHrsLetFly . Attach ( GetDlgItem ( IDC_CHK_USE_ALPHA_FULLY ) ) ;
2016-07-07 22:45:12 +00:00
TTSetTxt ( IDC_CHK_USE_ALPHA_FULLY , " Use Alpha channel fully: \n \n When this option is off, 16bit rgba textures will be loaded using RiceVideo style, with 1bit for alpha channel. \n When it is on, GlideHQ will check, how alpha channel is used by the hires texture, and select most appropriate format for it. \n This gives texture designers freedom to play with alpha, as they need, regardless of format of original N64 texture. \n For older and badly designed texture packs it can cause unwanted black borders. \n \n [Recommended: texture pack dependant] " ) ;
2017-04-18 12:03:49 +00:00
m_cbxHrsLetFly . SetCheck ( g_settings - > ghq_hirs_let_texartists_fly ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
m_cbxSaveTexCache . Attach ( GetDlgItem ( IDC_CHK_TEX_CACHE_HD ) ) ;
2016-08-21 21:40:25 +00:00
TTSetTxt ( IDC_CHK_TEX_CACHE_HD , " Save texture cache to HD: \n \n For enhanced textures cache: \n This will save all previously loaded and enhanced textures to HD. \n So upon next game launch, all the textures will be instantly loaded, resulting in smoother performance. \n \n For high-resolution textures cache: \n After creation, loading hi-res texture will take only a few seconds upon game launch, as opposed to the 5 to 60 seconds a pack can take to load without this cache file. \n The only downside here is upon any changes to the pack, the cache file will need to be manually deleted. \n \n Saved cache files go into a folder called \" Cache \" within the Textures folder. \n \n [Highly Recommended: on] " ) ;
2017-04-18 12:03:49 +00:00
m_cbxSaveTexCache . SetCheck ( g_settings - > ghq_cache_save ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2016-03-09 06:44:01 +00:00
return TRUE ;
}
bool OnApply ( )
{
char texcache [ 100 ] ;
m_textTexCache . GetWindowText ( texcache , sizeof ( texcache ) ) ;
2017-01-30 06:51:54 +00:00
g_settings - > SetGhqFltr ( ( CSettings : : TextureFilter_t ) m_cmbEnhFilter . GetItemData ( m_cmbEnhFilter . GetCurSel ( ) ) ) ;
2017-01-30 07:01:22 +00:00
g_settings - > SetGhqEnht ( ( CSettings : : TextureEnhancement_t ) m_cmbEnhEnhancement . GetItemData ( m_cmbEnhEnhancement . GetCurSel ( ) ) ) ;
2017-03-12 17:49:23 +00:00
g_settings - > SetGhqCacheSize ( atoi ( texcache ) ) ;
2017-03-10 05:55:00 +00:00
g_settings - > SetGhqEnhtNobg ( m_cbxEnhIgnoreBG . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-10 05:31:59 +00:00
g_settings - > SetGhqEnhtCmpr ( m_cbxEnhTexCompression . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-10 05:42:29 +00:00
g_settings - > SetGhqEnhtGz ( m_cbxEnhCompressCache . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-09 21:37:26 +00:00
g_settings - > SetGhqHirs ( ( CSettings : : HiResPackFormat_t ) m_cmbHrsFormat . GetItemData ( m_cmbHrsFormat . GetCurSel ( ) ) ) ;
2017-03-10 06:10:09 +00:00
g_settings - > SetGhqHirsTile ( m_cbxHrsTile . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-10 12:03:10 +00:00
g_settings - > SetGhqHirsF16bpp ( m_cbxHrsForce16 . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-12 17:57:37 +00:00
g_settings - > SetGhqHirsDump ( m_cbxHrsTexEdit . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-10 20:43:12 +00:00
g_settings - > SetGhqHirsAltcrc ( m_cbxHrsAltCRC . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-10 06:01:41 +00:00
g_settings - > SetGhqHirsCmpr ( m_cbxHrsTexCompression . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-10 12:17:57 +00:00
g_settings - > SetGhqHirsGz ( m_cbxHrsCompressCache . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-12 17:54:23 +00:00
g_settings - > SetGhqHirsLetTexartistsFly ( m_cbxHrsLetFly . GetCheck ( ) = = BST_CHECKED ) ;
2017-03-09 21:21:52 +00:00
g_settings - > SetGhqCmpr ( ( CSettings : : TextureCompression_t ) m_cmbTextureCompression . GetItemData ( m_cmbTextureCompression . GetCurSel ( ) ) ) ;
2017-03-10 20:47:57 +00:00
g_settings - > SetGhqCacheSave ( m_cbxSaveTexCache . GetCheck ( ) = = BST_CHECKED ) ;
2017-04-30 19:18:09 +00:00
if ( g_settings - > dirty ( ) )
2016-03-09 06:44:01 +00:00
{
2017-01-27 06:30:19 +00:00
g_settings - > WriteSettings ( ) ;
2016-03-09 06:44:01 +00:00
}
return true ;
}
private :
void ItemChanged ( UINT /*Code*/ , int /*id*/ , HWND /*ctl*/ )
{
SendMessage ( GetParent ( ) , PSM_CHANGED , ( WPARAM ) m_hWnd , 0 ) ;
}
CComboBox m_cmbEnhFilter ;
CComboBox m_cmbEnhEnhancement ;
CComboBox m_cmbHrsFormat ;
CComboBox m_cmbTextureCompression ;
CButton m_cbxEnhIgnoreBG ;
CButton m_cbxEnhTexCompression ;
CButton m_cbxHrsTexCompression ;
CButton m_cbxEnhCompressCache ;
CButton m_cbxHrsTile ;
CButton m_cbxHrsForce16 ;
CButton m_cbxHrsTexEdit ;
CButton m_cbxHrsAltCRC ;
CButton m_cbxHrsCompressCache ;
CButton m_cbxHrsLetFly ;
CButton m_cbxSaveTexCache ;
CEdit m_textTexCache ;
CUpDownCtrl m_spinEnhCacheSize ;
2013-04-04 21:22:19 +00:00
} ;
2016-03-09 06:44:01 +00:00
COptionsSheet : : COptionsSheet ( _U_STRINGorID /*title*/ , UINT /*uStartPage*/ , HWND /*hWndParent*/ ) :
m_pgBasicPage ( new CConfigBasicPage ( this ) ) ,
m_pgEmuSettings ( new CConfigEmuSettings ) ,
2017-04-18 12:03:49 +00:00
m_pgDebugSettings ( new CDebugSettings ) ,
2016-03-09 06:44:01 +00:00
m_pgTextureEnhancement ( NULL ) ,
m_hTextureEnhancement ( 0 )
2016-03-08 22:22:28 +00:00
{
2016-03-09 06:44:01 +00:00
AddPage ( & m_pgBasicPage - > m_psp ) ;
2017-03-09 06:52:54 +00:00
if ( g_settings - > advanced_options ( ) )
2016-03-09 06:44:01 +00:00
{
AddPage ( & m_pgEmuSettings - > m_psp ) ;
}
2017-04-18 12:03:49 +00:00
if ( g_settings - > debugger_enabled ( ) )
{
AddPage ( & m_pgDebugSettings - > m_psp ) ;
}
2016-03-09 06:44:01 +00:00
UpdateTextureSettings ( ) ;
}
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
COptionsSheet : : ~ COptionsSheet ( )
2016-03-08 22:22:28 +00:00
{
2016-03-09 06:44:01 +00:00
delete m_pgBasicPage ;
delete m_pgEmuSettings ;
2017-04-18 12:03:49 +00:00
delete m_pgDebugSettings ;
2016-03-09 06:44:01 +00:00
delete m_pgTextureEnhancement ;
}
2013-04-04 21:22:19 +00:00
2016-03-09 06:44:01 +00:00
void COptionsSheet : : UpdateTextureSettings ( void )
2016-03-08 22:22:28 +00:00
{
2017-03-09 07:01:06 +00:00
if ( g_settings - > texenh_options ( ) )
2016-03-09 06:44:01 +00:00
{
if ( m_hTextureEnhancement = = NULL )
{
m_pgTextureEnhancement = new CConfigTextureEnhancement ;
m_hTextureEnhancement = m_pgTextureEnhancement - > Create ( ) ;
2016-04-02 09:01:37 +00:00
AddPage ( m_hTextureEnhancement ) ;
2016-03-09 06:44:01 +00:00
}
}
else if ( m_hTextureEnhancement ! = NULL )
{
RemovePage ( m_hTextureEnhancement ) ;
m_hTextureEnhancement = NULL ;
delete m_pgTextureEnhancement ;
m_pgTextureEnhancement = NULL ;
}
}
2013-04-04 21:22:19 +00:00
# endif
/******************************************************************
Function : DllConfig
Purpose : This function is optional function that is provided
to allow the user to configure the dll
input : a handle to the window that calls this function
output : none
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2017-04-18 12:03:49 +00:00
void CALL DllConfig ( void * hParent )
2013-04-04 21:22:19 +00:00
{
2016-02-04 10:22:19 +00:00
WriteTrace ( TraceGlide64 , TraceDebug , " - " ) ;
2016-01-25 09:33:04 +00:00
# ifdef _WIN32
CGuard guard ( * g_ProcessDListCS ) ;
2016-01-20 08:39:07 +00:00
2016-03-08 06:31:08 +00:00
if ( g_romopen )
2013-04-04 21:22:19 +00:00
{
2017-03-13 06:55:09 +00:00
if ( evoodoo ) // && fullscreen && !ev_fullscreen)
2016-01-20 08:39:07 +00:00
{
ReleaseGfx ( ) ;
rdp_reset ( ) ;
}
2017-03-10 05:25:04 +00:00
if ( g_ghq_use )
2016-01-20 08:39:07 +00:00
{
ext_ghq_shutdown ( ) ;
2017-03-10 05:25:04 +00:00
g_ghq_use = false ;
2016-01-20 08:39:07 +00:00
}
}
else
2013-04-04 21:22:19 +00:00
{
2016-01-20 08:39:07 +00:00
char name [ 21 ] = " DEFAULT " ;
2017-01-24 19:08:33 +00:00
g_settings - > ReadGameSettings ( name ) ;
2017-01-23 21:30:46 +00:00
ZLUT_init ( ) ;
2013-04-04 21:22:19 +00:00
}
2017-04-18 12:03:49 +00:00
COptionsSheet ( " Glide64 settings " ) . DoModal ( ( HWND ) hParent ) ;
2016-03-09 06:44:01 +00:00
CloseConfig ( ) ;
2016-01-25 09:33:04 +00:00
# endif
2013-04-04 21:22:19 +00:00
}
void CloseConfig ( )
{
2016-03-08 06:31:08 +00:00
if ( g_romopen )
2016-01-20 08:39:07 +00:00
{
2017-01-24 19:08:33 +00:00
if ( g_settings - > fb_depth_render_enabled ( ) )
{
2016-01-20 08:39:07 +00:00
ZLUT_init ( ) ;
2017-01-24 19:08:33 +00:00
}
2016-01-20 08:39:07 +00:00
// re-init evoodoo graphics to resize window
if ( evoodoo ) // && !ev_fullscreen)
InitGfx ( ) ;
else
rdp_reset ( ) ;
}
2013-04-04 21:22:19 +00:00
}
2016-03-08 22:22:28 +00:00
# ifdef _WIN32
class CAboutDlg :
public CDialogImpl < CAboutDlg >
2013-04-04 21:22:19 +00:00
{
2016-03-08 22:22:28 +00:00
public :
enum { IDD = IDD_ABOUTBOX } ;
2013-04-04 21:22:19 +00:00
2016-03-08 22:22:28 +00:00
BEGIN_MSG_MAP ( CAboutDlg )
MESSAGE_HANDLER ( WM_INITDIALOG , OnInitDialog )
COMMAND_ID_HANDLER ( IDOK , OnCloseCmd )
COMMAND_ID_HANDLER ( IDCANCEL , OnCloseCmd )
END_MSG_MAP ( )
2013-04-04 21:22:19 +00:00
2016-03-08 22:22:28 +00:00
LRESULT OnInitDialog ( UINT /*uMsg*/ , WPARAM /*wParam*/ , LPARAM /*lParam*/ , BOOL & /*bHandled*/ )
{
CenterWindow ( GetParent ( ) ) ;
return TRUE ;
}
2013-04-04 21:22:19 +00:00
2016-03-08 22:22:28 +00:00
LRESULT OnCloseCmd ( WORD /*wNotifyCode*/ , WORD wID , HWND /*hWndCtl*/ , BOOL & /*bHandled*/ )
{
EndDialog ( wID ) ;
return 0 ;
}
} ;
2013-04-04 21:22:19 +00:00
# endif
/******************************************************************
Function : DllAbout
Purpose : This function is optional function that is provided
to give further information about the DLL .
input : a handle to the window that calls this function
output : none
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2017-04-18 12:03:49 +00:00
void CALL DllAbout ( void * /*hParent*/ )
2013-04-04 21:22:19 +00:00
{
2016-03-08 22:22:28 +00:00
# ifdef _WIN32
CAboutDlg dlg ;
dlg . DoModal ( ) ;
2013-04-04 21:22:19 +00:00
# endif
2017-04-30 19:18:09 +00:00
}