2014-07-29 17:14:25 +00:00
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
2014-02-22 22:36:30 +00:00
# include <map>
# include <string>
# include <utility>
# include <vector>
# include <wx/arrstr.h>
# include <wx/button.h>
# include <wx/chartype.h>
# include <wx/checkbox.h>
# include <wx/choice.h>
# include <wx/control.h>
# include <wx/defs.h>
# include <wx/dialog.h>
# include <wx/event.h>
# include <wx/gdicmn.h>
# include <wx/notebook.h>
# include <wx/panel.h>
# include <wx/radiobut.h>
# include <wx/sizer.h>
# include <wx/slider.h>
# include <wx/stattext.h>
# include <wx/string.h>
# include <wx/translation.h>
# include <wx/window.h>
2010-11-15 09:54:07 +00:00
2014-02-17 10:18:15 +00:00
# include "Common/FileUtil.h"
2014-02-22 22:36:30 +00:00
# include "Common/SysConf.h"
# include "Core/ConfigManager.h"
2014-02-17 10:18:15 +00:00
# include "Core/Core.h"
2014-02-22 22:36:30 +00:00
# include "Core/CoreParameter.h"
2014-02-17 10:18:15 +00:00
# include "DolphinWX/Frame.h"
2014-07-08 14:49:33 +00:00
# include "DolphinWX/Main.h"
2014-02-17 10:18:15 +00:00
# include "DolphinWX/VideoConfigDiag.h"
2014-02-22 22:36:30 +00:00
# include "DolphinWX/WxUtils.h"
2014-08-02 06:21:03 +00:00
# include "VideoBackends/OGL/main.h"
2014-07-29 17:14:25 +00:00
# include "VideoCommon/PostProcessing.h"
2014-02-22 22:36:30 +00:00
# include "VideoCommon/VideoBackendBase.h"
# include "VideoCommon/VideoConfig.h"
2011-01-14 19:27:18 +00:00
2011-06-03 14:44:17 +00:00
# ifdef __APPLE__
# include <ApplicationServices/ApplicationServices.h>
# endif
2011-04-25 20:06:45 +00:00
// template instantiation
template class BoolSetting < wxCheckBox > ;
template class BoolSetting < wxRadioButton > ;
2010-11-15 09:54:07 +00:00
2011-04-25 20:06:45 +00:00
template < >
SettingCheckBox : : BoolSetting ( wxWindow * parent , const wxString & label , const wxString & tooltip , bool & setting , bool reverse , long style )
2014-12-02 03:56:18 +00:00
: wxCheckBox ( parent , wxID_ANY , label , wxDefaultPosition , wxDefaultSize , style )
2010-11-15 09:54:07 +00:00
, m_setting ( setting )
2011-03-21 19:57:31 +00:00
, m_reverse ( reverse )
2010-11-15 09:54:07 +00:00
{
2010-12-05 14:37:21 +00:00
SetToolTip ( tooltip ) ;
2011-03-21 19:57:31 +00:00
SetValue ( m_setting ^ m_reverse ) ;
2014-05-17 16:49:00 +00:00
Bind ( wxEVT_CHECKBOX , & SettingCheckBox : : UpdateValue , this ) ;
2011-03-21 19:57:31 +00:00
}
2011-03-21 05:46:33 +00:00
2011-04-25 20:06:45 +00:00
template < >
SettingRadioButton : : BoolSetting ( wxWindow * parent , const wxString & label , const wxString & tooltip , bool & setting , bool reverse , long style )
2014-12-02 03:56:18 +00:00
: wxRadioButton ( parent , wxID_ANY , label , wxDefaultPosition , wxDefaultSize , style )
2010-11-15 09:54:07 +00:00
, m_setting ( setting )
, m_reverse ( reverse )
{
2010-12-05 14:37:21 +00:00
SetToolTip ( tooltip ) ;
2011-03-21 19:57:31 +00:00
SetValue ( m_setting ^ m_reverse ) ;
2014-05-17 16:49:00 +00:00
Bind ( wxEVT_RADIOBUTTON , & SettingRadioButton : : UpdateValue , this ) ;
2010-11-15 09:54:07 +00:00
}
2011-04-25 20:06:45 +00:00
SettingChoice : : SettingChoice ( wxWindow * parent , int & setting , const wxString & tooltip , int num , const wxString choices [ ] , long style )
2014-12-02 03:56:18 +00:00
: wxChoice ( parent , wxID_ANY , wxDefaultPosition , wxDefaultSize , num , choices )
2011-03-21 19:57:31 +00:00
, m_setting ( setting )
{
SetToolTip ( tooltip ) ;
2011-04-25 20:06:45 +00:00
Select ( m_setting ) ;
2014-05-17 16:49:00 +00:00
Bind ( wxEVT_CHOICE , & SettingChoice : : UpdateValue , this ) ;
2011-03-21 19:57:31 +00:00
}
2011-04-25 20:06:45 +00:00
void SettingChoice : : UpdateValue ( wxCommandEvent & ev )
2011-03-21 19:57:31 +00:00
{
2011-04-25 20:06:45 +00:00
m_setting = ev . GetInt ( ) ;
ev . Skip ( ) ;
2011-03-27 22:23:44 +00:00
}
2010-11-22 22:17:35 +00:00
void VideoConfigDiag : : Event_ClickClose ( wxCommandEvent & )
2010-11-15 09:54:07 +00:00
{
2011-02-06 15:15:00 +00:00
Close ( ) ;
2010-11-15 09:54:07 +00:00
}
2010-11-22 22:17:35 +00:00
void VideoConfigDiag : : Event_Close ( wxCloseEvent & ev )
{
2014-03-12 19:33:41 +00:00
g_Config . Save ( File : : GetUserPath ( D_CONFIG_IDX ) + ininame + " .ini " ) ;
2011-03-21 19:57:31 +00:00
2011-02-06 15:15:00 +00:00
EndModal ( wxID_OK ) ;
2010-11-22 22:17:35 +00:00
}
2013-03-28 22:32:51 +00:00
# if defined(_WIN32)
2014-07-08 13:58:25 +00:00
static wxString backend_desc = wxTRANSLATE ( " Selects what graphics API to use internally. \n The software renderer is only used for debugging, so you'll want to use either Direct3D or OpenGL. Different games will behave differently on each backend, so for best emulation experience it's recommended to try both and chose the one that fits your requirements best. \n Note that the Direct3D backend is not available on old Windows versions. \n \n If unsure, use OpenGL. " ) ;
2013-03-28 22:32:51 +00:00
# else
2014-07-08 13:58:25 +00:00
static wxString backend_desc = wxTRANSLATE ( " Selects what graphics API to use internally. \n The software renderer is only used for debugging, so unless you have a reason to use it you'll want to select OpenGL here. \n \n If unsure, use OpenGL. " ) ;
2013-03-28 22:32:51 +00:00
# endif
2014-07-08 13:58:25 +00:00
static wxString adapter_desc = wxTRANSLATE ( " Select a hardware adapter to use. \n \n If unsure, use the first one. " ) ;
2014-10-25 20:39:58 +00:00
static wxString display_res_desc = wxTRANSLATE ( " Selects the display resolution used in fullscreen mode. \n This should always be bigger than or equal to the internal resolution. Performance impact is negligible. \n \n If unsure, select auto. " ) ;
2014-07-08 13:58:25 +00:00
static wxString use_fullscreen_desc = wxTRANSLATE ( " Enable this if you want the whole screen to be used for rendering. \n If this is disabled, a render window will be created instead. \n \n If unsure, leave this unchecked. " ) ;
static wxString auto_window_size_desc = wxTRANSLATE ( " Automatically adjusts the window size to your internal resolution. \n \n If unsure, leave this unchecked. " ) ;
static wxString keep_window_on_top_desc = wxTRANSLATE ( " Keep the game window on top of all other windows. \n \n If unsure, leave this unchecked. " ) ;
2014-10-24 16:36:14 +00:00
static wxString hide_mouse_cursor_desc = wxTRANSLATE ( " Hides the mouse cursor if it's on top of the emulation window. \n \n If unsure, leave this unchecked. " ) ;
2014-07-08 13:58:25 +00:00
static wxString render_to_main_win_desc = wxTRANSLATE ( " Enable this if you want to use the main Dolphin window for rendering rather than a separate render window. \n \n If unsure, leave this unchecked. " ) ;
static wxString prog_scan_desc = wxTRANSLATE ( " Enables progressive scan if supported by the emulated software. \n Most games don't care about this. \n \n If unsure, leave this unchecked. " ) ;
static wxString ar_desc = wxTRANSLATE ( " Select what aspect ratio to use when rendering: \n Auto: Use the native aspect ratio \n Force 16:9: Stretch the picture to an aspect ratio of 16:9. \n Force 4:3: Stretch the picture to an aspect ratio of 4:3. \n Stretch to Window: Stretch the picture to the window size. \n \n If unsure, select Auto. " ) ;
2014-10-02 07:25:25 +00:00
static wxString ws_hack_desc = wxTRANSLATE ( " Force the game to output graphics for widescreen resolutions. \n Causes graphical glitches in some games. \n \n If unsure, leave this unchecked. " ) ;
2014-07-08 13:58:25 +00:00
static wxString vsync_desc = wxTRANSLATE ( " Wait for vertical blanks in order to reduce tearing. \n Decreases performance if emulation speed is below 100%. \n \n If unsure, leave this unchecked. " ) ;
static wxString af_desc = wxTRANSLATE ( " Enable anisotropic filtering. \n Enhances visual quality of textures that are at oblique viewing angles. \n Might cause issues in a small number of games. \n \n If unsure, select 1x. " ) ;
static wxString aa_desc = wxTRANSLATE ( " Reduces the amount of aliasing caused by rasterizing 3D graphics. \n This makes the rendered picture look less blocky. \n Heavily decreases emulation speed and sometimes causes issues. \n \n If unsure, select None. " ) ;
static wxString scaled_efb_copy_desc = wxTRANSLATE ( " Greatly increases quality of textures generated using render to texture effects. \n Raising the internal resolution will improve the effect of this setting. \n Slightly decreases performance and possibly causes issues (although unlikely). \n \n If unsure, leave this checked. " ) ;
static wxString pixel_lighting_desc = wxTRANSLATE ( " Calculate lighting of 3D graphics per-pixel rather than per vertex. \n Decreases emulation speed by some percent (depending on your GPU). \n This usually is a safe enhancement, but might cause issues sometimes. \n \n If unsure, leave this unchecked. " ) ;
static wxString fast_depth_calc_desc = wxTRANSLATE ( " Use a less accurate algorithm to calculate depth values. \n Causes issues in a few games but might give a decent speedup. \n \n If unsure, leave this checked. " ) ;
static wxString force_filtering_desc = wxTRANSLATE ( " Force texture filtering even if the emulated game explicitly disabled it. \n Improves texture quality slightly but causes glitches in some games. \n \n If unsure, leave this unchecked. " ) ;
2014-10-07 14:46:10 +00:00
static wxString borderless_fullscreen_desc = wxTRANSLATE ( " Implement fullscreen mode with a borderless window spanning the whole screen instead of using exclusive mode. \n Allows for faster transitions between fullscreen and windowed mode, but increases input latency, makes movement less smooth and slightly decreases performance. \n Exclusive mode is required to support Nvidia 3D Vision in the Direct3D backend. \n \n If unsure, leave this unchecked. " ) ;
2014-07-08 13:58:25 +00:00
static wxString internal_res_desc = wxTRANSLATE ( " Specifies the resolution used to render at. A high resolution will improve visual quality a lot but is also quite heavy on performance and might cause glitches in certain games. \n \" Multiple of 640x528 \" is a bit slower than \" Window Size \" but yields less issues. Generally speaking, the lower the internal resolution is, the better your performance will be. \n \n If unsure, select 640x528. " ) ;
static wxString efb_access_desc = wxTRANSLATE ( " Ignore any requests of the CPU to read from or write to the EFB. \n Improves performance in some games, but might disable some gameplay-related features or graphical effects. \n \n If unsure, leave this unchecked. " ) ;
static wxString efb_emulate_format_changes_desc = wxTRANSLATE ( " Ignore any changes to the EFB format. \n Improves performance in many games without any negative effect. Causes graphical defects in a small number of other games though. \n \n If unsure, leave this checked. " ) ;
static wxString efb_copy_desc = wxTRANSLATE ( " Disable emulation of EFB copies. \n These are often used for post-processing or render-to-texture effects, so while checking this setting gives a great speedup it almost always also causes issues. \n \n If unsure, leave this unchecked. " ) ;
static wxString efb_copy_texture_desc = wxTRANSLATE ( " Store EFB copies in GPU texture objects. \n This is not so accurate, but it works well enough for most games and gives a great speedup over EFB to RAM. \n \n If unsure, leave this checked. " ) ;
static wxString efb_copy_ram_desc = wxTRANSLATE ( " Accurately emulate EFB copies. \n Some games depend on this for certain graphical effects or gameplay functionality. \n \n If unsure, check EFB to Texture instead. " ) ;
static wxString stc_desc = wxTRANSLATE ( " The safer you adjust this, the less likely the emulator will be missing any texture updates from RAM. \n \n If unsure, use the rightmost value. " ) ;
static wxString wireframe_desc = wxTRANSLATE ( " Render the scene as a wireframe. \n \n If unsure, leave this unchecked. " ) ;
static wxString disable_fog_desc = wxTRANSLATE ( " Makes distant objects more visible by removing fog, thus increasing the overall detail. \n Disabling fog will break some games which rely on proper fog emulation. \n \n If unsure, leave this unchecked. " ) ;
static wxString disable_dstalpha_desc = wxTRANSLATE ( " Disables emulation of a hardware feature called destination alpha, which is used in many games for various graphical effects. \n \n If unsure, leave this unchecked. " ) ;
static wxString show_fps_desc = wxTRANSLATE ( " Show the number of frames rendered per second as a measure of emulation speed. \n \n If unsure, leave this unchecked. " ) ;
static wxString log_render_time_to_file_desc = wxTRANSLATE ( " Log the render time of every frame to User/Logs/render_time.txt. Use this feature when you want to measure the performance of Dolphin. \n \n If unsure, leave this unchecked. " ) ;
static wxString show_stats_desc = wxTRANSLATE ( " Show various statistics. \n \n If unsure, leave this unchecked. " ) ;
static wxString texfmt_desc = wxTRANSLATE ( " Modify textures to show the format they're encoded in. Needs an emulation reset in most cases. \n \n If unsure, leave this unchecked. " ) ;
static wxString efb_copy_regions_desc = wxTRANSLATE ( " [BROKEN] \n Highlight regions the EFB was copied from. \n \n If unsure, leave this unchecked. " ) ;
static wxString xfb_desc = wxTRANSLATE ( " Disable any XFB emulation. \n Speeds up emulation a lot but causes heavy glitches in many games which rely on them (especially homebrew applications). \n \n If unsure, leave this checked. " ) ;
static wxString xfb_virtual_desc = wxTRANSLATE ( " Emulate XFBs using GPU texture objects. \n Fixes many games which don't work without XFB emulation while not being as slow as real XFB emulation. However, it may still fail for a lot of other games (especially homebrew applications). \n \n If unsure, leave this checked. " ) ;
static wxString xfb_real_desc = wxTRANSLATE ( " Emulate XFBs accurately. \n Slows down emulation a lot and prohibits high-resolution rendering but is necessary to emulate a number of games properly. \n \n If unsure, check virtual XFB emulation instead. " ) ;
static wxString dump_textures_desc = wxTRANSLATE ( " Dump decoded game textures to User/Dump/Textures/<game_id>/ \n \n If unsure, leave this unchecked. " ) ;
static wxString load_hires_textures_desc = wxTRANSLATE ( " Load custom textures from User/Load/Textures/<game_id>/ \n \n If unsure, leave this unchecked. " ) ;
static wxString dump_efb_desc = wxTRANSLATE ( " Dump the contents of EFB copies to User/Dump/Textures/ \n \n If unsure, leave this unchecked. " ) ;
2011-02-11 22:09:20 +00:00
# if !defined WIN32 && defined HAVE_LIBAV
2014-07-08 13:58:25 +00:00
static wxString use_ffv1_desc = wxTRANSLATE ( " Encode frame dumps using the FFV1 codec. \n \n If unsure, leave this unchecked. " ) ;
2011-02-11 22:09:20 +00:00
# endif
2014-11-16 18:39:54 +00:00
static wxString free_look_desc = wxTRANSLATE ( " This feature allows you to change the game's camera. \n Move the mouse while holding the right mouse button to pan and while holding the middle button to move. \n Hold SHIFT and press one of the WASD keys to move the camera by a certain step distance (SHIFT+2 to move faster and SHIFT+1 to move slower). Press SHIFT+R to reset the camera and SHIFT+F to reset the speed. \n \n If unsure, leave this unchecked. " ) ;
2014-07-08 13:58:25 +00:00
static wxString crop_desc = wxTRANSLATE ( " Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10. \n \n If unsure, leave this unchecked. " ) ;
static wxString ppshader_desc = wxTRANSLATE ( " Apply a post-processing effect after finishing a frame. \n \n If unsure, select (off). " ) ;
static wxString cache_efb_copies_desc = wxTRANSLATE ( " Slightly speeds up EFB to RAM copies by sacrificing emulation accuracy. \n Sometimes also increases visual quality. \n If you're experiencing any issues, try raising texture cache accuracy or disable this option. \n \n If unsure, leave this unchecked. " ) ;
static wxString shader_errors_desc = wxTRANSLATE ( " Usually if shader compilation fails, an error message is displayed. \n However, one may skip the popups to allow interruption free gameplay by checking this option. \n \n If unsure, leave this unchecked. " ) ;
2014-12-28 23:46:47 +00:00
static wxString stereo_3d_desc = wxTRANSLATE ( " Select the stereoscopic 3D mode, stereoscopy allows you to get a better feeling of depth if you have the necessary hardware. \n Side-by-Side and Top-and-Bottom are used by most 3D TVs. \n Anaglyph is used for Red-Cyan colored glasses. \n Heavily decreases emulation speed and sometimes causes issues. \n \n If unsure, select Off. " ) ;
2014-12-21 13:06:16 +00:00
static wxString stereo_depth_desc = wxTRANSLATE ( " Control the distance between the virtual cameras. \n A higher value creates a stronger feeling of depth while a lower value is more comfortable. " ) ;
static wxString stereo_convergence_desc = wxTRANSLATE ( " Control the distance of the convergence plane, this is the distance at which objects will appear to be in front of the screen. \n A higher value creates stronger out-of-screen effects while a lower value is more comfortable. " ) ;
2014-11-05 01:00:37 +00:00
static wxString stereo_swap_desc = wxTRANSLATE ( " Swap the left and right eye, mostly useful if you want to view side-by-side cross-eyed. \n \n If unsure, leave this unchecked. " ) ;
2010-12-05 14:37:21 +00:00
2011-06-02 19:32:34 +00:00
2014-08-23 19:26:59 +00:00
# if !defined(__APPLE__)
2013-04-19 13:21:45 +00:00
// Search for available resolutions - TODO: Move to Common?
2014-07-08 12:29:26 +00:00
static wxArrayString GetListOfResolutions ( )
2011-06-02 19:32:34 +00:00
{
wxArrayString retlist ;
2013-05-25 07:03:12 +00:00
retlist . Add ( " Auto " ) ;
2011-06-02 19:32:34 +00:00
# ifdef _WIN32
DWORD iModeNum = 0 ;
DEVMODE dmi ;
ZeroMemory ( & dmi , sizeof ( dmi ) ) ;
dmi . dmSize = sizeof ( dmi ) ;
std : : vector < std : : string > resos ;
2014-03-09 20:14:26 +00:00
while ( EnumDisplaySettings ( nullptr , iModeNum + + , & dmi ) ! = 0 )
2011-06-02 19:32:34 +00:00
{
char res [ 100 ] ;
sprintf ( res , " %dx%d " , dmi . dmPelsWidth , dmi . dmPelsHeight ) ;
std : : string strRes ( res ) ;
// Only add unique resolutions
if ( std : : find ( resos . begin ( ) , resos . end ( ) , strRes ) = = resos . end ( ) )
{
resos . push_back ( strRes ) ;
2013-02-28 04:37:38 +00:00
retlist . Add ( StrToWxStr ( res ) ) ;
2011-06-02 19:32:34 +00:00
}
ZeroMemory ( & dmi , sizeof ( dmi ) ) ;
}
# elif defined(HAVE_XRANDR) && HAVE_XRANDR
2014-08-06 19:45:40 +00:00
std : : vector < std : : string > resos ;
main_frame - > m_XRRConfig - > AddResolutions ( resos ) ;
for ( auto res : resos )
retlist . Add ( StrToWxStr ( res ) ) ;
2011-06-02 19:32:34 +00:00
# elif defined(__APPLE__)
2014-03-09 20:14:26 +00:00
CFArrayRef modes = CGDisplayCopyAllDisplayModes ( CGMainDisplayID ( ) , nullptr ) ;
2011-06-02 19:32:34 +00:00
for ( CFIndex i = 0 ; i < CFArrayGetCount ( modes ) ; i + + )
{
std : : stringstream res ;
2013-08-29 05:42:45 +00:00
CGDisplayModeRef mode ;
CFStringRef encoding ;
size_t w , h ;
bool is32 ;
mode = ( CGDisplayModeRef ) CFArrayGetValueAtIndex ( modes , i ) ;
w = CGDisplayModeGetWidth ( mode ) ;
h = CGDisplayModeGetHeight ( mode ) ;
encoding = CGDisplayModeCopyPixelEncoding ( mode ) ;
is32 = CFEqual ( encoding , CFSTR ( IO32BitDirectPixels ) ) ;
CFRelease ( encoding ) ;
if ( ! is32 )
2011-06-02 19:32:34 +00:00
continue ;
2013-08-29 05:42:45 +00:00
if ( CGDisplayModeGetIOFlags ( mode ) & kDisplayModeStretchedFlag )
2011-06-02 19:32:34 +00:00
continue ;
res < < w < < " x " < < h ;
retlist . Add ( res . str ( ) ) ;
}
2013-08-29 05:42:45 +00:00
CFRelease ( modes ) ;
2011-06-02 19:32:34 +00:00
# endif
return retlist ;
}
2014-08-23 19:26:59 +00:00
# endif
2011-06-02 19:32:34 +00:00
2011-03-21 19:57:31 +00:00
VideoConfigDiag : : VideoConfigDiag ( wxWindow * parent , const std : : string & title , const std : : string & _ininame )
2014-12-02 03:56:18 +00:00
: wxDialog ( parent , wxID_ANY ,
2014-03-06 04:02:34 +00:00
wxString : : Format ( _ ( " Dolphin %s Graphics Configuration " ) , wxGetTranslation ( StrToWxStr ( title ) ) ) )
2011-04-25 20:06:45 +00:00
, vconfig ( g_Config )
2011-03-21 19:57:31 +00:00
, ininame ( _ininame )
2010-11-15 09:54:07 +00:00
{
2014-03-12 19:33:41 +00:00
vconfig . Load ( File : : GetUserPath ( D_CONFIG_IDX ) + ininame + " .ini " ) ;
2011-02-13 22:36:12 +00:00
2013-01-13 18:07:45 +00:00
Bind ( wxEVT_UPDATE_UI , & VideoConfigDiag : : OnUpdateUI , this ) ;
2010-11-22 22:17:35 +00:00
2014-12-02 03:56:18 +00:00
wxNotebook * const notebook = new wxNotebook ( this , wxID_ANY ) ;
2010-11-15 09:54:07 +00:00
// -- GENERAL --
{
2014-12-02 03:56:18 +00:00
wxPanel * const page_general = new wxPanel ( notebook ) ;
2011-01-05 04:35:46 +00:00
notebook - > AddPage ( page_general , _ ( " General " ) ) ;
2010-11-15 09:54:07 +00:00
wxBoxSizer * const szr_general = new wxBoxSizer ( wxVERTICAL ) ;
// - basic
{
wxFlexGridSizer * const szr_basic = new wxFlexGridSizer ( 2 , 5 , 5 ) ;
2011-06-02 19:32:34 +00:00
// backend
{
2014-09-03 07:35:23 +00:00
label_backend = new wxStaticText ( page_general , wxID_ANY , _ ( " Backend: " ) ) ;
2014-03-06 04:02:34 +00:00
choice_backend = new wxChoice ( page_general , wxID_ANY ) ;
2011-06-02 19:32:34 +00:00
RegisterControl ( choice_backend , wxGetTranslation ( backend_desc ) ) ;
2014-03-11 05:55:00 +00:00
for ( const VideoBackend * backend : g_available_video_backends )
{
choice_backend - > AppendString ( wxGetTranslation ( StrToWxStr ( backend - > GetDisplayName ( ) ) ) ) ;
}
2011-06-02 19:32:34 +00:00
2013-03-20 23:14:14 +00:00
choice_backend - > SetStringSelection ( wxGetTranslation ( StrToWxStr ( g_video_backend - > GetDisplayName ( ) ) ) ) ;
2014-05-17 16:49:00 +00:00
choice_backend - > Bind ( wxEVT_CHOICE , & VideoConfigDiag : : Event_Backend , this ) ;
2011-03-21 19:57:31 +00:00
2011-06-02 19:32:34 +00:00
szr_basic - > Add ( label_backend , 1 , wxALIGN_CENTER_VERTICAL , 5 ) ;
szr_basic - > Add ( choice_backend , 1 , 0 , 0 ) ;
}
2011-03-21 19:57:31 +00:00
2011-04-29 14:37:47 +00:00
// adapter (D3D only)
2011-04-25 20:06:45 +00:00
if ( vconfig . backend_info . Adapters . size ( ) )
2010-11-15 09:54:07 +00:00
{
2014-09-03 07:35:23 +00:00
choice_adapter = CreateChoice ( page_general , vconfig . iAdapter , wxGetTranslation ( adapter_desc ) ) ;
2010-11-15 09:54:07 +00:00
2014-03-11 05:55:00 +00:00
for ( const std : : string & adapter : vconfig . backend_info . Adapters )
{
choice_adapter - > AppendString ( StrToWxStr ( adapter ) ) ;
}
2010-11-15 09:54:07 +00:00
2011-04-29 14:37:47 +00:00
choice_adapter - > Select ( vconfig . iAdapter ) ;
2010-11-15 09:54:07 +00:00
2014-09-03 07:35:23 +00:00
label_adapter = new wxStaticText ( page_general , wxID_ANY , _ ( " Adapter: " ) ) ;
szr_basic - > Add ( label_adapter , 1 , wxALIGN_CENTER_VERTICAL , 5 ) ;
2011-04-29 14:37:47 +00:00
szr_basic - > Add ( choice_adapter , 1 , 0 , 0 ) ;
2010-11-15 09:54:07 +00:00
}
2011-06-02 19:32:34 +00:00
// - display
wxFlexGridSizer * const szr_display = new wxFlexGridSizer ( 2 , 5 , 5 ) ;
{
2013-03-31 16:08:29 +00:00
# if !defined(__APPLE__)
2011-06-02 19:32:34 +00:00
// display resolution
{
wxArrayString res_list = GetListOfResolutions ( ) ;
if ( res_list . empty ( ) )
res_list . Add ( _ ( " <No resolutions found> " ) ) ;
2014-09-03 07:35:23 +00:00
label_display_resolution = new wxStaticText ( page_general , wxID_ANY , _ ( " Fullscreen Resolution: " ) ) ;
2011-06-02 19:32:34 +00:00
choice_display_resolution = new wxChoice ( page_general , wxID_ANY , wxDefaultPosition , wxDefaultSize , res_list ) ;
RegisterControl ( choice_display_resolution , wxGetTranslation ( display_res_desc ) ) ;
2014-05-17 16:49:00 +00:00
choice_display_resolution - > Bind ( wxEVT_CHOICE , & VideoConfigDiag : : Event_DisplayResolution , this ) ;
2011-06-02 19:32:34 +00:00
2013-02-28 08:39:06 +00:00
choice_display_resolution - > SetStringSelection ( StrToWxStr ( SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . strFullscreenResolution ) ) ;
2011-06-02 19:32:34 +00:00
szr_display - > Add ( label_display_resolution , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
szr_display - > Add ( choice_display_resolution ) ;
}
2013-03-31 16:08:29 +00:00
# endif
2011-06-02 19:32:34 +00:00
2010-11-15 09:54:07 +00:00
// aspect-ratio
{
2011-04-29 14:37:47 +00:00
const wxString ar_choices [ ] = { _ ( " Auto " ) , _ ( " Force 16:9 " ) , _ ( " Force 4:3 " ) , _ ( " Stretch to Window " ) } ;
2010-11-15 09:54:07 +00:00
2014-12-02 03:56:18 +00:00
szr_display - > Add ( new wxStaticText ( page_general , wxID_ANY , _ ( " Aspect Ratio: " ) ) , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
2011-04-29 23:11:18 +00:00
wxChoice * const choice_aspect = CreateChoice ( page_general , vconfig . iAspectRatio , wxGetTranslation ( ar_desc ) ,
2011-04-29 14:37:47 +00:00
sizeof ( ar_choices ) / sizeof ( * ar_choices ) , ar_choices ) ;
2011-06-02 19:32:34 +00:00
szr_display - > Add ( choice_aspect , 1 , 0 , 0 ) ;
}
// various other display options
{
szr_display - > Add ( CreateCheckBox ( page_general , _ ( " V-Sync " ) , wxGetTranslation ( vsync_desc ) , vconfig . bVSync ) ) ;
szr_display - > Add ( CreateCheckBox ( page_general , _ ( " Use Fullscreen " ) , wxGetTranslation ( use_fullscreen_desc ) , SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . bFullscreen ) ) ;
}
}
// - other
wxFlexGridSizer * const szr_other = new wxFlexGridSizer ( 2 , 5 , 5 ) ;
{
szr_other - > Add ( CreateCheckBox ( page_general , _ ( " Show FPS " ) , wxGetTranslation ( show_fps_desc ) , vconfig . bShowFPS ) ) ;
2014-07-09 19:50:31 +00:00
szr_other - > Add ( CreateCheckBox ( page_general , _ ( " Log Render Time to File " ) , wxGetTranslation ( log_render_time_to_file_desc ) , vconfig . bLogRenderTimeToFile ) ) ;
2011-06-02 19:32:34 +00:00
szr_other - > Add ( CreateCheckBox ( page_general , _ ( " Auto adjust Window Size " ) , wxGetTranslation ( auto_window_size_desc ) , SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . bRenderWindowAutoSize ) ) ;
2014-07-09 19:50:31 +00:00
szr_other - > Add ( CreateCheckBox ( page_general , _ ( " Keep Window on Top " ) , wxGetTranslation ( keep_window_on_top_desc ) , SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . bKeepWindowOnTop ) ) ;
2011-06-02 19:32:34 +00:00
szr_other - > Add ( CreateCheckBox ( page_general , _ ( " Hide Mouse Cursor " ) , wxGetTranslation ( hide_mouse_cursor_desc ) , SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . bHideCursor ) ) ;
2014-09-03 07:35:23 +00:00
szr_other - > Add ( render_to_main_checkbox = CreateCheckBox ( page_general , _ ( " Render to Main Window " ) , wxGetTranslation ( render_to_main_win_desc ) , SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . bRenderToMain ) ) ;
2011-06-02 19:32:34 +00:00
}
wxStaticBoxSizer * const group_basic = new wxStaticBoxSizer ( wxVERTICAL , page_general , _ ( " Basic " ) ) ;
group_basic - > Add ( szr_basic , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
szr_general - > Add ( group_basic , 0 , wxEXPAND | wxALL , 5 ) ;
wxStaticBoxSizer * const group_display = new wxStaticBoxSizer ( wxVERTICAL , page_general , _ ( " Display " ) ) ;
group_display - > Add ( szr_display , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
szr_general - > Add ( group_display , 0 , wxEXPAND | wxALL , 5 ) ;
wxStaticBoxSizer * const group_other = new wxStaticBoxSizer ( wxVERTICAL , page_general , _ ( " Other " ) ) ;
group_other - > Add ( szr_other , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
szr_general - > Add ( group_other , 0 , wxEXPAND | wxALL , 5 ) ;
2010-11-15 09:54:07 +00:00
}
2011-06-02 19:32:34 +00:00
szr_general - > AddStretchSpacer ( ) ;
CreateDescriptionArea ( page_general , szr_general ) ;
page_general - > SetSizerAndFit ( szr_general ) ;
}
2010-11-15 09:54:07 +00:00
2011-06-02 19:32:34 +00:00
// -- ENHANCEMENTS --
{
2014-12-02 03:56:18 +00:00
wxPanel * const page_enh = new wxPanel ( notebook ) ;
2011-06-02 19:32:34 +00:00
notebook - > AddPage ( page_enh , _ ( " Enhancements " ) ) ;
wxBoxSizer * const szr_enh_main = new wxBoxSizer ( wxVERTICAL ) ;
2011-04-29 14:37:47 +00:00
// - enhancements
2010-11-15 09:54:07 +00:00
wxFlexGridSizer * const szr_enh = new wxFlexGridSizer ( 2 , 5 , 5 ) ;
2011-04-29 14:37:47 +00:00
// Internal resolution
2011-05-01 13:41:06 +00:00
{
2011-04-29 14:37:47 +00:00
const wxString efbscale_choices [ ] = { _ ( " Auto (Window Size) " ) , _ ( " Auto (Multiple of 640x528) " ) ,
2013-10-29 05:23:17 +00:00
_ ( " 1x Native (640x528) " ) , _ ( " 1.5x Native (960x792) " ) , _ ( " 2x Native (1280x1056) " ) ,
2014-09-25 23:50:25 +00:00
_ ( " 2.5x Native (1600x1320) " ) , _ ( " 3x Native (1920x1584) " ) , _ ( " 4x Native (2560x2112) " ) , _ ( " Custom " ) } ;
2011-04-25 20:06:45 +00:00
2011-06-02 19:32:34 +00:00
wxChoice * const choice_efbscale = CreateChoice ( page_enh ,
2014-09-25 23:50:25 +00:00
vconfig . iEFBScale , wxGetTranslation ( internal_res_desc ) , ( vconfig . iEFBScale > 7 ) ?
ArraySize ( efbscale_choices ) : ArraySize ( efbscale_choices ) - 1 , efbscale_choices ) ;
if ( vconfig . iEFBScale > 7 )
choice_efbscale - > SetSelection ( 8 ) ;
2011-04-25 20:06:45 +00:00
2011-06-02 19:32:34 +00:00
szr_enh - > Add ( new wxStaticText ( page_enh , wxID_ANY , _ ( " Internal Resolution: " ) ) , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
2011-04-29 14:37:47 +00:00
szr_enh - > Add ( choice_efbscale ) ;
2011-05-01 13:41:06 +00:00
}
2011-04-29 14:37:47 +00:00
// AA
2011-05-01 13:41:06 +00:00
{
2014-12-02 03:56:18 +00:00
text_aamode = new wxStaticText ( page_enh , wxID_ANY , _ ( " Anti-Aliasing: " ) ) ;
2011-06-02 19:32:34 +00:00
choice_aamode = CreateChoice ( page_enh , vconfig . iMultisampleMode , wxGetTranslation ( aa_desc ) ) ;
2010-11-28 17:25:19 +00:00
2014-03-11 05:55:00 +00:00
for ( const std : : string & mode : vconfig . backend_info . AAModes )
{
choice_aamode - > AppendString ( wxGetTranslation ( StrToWxStr ( mode ) ) ) ;
}
2010-11-28 17:25:19 +00:00
2011-04-25 20:06:45 +00:00
choice_aamode - > Select ( vconfig . iMultisampleMode ) ;
2011-04-29 14:37:47 +00:00
szr_enh - > Add ( text_aamode , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
2011-03-21 19:57:31 +00:00
szr_enh - > Add ( choice_aamode ) ;
2011-05-01 13:41:06 +00:00
}
2011-04-25 20:06:45 +00:00
2011-04-29 14:37:47 +00:00
// AF
2011-05-01 13:41:06 +00:00
{
2014-05-17 17:17:28 +00:00
const wxString af_choices [ ] = { " 1x " , " 2x " , " 4x " , " 8x " , " 16x " } ;
2014-12-02 03:56:18 +00:00
szr_enh - > Add ( new wxStaticText ( page_enh , wxID_ANY , _ ( " Anisotropic Filtering: " ) ) , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
2011-06-02 19:32:34 +00:00
szr_enh - > Add ( CreateChoice ( page_enh , vconfig . iMaxAnisotropy , wxGetTranslation ( af_desc ) , 5 , af_choices ) ) ;
2011-05-01 13:41:06 +00:00
}
2011-04-25 20:06:45 +00:00
2011-04-29 14:37:47 +00:00
// postproc shader
if ( vconfig . backend_info . PPShaders . size ( ) )
{
2014-07-29 17:14:25 +00:00
wxFlexGridSizer * const szr_pp = new wxFlexGridSizer ( 3 , 5 , 5 ) ;
2014-12-02 03:56:18 +00:00
choice_ppshader = new wxChoice ( page_enh , wxID_ANY ) ;
2011-04-29 23:11:18 +00:00
RegisterControl ( choice_ppshader , wxGetTranslation ( ppshader_desc ) ) ;
2011-04-29 14:37:47 +00:00
choice_ppshader - > AppendString ( _ ( " (off) " ) ) ;
2010-12-20 14:48:46 +00:00
2014-07-29 17:14:25 +00:00
button_config_pp = new wxButton ( page_enh , wxID_ANY , _ ( " Config " ) ) ;
2014-03-11 05:55:00 +00:00
for ( const std : : string & shader : vconfig . backend_info . PPShaders )
{
choice_ppshader - > AppendString ( StrToWxStr ( shader ) ) ;
}
2011-04-25 20:06:45 +00:00
2014-12-24 23:06:29 +00:00
if ( vconfig . sPostProcessingShader . empty ( ) | | vconfig . iStereoMode = = STEREO_ANAGLYPH )
2011-04-29 14:37:47 +00:00
choice_ppshader - > Select ( 0 ) ;
else
2013-02-28 08:39:06 +00:00
choice_ppshader - > SetStringSelection ( StrToWxStr ( vconfig . sPostProcessingShader ) ) ;
2011-04-25 20:06:45 +00:00
2014-07-29 16:47:56 +00:00
// Should the configuration button be loaded by default?
PostProcessingShaderConfiguration postprocessing_shader ;
postprocessing_shader . LoadShader ( vconfig . sPostProcessingShader ) ;
button_config_pp - > Enable ( postprocessing_shader . HasOptions ( ) ) ;
2014-05-17 16:49:00 +00:00
choice_ppshader - > Bind ( wxEVT_CHOICE , & VideoConfigDiag : : Event_PPShader , this ) ;
2014-07-29 17:14:25 +00:00
button_config_pp - > Bind ( wxEVT_BUTTON , & VideoConfigDiag : : Event_ConfigurePPShader , this ) ;
2011-04-25 20:06:45 +00:00
2014-12-02 03:56:18 +00:00
szr_enh - > Add ( new wxStaticText ( page_enh , wxID_ANY , _ ( " Post-Processing Effect: " ) ) , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
2014-07-29 17:14:25 +00:00
szr_pp - > Add ( choice_ppshader ) ;
szr_pp - > Add ( button_config_pp ) ;
szr_enh - > Add ( szr_pp ) ;
2011-04-29 14:37:47 +00:00
}
2014-10-31 14:53:08 +00:00
else
{
choice_ppshader = nullptr ;
button_config_pp = nullptr ;
}
2010-12-20 14:48:46 +00:00
2014-07-26 10:45:10 +00:00
// Scaled copy, PL, Bilinear filter
2011-06-02 19:32:34 +00:00
szr_enh - > Add ( CreateCheckBox ( page_enh , _ ( " Scaled EFB Copy " ) , wxGetTranslation ( scaled_efb_copy_desc ) , vconfig . bCopyEFBScaled ) ) ;
2014-04-04 23:17:14 +00:00
szr_enh - > Add ( CreateCheckBox ( page_enh , _ ( " Per-Pixel Lighting " ) , wxGetTranslation ( pixel_lighting_desc ) , vconfig . bEnablePixelLighting ) ) ;
2011-06-02 19:32:34 +00:00
szr_enh - > Add ( CreateCheckBox ( page_enh , _ ( " Force Texture Filtering " ) , wxGetTranslation ( force_filtering_desc ) , vconfig . bForceFiltering ) ) ;
2013-03-24 19:47:18 +00:00
szr_enh - > Add ( CreateCheckBox ( page_enh , _ ( " Widescreen Hack " ) , wxGetTranslation ( ws_hack_desc ) , vconfig . bWidescreenHack ) ) ;
szr_enh - > Add ( CreateCheckBox ( page_enh , _ ( " Disable Fog " ) , wxGetTranslation ( disable_fog_desc ) , vconfig . bDisableFog ) ) ;
2011-06-02 19:32:34 +00:00
wxStaticBoxSizer * const group_enh = new wxStaticBoxSizer ( wxVERTICAL , page_enh , _ ( " Enhancements " ) ) ;
2011-01-31 17:52:46 +00:00
group_enh - > Add ( szr_enh , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
2011-06-02 19:32:34 +00:00
szr_enh_main - > Add ( group_enh , 0 , wxEXPAND | wxALL , 5 ) ;
2010-11-15 09:54:07 +00:00
2014-10-30 22:29:56 +00:00
// - stereoscopy
2014-12-21 13:23:34 +00:00
if ( vconfig . backend_info . bSupportsGeometryShaders )
2014-10-30 22:29:56 +00:00
{
2014-10-31 16:55:46 +00:00
wxFlexGridSizer * const szr_stereo = new wxFlexGridSizer ( 2 , 5 , 5 ) ;
2014-10-30 22:29:56 +00:00
2014-12-02 03:56:18 +00:00
szr_stereo - > Add ( new wxStaticText ( page_enh , wxID_ANY , _ ( " Stereoscopic 3D Mode: " ) ) , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
2014-12-24 23:06:29 +00:00
const wxString stereo_choices [ ] = { " Off " , " Side-by-Side " , " Top-and-Bottom " , " Anaglyph " , " Nvidia 3D Vision " } ;
wxChoice * stereo_choice = CreateChoice ( page_enh , vconfig . iStereoMode , wxGetTranslation ( stereo_3d_desc ) , vconfig . backend_info . bSupports3DVision ? ArraySize ( stereo_choices ) : ArraySize ( stereo_choices ) - 1 , stereo_choices ) ;
stereo_choice - > Bind ( wxEVT_CHOICE , & VideoConfigDiag : : Event_StereoMode , this ) ;
szr_stereo - > Add ( stereo_choice ) ;
2014-10-30 22:29:56 +00:00
2014-12-21 13:06:16 +00:00
wxSlider * const sep_slider = new wxSlider ( page_enh , wxID_ANY , vconfig . iStereoDepth , 0 , 100 , wxDefaultPosition , wxDefaultSize ) ;
2014-12-24 23:06:29 +00:00
sep_slider - > Bind ( wxEVT_SLIDER , & VideoConfigDiag : : Event_StereoDepth , this ) ;
2014-12-21 13:06:16 +00:00
RegisterControl ( sep_slider , wxGetTranslation ( stereo_depth_desc ) ) ;
2014-10-30 22:29:56 +00:00
2014-12-21 13:06:16 +00:00
szr_stereo - > Add ( new wxStaticText ( page_enh , wxID_ANY , _ ( " Depth: " ) ) , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
2014-10-31 16:55:46 +00:00
szr_stereo - > Add ( sep_slider , 0 , wxEXPAND | wxRIGHT ) ;
2014-10-30 22:29:56 +00:00
2014-11-27 14:28:00 +00:00
wxSlider * const conv_slider = new wxSlider ( page_enh , wxID_ANY , vconfig . iStereoConvergence , 0 , 500 , wxDefaultPosition , wxDefaultSize ) ;
2014-12-24 23:06:29 +00:00
conv_slider - > Bind ( wxEVT_SLIDER , & VideoConfigDiag : : Event_StereoConvergence , this ) ;
2014-11-05 01:00:37 +00:00
RegisterControl ( conv_slider , wxGetTranslation ( stereo_convergence_desc ) ) ;
2014-10-30 22:29:56 +00:00
2014-11-05 01:00:37 +00:00
szr_stereo - > Add ( new wxStaticText ( page_enh , wxID_ANY , _ ( " Convergence: " ) ) , 1 , wxALIGN_CENTER_VERTICAL , 0 ) ;
szr_stereo - > Add ( conv_slider , 0 , wxEXPAND | wxRIGHT ) ;
2014-10-30 22:29:56 +00:00
2014-11-24 11:01:21 +00:00
szr_stereo - > Add ( CreateCheckBox ( page_enh , _ ( " Swap Eyes " ) , wxGetTranslation ( stereo_swap_desc ) , vconfig . bStereoSwapEyes ) ) ;
2014-11-08 15:19:15 +00:00
2014-10-30 22:29:56 +00:00
wxStaticBoxSizer * const group_stereo = new wxStaticBoxSizer ( wxVERTICAL , page_enh , _ ( " Stereoscopy " ) ) ;
group_stereo - > Add ( szr_stereo , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
szr_enh_main - > Add ( group_stereo , 0 , wxEXPAND | wxALL , 5 ) ;
}
2011-06-02 19:32:34 +00:00
szr_enh_main - > AddStretchSpacer ( ) ;
CreateDescriptionArea ( page_enh , szr_enh_main ) ;
page_enh - > SetSizerAndFit ( szr_enh_main ) ;
2010-11-15 09:54:07 +00:00
}
2011-06-02 19:32:34 +00:00
2011-04-29 14:37:47 +00:00
// -- SPEED HACKS --
2010-11-15 09:54:07 +00:00
{
2014-12-02 03:56:18 +00:00
wxPanel * const page_hacks = new wxPanel ( notebook ) ;
2011-04-29 14:37:47 +00:00
notebook - > AddPage ( page_hacks , _ ( " Hacks " ) ) ;
wxBoxSizer * const szr_hacks = new wxBoxSizer ( wxVERTICAL ) ;
2010-11-15 09:54:07 +00:00
2011-04-29 14:37:47 +00:00
// - EFB hacks
2011-04-29 23:11:18 +00:00
wxStaticBoxSizer * const szr_efb = new wxStaticBoxSizer ( wxVERTICAL , page_hacks , _ ( " Embedded Frame Buffer " ) ) ;
2010-11-15 09:54:07 +00:00
2011-04-29 14:37:47 +00:00
// EFB copies
wxStaticBoxSizer * const group_efbcopy = new wxStaticBoxSizer ( wxHORIZONTAL , page_hacks , _ ( " EFB Copies " ) ) ;
2011-04-29 23:11:18 +00:00
SettingCheckBox * efbcopy_disable = CreateCheckBox ( page_hacks , _ ( " Disable " ) , wxGetTranslation ( efb_copy_desc ) , vconfig . bEFBCopyEnable , true ) ;
efbcopy_texture = CreateRadioButton ( page_hacks , _ ( " Texture " ) , wxGetTranslation ( efb_copy_texture_desc ) , vconfig . bCopyEFBToTexture , false , wxRB_GROUP ) ;
efbcopy_ram = CreateRadioButton ( page_hacks , _ ( " RAM " ) , wxGetTranslation ( efb_copy_ram_desc ) , vconfig . bCopyEFBToTexture , true ) ;
cache_efb_copies = CreateCheckBox ( page_hacks , _ ( " Enable Cache " ) , wxGetTranslation ( cache_efb_copies_desc ) , vconfig . bEFBCopyCacheEnable ) ;
2011-04-29 14:37:47 +00:00
group_efbcopy - > Add ( efbcopy_disable , 0 , wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
group_efbcopy - > AddStretchSpacer ( 1 ) ;
group_efbcopy - > Add ( efbcopy_texture , 0 , wxRIGHT , 5 ) ;
group_efbcopy - > Add ( efbcopy_ram , 0 , wxRIGHT , 5 ) ;
group_efbcopy - > Add ( cache_efb_copies , 0 , wxRIGHT , 5 ) ;
2011-04-29 23:11:18 +00:00
szr_efb - > Add ( CreateCheckBox ( page_hacks , _ ( " Skip EFB Access from CPU " ) , wxGetTranslation ( efb_access_desc ) , vconfig . bEFBAccessEnable , true ) , 0 , wxBOTTOM | wxLEFT , 5 ) ;
2014-04-04 23:17:14 +00:00
szr_efb - > Add ( CreateCheckBox ( page_hacks , _ ( " Ignore Format Changes " ) , wxGetTranslation ( efb_emulate_format_changes_desc ) , vconfig . bEFBEmulateFormatChanges , true ) , 0 , wxBOTTOM | wxLEFT , 5 ) ;
2011-06-02 19:32:34 +00:00
szr_efb - > Add ( group_efbcopy , 0 , wxEXPAND | wxALL , 5 ) ;
2011-04-29 14:37:47 +00:00
szr_hacks - > Add ( szr_efb , 0 , wxEXPAND | wxALL , 5 ) ;
// Texture cache
2011-05-01 13:41:06 +00:00
{
2011-04-29 14:37:47 +00:00
wxStaticBoxSizer * const szr_safetex = new wxStaticBoxSizer ( wxHORIZONTAL , page_hacks , _ ( " Texture Cache " ) ) ;
2010-11-15 09:54:07 +00:00
2011-04-29 14:37:47 +00:00
// TODO: Use wxSL_MIN_MAX_LABELS or wxSL_VALUE_LABEL with wx 2.9.1
2011-12-26 21:04:59 +00:00
wxSlider * const stc_slider = new wxSlider ( page_hacks , wxID_ANY , 0 , 0 , 2 , wxDefaultPosition , wxDefaultSize , wxSL_HORIZONTAL | wxSL_BOTTOM ) ;
2014-05-17 16:49:00 +00:00
stc_slider - > Bind ( wxEVT_SLIDER , & VideoConfigDiag : : Event_Stc , this ) ;
2011-04-29 23:11:18 +00:00
RegisterControl ( stc_slider , wxGetTranslation ( stc_desc ) ) ;
2011-04-29 14:37:47 +00:00
2011-12-26 21:04:59 +00:00
if ( vconfig . iSafeTextureCache_ColorSamples = = 0 ) stc_slider - > SetValue ( 0 ) ;
else if ( vconfig . iSafeTextureCache_ColorSamples = = 512 ) stc_slider - > SetValue ( 1 ) ;
else if ( vconfig . iSafeTextureCache_ColorSamples = = 128 ) stc_slider - > SetValue ( 2 ) ;
else stc_slider - > Disable ( ) ; // Using custom number of samples; TODO: Inform the user why this is disabled..
2011-04-29 14:37:47 +00:00
szr_safetex - > Add ( new wxStaticText ( page_hacks , wxID_ANY , _ ( " Accuracy: " ) ) , 0 , wxALL , 5 ) ;
szr_safetex - > AddStretchSpacer ( 1 ) ;
szr_safetex - > Add ( new wxStaticText ( page_hacks , wxID_ANY , _ ( " Safe " ) ) , 0 , wxLEFT | wxTOP | wxBOTTOM , 5 ) ;
szr_safetex - > Add ( stc_slider , 2 , wxRIGHT , 0 ) ;
szr_safetex - > Add ( new wxStaticText ( page_hacks , wxID_ANY , _ ( " Fast " ) ) , 0 , wxRIGHT | wxTOP | wxBOTTOM , 5 ) ;
szr_hacks - > Add ( szr_safetex , 0 , wxEXPAND | wxALL , 5 ) ;
2011-05-01 13:41:06 +00:00
}
2011-04-29 14:37:47 +00:00
2010-11-15 09:54:07 +00:00
// - XFB
{
2011-04-29 23:11:18 +00:00
wxStaticBoxSizer * const group_xfb = new wxStaticBoxSizer ( wxHORIZONTAL , page_hacks , _ ( " External Frame Buffer " ) ) ;
2011-01-31 17:52:46 +00:00
2011-04-29 23:11:18 +00:00
SettingCheckBox * disable_xfb = CreateCheckBox ( page_hacks , _ ( " Disable " ) , wxGetTranslation ( xfb_desc ) , vconfig . bUseXFB , true ) ;
virtual_xfb = CreateRadioButton ( page_hacks , _ ( " Virtual " ) , wxGetTranslation ( xfb_virtual_desc ) , vconfig . bUseRealXFB , true , wxRB_GROUP ) ;
real_xfb = CreateRadioButton ( page_hacks , _ ( " Real " ) , wxGetTranslation ( xfb_real_desc ) , vconfig . bUseRealXFB ) ;
2011-04-29 14:37:47 +00:00
group_xfb - > Add ( disable_xfb , 0 , wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
2010-11-15 09:54:07 +00:00
group_xfb - > AddStretchSpacer ( 1 ) ;
2010-11-21 14:47:28 +00:00
group_xfb - > Add ( virtual_xfb , 0 , wxRIGHT , 5 ) ;
group_xfb - > Add ( real_xfb , 0 , wxRIGHT , 5 ) ;
2011-06-02 19:32:34 +00:00
szr_hacks - > Add ( group_xfb , 0 , wxEXPAND | wxALL , 5 ) ;
2014-02-17 04:51:41 +00:00
} // xfb
2011-04-29 14:37:47 +00:00
// - other hacks
{
2011-05-01 13:41:06 +00:00
wxGridSizer * const szr_other = new wxGridSizer ( 2 , 5 , 5 ) ;
2013-04-07 21:41:25 +00:00
szr_other - > Add ( CreateCheckBox ( page_hacks , _ ( " Disable Destination Alpha " ) , wxGetTranslation ( disable_dstalpha_desc ) , vconfig . bDstAlphaPass ) ) ;
2013-05-10 10:51:06 +00:00
szr_other - > Add ( CreateCheckBox ( page_hacks , _ ( " Fast Depth Calculation " ) , wxGetTranslation ( fast_depth_calc_desc ) , vconfig . bFastDepthCalc ) ) ;
2013-10-29 05:23:17 +00:00
2011-04-29 23:11:18 +00:00
wxStaticBoxSizer * const group_other = new wxStaticBoxSizer ( wxVERTICAL , page_hacks , _ ( " Other " ) ) ;
2011-04-29 14:37:47 +00:00
group_other - > Add ( szr_other , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
szr_hacks - > Add ( group_other , 0 , wxEXPAND | wxALL , 5 ) ;
}
2011-03-21 19:57:31 +00:00
2011-04-29 23:11:18 +00:00
szr_hacks - > AddStretchSpacer ( ) ;
CreateDescriptionArea ( page_hacks , szr_hacks ) ;
2011-04-29 14:37:47 +00:00
page_hacks - > SetSizerAndFit ( szr_hacks ) ;
}
2011-03-21 19:57:31 +00:00
2011-04-29 14:37:47 +00:00
// -- ADVANCED --
{
2014-12-02 03:56:18 +00:00
wxPanel * const page_advanced = new wxPanel ( notebook ) ;
2011-04-29 14:37:47 +00:00
notebook - > AddPage ( page_advanced , _ ( " Advanced " ) ) ;
wxBoxSizer * const szr_advanced = new wxBoxSizer ( wxVERTICAL ) ;
// - debug
{
wxGridSizer * const szr_debug = new wxGridSizer ( 2 , 5 , 5 ) ;
2011-04-29 23:11:18 +00:00
szr_debug - > Add ( CreateCheckBox ( page_advanced , _ ( " Enable Wireframe " ) , wxGetTranslation ( wireframe_desc ) , vconfig . bWireFrame ) ) ;
szr_debug - > Add ( CreateCheckBox ( page_advanced , _ ( " Show EFB Copy Regions " ) , wxGetTranslation ( efb_copy_regions_desc ) , vconfig . bShowEFBCopyRegions ) ) ;
szr_debug - > Add ( CreateCheckBox ( page_advanced , _ ( " Show Statistics " ) , wxGetTranslation ( show_stats_desc ) , vconfig . bOverlayStats ) ) ;
szr_debug - > Add ( CreateCheckBox ( page_advanced , _ ( " Texture Format Overlay " ) , wxGetTranslation ( texfmt_desc ) , vconfig . bTexFmtOverlayEnable ) ) ;
2011-04-29 14:37:47 +00:00
wxStaticBoxSizer * const group_debug = new wxStaticBoxSizer ( wxVERTICAL , page_advanced , _ ( " Debugging " ) ) ;
szr_advanced - > Add ( group_debug , 0 , wxEXPAND | wxALL , 5 ) ;
group_debug - > Add ( szr_debug , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
}
2010-11-22 10:39:24 +00:00
2010-11-15 09:54:07 +00:00
// - utility
{
wxGridSizer * const szr_utility = new wxGridSizer ( 2 , 5 , 5 ) ;
2011-04-29 23:11:18 +00:00
szr_utility - > Add ( CreateCheckBox ( page_advanced , _ ( " Dump Textures " ) , wxGetTranslation ( dump_textures_desc ) , vconfig . bDumpTextures ) ) ;
szr_utility - > Add ( CreateCheckBox ( page_advanced , _ ( " Load Custom Textures " ) , wxGetTranslation ( load_hires_textures_desc ) , vconfig . bHiresTextures ) ) ;
szr_utility - > Add ( CreateCheckBox ( page_advanced , _ ( " Dump EFB Target " ) , wxGetTranslation ( dump_efb_desc ) , vconfig . bDumpEFBTarget ) ) ;
szr_utility - > Add ( CreateCheckBox ( page_advanced , _ ( " Free Look " ) , wxGetTranslation ( free_look_desc ) , vconfig . bFreeLook ) ) ;
2011-02-11 22:09:20 +00:00
# if !defined WIN32 && defined HAVE_LIBAV
2011-04-29 23:11:18 +00:00
szr_utility - > Add ( CreateCheckBox ( page_advanced , _ ( " Frame Dumps use FFV1 " ) , wxGetTranslation ( use_ffv1_desc ) , vconfig . bUseFFV1 ) ) ;
2011-02-11 22:09:20 +00:00
# endif
2011-01-31 17:52:46 +00:00
wxStaticBoxSizer * const group_utility = new wxStaticBoxSizer ( wxVERTICAL , page_advanced , _ ( " Utility " ) ) ;
2011-06-02 19:32:34 +00:00
szr_advanced - > Add ( group_utility , 0 , wxEXPAND | wxALL , 5 ) ;
2011-01-31 17:52:46 +00:00
group_utility - > Add ( szr_utility , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
2010-11-15 09:54:07 +00:00
}
// - misc
{
2011-05-01 13:41:06 +00:00
wxGridSizer * const szr_misc = new wxGridSizer ( 2 , 5 , 5 ) ;
2011-04-25 20:06:45 +00:00
2011-04-29 23:11:18 +00:00
szr_misc - > Add ( CreateCheckBox ( page_advanced , _ ( " Crop " ) , wxGetTranslation ( crop_desc ) , vconfig . bCrop ) ) ;
2010-11-15 09:54:07 +00:00
2011-06-02 19:32:34 +00:00
// Progressive Scan
{
2014-09-03 07:35:23 +00:00
progressive_scan_checkbox = new wxCheckBox ( page_advanced , wxID_ANY , _ ( " Enable Progressive Scan " ) ) ;
RegisterControl ( progressive_scan_checkbox , wxGetTranslation ( prog_scan_desc ) ) ;
progressive_scan_checkbox - > Bind ( wxEVT_CHECKBOX , & VideoConfigDiag : : Event_ProgressiveScan , this ) ;
2011-06-02 19:32:34 +00:00
2014-09-03 07:35:23 +00:00
progressive_scan_checkbox - > SetValue ( SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . bProgressive ) ;
2011-06-02 19:32:34 +00:00
// A bit strange behavior, but this needs to stay in sync with the main progressive boolean; TODO: Is this still necessary?
SConfig : : GetInstance ( ) . m_SYSCONF - > SetData ( " IPL.PGS " , SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . bProgressive ) ;
2014-09-03 07:35:23 +00:00
szr_misc - > Add ( progressive_scan_checkbox ) ;
2011-06-02 19:32:34 +00:00
}
2014-10-09 09:30:26 +00:00
# if defined WIN32
2014-07-19 18:18:03 +00:00
// Borderless Fullscreen
2014-07-26 10:43:49 +00:00
borderless_fullscreen = CreateCheckBox ( page_advanced , _ ( " Borderless Fullscreen " ) , wxGetTranslation ( borderless_fullscreen_desc ) , vconfig . bBorderlessFullscreen ) ;
2014-07-19 18:18:03 +00:00
szr_misc - > Add ( borderless_fullscreen ) ;
2014-10-09 09:30:26 +00:00
# endif
2014-07-19 18:18:03 +00:00
2011-01-31 17:52:46 +00:00
wxStaticBoxSizer * const group_misc = new wxStaticBoxSizer ( wxVERTICAL , page_advanced , _ ( " Misc " ) ) ;
2011-06-02 19:32:34 +00:00
szr_advanced - > Add ( group_misc , 0 , wxEXPAND | wxALL , 5 ) ;
2011-01-31 17:52:46 +00:00
group_misc - > Add ( szr_misc , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
2010-11-15 09:54:07 +00:00
}
2011-04-29 23:11:18 +00:00
szr_advanced - > AddStretchSpacer ( ) ;
CreateDescriptionArea ( page_advanced , szr_advanced ) ;
2010-11-15 09:54:07 +00:00
page_advanced - > SetSizerAndFit ( szr_advanced ) ;
}
2014-03-06 04:02:34 +00:00
wxButton * const btn_close = new wxButton ( this , wxID_OK , _ ( " Close " ) ) ;
2014-05-17 16:49:00 +00:00
btn_close - > Bind ( wxEVT_BUTTON , & VideoConfigDiag : : Event_ClickClose , this ) ;
2010-11-22 22:17:35 +00:00
2013-01-13 18:07:45 +00:00
Bind ( wxEVT_CLOSE_WINDOW , & VideoConfigDiag : : Event_Close , this ) ;
2010-11-15 09:54:07 +00:00
wxBoxSizer * const szr_main = new wxBoxSizer ( wxVERTICAL ) ;
szr_main - > Add ( notebook , 1 , wxEXPAND | wxALL , 5 ) ;
2011-04-25 20:06:45 +00:00
szr_main - > Add ( btn_close , 0 , wxALIGN_RIGHT | wxRIGHT | wxBOTTOM , 5 ) ;
2010-11-15 09:54:07 +00:00
SetSizerAndFit ( szr_main ) ;
Center ( ) ;
2011-03-16 22:22:21 +00:00
SetFocus ( ) ;
2011-03-21 19:57:31 +00:00
UpdateWindowUI ( ) ;
2010-12-20 17:06:39 +00:00
}
2011-04-29 23:11:18 +00:00
2011-06-02 23:28:47 +00:00
void VideoConfigDiag : : Event_DisplayResolution ( wxCommandEvent & ev )
{
SConfig : : GetInstance ( ) . m_LocalCoreStartupParameter . strFullscreenResolution =
2013-02-28 04:37:38 +00:00
WxStrToStr ( choice_display_resolution - > GetStringSelection ( ) ) ;
2011-06-02 23:28:47 +00:00
# if defined(HAVE_XRANDR) && HAVE_XRANDR
main_frame - > m_XRRConfig - > Update ( ) ;
# endif
ev . Skip ( ) ;
}
2011-04-29 23:11:18 +00:00
SettingCheckBox * VideoConfigDiag : : CreateCheckBox ( wxWindow * parent , const wxString & label , const wxString & description , bool & setting , bool reverse , long style )
{
SettingCheckBox * const cb = new SettingCheckBox ( parent , label , wxString ( ) , setting , reverse , style ) ;
RegisterControl ( cb , description ) ;
return cb ;
}
SettingChoice * VideoConfigDiag : : CreateChoice ( wxWindow * parent , int & setting , const wxString & description , int num , const wxString choices [ ] , long style )
{
SettingChoice * const ch = new SettingChoice ( parent , setting , wxString ( ) , num , choices , style ) ;
RegisterControl ( ch , description ) ;
return ch ;
}
SettingRadioButton * VideoConfigDiag : : CreateRadioButton ( wxWindow * parent , const wxString & label , const wxString & description , bool & setting , bool reverse , long style )
{
SettingRadioButton * const rb = new SettingRadioButton ( parent , label , wxString ( ) , setting , reverse , style ) ;
RegisterControl ( rb , description ) ;
return rb ;
}
2011-06-02 19:32:34 +00:00
/* Use this to register descriptions for controls which have NOT been created using the Create* functions from above */
2011-04-29 23:11:18 +00:00
wxControl * VideoConfigDiag : : RegisterControl ( wxControl * const control , const wxString & description )
{
ctrl_descs . insert ( std : : pair < wxWindow * , wxString > ( control , description ) ) ;
2013-01-13 18:07:45 +00:00
control - > Bind ( wxEVT_ENTER_WINDOW , & VideoConfigDiag : : Evt_EnterControl , this ) ;
control - > Bind ( wxEVT_LEAVE_WINDOW , & VideoConfigDiag : : Evt_LeaveControl , this ) ;
2011-04-29 23:11:18 +00:00
return control ;
}
void VideoConfigDiag : : Evt_EnterControl ( wxMouseEvent & ev )
{
// TODO: Re-Fit the sizer if necessary!
// Get settings control object from event
wxWindow * ctrl = ( wxWindow * ) ev . GetEventObject ( ) ;
if ( ! ctrl ) return ;
// look up description text object from the control's parent (which is the wxPanel of the current tab)
wxStaticText * descr_text = desc_texts [ ctrl - > GetParent ( ) ] ;
if ( ! descr_text ) return ;
// look up the description of the selected control and assign it to the current description text object's label
descr_text - > SetLabel ( ctrl_descs [ ctrl ] ) ;
descr_text - > Wrap ( descr_text - > GetContainingSizer ( ) - > GetSize ( ) . x - 20 ) ;
ev . Skip ( ) ;
}
// TODO: Don't hardcode the size of the description area via line breaks
2011-05-23 03:20:42 +00:00
# define DEFAULT_DESC_TEXT _("Move the mouse pointer over an option to display a detailed description.\n\n\n\n\n\n\n")
2011-04-29 23:11:18 +00:00
void VideoConfigDiag : : Evt_LeaveControl ( wxMouseEvent & ev )
{
// look up description text control and reset its label
wxWindow * ctrl = ( wxWindow * ) ev . GetEventObject ( ) ;
if ( ! ctrl ) return ;
wxStaticText * descr_text = desc_texts [ ctrl - > GetParent ( ) ] ;
if ( ! descr_text ) return ;
2011-05-23 03:20:42 +00:00
descr_text - > SetLabel ( DEFAULT_DESC_TEXT ) ;
2011-04-29 23:11:18 +00:00
descr_text - > Wrap ( descr_text - > GetContainingSizer ( ) - > GetSize ( ) . x - 20 ) ;
ev . Skip ( ) ;
}
void VideoConfigDiag : : CreateDescriptionArea ( wxPanel * const page , wxBoxSizer * const sizer )
{
// Create description frame
wxStaticBoxSizer * const desc_sizer = new wxStaticBoxSizer ( wxVERTICAL , page , _ ( " Description " ) ) ;
sizer - > Add ( desc_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
// Need to call SetSizerAndFit here, since we don't want the description texts to change the dialog width
page - > SetSizerAndFit ( sizer ) ;
// Create description text
2011-05-23 03:20:42 +00:00
wxStaticText * const desc_text = new wxStaticText ( page , wxID_ANY , DEFAULT_DESC_TEXT ) ;
2011-04-29 23:11:18 +00:00
desc_text - > Wrap ( desc_sizer - > GetSize ( ) . x - 20 ) ;
desc_sizer - > Add ( desc_text , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
// Store description text object for later lookup
desc_texts . insert ( std : : pair < wxWindow * , wxStaticText * > ( page , desc_text ) ) ;
}