Moved per-game graphics configuration to the game-list right click menu. It will be too difficult to make the "profiles" drop-down thing work with 3-state vs 2-state checkboxes. The per-game settings now have "undetermined" states, except for the radio buttons(I'll fix that later). It's super hacky right now. Video config (probably all config stuff) could be redone.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7386 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2011-03-21 05:46:33 +00:00
parent 8eaed1c105
commit 068855bbd6
26 changed files with 462 additions and 522 deletions

View File

@ -1,3 +1,4 @@
#include "VideoConfigDiag.h"
#include "FileUtil.h"
@ -13,48 +14,58 @@
#include "Core.h"
#include "Host.h"
extern CFrame* main_frame;
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
// template instantiation
template class BoolSetting<wxCheckBox>;
template class BoolSetting<wxRadioButton>;
// hackity hack
static bool g_use_intermediate_state = false;
template <>
SettingCheckBox::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse, long style)
: wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize, style)
SettingCheckBox::SettingCheckBox(wxWindow* parent, const wxString& label,
const wxString& tooltip, bool &setting, long style)
: wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize,
style | (g_use_intermediate_state ? (wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER) : 0))
, m_setting(setting)
, m_reverse(reverse)
{
SetToolTip(tooltip);
SetValue(m_setting ^ m_reverse);
if (VideoConfig::IsUndetermined(m_setting))
Set3StateValue(wxCHK_UNDETERMINED);
else
SetValue(m_setting);
_connect_macro_(this, SettingCheckBox::UpdateValue, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
}
template <>
SettingRadioButton::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse, long style)
SettingRadioButton::SettingRadioButton(wxWindow* parent, const wxString& label,
const wxString& tooltip, bool &setting, bool reverse, long style)
: wxRadioButton(parent, -1, label, wxDefaultPosition, wxDefaultSize, style)
, m_setting(setting)
, m_reverse(reverse)
{
SetToolTip(tooltip);
SetValue(m_setting ^ m_reverse);
if (!VideoConfig::IsUndetermined(m_setting) && m_setting != m_reverse)
SetValue(true);
_connect_macro_(this, SettingRadioButton::UpdateValue, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
}
SettingChoice::SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num, const wxString choices[], long style)
SettingChoice::SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip,
int num, const wxString choices[], long style)
: wxChoice(parent, -1, wxDefaultPosition, wxDefaultSize, num, choices)
, m_setting(setting)
{
SetToolTip(tooltip);
Select(m_setting);
if (g_use_intermediate_state)
Insert(wxTRANSLATE("< Default >"), 0);
Select(m_setting + g_use_intermediate_state);
_connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this);
}
void SettingChoice::UpdateValue(wxCommandEvent& ev)
{
m_setting = ev.GetInt();
m_setting = ev.GetInt() - g_use_intermediate_state;
ev.Skip();
}
@ -65,17 +76,6 @@ void VideoConfigDiag::Event_ClickClose(wxCommandEvent&)
void VideoConfigDiag::Event_Close(wxCloseEvent& ev)
{
if (cur_profile == 0)
{
vconfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
}
else
{
const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1));
vconfig.GameIniSave((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(),
(File::GetUserPath(D_GAMECONFIG_IDX) + item->GetUniqueID() + ".ini").c_str());
}
EndModal(wxID_OK);
TextureCache::InvalidateDefer(); // For settings like hi-res textures/texture format/etc.
@ -132,43 +132,18 @@ wxString hotkeys_tooltip = wxT("");
wxString ppshader_tooltip = wxT("");
wxString cache_efb_copies_tooltip = wxTRANSLATE("When using EFB to RAM we very often need to decode RAM data to a VRAM texture, which is a very time-consuming task.\nWith this option enabled, we'll skip decoding a texture if it didn't change.\nThis results in a nice speedup, but possibly causes glitches.\nIf you have any problems with this option enabled you should either try increasing the safety of the texture cache or disable this option.\n(NOTE: The safer the texture cache is adjusted the lower the speedup will be; accurate texture cache set to \"safe\" might actually be slower!)");
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, const std::string& _ininame)
: wxDialog(parent, -1,
wxString::Format(_("Dolphin %s Graphics Configuration"),
wxGetTranslation(wxString::From8BitData(title.c_str()))),
VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, bool is_game_config)
: wxDialog(parent, -1, wxString::Format(_("Dolphin %s Graphics Configuration"),
wxGetTranslation(wxString::From8BitData(title.c_str()))),
wxDefaultPosition, wxDefaultSize)
, choice_adapter(NULL)
, choice_ppshader(NULL)
, ininame(_ininame)
, GameListCtrl(main_frame->GetGameListCtrl())
//, choice_adapter(NULL)
//, choice_ppshader(NULL)
, vconfig(g_Config)
{
// TODO: Make this less hacky
vconfig = g_Config; // take over backend_info
// If a game from the game list is running, show the game specific config; show the default config otherwise
cur_profile = 0;
if (Core::IsRunning())
{
// Search which ISO has been started
for (long index = GameListCtrl->GetNextItem(-1); index != -1; index = GameListCtrl->GetNextItem(index))
{
const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(index));
if (!item) continue;
if (item->GetUniqueID() == SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID)
{
cur_profile = index + 1;
break;
}
}
}
g_use_intermediate_state = is_game_config;
// Load settings
vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
if (cur_profile != 0)
{
const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1));
vconfig.GameIniLoad((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str());
}
//vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
wxNotebook* const notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize);
@ -182,28 +157,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxFlexGridSizer* const szr_basic = new wxFlexGridSizer(2, 5, 5);
// game specific config
szr_basic->Add(new wxStaticText(page_general, -1, _("Configuration profile:")), 1, wxALIGN_CENTER_VERTICAL, 5);
profile_cb = new SettingChoice(page_general, cur_profile, wxGetTranslation(profile_tooltip));
szr_basic->Add(profile_cb, 1, 0, 0);
profile_cb->AppendString(_("(Default)"));
for (long index = GameListCtrl->GetNextItem(-1); index != -1; index = GameListCtrl->GetNextItem(index))
{
const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(index));
if (!item) continue;
profile_cb->AppendString(wxString(item->GetName(0).c_str(), wxConvUTF8));
}
profile_cb->Select(cur_profile);
_connect_macro_(profile_cb, VideoConfigDiag::Event_OnProfileChange, wxEVT_COMMAND_CHOICE_SELECTED, this);
profile_cb->Enable(!Core::IsRunning());
// adapter // for D3D only
if (vconfig.backend_info.Adapters.size())
{
szr_basic->Add(new wxStaticText(page_general, -1, _("Adapter:")), 1, wxALIGN_CENTER_VERTICAL, 5);
choice_adapter = new SettingChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_tooltip));
auto const choice_adapter = new SettingChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_tooltip));
std::vector<std::string>::const_iterator
it = vconfig.backend_info.Adapters.begin(),
@ -222,7 +180,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
_("Force 16:9"), _("Force 4:3"), _("Stretch to Window") };
szr_basic->Add(new wxStaticText(page_general, -1, _("Aspect Ratio:")), 1, wxALIGN_CENTER_VERTICAL, 0);
choice_aspect = new SettingChoice(page_general,
auto const choice_aspect = new SettingChoice(page_general,
vconfig.iAspectRatio, wxGetTranslation(ar_tooltip), sizeof(ar_choices)/sizeof(*ar_choices), ar_choices);
szr_basic->Add(choice_aspect, 1, 0, 0);
}
@ -230,9 +188,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// widescreen hack
{
szr_basic->AddStretchSpacer(1);
szr_basic->Add(widescreen_hack = new SettingCheckBox(page_general, _("Widescreen Hack"), wxGetTranslation(ws_hack_tooltip), vconfig.bWidescreenHack), 1, 0, 0);
szr_basic->Add(new SettingCheckBox(page_general, _("Widescreen Hack"),
wxGetTranslation(ws_hack_tooltip), vconfig.bWidescreenHack), 1, 0, 0);
szr_basic->AddStretchSpacer(1);
szr_basic->Add(vsync = new SettingCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_tooltip), vconfig.bVSync), 1, 0, 0);
szr_basic->Add(new SettingCheckBox(page_general, _("V-Sync"),
wxGetTranslation(vsync_tooltip), vconfig.bVSync), 1, 0, 0);
}
// enhancements
@ -240,31 +200,36 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_enh->Add(new wxStaticText(page_general, -1, _("Anisotropic Filtering:")), 1, wxALIGN_CENTER_VERTICAL, 0);
const wxString af_choices[] = {wxT("1x"), wxT("2x"), wxT("4x"), wxT("8x"), wxT("16x")};
szr_enh->Add(anisotropic_filtering = new SettingChoice(page_general, vconfig.iMaxAnisotropy, wxGetTranslation(af_tooltip), 5, af_choices));
szr_enh->Add(new SettingChoice(page_general, vconfig.iMaxAnisotropy,
wxGetTranslation(af_tooltip), 5, af_choices));
if (!vconfig.backend_info.AAModes.empty())
{
szr_enh->Add(new wxStaticText(page_general, -1, _("Anti-Aliasing:")), 1, wxALIGN_CENTER_VERTICAL, 0);
auto const choice_aamode = new SettingChoice(page_general, vconfig.iMultisampleMode, wxGetTranslation(aa_tooltip));
text_aamode = new wxStaticText(page_general, -1, _("Anti-Aliasing:"));
szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
choice_aamode = new SettingChoice(page_general, vconfig.iMultisampleMode, wxGetTranslation(aa_tooltip));
std::vector<std::string>::const_iterator
it = vconfig.backend_info.AAModes.begin(),
itend = vconfig.backend_info.AAModes.end();
for (; it != itend; ++it)
choice_aamode->AppendString(wxGetTranslation(wxString::FromAscii(it->c_str())));
std::vector<std::string>::const_iterator
it = vconfig.backend_info.AAModes.begin(),
itend = vconfig.backend_info.AAModes.end();
for (; it != itend; ++it)
choice_aamode->AppendString(wxGetTranslation(wxString::FromAscii(it->c_str())));
choice_aamode->Select(vconfig.iMultisampleMode);
szr_enh->Add(choice_aamode);
}
choice_aamode->Select(vconfig.iMultisampleMode);
szr_enh->Add(choice_aamode);
szr_enh->Add(native_mips = new SettingCheckBox(page_general, _("Load Native Mipmaps"), wxGetTranslation(native_mips_tooltip), vconfig.bUseNativeMips));
szr_enh->Add(efb_scaled_copy = new SettingCheckBox(page_general, _("EFB Scaled Copy"), wxGetTranslation(scaled_efb_copy_tooltip), vconfig.bCopyEFBScaled));
szr_enh->Add(pixel_lighting = new SettingCheckBox(page_general, _("Pixel Lighting"), wxGetTranslation(pixel_lighting_tooltip), vconfig.bEnablePixelLighting));
szr_enh->Add(pixel_depth = new SettingCheckBox(page_general, _("Pixel Depth"), wxGetTranslation(pixel_depth_tooltip), vconfig.bEnablePerPixelDepth));
szr_enh->Add(force_filtering = new SettingCheckBox(page_general, _("Force Bi/Trilinear Filtering"), wxGetTranslation(force_filtering_tooltip), vconfig.bForceFiltering));
szr_enh->Add(new SettingCheckBox(page_general, _("Load Native Mipmaps"),
wxGetTranslation(native_mips_tooltip), vconfig.bUseNativeMips));
szr_enh->Add(new SettingCheckBox(page_general, _("EFB Scaled Copy"),
wxGetTranslation(scaled_efb_copy_tooltip), vconfig.bCopyEFBScaled));
szr_enh->Add(new SettingCheckBox(page_general, _("Pixel Lighting"),
wxGetTranslation(pixel_lighting_tooltip), vconfig.bEnablePixelLighting));
szr_enh->Add(new SettingCheckBox(page_general, _("Pixel Depth"),
wxGetTranslation(pixel_depth_tooltip), vconfig.bEnablePerPixelDepth));
szr_enh->Add(new SettingCheckBox(page_general, _("Force Bi/Trilinear Filtering"),
wxGetTranslation(force_filtering_tooltip), vconfig.bForceFiltering));
_3d_vision = new SettingCheckBox(page_general, _("3D Vision (Requires Fullscreen)"), wxGetTranslation(_3d_vision_tooltip), vconfig.b3DVision);
auto const _3d_vision = new SettingCheckBox(page_general, _("3D Vision (Requires Fullscreen)"), wxGetTranslation(_3d_vision_tooltip), vconfig.b3DVision);
_3d_vision->Show(vconfig.backend_info.bSupports3DVision);
szr_enh->Add(_3d_vision);
@ -274,21 +239,24 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
const wxString efbscale_choices[] = { _("Fractional"), _("Integral [recommended]"),
wxT("1x"), wxT("2x"), wxT("3x"), wxT("0.75x"), wxT("0.5x"), wxT("0.375x") };
choice_efbscale = new SettingChoice(page_general,
auto const choice_efbscale = new SettingChoice(page_general,
vconfig.iEFBScale, wxGetTranslation(internal_res_tooltip), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices);
efb_scale_szr->Add(new wxStaticText(page_general, -1, _("Scale:")), 0, wxALIGN_CENTER_VERTICAL, 5);
//efb_scale_szr->AddStretchSpacer(1);
efb_scale_szr->Add(choice_efbscale, 0, wxBOTTOM | wxLEFT, 5);
emulate_efb_format_changes = new SettingCheckBox(page_general, _("Emulate format changes"), wxGetTranslation(efb_emulate_format_changes_tooltip), vconfig.bEFBEmulateFormatChanges);
auto const emulate_efb_format_changes = new SettingCheckBox(page_general, _("Emulate Format Changes"),
wxGetTranslation(efb_emulate_format_changes_tooltip), vconfig.bEFBEmulateFormatChanges);
// EFB copy
efbcopy_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(efb_copy_tooltip), vconfig.bEFBCopyEnable);
efbcopy_texture = new SettingRadioButton(page_general, _("Texture"), wxGetTranslation(efb_copy_texture_tooltip), vconfig.bCopyEFBToTexture, false, wxRB_GROUP);
efbcopy_ram = new SettingRadioButton(page_general, _("RAM"), wxGetTranslation(efb_copy_ram_tooltip), vconfig.bCopyEFBToTexture, true);
cache_efb_copies = new SettingCheckBox(page_general, _("Enable cache"), wxGetTranslation(cache_efb_copies_tooltip), vconfig.bEFBCopyCacheEnable);
auto const efbcopy_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(efb_copy_tooltip), vconfig.bEFBCopyEnable);
auto const efbcopy_texture = new SettingRadioButton(page_general, _("Texture"), wxGetTranslation(efb_copy_texture_tooltip), vconfig.bCopyEFBToTexture, false, wxRB_GROUP);
auto const efbcopy_ram = new SettingRadioButton(page_general, _("RAM"), wxGetTranslation(efb_copy_ram_tooltip), vconfig.bCopyEFBToTexture, true);
auto const cache_efb_copies = new SettingCheckBox(page_general, _("Enable Cache"), wxGetTranslation(cache_efb_copies_tooltip), vconfig.bEFBCopyCacheEnable);
wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_general, _("Copy"));
group_efbcopy->Add(efbcopy_enable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
group_efbcopy->AddStretchSpacer(1);
group_efbcopy->Add(efbcopy_texture, 0, wxRIGHT, 5);
@ -297,18 +265,18 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - safe texture cache
stc_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(stc_tooltip), vconfig.bSafeTextureCache);
auto const stc_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(stc_tooltip), vconfig.bSafeTextureCache);
stc_safe = new wxRadioButton(page_general, -1, _("Safe"),
auto const stc_safe = new wxRadioButton(page_general, -1, _("Safe"),
wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
stc_safe->SetToolTip(wxGetTranslation(stc_speed_tooltip));
_connect_macro_(stc_safe, VideoConfigDiag::Event_StcSafe, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
stc_normal = new wxRadioButton(page_general, -1, _("Normal"));
auto const stc_normal = new wxRadioButton(page_general, -1, _("Normal"));
stc_normal->SetToolTip(wxGetTranslation(stc_speed_tooltip));
_connect_macro_(stc_normal, VideoConfigDiag::Event_StcNormal, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
stc_fast = new wxRadioButton(page_general, -1, _("Fast"));
auto const stc_fast = new wxRadioButton(page_general, -1, _("Fast"));
stc_fast->SetToolTip(wxGetTranslation(stc_speed_tooltip));
_connect_macro_(stc_fast, VideoConfigDiag::Event_StcFast, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
@ -323,7 +291,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
wxStaticBoxSizer* const group_efb = new wxStaticBoxSizer(wxVERTICAL, page_general, _("EFB"));
szr_general->Add(group_efb, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
group_efb->Add(efb_scale_szr, 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(efbaccess_enable = new SettingCheckBox(page_general, _("Enable CPU Access"), wxGetTranslation(efb_access_tooltip), vconfig.bEFBAccessEnable), 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(new SettingCheckBox(page_general, _("Enable CPU Access"),
wxGetTranslation(efb_access_tooltip), vconfig.bEFBAccessEnable), 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(emulate_efb_format_changes, 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(group_efbcopy, 0, wxEXPAND | wxBOTTOM, 5);
@ -345,23 +314,20 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
notebook->AddPage(page_advanced, _("Advanced"));
wxBoxSizer* const szr_advanced = new wxBoxSizer(wxVERTICAL);
// configuration profiles
{
wxStaticBoxSizer* const group_profile = new wxStaticBoxSizer(wxHORIZONTAL, page_advanced, _("Configuration profile"));
profile_text = new wxStaticText(page_advanced, -1, profile_cb->GetStringSelection());
szr_advanced->Add(group_profile, 0, wxEXPAND | wxALL, 5);
group_profile->Add(profile_text, 1, wxEXPAND | wxALL, 5);
}
// - rendering
{
wxGridSizer* const szr_rendering = new wxGridSizer(2, 5, 5);
szr_rendering->Add(wireframe = new SettingCheckBox(page_advanced, _("Enable Wireframe"), wxGetTranslation(wireframe_tooltip), vconfig.bWireFrame));
szr_rendering->Add(disable_lighting = new SettingCheckBox(page_advanced, _("Disable Lighting"), wxGetTranslation(disable_lighting_tooltip), vconfig.bDisableLighting));
szr_rendering->Add(disable_textures = new SettingCheckBox(page_advanced, _("Disable Textures"), wxGetTranslation(disable_textures_tooltip), vconfig.bDisableTexturing));
szr_rendering->Add(disable_fog = new SettingCheckBox(page_advanced, _("Disable Fog"), wxGetTranslation(disable_fog_tooltip), vconfig.bDisableFog));
szr_rendering->Add(disable_dst_alpha = new SettingCheckBox(page_advanced, _("Disable Dest. Alpha Pass"), wxGetTranslation(disable_alphapass_tooltip), vconfig.bDstAlphaPass));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Enable Wireframe"),
wxGetTranslation(wireframe_tooltip), vconfig.bWireFrame));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Lighting"),
wxGetTranslation(disable_lighting_tooltip), vconfig.bDisableLighting));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Textures"),
wxGetTranslation(disable_textures_tooltip), vconfig.bDisableTexturing));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Fog"),
wxGetTranslation(disable_fog_tooltip), vconfig.bDisableFog));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Dest. Alpha Pass"),
wxGetTranslation(disable_alphapass_tooltip), vconfig.bDstAlphaPass));
wxStaticBoxSizer* const group_rendering = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Rendering"));
szr_advanced->Add(group_rendering, 0, wxEXPAND | wxALL, 5);
@ -372,13 +338,20 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5);
szr_info->Add(show_fps = new SettingCheckBox(page_advanced, _("Show FPS"), wxGetTranslation(show_fps_tooltip), vconfig.bShowFPS));
szr_info->Add(overlay_stats = new SettingCheckBox(page_advanced, _("Various Statistics"), wxGetTranslation(show_stats_tooltip), vconfig.bOverlayStats));
szr_info->Add(overlay_proj_stats = new SettingCheckBox(page_advanced, _("Projection Stats"), wxGetTranslation(proj_stats_tooltip), vconfig.bOverlayProjStats));
szr_info->Add(texfmt_overlay = new SettingCheckBox(page_advanced, _("Texture Format"), wxGetTranslation(texfmt_tooltip), vconfig.bTexFmtOverlayEnable));
szr_info->Add(efb_copy_regions = new SettingCheckBox(page_advanced, _("EFB Copy Regions"), wxGetTranslation(efb_copy_regions_tooltip), vconfig.bShowEFBCopyRegions));
szr_info->Add(show_shader_errors = new SettingCheckBox(page_advanced, _("Show Shader Errors"), wxT(""), vconfig.bShowShaderErrors));
szr_info->Add(show_input_display = new SettingCheckBox(page_advanced, _("Show Input Display"), wxGetTranslation(show_input_display_tooltip), vconfig.bShowInputDisplay));
szr_info->Add(new SettingCheckBox(page_advanced, _("Show FPS"),
wxGetTranslation(show_fps_tooltip), vconfig.bShowFPS));
szr_info->Add(new SettingCheckBox(page_advanced, _("Various Statistics"),
wxGetTranslation(show_stats_tooltip), vconfig.bOverlayStats));
szr_info->Add(new SettingCheckBox(page_advanced, _("Projection Stats"),
wxGetTranslation(proj_stats_tooltip), vconfig.bOverlayProjStats));
szr_info->Add(new SettingCheckBox(page_advanced, _("Texture Format"),
wxGetTranslation(texfmt_tooltip), vconfig.bTexFmtOverlayEnable));
szr_info->Add(new SettingCheckBox(page_advanced, _("EFB Copy Regions"),
wxGetTranslation(efb_copy_regions_tooltip), vconfig.bShowEFBCopyRegions));
szr_info->Add(new SettingCheckBox(page_advanced, _("Show Shader Errors"),
wxT(""), vconfig.bShowShaderErrors));
szr_info->Add(new SettingCheckBox(page_advanced, _("Show Input Display"),
wxGetTranslation(show_input_display_tooltip), vconfig.bShowInputDisplay));
wxStaticBoxSizer* const group_info = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Information"));
szr_advanced->Add(group_info, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
@ -387,9 +360,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - XFB
{
enable_xfb = new SettingCheckBox(page_advanced, _("Enable"), wxGetTranslation(xfb_tooltip), vconfig.bUseXFB);
virtual_xfb = new SettingRadioButton(page_advanced, _("Virtual"), wxGetTranslation(xfb_tooltip), vconfig.bUseRealXFB, true, wxRB_GROUP);
real_xfb = new SettingRadioButton(page_advanced, _("Real"), wxGetTranslation(xfb_tooltip), vconfig.bUseRealXFB);
auto const enable_xfb = new SettingCheckBox(page_advanced, _("Enable"), wxGetTranslation(xfb_tooltip), vconfig.bUseXFB);
auto const virtual_xfb = new SettingRadioButton(page_advanced, _("Virtual"), wxGetTranslation(xfb_tooltip), vconfig.bUseRealXFB, true, wxRB_GROUP);
auto const real_xfb = new SettingRadioButton(page_advanced, _("Real"), wxGetTranslation(xfb_tooltip), vconfig.bUseRealXFB);
wxStaticBoxSizer* const group_xfb = new wxStaticBoxSizer(wxHORIZONTAL, page_advanced, _("XFB"));
szr_advanced->Add(group_xfb, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
@ -397,21 +370,24 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
group_xfb->AddStretchSpacer(1);
group_xfb->Add(virtual_xfb, 0, wxRIGHT, 5);
group_xfb->Add(real_xfb, 0, wxRIGHT, 5);
} // xfb
// - utility
{
wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5);
szr_utility->Add(dump_textures = new SettingCheckBox(page_advanced, _("Dump Textures"), wxGetTranslation(dump_textures_tooltip), vconfig.bDumpTextures));
szr_utility->Add(hires_textures = new SettingCheckBox(page_advanced, _("Load Hi-Res Textures"), wxGetTranslation(load_hires_textures_tooltip), vconfig.bHiresTextures));
szr_utility->Add(dump_efb = new SettingCheckBox(page_advanced, _("Dump EFB Target"), dump_efb_tooltip, vconfig.bDumpEFBTarget));
szr_utility->Add(dump_frames = new SettingCheckBox(page_advanced, _("Dump Frames"), dump_frames_tooltip, vconfig.bDumpFrames));
szr_utility->Add(free_look = new SettingCheckBox(page_advanced, _("Free Look"), free_look_tooltip, vconfig.bFreeLook));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump Textures"),
wxGetTranslation(dump_textures_tooltip), vconfig.bDumpTextures));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Load Hi-Res Textures"),
wxGetTranslation(load_hires_textures_tooltip), vconfig.bHiresTextures));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump EFB Target"),
dump_efb_tooltip, vconfig.bDumpEFBTarget));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump Frames"),
dump_frames_tooltip, vconfig.bDumpFrames));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Free Look"),
free_look_tooltip, vconfig.bFreeLook));
#if !defined WIN32 && defined HAVE_LIBAV
szr_utility->Add(frame_dumps_via_ffv1 = new SettingCheckBox(page_advanced, _("Frame dumps use FFV1"), use_ffv1_tooltip, vconfig.bUseFFV1));
szr_utility->Add(frame_dumps_via_ffv1 = new SettingCheckBox(page_advanced, _("Dump Frames With FFV1"), use_ffv1_tooltip, vconfig.bUseFFV1));
#endif
wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Utility"));
@ -423,18 +399,23 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxGridSizer* const szr_misc = new wxGridSizer(2);
szr_misc->Add(crop = new SettingCheckBox(page_advanced, _("Crop"), crop_tooltip, vconfig.bCrop), 0, wxBOTTOM, 5);
szr_misc->Add(opencl = new SettingCheckBox(page_advanced, _("Enable OpenCL"), opencl_tooltip, vconfig.bEnableOpenCL), 0, wxLEFT|wxBOTTOM, 5);
szr_misc->Add(dlcache = new SettingCheckBox(page_advanced, _("Enable Display List Caching"), dlc_tooltip, vconfig.bDlistCachingEnable), 0, wxBOTTOM, 5);
szr_misc->Add(hotkeys = new SettingCheckBox(page_advanced, _("Enable Hotkeys"), hotkeys_tooltip, vconfig.bOSDHotKey), 0, wxLEFT|wxBOTTOM, 5);
szr_misc->Add(ompdecoder = new SettingCheckBox(page_advanced, _("OpenMP Texture Decoder"), omp_tooltip, vconfig.bOMPDecoder), 0, wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Crop"),
crop_tooltip, vconfig.bCrop), 0, wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Enable OpenCL"),
opencl_tooltip, vconfig.bEnableOpenCL), 0, wxLEFT|wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Enable Display List Caching"),
dlc_tooltip, vconfig.bDlistCachingEnable), 0, wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Enable Hotkeys"),
hotkeys_tooltip, vconfig.bOSDHotKey), 0, wxLEFT|wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("OpenMP Texture Decoder"),
omp_tooltip, vconfig.bOMPDecoder), 0, wxBOTTOM, 5);
// postproc shader
if (vconfig.backend_info.PPShaders.size())
{
szr_misc->Add(new wxStaticText(page_advanced, -1, _("Post-Processing Shader:")), 1, wxALIGN_CENTER_VERTICAL, 0);
choice_ppshader = new wxChoice(page_advanced, -1, wxDefaultPosition);
auto const choice_ppshader = new wxChoice(page_advanced, -1, wxDefaultPosition);
choice_ppshader->SetToolTip(wxGetTranslation(ppshader_tooltip));
choice_ppshader->AppendString(_("(off)"));
@ -474,166 +455,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
SetSizerAndFit(szr_main);
Center();
SetFocus();
SetUIValuesFromConfig();
Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this);
UpdateWindowUI();
}
void VideoConfigDiag::Event_OnProfileChange(wxCommandEvent& ev)
{
// Save settings of current profile
if (cur_profile == 0)
{
vconfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
}
else
{
const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1));
vconfig.GameIniSave((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(),
(std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str());
}
// Enable new profile
cur_profile = ev.GetInt();
// Reset settings
vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
// Load game-specific settings
if (cur_profile != 0)
{
const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1));
vconfig.GameIniLoad((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str());
}
// Update our UI elements with the new config
SetUIValuesFromConfig();
UpdateWindowUI();
profile_text->SetLabel(profile_cb->GetStringSelection());
ev.Skip();
}
void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
{
// Anti-aliasing
choice_aamode->Enable(vconfig.backend_info.AAModes.size() > 1);
text_aamode->Enable(vconfig.backend_info.AAModes.size() > 1);
// pixel lighting
pixel_lighting->Enable(vconfig.backend_info.bSupportsPixelLighting);
// 3D vision
_3d_vision->Show(vconfig.backend_info.bSupports3DVision);
// EFB copy
efbcopy_texture->Enable(vconfig.bEFBCopyEnable);
efbcopy_ram->Enable(vconfig.bEFBCopyEnable);
cache_efb_copies->Enable(vconfig.bEFBCopyEnable && !vconfig.bCopyEFBToTexture);
// EFB format change emulation
emulate_efb_format_changes->Enable(vconfig.backend_info.bSupportsFormatReinterpretation);
// ATC
stc_safe->Enable(vconfig.bSafeTextureCache);
stc_normal->Enable(vconfig.bSafeTextureCache);
stc_fast->Enable(vconfig.bSafeTextureCache);
// XFB
virtual_xfb->Enable(vconfig.bUseXFB);
real_xfb->Enable(vconfig.bUseXFB);
// If emulation hasn't started, yet, always update g_Config.
// Otherwise only update it if we're editing the currently running game's profile
if (!Core::IsRunning())
{
g_Config = vconfig;
}
else if (cur_profile != 0)
{
// TODO: Modifying the default profile should update g_Config as well
if (GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1))->GetUniqueID() ==
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID)
g_Config = vconfig;
}
ev.Skip();
}
void VideoConfigDiag::SetUIValuesFromConfig()
{
if (choice_adapter) choice_adapter->SetSelection(vconfig.iAdapter);
vconfig.VerifyValidity();
choice_aspect->SetSelection(vconfig.iAspectRatio);
widescreen_hack->SetValue(vconfig.bWidescreenHack);
vsync->SetValue(vconfig.bVSync);
anisotropic_filtering->SetSelection(vconfig.iMaxAnisotropy);
choice_aamode->SetSelection(vconfig.iMultisampleMode);
native_mips->SetValue(vconfig.bUseNativeMips);
efb_scaled_copy->SetValue(vconfig.bCopyEFBScaled);
pixel_lighting->SetValue(vconfig.bEnablePixelLighting);
pixel_depth->SetValue(vconfig.bEnablePerPixelDepth);
force_filtering->SetValue(vconfig.bForceFiltering);
_3d_vision->SetValue(vconfig.b3DVision);
choice_efbscale->SetSelection(vconfig.iEFBScale);
efbaccess_enable->SetValue(vconfig.bEFBAccessEnable);
emulate_efb_format_changes->SetValue(vconfig.bEFBEmulateFormatChanges);
efbcopy_enable->SetValue(vconfig.bEFBCopyEnable);
efbcopy_texture->SetValue(vconfig.bCopyEFBToTexture);
efbcopy_ram->SetValue(!vconfig.bCopyEFBToTexture);
cache_efb_copies->SetValue(vconfig.bEFBCopyCacheEnable);
stc_enable->SetValue(vconfig.bSafeTextureCache);
if (0 == vconfig.iSafeTextureCache_ColorSamples)
stc_safe->SetValue(true);
if (512 == vconfig.iSafeTextureCache_ColorSamples)
stc_normal->SetValue(true);
if (128 == vconfig.iSafeTextureCache_ColorSamples)
stc_fast->SetValue(true);
wireframe->SetValue(vconfig.bWireFrame);
disable_lighting->SetValue(vconfig.bDisableLighting);
disable_textures->SetValue(vconfig.bDisableTexturing);
disable_fog->SetValue(vconfig.bDisableFog);
disable_dst_alpha->SetValue(vconfig.bDstAlphaPass);
show_fps->SetValue(vconfig.bShowFPS);
overlay_stats->SetValue(vconfig.bOverlayStats);
overlay_proj_stats->SetValue(vconfig.bOverlayProjStats);
texfmt_overlay->SetValue(vconfig.bTexFmtOverlayEnable);
efb_copy_regions->SetValue(vconfig.bShowEFBCopyRegions);
show_shader_errors->SetValue(vconfig.bShowShaderErrors);
show_input_display->SetValue(vconfig.bShowInputDisplay);
enable_xfb->SetValue(vconfig.bUseXFB);
virtual_xfb->SetValue(!vconfig.bUseRealXFB);
real_xfb->SetValue(vconfig.bUseRealXFB);
dump_textures->SetValue(vconfig.bDumpTextures);
hires_textures->SetValue(vconfig.bHiresTextures);
dump_efb->SetValue(vconfig.bDumpEFBTarget);
dump_frames->SetValue(vconfig.bDumpFrames);
free_look->SetValue(vconfig.bFreeLook);
#if !defined WIN32 && defined HAVE_LIBAV
frame_dumps_via_ffv1->SetValue(vconfig.bUseFFV1);
#endif
crop->SetValue(vconfig.bCrop);
opencl->SetValue(vconfig.bEnableOpenCL);
dlcache->SetValue(vconfig.bDlistCachingEnable);
ompdecoder->SetValue(vconfig.bOMPDecoder);
hotkeys->SetValue(vconfig.bOSDHotKey);
if (choice_ppshader)
{
if (vconfig.sPostProcessingShader.empty()) choice_ppshader->Select(0);
else choice_ppshader->SetStringSelection(wxString::FromAscii(vconfig.sPostProcessingShader.c_str()));
}
//for (auto i = m_settings.begin(), e = m_settings.end(); i != e; ++i)
// (*i)->UpdateUI();
}