From a779b92a09dccfb411a1bee84b078c7b2877379a Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 25 Apr 2011 20:06:45 +0000 Subject: [PATCH] Remove configuration profile support. I.e. revert most of the video configuration dialog changes since r7483. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7484 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/VideoConfigDiag.cpp | 809 +++--------------- Source/Core/DolphinWX/Src/VideoConfigDiag.h | 319 ++----- Source/Core/VideoCommon/Src/VideoConfig.cpp | 416 +++++---- Source/Core/VideoCommon/Src/VideoConfig.h | 81 +- Source/Plugins/Plugin_VideoDX11/Src/main.cpp | 5 +- Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 6 +- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 4 +- .../Plugin_VideoSoftware/Src/SWmain.cpp | 2 +- 8 files changed, 385 insertions(+), 1257 deletions(-) diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index dbbe884670..da78b931a4 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -5,26 +5,16 @@ #include -#include "Frame.h" -#include "ISOFile.h" -#include "GameListCtrl.h" - -#include "ConfigManager.h" -#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) -_pattern::_pattern(bool *state, const tmp_TypeClass type): m_uistate(state), _type(type) {} +// template instantiation +template class BoolSetting; +template class BoolSetting; -IMPLEMENT_CLASS(SettingCheckBox, wxCheckBox) // this allows to register the class in RTTI passing through wxWidgets -SettingCheckBox::SettingCheckBox(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool &def_setting, bool &state, bool reverse, long style) - : _pattern(&state, allow_3State) - , wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize, style) +template <> +SettingCheckBox::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse, long style) + : wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize, style) , m_setting(setting) - , d_setting(&def_setting) , m_reverse(reverse) { SetToolTip(tooltip); @@ -32,24 +22,9 @@ SettingCheckBox::SettingCheckBox(wxWindow* parent, const wxString& label, const _connect_macro_(this, SettingCheckBox::UpdateValue, wxEVT_COMMAND_CHECKBOX_CLICKED, this); } -// without 3sate support -SettingCheckBox::SettingCheckBox(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse, long style) - : _pattern(0, only_2State) - , wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize, style) - , m_setting(setting) - , d_setting(&setting) - , m_reverse(reverse) -{ - SetToolTip(tooltip); - SetValue(m_setting ^ m_reverse); - _connect_macro_(this, SettingCheckBox::UpdateValue, wxEVT_COMMAND_CHECKBOX_CLICKED, this); -} - - -IMPLEMENT_CLASS(SettingRadioButton, wxRadioButton) -SettingRadioButton::SettingRadioButton(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse, long style) - : _pattern(0, only_2State) - , wxRadioButton(parent, -1, label, wxDefaultPosition, wxDefaultSize, style) +template <> +SettingRadioButton::BoolSetting(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) { @@ -58,128 +33,21 @@ SettingRadioButton::SettingRadioButton(wxWindow* parent, const wxString& label, _connect_macro_(this, SettingRadioButton::UpdateValue, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); } -// partial specialization (SettingChoice template) -template<> -void StringSettingChoice::UpdateValue(wxCommandEvent& ev) +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) { - m_setting = ev.GetString().mb_str(); - if (_type == allow_3State) - { - if (m_index != 0) // Choice ctrl with 3RD option - { - // changing state value should be done here, never outside this block - if (ev.GetInt() == 0) - { - UpdateUIState(false); - } - else - { - UpdateUIState(true); - if (ev.GetInt() == 1) m_setting.clear(); - } - } - else // Choice ctrl without 3RD option - { - if (ev.GetInt() == 0) - m_setting.clear(); - if (m_uistate) - if (!*m_uistate) - *d_setting = m_setting; - } - } + SetToolTip(tooltip); + Select(m_setting); + _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this); +} + +void SettingChoice::UpdateValue(wxCommandEvent& ev) +{ + m_setting = ev.GetInt(); ev.Skip(); } -template<> -wxClassInfo IntSettingChoice::ms_classInfo(wxT("IntSettingChoice"), - &wxChoice::ms_classInfo, NULL, (int)sizeof(IntSettingChoice), - (wxObjectConstructorFn) NULL); - -template<> -wxClassInfo *IntSettingChoice::GetClassInfo() const -{ - return &IntSettingChoice::ms_classInfo; -} - -template<> -wxClassInfo StringSettingChoice::ms_classInfo(wxT("StringSettingChoice"), - &wxChoice::ms_classInfo, NULL, (int)sizeof(StringSettingChoice), - (wxObjectConstructorFn) NULL); - -template<> -wxClassInfo *StringSettingChoice::GetClassInfo() const -{ - return &StringSettingChoice::ms_classInfo; -} - -template -SettingChoice::SettingChoice(wxWindow* parent, V &setting, V &def_setting, bool &state, int &cur_index, const wxString& tooltip, int num, const wxString choices[], long style) - : _pattern(&state, allow_3State) - , wxChoice(parent, -1, wxDefaultPosition, wxDefaultSize, num, choices) - , m_setting(setting) - , d_setting(&def_setting) - , m_index(cur_index) -{ - SetToolTip(tooltip); - _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this); -} - -// without 3state support -template -SettingChoice::SettingChoice(wxWindow* parent, V &setting, const wxString& tooltip, int num, const wxString choices[], long style) - : _pattern(0, only_2State) - , wxChoice(parent, -1, wxDefaultPosition, wxDefaultSize, num, choices) - , m_setting(setting) - , d_setting(&setting) - , m_index(setting) -{ - SetToolTip(tooltip); - _connect_macro_(this, SettingChoice::UpdateValue, wxEVT_COMMAND_CHOICE_SELECTED, this); -} - -static void ScanLayouts(wxWindow *obj) -{ - const wxWindowList container = obj->GetChildren(); - for(wxWindowList::compatibility_iterator node = container.GetFirst(); node; node = node->GetNext()) - { - wxWindow *ctrl = node->GetData(); - if (ctrl->IsKindOf(CLASSINFO(SettingCheckBox))) - { - if (((SettingCheckBox*)ctrl)->getTypeClass() == allow_3State) - { - ((SettingCheckBox*)ctrl)->UpdateUIState(false); - ((SettingCheckBox*)ctrl)->Set3StateValue(wxCHK_UNDETERMINED); - } - } - if (ctrl->IsKindOf(CLASSINFO(IntSettingChoice))) - { - if (((IntSettingChoice*)ctrl)->getTypeClass() == allow_3State) - { - ((IntSettingChoice*)ctrl)->UpdateUIState(false); - ((IntSettingChoice*)ctrl)->Select(0); - } - } - if (ctrl->IsKindOf(CLASSINFO(StringSettingChoice))) - { - if (((StringSettingChoice*)ctrl)->getTypeClass() == allow_3State) - { - ((StringSettingChoice*)ctrl)->UpdateUIState(false); - ((StringSettingChoice*)ctrl)->Select(0); - } - } - - - if (ctrl->GetChildren().GetCount() > 0) - ScanLayouts(ctrl); // Exponential Recursive Calls - } - -} - -void VideoConfigDiag::Event_ClickDefault(wxCommandEvent&) -{ - ScanLayouts(this); // set UIstate and values -} - void VideoConfigDiag::Event_ClickClose(wxCommandEvent&) { Close(); @@ -187,57 +55,13 @@ void VideoConfigDiag::Event_ClickClose(wxCommandEvent&) void VideoConfigDiag::Event_Close(wxCloseEvent& ev) { - if (cur_profile == 0) - { - cur_vconfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); - } - else - { - const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1)); - cur_vconfig.GameIniSave((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(), - (File::GetUserPath(D_GAMECONFIG_IDX) + item->GetUniqueID() + ".ini").c_str()); - } + g_Config.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); EndModal(wxID_OK); TextureCache::InvalidateDefer(); // For settings like hi-res textures/texture format/etc. } - -static wxString FormatString(const GameListItem *item) -{ - wxString title; - if (item->GetCountry() == DiscIO::IVolume::COUNTRY_JAPAN - || item->GetCountry() == DiscIO::IVolume::COUNTRY_TAIWAN - || item->GetPlatform() == GameListItem::WII_WAD) - { -#ifdef _WIN32 - wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent); - static bool validCP932 = ::IsValidCodePage(932) != 0; - if (validCP932) - { - SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); - } - else - { - WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932"); - } -#else - wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP)); -#endif - - title = wxString(item->GetName(0).c_str(), SJISConv); - } - - else // Do the same for PAL/US Games (assuming ISO 8859-1) - { - title = wxString::From8BitData(item->GetName(0).c_str()); - } - - return title; -} - -wxString profile_tooltip = wxTRANSLATE("Selects which game should be affected by the configuration changes done in this dialog.\nThe (Default) profile affects the standard settings used for every game."); wxString adapter_tooltip = wxTRANSLATE("Select a hardware adapter to use.\nWhen in doubt, use the first one"); wxString ar_tooltip = wxTRANSLATE("Select what aspect ratio to use when rendering:\nAuto: Use the native aspect ratio (4:3)\nForce 16:9: Stretch the picture to an aspect ratio of 16:9.\nForce 4:3: Stretch the picture to an aspect ratio of 4:3.\nStretch to window: Stretch the picture to the window size."); wxString ws_hack_tooltip = wxTRANSLATE("Force the game to output graphics for widescreen resolutions.\nNote that this might cause graphical glitches"); @@ -286,64 +110,17 @@ 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!)"); -wxString def_profile = wxTRANSLATE("< as Default Profile >"); - -// this macro decides the config which binds all controls: -// default config = main data from cur_vconfig, default and state data from g_Config -// custom config = main data from cur_vconfig, default value from def_vconfig, state data from cur_vconfig -// -#define CONFIG(member, n) (cur_profile == 0) ? g_Config.member : (n == 0) ? def_vconfig.member : cur_vconfig.member - 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()))), wxDefaultPosition, wxDefaultSize) - , choice_adapter(NULL) - , choice_ppshader(NULL) + , vconfig(g_Config) , ininame(_ininame) - , GameListCtrl(main_frame->GetGameListCtrl()) { - -#define SET_PARAMS(member) cur_vconfig.member, CONFIG(member, 0), CONFIG(UI_State.member, 1) + vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); - // TODO: Make this less hacky - cur_vconfig = g_Config; // take over backend_info (preserve integrity) - - // If a game from the game list is running, show the game specific config; show the default config otherwise - long cb_style = wxCHK_3STATE; - 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; - } - } - } - - prev_profile = cur_profile; - - // Load default profile settings - def_vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); - - // Load current profile settings - std::string game_ini; - if (cur_profile != 0) - { - const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1)); - game_ini = File::GetUserPath(D_GAMECONFIG_IDX) + item->GetUniqueID() + ".ini"; - cb_style |= wxCHK_ALLOW_3RD_STATE_FOR_USER; - } - - cur_vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(), (cur_profile != 0), game_ini.c_str()); + Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this); wxNotebook* const notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize); @@ -357,61 +134,52 @@ 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 IntSettingChoice(page_general, cur_profile, wxGetTranslation(profile_tooltip)); - szr_basic->Add(profile_cb, 1, 0, 0); + // graphics api + //{ + //const wxString gfxapi_choices[] = { _("Software [not present]"), + // _("OpenGL [broken]"), _("Direct3D 9 [broken]"), _("Direct3D 11") }; - 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(FormatString(item)); - } - - profile_cb->Select(cur_profile); - _connect_macro_(profile_cb, VideoConfigDiag::Event_OnProfileChange, wxEVT_COMMAND_CHOICE_SELECTED, this); + //szr_basic->Add(new wxStaticText(page_general, -1, _("Graphics API:")), 1, wxALIGN_CENTER_VERTICAL, 0); + //wxChoice* const choice_gfxapi = new SettingChoice(page_general, + // g_gfxapi, sizeof(gfxapi_choices)/sizeof(*gfxapi_choices), gfxapi_choices); + //szr_basic->Add(choice_gfxapi, 1, 0, 0); + // TODO: Connect with Event_Backend() + //} // adapter // for D3D only - if (cur_vconfig.backend_info.Adapters.size()) + if (vconfig.backend_info.Adapters.size()) { szr_basic->Add(new wxStaticText(page_general, -1, _("Adapter:")), 1, wxALIGN_CENTER_VERTICAL, 5); - choice_adapter = new IntSettingChoice(page_general, SET_PARAMS(iAdapter), cur_profile, wxGetTranslation(adapter_tooltip)); + wxChoice* const choice_adapter = new SettingChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_tooltip)); std::vector::const_iterator - it = cur_vconfig.backend_info.Adapters.begin(), - itend = cur_vconfig.backend_info.Adapters.end(); + it = vconfig.backend_info.Adapters.begin(), + itend = vconfig.backend_info.Adapters.end(); for (; it != itend; ++it) choice_adapter->AppendString(wxString::FromAscii(it->c_str())); - if (cur_profile != 0) - choice_adapter->Insert(wxGetTranslation(def_profile), 0); + choice_adapter->Select(vconfig.iAdapter); szr_basic->Add(choice_adapter, 1, 0, 0); } - + // aspect-ratio { const wxString ar_choices[] = { _("Auto [recommended]"), _("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 IntSettingChoice(page_general, - SET_PARAMS(iAspectRatio), cur_profile, wxGetTranslation(ar_tooltip), sizeof(ar_choices)/sizeof(*ar_choices), ar_choices); - - if (cur_profile != 0) - choice_aspect->Insert(wxGetTranslation(def_profile), 0); - + wxChoice* 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); } // widescreen hack { szr_basic->AddStretchSpacer(1); - szr_basic->Add(widescreen_hack = new SettingCheckBox(page_general, _("Widescreen Hack"), wxGetTranslation(ws_hack_tooltip), SET_PARAMS(bWidescreenHack), false, cb_style), 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), SET_PARAMS(bVSync), false, cb_style), 1, 0, 0); + szr_basic->Add(new SettingCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_tooltip), vconfig.bVSync), 1, 0, 0); } // enhancements @@ -419,32 +187,32 @@ 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 IntSettingChoice(page_general, SET_PARAMS(iMaxAnisotropy), cur_profile, wxGetTranslation(af_tooltip), 5, af_choices)); - - if (cur_profile != 0) - anisotropic_filtering->Insert(wxGetTranslation(def_profile), 0); - + szr_enh->Add(new SettingChoice(page_general, vconfig.iMaxAnisotropy, wxGetTranslation(af_tooltip), 5, af_choices)); + + text_aamode = new wxStaticText(page_general, -1, _("Anti-Aliasing:")); szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0); - choice_aamode = new IntSettingChoice(page_general, SET_PARAMS(iMultisampleMode), cur_profile, wxGetTranslation(aa_tooltip)); + choice_aamode = new SettingChoice(page_general, vconfig.iMultisampleMode, wxGetTranslation(aa_tooltip)); std::vector::const_iterator - it = cur_vconfig.backend_info.AAModes.begin(), - itend = cur_vconfig.backend_info.AAModes.end(); + 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()))); - if (cur_profile != 0) - choice_aamode->Insert(wxGetTranslation(def_profile), 0); + 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), SET_PARAMS(bUseNativeMips), false, cb_style)); - szr_enh->Add(efb_scaled_copy = new SettingCheckBox(page_general, _("EFB Scaled Copy"), wxGetTranslation(scaled_efb_copy_tooltip), SET_PARAMS(bCopyEFBScaled), false, cb_style)); - szr_enh->Add(pixel_lighting = new SettingCheckBox(page_general, _("Pixel Lighting"), wxGetTranslation(pixel_lighting_tooltip), SET_PARAMS(bEnablePixelLighting), false, cb_style)); - szr_enh->Add(pixel_depth = new SettingCheckBox(page_general, _("Pixel Depth"), wxGetTranslation(pixel_depth_tooltip), SET_PARAMS(bEnablePerPixelDepth), false, cb_style)); - szr_enh->Add(force_filtering = new SettingCheckBox(page_general, _("Force Bi/Trilinear Filtering"), wxGetTranslation(force_filtering_tooltip), SET_PARAMS(bForceFiltering), false, cb_style)); + + + 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(pixel_lighting = 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), SET_PARAMS(b3DVision), false, cb_style); + _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); // - EFB @@ -453,22 +221,20 @@ 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 IntSettingChoice(page_general, - SET_PARAMS(iEFBScale), cur_profile, wxGetTranslation(internal_res_tooltip), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices); - - if (cur_profile != 0) - choice_efbscale->Insert(wxGetTranslation(def_profile), 0); + wxChoice *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->Add(choice_efbscale, 1, wxLEFT, 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), SET_PARAMS(bEFBEmulateFormatChanges), false, cb_style); + 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), SET_PARAMS(bEFBCopyEnable), false, cb_style); - efbcopy_texture = new SettingRadioButton(page_general, _("Texture"), wxGetTranslation(efb_copy_texture_tooltip), cur_vconfig.bCopyEFBToTexture, false, wxRB_GROUP); - efbcopy_ram = new SettingRadioButton(page_general, _("RAM"), wxGetTranslation(efb_copy_ram_tooltip), cur_vconfig.bCopyEFBToTexture, true); - cache_efb_copies = new SettingCheckBox(page_general, _("Enable cache"), wxGetTranslation(cache_efb_copies_tooltip), SET_PARAMS(bEFBCopyCacheEnable), false, cb_style); + SettingCheckBox* 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); wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_general, _("Copy")); group_efbcopy->Add(efbcopy_enable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); group_efbcopy->AddStretchSpacer(1); @@ -478,7 +244,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con // - safe texture cache - stc_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(stc_tooltip), SET_PARAMS(bSafeTextureCache), false, cb_style); + SettingCheckBox* stc_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(stc_tooltip), vconfig.bSafeTextureCache); stc_safe = new wxRadioButton(page_general, -1, _("Safe"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); @@ -493,6 +259,15 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con stc_fast->SetToolTip(wxGetTranslation(stc_speed_tooltip)); _connect_macro_(stc_fast, VideoConfigDiag::Event_StcFast, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); + 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); + wxStaticBoxSizer* const group_basic = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Basic")); szr_general->Add(group_basic, 0, wxEXPAND | wxALL, 5); @@ -504,7 +279,7 @@ 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), SET_PARAMS(bEFBAccessEnable), false, cb_style), 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); @@ -526,23 +301,15 @@ 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), SET_PARAMS(bWireFrame), false, cb_style)); - szr_rendering->Add(disable_lighting = new SettingCheckBox(page_advanced, _("Disable Lighting"), wxGetTranslation(disable_lighting_tooltip), SET_PARAMS(bDisableLighting), false, cb_style)); - szr_rendering->Add(disable_textures = new SettingCheckBox(page_advanced, _("Disable Textures"), wxGetTranslation(disable_textures_tooltip), SET_PARAMS(bDisableTexturing), false, cb_style)); - szr_rendering->Add(disable_fog = new SettingCheckBox(page_advanced, _("Disable Fog"), wxGetTranslation(disable_fog_tooltip), SET_PARAMS(bDisableFog), false, cb_style)); - szr_rendering->Add(disable_dst_alpha = new SettingCheckBox(page_advanced, _("Disable Dest. Alpha Pass"), wxGetTranslation(disable_alphapass_tooltip), SET_PARAMS(bDstAlphaPass), false, cb_style)); + 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); @@ -553,13 +320,13 @@ 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), SET_PARAMS(bShowFPS), false, cb_style)); - szr_info->Add(overlay_stats = new SettingCheckBox(page_advanced, _("Various Statistics"), wxGetTranslation(show_stats_tooltip), SET_PARAMS(bOverlayStats), false, cb_style)); - szr_info->Add(overlay_proj_stats = new SettingCheckBox(page_advanced, _("Projection Stats"), wxGetTranslation(proj_stats_tooltip), SET_PARAMS(bOverlayProjStats), false, cb_style)); - szr_info->Add(texfmt_overlay = new SettingCheckBox(page_advanced, _("Texture Format"), wxGetTranslation(texfmt_tooltip), SET_PARAMS(bTexFmtOverlayEnable), false, cb_style)); - szr_info->Add(efb_copy_regions = new SettingCheckBox(page_advanced, _("EFB Copy Regions"), wxGetTranslation(efb_copy_regions_tooltip), SET_PARAMS(bShowEFBCopyRegions), false, cb_style)); - szr_info->Add(show_shader_errors = new SettingCheckBox(page_advanced, _("Show Shader Errors"), wxT(""), SET_PARAMS(bShowShaderErrors), false, cb_style)); - szr_info->Add(show_input_display = new SettingCheckBox(page_advanced, _("Show Input Display"), wxGetTranslation(show_input_display_tooltip), SET_PARAMS(bShowInputDisplay), false, cb_style)); + 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); @@ -568,9 +335,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con // - XFB { - enable_xfb = new SettingCheckBox(page_advanced, _("Enable"), wxGetTranslation(xfb_tooltip), SET_PARAMS(bUseXFB), false, cb_style); - virtual_xfb = new SettingRadioButton(page_advanced, _("Virtual"), wxGetTranslation(xfb_tooltip), cur_vconfig.bUseRealXFB, true, wxRB_GROUP); - real_xfb = new SettingRadioButton(page_advanced, _("Real"), wxGetTranslation(xfb_tooltip), cur_vconfig.bUseRealXFB); + SettingCheckBox* 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); wxStaticBoxSizer* const group_xfb = new wxStaticBoxSizer(wxHORIZONTAL, page_advanced, _("XFB")); szr_advanced->Add(group_xfb, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); @@ -586,13 +353,13 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con { wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5); - szr_utility->Add(dump_textures = new SettingCheckBox(page_advanced, _("Dump Textures"), wxGetTranslation(dump_textures_tooltip), SET_PARAMS(bDumpTextures), false, cb_style)); - szr_utility->Add(hires_textures = new SettingCheckBox(page_advanced, _("Load Hi-Res Textures"), wxGetTranslation(load_hires_textures_tooltip), SET_PARAMS(bHiresTextures), false, cb_style)); - szr_utility->Add(dump_efb = new SettingCheckBox(page_advanced, _("Dump EFB Target"), dump_efb_tooltip, SET_PARAMS(bDumpEFBTarget), false, cb_style)); - szr_utility->Add(dump_frames = new SettingCheckBox(page_advanced, _("Dump Frames"), dump_frames_tooltip, SET_PARAMS(bDumpFrames), false, cb_style)); - szr_utility->Add(free_look = new SettingCheckBox(page_advanced, _("Free Look"), free_look_tooltip, SET_PARAMS(bFreeLook), false, cb_style)); + 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, SET_PARAMS(bUseFFV1), false, cb_style)); + szr_utility->Add(new SettingCheckBox(page_advanced, _("Frame dumps use FFV1"), use_ffv1_tooltip, vconfig.bUseFFV1)); #endif wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Utility")); @@ -602,393 +369,61 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con // - misc { - wxGridSizer* const szr_misc = new wxGridSizer(2, 5, 5); + wxGridSizer* const szr_misc = new wxGridSizer(2); - szr_misc->Add(crop = new SettingCheckBox(page_advanced, _("Crop"), crop_tooltip, SET_PARAMS(bCrop), false, cb_style)); - szr_misc->Add(opencl = new SettingCheckBox(page_advanced, _("Enable OpenCL"), opencl_tooltip, SET_PARAMS(bEnableOpenCL), false, cb_style)); - szr_misc->Add(dlcache = new SettingCheckBox(page_advanced, _("Enable Display List Caching"), dlc_tooltip, SET_PARAMS(bDlistCachingEnable), false, cb_style)); - szr_misc->Add(hotkeys = new SettingCheckBox(page_advanced, _("Enable Hotkeys"), hotkeys_tooltip, SET_PARAMS(bOSDHotKey), false, cb_style)); - szr_misc->Add(ompdecoder = new SettingCheckBox(page_advanced, _("OpenMP Texture Decoder"), wxGetTranslation(omp_tooltip), SET_PARAMS(bOMPDecoder), false, cb_style)); + 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"), wxGetTranslation(omp_tooltip), vconfig.bOMPDecoder), 0, wxBOTTOM, 5); // postproc shader - wxBoxSizer* const box_pps = new wxBoxSizer(wxHORIZONTAL); - if (cur_vconfig.backend_info.PPShaders.size()) + wxBoxSizer* const szr_pps = new wxBoxSizer(wxHORIZONTAL); + if (vconfig.backend_info.PPShaders.size()) { - wxFlexGridSizer* const szr_pps = new wxFlexGridSizer(2, 5, 5); - szr_pps->AddStretchSpacer(); szr_pps->AddStretchSpacer(); szr_pps->Add(new wxStaticText(page_advanced, -1, _("Post-Processing Shader:")), 1, wxALIGN_CENTER_VERTICAL, 0); - choice_ppshader = new StringSettingChoice(page_advanced, SET_PARAMS(sPostProcessingShader), cur_profile, wxGetTranslation(ppshader_tooltip)); - + wxChoice *const choice_ppshader = new wxChoice(page_advanced, -1, wxDefaultPosition); + choice_ppshader->SetToolTip(wxGetTranslation(ppshader_tooltip)); choice_ppshader->AppendString(_("(off)")); std::vector::const_iterator - it = cur_vconfig.backend_info.PPShaders.begin(), - itend = cur_vconfig.backend_info.PPShaders.end(); + it = vconfig.backend_info.PPShaders.begin(), + itend = vconfig.backend_info.PPShaders.end(); for (; it != itend; ++it) choice_ppshader->AppendString(wxString::FromAscii(it->c_str())); - if (cur_profile != 0) - choice_ppshader->Insert(wxGetTranslation(def_profile), 0); + if (vconfig.sPostProcessingShader.empty()) + choice_ppshader->Select(0); + else + choice_ppshader->SetStringSelection(wxString::FromAscii(vconfig.sPostProcessingShader.c_str())); - szr_pps->Add(choice_ppshader); - box_pps->Add(szr_pps, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); + _connect_macro_(choice_ppshader, VideoConfigDiag::Event_PPShader, wxEVT_COMMAND_CHOICE_SELECTED, this); + + szr_pps->Add(choice_ppshader, 0, wxLEFT, 5); } wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc")); szr_advanced->Add(group_misc, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); - group_misc->Add(box_pps); + group_misc->Add(szr_pps); } page_advanced->SetSizerAndFit(szr_advanced); } - wxSizer* sButtons = CreateButtonSizer(wxNO_DEFAULT); - btn_default = new wxButton(this, wxID_ANY, _("Set All to Default"), wxDefaultPosition); - btn_default->Enable(cur_profile != 0); - _connect_macro_(btn_default, VideoConfigDiag::Event_ClickDefault, wxEVT_COMMAND_BUTTON_CLICKED, this); - wxButton* const btn_close = new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition); _connect_macro_(btn_close, VideoConfigDiag::Event_ClickClose, wxEVT_COMMAND_BUTTON_CLICKED, this); Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(VideoConfigDiag::Event_Close), (wxObject*)0, this); - sButtons->Prepend(btn_default, 0, wxALL, 5); - sButtons->Add(btn_close, 0, wxALL, 5); - wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL); szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5); - szr_main->Add(sButtons, 0, wxEXPAND, 5); + szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); SetSizerAndFit(szr_main); Center(); - CenterCoords = GetScreenPosition(); SetFocus(); - SetUIValuesFromConfig(); - Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this); UpdateWindowUI(); } - -void VideoConfigDiag::ChangeStyle() -{ - // here where we change opportune UI Controls only if we come from, or we go to, default profile - if (prev_profile != cur_profile && !(prev_profile && cur_profile)) - { - - const long cb_style = (cur_profile == 0) ? wxCHK_3STATE : wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER; - - // set State and Rebind all controls - #define CHANGE_DATAREF(ctrl, member) { void *p;\ - p = &(CONFIG(member, 0)); ctrl->ChangeRefDataMember(Def_Data,p);\ - p = &(CONFIG(UI_State.member, 1)); ctrl->ChangeRefDataMember(State,p);\ - if (sizeof(cur_vconfig.member) == sizeof(bool)) ctrl->SetWindowStyle(cb_style); } - - if (cur_vconfig.backend_info.Adapters.size()) - { - if (cur_profile == 0) choice_adapter->Delete(0); - else choice_adapter->Insert(wxGetTranslation(def_profile), 0); - - choice_adapter->GetParent()->Layout(); // redraws all elements inside the parent container - CHANGE_DATAREF(choice_adapter, iAdapter); - } - if (cur_profile == 0) choice_aspect->Delete(0); - else choice_aspect->Insert(wxGetTranslation(def_profile), 0); - choice_aspect->GetParent()->Layout(); - CHANGE_DATAREF(choice_aspect, iAspectRatio); - - CHANGE_DATAREF(widescreen_hack, bWidescreenHack); - CHANGE_DATAREF(vsync, bVSync); - - if (cur_profile == 0) anisotropic_filtering->Delete(0); - else anisotropic_filtering->Insert(wxGetTranslation(def_profile), 0); - anisotropic_filtering->GetParent()->Layout(); - CHANGE_DATAREF(anisotropic_filtering, iMaxAnisotropy); - - if (cur_profile == 0) choice_aamode->Delete(0); - else choice_aamode->Insert(wxGetTranslation(def_profile), 0); - choice_aamode->GetParent()->Layout(); - CHANGE_DATAREF(choice_aamode, iMultisampleMode); - - CHANGE_DATAREF(native_mips, bUseNativeMips); - CHANGE_DATAREF(efb_scaled_copy, bCopyEFBScaled); - CHANGE_DATAREF(pixel_lighting, bEnablePixelLighting); - CHANGE_DATAREF(pixel_depth, bEnablePerPixelDepth); - CHANGE_DATAREF(force_filtering, bForceFiltering); - CHANGE_DATAREF(_3d_vision, b3DVision); - - if (cur_profile == 0) choice_efbscale->Delete(0); - else choice_efbscale->Insert(wxGetTranslation(def_profile), 0); - choice_efbscale->GetParent()->Layout(); - CHANGE_DATAREF(choice_efbscale, iEFBScale); - - CHANGE_DATAREF(efbaccess_enable, bEFBAccessEnable); - CHANGE_DATAREF(emulate_efb_format_changes, bEFBEmulateFormatChanges); - CHANGE_DATAREF(efbcopy_enable, bEFBCopyEnable); - CHANGE_DATAREF(cache_efb_copies, bEFBCopyCacheEnable); - CHANGE_DATAREF(stc_enable, bSafeTextureCache); - CHANGE_DATAREF(wireframe, bWireFrame); - CHANGE_DATAREF(disable_lighting, bDisableLighting); - CHANGE_DATAREF(disable_textures, bDisableTexturing); - CHANGE_DATAREF(disable_fog, bDisableFog); - CHANGE_DATAREF(disable_dst_alpha, bDstAlphaPass); - CHANGE_DATAREF(show_fps, bShowFPS); - CHANGE_DATAREF(overlay_stats, bOverlayStats); - CHANGE_DATAREF(overlay_proj_stats, bOverlayProjStats); - CHANGE_DATAREF(texfmt_overlay, bTexFmtOverlayEnable); - CHANGE_DATAREF(efb_copy_regions, bShowEFBCopyRegions); - CHANGE_DATAREF(show_shader_errors, bShowShaderErrors); - CHANGE_DATAREF(show_input_display, bShowInputDisplay); - CHANGE_DATAREF(enable_xfb, bUseXFB); - CHANGE_DATAREF(dump_textures, bDumpTextures); - CHANGE_DATAREF(hires_textures, bHiresTextures); - CHANGE_DATAREF(dump_efb, bDumpEFBTarget); - CHANGE_DATAREF(dump_frames, bDumpFrames); - CHANGE_DATAREF(free_look, bFreeLook); - - #if !defined WIN32 && defined HAVE_LIBAV - CHANGE_DATAREF(frame_dumps_via_ffv1,bUseFFV1); - #endif - - CHANGE_DATAREF(hotkeys, bOSDHotKey); - CHANGE_DATAREF(dlcache, bDlistCachingEnable); - CHANGE_DATAREF(ompdecoder, bOMPDecoder); - CHANGE_DATAREF(opencl, bEnableOpenCL); - CHANGE_DATAREF(crop, bCrop); - - if (cur_vconfig.backend_info.PPShaders.size()) - { - if (cur_profile == 0) - choice_ppshader->Delete(0); - else - choice_ppshader->Insert(wxGetTranslation(def_profile), 0); - - choice_ppshader->GetParent()->Layout(); - CHANGE_DATAREF(choice_ppshader, sPostProcessingShader); - } - - Fit(); // wraps sizes of the outer layout - if (CenterCoords == this->GetScreenPosition()) - { - Center(); // lastly if window hasn't moved, re-center it - CenterCoords = this->GetScreenPosition(); - } - } -} - -void VideoConfigDiag::Event_OnProfileChange(wxCommandEvent& ev) -{ - // Save settings of current profile - if (cur_profile == 0) - { - def_vconfig = cur_vconfig; // copy default profile changes - cur_vconfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str()); - } - else - { - const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1)); - cur_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(); - - btn_default->Enable(cur_profile != 0); - // Reset settings and, if necessary, load game-specific settings - std::string game_ini; - if (cur_profile != 0) - { - const GameListItem* item = GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1)); - game_ini = File::GetUserPath(D_GAMECONFIG_IDX) + item->GetUniqueID() + ".ini"; - } - - cur_vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(), (cur_profile != 0), game_ini.c_str()); - - ChangeStyle(); - prev_profile = cur_profile; - - // Update our UI elements with the new config - SetUIValuesFromConfig(); - UpdateWindowUI(); - profile_text->SetLabel(profile_cb->GetStringSelection()); - - ev.Skip(); -} - -void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev) -{ - bool enable_group; - - // Anti-aliasing - choice_aamode->Enable(cur_vconfig.backend_info.AAModes.size() > 1); - text_aamode->Enable(cur_vconfig.backend_info.AAModes.size() > 1); - - // pixel lighting - pixel_lighting->Enable(cur_vconfig.backend_info.bSupportsPixelLighting); - - // 3D vision - _3d_vision->Show(cur_vconfig.backend_info.bSupports3DVision); - - // EFB copy - enable_group = cur_vconfig.bEFBCopyEnable && (efbcopy_enable->Get3StateValue() != wxCHK_UNDETERMINED); - efbcopy_texture->Enable(enable_group); - efbcopy_ram->Enable(enable_group); - cache_efb_copies->Enable(cur_vconfig.bEFBCopyEnable && !cur_vconfig.bCopyEFBToTexture); - - // EFB format change emulation - emulate_efb_format_changes->Enable(cur_vconfig.backend_info.bSupportsFormatReinterpretation); - - // ATC - enable_group = cur_vconfig.bSafeTextureCache && (stc_enable->Get3StateValue() != wxCHK_UNDETERMINED); - stc_safe->Enable(enable_group); - stc_normal->Enable(enable_group); - stc_fast->Enable(enable_group); - - // XFB - enable_group = cur_vconfig.bUseXFB && (enable_xfb->Get3StateValue() != wxCHK_UNDETERMINED); - virtual_xfb->Enable(enable_group); - real_xfb->Enable(enable_group); - - // here where we check Radio Button Groups and if main CheckBox has 3rd state activated - // NOTE: this code block just before g_Config is updated - if (cur_profile != 0) - { - // ID check is to reduce drastically the CPU load, since too many SetValue() calls at once, - // are very expensive inside this procedure - if (ev.GetId() == efbcopy_enable->GetId() && efbcopy_enable->Get3StateValue() == wxCHK_UNDETERMINED) - { - cur_vconfig.bCopyEFBToTexture = def_vconfig.bCopyEFBToTexture; - efbcopy_texture->SetValue(cur_vconfig.bCopyEFBToTexture); - efbcopy_ram->SetValue(!cur_vconfig.bCopyEFBToTexture); - } - if (ev.GetId() == stc_enable->GetId() && stc_enable->Get3StateValue() == wxCHK_UNDETERMINED) - { - cur_vconfig.iSafeTextureCache_ColorSamples = def_vconfig.iSafeTextureCache_ColorSamples; - stc_safe->SetValue(0 == cur_vconfig.iSafeTextureCache_ColorSamples); - stc_normal->SetValue(512 == cur_vconfig.iSafeTextureCache_ColorSamples); - stc_fast->SetValue(128 == cur_vconfig.iSafeTextureCache_ColorSamples); - } - if (ev.GetId() == enable_xfb->GetId() && enable_xfb->Get3StateValue() == wxCHK_UNDETERMINED) - { - cur_vconfig.bUseRealXFB = def_vconfig.bUseRealXFB; - virtual_xfb->SetValue(!cur_vconfig.bUseRealXFB); - real_xfb->SetValue(cur_vconfig.bUseRealXFB); - } - } - - // 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 = cur_vconfig; - } - else if (cur_profile != 0) - { - if (GameListCtrl->GetISO(GameListCtrl->GetItemData(cur_profile - 1))->GetUniqueID() == - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID) - g_Config = cur_vconfig; - } - else // here, if we're editing the Default profile and a game is running... - { - // RadioButton instant update from Default profile - if (!g_Config.UI_State.bSafeTextureCache) - g_Config.iSafeTextureCache_ColorSamples = cur_vconfig.iSafeTextureCache_ColorSamples; - - if (!g_Config.UI_State.bUseXFB) - g_Config.bUseRealXFB = cur_vconfig.bUseRealXFB; - - if (!g_Config.UI_State.bEFBCopyEnable) - g_Config.bCopyEFBToTexture = cur_vconfig.bCopyEFBToTexture; - - // other controls (checkbox, choice dropdown) handle 'the instant update' internally inside their own class - } - ev.Skip(); -} - -void VideoConfigDiag::SetUIValuesFromConfig() -{ - - const int inc = (cur_profile != 0) ? 1 : 0; - - #define SET_CHOICE(control, member) {\ - void *p = control; void *m = &cur_vconfig.member;\ - switch (sizeof(cur_vconfig.member)) {\ - case sizeof(bool): if (cur_vconfig.UI_State.member) ((SettingCheckBox*)p)->Set3StateValue((wxCheckBoxState)*(bool*)m);\ - else ((SettingCheckBox*)p)->Set3StateValue(wxCHK_UNDETERMINED); break;\ - case sizeof(int): if (cur_vconfig.UI_State.member) ((IntSettingChoice*)p)->SetSelection(*(int*)m + inc);\ - else ((IntSettingChoice*)p)->SetSelection(0); break; } } - - if (choice_adapter) SET_CHOICE(choice_adapter, iAdapter); - SET_CHOICE(choice_aspect, iAspectRatio); - SET_CHOICE(widescreen_hack, bWidescreenHack); - SET_CHOICE(vsync, bVSync); - - SET_CHOICE(anisotropic_filtering, iMaxAnisotropy); - SET_CHOICE(choice_aamode, iMultisampleMode); - - SET_CHOICE(native_mips, bUseNativeMips); - SET_CHOICE(efb_scaled_copy,bCopyEFBScaled); - SET_CHOICE(pixel_lighting, bEnablePixelLighting); - SET_CHOICE(pixel_depth, bEnablePerPixelDepth); - SET_CHOICE(force_filtering, bForceFiltering); - SET_CHOICE(_3d_vision, b3DVision); - - SET_CHOICE(choice_efbscale, iEFBScale); - SET_CHOICE(efbaccess_enable, bEFBAccessEnable); - SET_CHOICE(emulate_efb_format_changes, bEFBEmulateFormatChanges); - - SET_CHOICE(efbcopy_enable, bEFBCopyEnable); - efbcopy_texture->SetValue(cur_vconfig.bCopyEFBToTexture); - efbcopy_ram->SetValue(!cur_vconfig.bCopyEFBToTexture); - SET_CHOICE(cache_efb_copies, bEFBCopyCacheEnable); - - SET_CHOICE(stc_enable, bSafeTextureCache); - stc_safe->SetValue(0 == cur_vconfig.iSafeTextureCache_ColorSamples); - stc_normal->SetValue(512 == cur_vconfig.iSafeTextureCache_ColorSamples); - stc_fast->SetValue(128 == cur_vconfig.iSafeTextureCache_ColorSamples); - - SET_CHOICE(wireframe, bWireFrame); - SET_CHOICE(disable_lighting, bDisableLighting); - SET_CHOICE(disable_textures, bDisableTexturing); - SET_CHOICE(disable_fog, bDisableFog); - SET_CHOICE(disable_dst_alpha, bDstAlphaPass); - - SET_CHOICE(show_fps, bShowFPS); - SET_CHOICE(overlay_stats, bOverlayStats); - SET_CHOICE(overlay_proj_stats, bOverlayProjStats); - SET_CHOICE(texfmt_overlay, bTexFmtOverlayEnable); - SET_CHOICE(efb_copy_regions, bShowEFBCopyRegions); - SET_CHOICE(show_shader_errors, bShowShaderErrors); - SET_CHOICE(show_input_display, bShowInputDisplay); - - SET_CHOICE(enable_xfb, bUseXFB); - virtual_xfb->SetValue(!cur_vconfig.bUseRealXFB); - real_xfb->SetValue(cur_vconfig.bUseRealXFB); - - SET_CHOICE(dump_textures, bDumpTextures); - SET_CHOICE(hires_textures, bHiresTextures); - SET_CHOICE(dump_efb, bDumpEFBTarget); - SET_CHOICE(dump_frames, bDumpFrames); - SET_CHOICE(free_look, bFreeLook); -#if !defined WIN32 && defined HAVE_LIBAV - SET_CHOICE(frame_dumps_via_ffv1, bUseFFV1); -#endif - - SET_CHOICE(crop, bCrop); - SET_CHOICE(opencl, bEnableOpenCL); - SET_CHOICE(dlcache, bDlistCachingEnable); - SET_CHOICE(ompdecoder, bOMPDecoder); - SET_CHOICE(hotkeys, bOSDHotKey); - if (choice_ppshader) - { - std::string m = cur_vconfig.sPostProcessingShader; - if (cur_vconfig.UI_State.sPostProcessingShader) - { - if (m.empty()) choice_ppshader->SetSelection(inc); - else choice_ppshader->SetStringSelection(wxString::FromAscii(m.c_str())); - } - else choice_ppshader->SetSelection(0); - } -} diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.h b/Source/Core/DolphinWX/Src/VideoConfigDiag.h index 2a0b24aef5..360da046e2 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.h +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.h @@ -16,207 +16,26 @@ #include #include #include -#include -enum tmp_MemberClass { - Def_Data, - State -}; - -enum tmp_TypeClass { - only_2State, - allow_3State -}; - -struct _pattern +template +class BoolSetting : public W { -protected: - _pattern(bool *state, const tmp_TypeClass type); - - bool *m_uistate; - const tmp_TypeClass _type; - public: - /* - Couldn't make this a pure abstract class since wxWidgets in use(v.2.8.x) is buggy; - oddly, CommandEventHandler fails to connect&retrieve the correct target function. - Newer wxWidgets versions don't have this problem... - */ - //virtual void UpdateValue(wxCommandEvent& ev) = 0; - //virtual void UpdateUIState(bool state) = 0; - //virtual void ChangeRefDataMember(tmp_MemberClass type, void *newRef) = 0; + BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse = false, long style = 0); - tmp_TypeClass getTypeClass() - { - // This method returns what kind of support has the Object (2State or 3State). - // NOTE: this doesn't return a run-time Control-state, since a 3State Control - // can to switch to 2State and vice-versa, while an Object 2State only can't. - return _type; - } -}; - -class SettingCheckBox : public _pattern, public wxCheckBox -{ - DECLARE_CLASS(SettingCheckBox) - -public: - SettingCheckBox(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse = false, long style = 0); - - // overload constructor - SettingCheckBox(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool &def_setting, bool &state, bool reverse = false, long style = 0); - - void UpdateValue(wxCommandEvent& ev) - { - if (_type == only_2State) - { - m_setting = (ev.GetInt() != 0) ^ m_reverse; - } - else - { - bool style = (this->GetWindowStyle() == (wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER)); - - if (style) - { - // changing state value should be done here, never outside this block - UpdateUIState(ev.GetInt() != wxCHK_UNDETERMINED); - } - - m_setting = (ev.GetInt() == wxCHK_CHECKED); - if (m_uistate) - { - // if state = false and Checkbox ctrl allow 3RD STATE, then data = default_data - m_setting = (style && !*m_uistate) ? *d_setting : m_setting; - } - - m_setting = m_setting ^ m_reverse; - - if (!style && m_uistate) // this guarantees bidirectional access to default value - if (!*m_uistate) *d_setting = m_setting; - } - ev.Skip(); - } - - void UpdateUIState(bool state) - { - if (m_uistate && this->GetWindowStyle() == (wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER)) - { - *m_uistate = state; - if (!*m_uistate) - m_setting = *d_setting ^ m_reverse; - } - } - - void ChangeRefDataMember(tmp_MemberClass type, void *newRef) - { - switch (type) - { - case Def_Data: - d_setting = (bool*)newRef; - break; - case State: - m_uistate = (bool*)newRef; - break; - } - } - -private: - bool &m_setting; - bool *d_setting; - const bool m_reverse; -}; - -template -class SettingChoice : public _pattern, public wxChoice -{ - DECLARE_CLASS(SettingChoice) - -public: - SettingChoice(wxWindow* parent, V &setting, const wxString& tooltip, int num = 0, const wxString choices[] = NULL, long style = 0); - - // overload constructor - SettingChoice(wxWindow* parent, V &setting, V &def_setting, bool &state, int &cur_index, const wxString& tooltip, int num = 0, const wxString choices[] = NULL, long style = 0); - - void UpdateValue(wxCommandEvent& ev) - { - m_setting = ev.GetInt(); - if (_type == allow_3State) - { - if (m_index != 0) // Choice ctrl with 3RD option - { - // changing state value should be done here, never outside this block - if (m_setting == 0) - { - UpdateUIState(false); - } - else - { - UpdateUIState(true); - m_setting -= 1; - } - } - else // Choice ctrl without 3RD option - { - if (m_uistate) - if (!*m_uistate) *d_setting = m_setting; - } - } - ev.Skip(); - } - - void UpdateUIState(bool state) - { - if (m_uistate && m_index != 0) - { - *m_uistate = state; - if (!*m_uistate) - m_setting = *d_setting; - } - } - - void ChangeRefDataMember(tmp_MemberClass type, void *newRef) - { - switch (type) - { - case Def_Data: - d_setting = (V*)newRef; - break; - case State: - m_uistate = (bool*)newRef; - break; - } - } - -private: - V &m_setting; - V *d_setting; - int &m_index; -}; - -typedef SettingChoice IntSettingChoice; -typedef SettingChoice StringSettingChoice; - -class SettingRadioButton : public _pattern, public wxRadioButton -{ - DECLARE_CLASS(SettingRadioButton) - -public: - SettingRadioButton(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse = false, long style = 0); - void UpdateValue(wxCommandEvent& ev) { m_setting = (ev.GetInt() != 0) ^ m_reverse; ev.Skip(); } - - void UpdateUIState(bool state) {} - void ChangeRefDataMember(tmp_MemberClass type, void *newRef) {} - - private: bool &m_setting; const bool m_reverse; }; +typedef BoolSetting SettingCheckBox; +typedef BoolSetting SettingRadioButton; + template class IntegerSetting : public wxSpinCtrl { @@ -234,7 +53,14 @@ private: typedef IntegerSetting U32Setting; -class CGameListCtrl; +class SettingChoice : public wxChoice +{ +public: + SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num = 0, const wxString choices[] = NULL, long style = 0); + void UpdateValue(wxCommandEvent& ev); +private: + int &m_setting; +}; class VideoConfigDiag : public wxDialog { @@ -245,106 +71,77 @@ protected: void Event_Backend(wxCommandEvent &ev) { ev.Skip(); } // TODO: Query list of supported AA modes void Event_Adapter(wxCommandEvent &ev) { ev.Skip(); } // TODO - void Event_StcSafe(wxCommandEvent &ev) { cur_vconfig.iSafeTextureCache_ColorSamples = 0; ev.Skip(); } - void Event_StcNormal(wxCommandEvent &ev) { cur_vconfig.iSafeTextureCache_ColorSamples = 512; ev.Skip(); } - void Event_StcFast(wxCommandEvent &ev) { cur_vconfig.iSafeTextureCache_ColorSamples = 128; ev.Skip(); } + void Event_StcSafe(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 0; ev.Skip(); } + void Event_StcNormal(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 512; ev.Skip(); } + void Event_StcFast(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 128; ev.Skip(); } + + void Event_PPShader(wxCommandEvent &ev) + { + const int sel = ev.GetInt(); + if (sel) + vconfig.sPostProcessingShader = ev.GetString().mb_str(); + else + vconfig.sPostProcessingShader.clear(); + ev.Skip(); + } void Event_ClickClose(wxCommandEvent&); - void Event_ClickDefault(wxCommandEvent&); void Event_Close(wxCloseEvent&); - void Event_OnProfileChange(wxCommandEvent& ev); + // Enables/disables UI elements depending on current config + void OnUpdateUI(wxUpdateUIEvent& ev) + { + // Anti-aliasing + choice_aamode->Enable(vconfig.backend_info.AAModes.size() > 1); + text_aamode->Enable(vconfig.backend_info.AAModes.size() > 1); - // Enables/disables UI elements depending on current config - if appropriate also updates g_Config - void OnUpdateUI(wxUpdateUIEvent& ev); + // pixel lighting + pixel_lighting->Enable(vconfig.backend_info.bSupportsPixelLighting); - // Refresh UI values from current config (used when reloading config) - void SetUIValuesFromConfig(); + // 3D vision + _3d_vision->Show(vconfig.backend_info.bSupports3DVision); - // Redraw the aspect about some UI controls when a profile is selected - void ChangeStyle(); + // EFB copy + efbcopy_texture->Enable(vconfig.bEFBCopyEnable); + efbcopy_ram->Enable(vconfig.bEFBCopyEnable); + cache_efb_copies->Enable(vconfig.bEFBCopyEnable && !vconfig.bCopyEFBToTexture); - // Don't mess with keeping two comboboxes in sync, use only one CB instead.. - SettingChoice* profile_cb; // "General" tab - wxStaticText* profile_text; // "Advanced" tab + // EFB format change emulation + emulate_efb_format_changes->Enable(vconfig.backend_info.bSupportsFormatReinterpretation); - IntSettingChoice* choice_adapter; - IntSettingChoice* choice_aspect; - SettingCheckBox* widescreen_hack; - SettingCheckBox* vsync; + // 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); + + ev.Skip(); + } - IntSettingChoice* anisotropic_filtering; wxStaticText* text_aamode; - IntSettingChoice* choice_aamode; + SettingChoice* choice_aamode; - SettingCheckBox* native_mips; - SettingCheckBox* efb_scaled_copy; SettingCheckBox* pixel_lighting; - SettingCheckBox* pixel_depth; - SettingCheckBox* force_filtering; + SettingCheckBox* _3d_vision; - IntSettingChoice* choice_efbscale; - SettingCheckBox* efbaccess_enable; - SettingCheckBox* emulate_efb_format_changes; - - SettingCheckBox* efbcopy_enable; SettingRadioButton* efbcopy_texture; SettingRadioButton* efbcopy_ram; SettingCheckBox* cache_efb_copies; + SettingCheckBox* emulate_efb_format_changes; - SettingCheckBox* stc_enable; wxRadioButton* stc_safe; wxRadioButton* stc_normal; wxRadioButton* stc_fast; - SettingCheckBox* wireframe; - SettingCheckBox* disable_lighting; - SettingCheckBox* disable_textures; - SettingCheckBox* disable_fog; - SettingCheckBox* disable_dst_alpha; - - SettingCheckBox* show_fps; - SettingCheckBox* overlay_stats; - SettingCheckBox* overlay_proj_stats; - SettingCheckBox* texfmt_overlay; - SettingCheckBox* efb_copy_regions; - SettingCheckBox* show_shader_errors; - SettingCheckBox* show_input_display; - - SettingCheckBox* enable_xfb; SettingRadioButton* virtual_xfb; SettingRadioButton* real_xfb; - SettingCheckBox* dump_textures; - SettingCheckBox* hires_textures; - SettingCheckBox* dump_efb; - SettingCheckBox* dump_frames; - SettingCheckBox* free_look; - SettingCheckBox* frame_dumps_via_ffv1; - - SettingCheckBox* crop; - SettingCheckBox* opencl; - SettingCheckBox* dlcache; - SettingCheckBox* hotkeys; - SettingCheckBox* ompdecoder; - StringSettingChoice* choice_ppshader; - - wxButton* btn_default; - // TODO: Add options for - //cur_vconfig.bTexFmtOverlayCenter - //cur_vconfig.bAnaglyphStereo - //cur_vconfig.iAnaglyphStereoSeparation - //cur_vconfig.iAnaglyphFocalAngle - //cur_vconfig.bShowEFBCopyRegions - //cur_vconfig.iCompileDLsLevel - wxPoint CenterCoords; - VideoConfig cur_vconfig; - VideoConfig def_vconfig; + VideoConfig &vconfig; std::string ininame; - int cur_profile; - int prev_profile; - const CGameListCtrl *GameListCtrl; }; #endif diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 3180891e28..c6d564a52d 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -45,88 +45,81 @@ VideoConfig::VideoConfig() backend_info.bSupports3DVision = false; } -void VideoConfig::Load(const char *main_ini_file, bool filecheck_passed, const char *game_ini_file) +void VideoConfig::Load(const char *ini_file) { std::string temp; IniFile iniFile; - iniFile.Load(main_ini_file); - - #define SET_STATE(evaluate, member) evaluate; UI_State.member = true; - - SET_STATE(iniFile.Get("Hardware", "VSync", &bVSync, false), bVSync); // Hardware - SET_STATE(iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false), bWidescreenHack); - SET_STATE(iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO), iAspectRatio); - SET_STATE(iniFile.Get("Settings", "Crop", &bCrop, false), bCrop); - SET_STATE(iniFile.Get("Settings", "UseXFB", &bUseXFB, false), bUseXFB); - iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, false); - SET_STATE(iniFile.Get("Settings", "UseNativeMips", &bUseNativeMips, true), bUseNativeMips); + iniFile.Load(ini_file); - SET_STATE(iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false), bSafeTextureCache); // Settings + iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware + iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false); + iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); + iniFile.Get("Settings", "Crop", &bCrop, false); + iniFile.Get("Settings", "UseXFB", &bUseXFB, 0); + iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0); + iniFile.Get("Settings", "UseNativeMips", &bUseNativeMips, true); + + iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings //Safe texture cache params - iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 512); + iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,512); - SET_STATE(iniFile.Get("Settings", "ShowFPS", &bShowFPS, false), bShowFPS); // Settings - SET_STATE(iniFile.Get("Settings", "ShowInputDisplay", &bShowInputDisplay, false), bShowInputDisplay); - SET_STATE(iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false), bOverlayStats); - SET_STATE(iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false), bOverlayProjStats); - SET_STATE(iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false), bShowEFBCopyRegions); - SET_STATE(iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0), iCompileDLsLevel); - SET_STATE(iniFile.Get("Settings", "DumpTextures", &bDumpTextures, false), bDumpTextures); - SET_STATE(iniFile.Get("Settings", "HiresTextures", &bHiresTextures, false), bHiresTextures); - SET_STATE(iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, false), bDumpEFBTarget) ; - SET_STATE(iniFile.Get("Settings", "DumpFrames", &bDumpFrames, false), bDumpFrames); - SET_STATE(iniFile.Get("Settings", "FreeLook", &bFreeLook, false), bFreeLook); - SET_STATE(iniFile.Get("Settings", "UseFFV1", &bUseFFV1, false), bUseFFV1); - SET_STATE(iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false), bAnaglyphStereo); - SET_STATE(iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200), iAnaglyphStereoSeparation); - SET_STATE(iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0), iAnaglyphFocalAngle); - SET_STATE(iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, false), bEnablePixelLighting); - SET_STATE(iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, false), bEnablePerPixelDepth); + iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings + iniFile.Get("Settings", "ShowInputDisplay", &bShowInputDisplay, false); + iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); + iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false); + iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false); + iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0); + iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0); + iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0); + iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0); + iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0); + iniFile.Get("Settings", "FreeLook", &bFreeLook, 0); + iniFile.Get("Settings", "UseFFV1", &bUseFFV1, 0); + iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false); + iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200); + iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0); + iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0); + iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, 0); - SET_STATE(iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, false), bShowShaderErrors); - SET_STATE(iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0), iMultisampleMode); - SET_STATE(iniFile.Get("Settings", "EFBScale", &iEFBScale, 1), iEFBScale); // integral + iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0); + iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); + iniFile.Get("Settings", "EFBScale", &iEFBScale, 1); // integral - SET_STATE(iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false), bDstAlphaPass); + iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false); - SET_STATE(iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, false), bTexFmtOverlayEnable); - SET_STATE(iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, false), bTexFmtOverlayCenter); - SET_STATE(iniFile.Get("Settings", "WireFrame", &bWireFrame, false), bWireFrame); - SET_STATE(iniFile.Get("Settings", "DisableLighting", &bDisableLighting, false), bDisableLighting); - SET_STATE(iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, false), bDisableTexturing); - SET_STATE(iniFile.Get("Settings", "DisableFog", &bDisableFog, false), bDisableFog); + iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); + iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); + iniFile.Get("Settings", "WireFrame", &bWireFrame, 0); + iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0); + iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0); + iniFile.Get("Settings", "DisableFog", &bDisableFog, 0); - SET_STATE(iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false), bEnableOpenCL); -#ifdef _OPENMP - SET_STATE(iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false), bOMPDecoder); -#endif + iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false); + iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false); - SET_STATE(iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, false), bForceFiltering); - SET_STATE(iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0), iMaxAnisotropy); // NOTE - this is x in (1 << x) - SET_STATE(iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, ""), sPostProcessingShader); - SET_STATE(iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false), b3DVision); + iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0); + iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x) + iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, ""); + iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false); - SET_STATE(iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true), bEFBAccessEnable); - SET_STATE(iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false), bDlistCachingEnable); - SET_STATE(iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true), bEFBCopyEnable); - SET_STATE(iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, false), bOSDHotKey); + iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); + iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false); + iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true); + iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false); - SET_STATE(iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true), bCopyEFBScaled); - SET_STATE(iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false), bEFBCopyCacheEnable); - SET_STATE(iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, true), bEFBEmulateFormatChanges); + iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); + iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false); + iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, true); iniFile.Get("Hardware", "Adapter", &iAdapter, 0); - if (iAdapter == -1) - iAdapter = 0; - SET_STATE((void)true, iAdapter); + + VerifyValidity(); // Load common settings iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); bool bTmp; iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true); SetEnableAlert(bTmp); - if (filecheck_passed) - GameIniLoad(game_ini_file); } void VideoConfig::GameIniLoad(const char *ini_file) @@ -134,102 +127,92 @@ void VideoConfig::GameIniLoad(const char *ini_file) IniFile iniFile; iniFile.Load(ini_file); - #define SET_UISTATE(check, member) UI_State.member = (check) ? true : false + iniFile.GetIfExists("Video_Hardware", "VSync", &bVSync); + iniFile.GetIfExists("Video_Settings", "wideScreenHack", &bWidescreenHack); + iniFile.GetIfExists("Video_Settings", "AspectRatio", &iAspectRatio); + iniFile.GetIfExists("Video_Settings", "Crop", &bCrop); + iniFile.GetIfExists("Video_Settings", "UseXFB", &bUseXFB); + iniFile.GetIfExists("Video_Settings", "UseRealXFB", &bUseRealXFB); + iniFile.GetIfExists("Video_Settings", "UseNativeMips", &bUseNativeMips); - SET_UISTATE(iniFile.GetIfExists("Video_Hardware", "VSync", &bVSync), bVSync); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "wideScreenHack", &bWidescreenHack), bWidescreenHack); - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "AspectRatio", &iAspectRatio), iAspectRatio); - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "Crop", &bCrop), bCrop); - - { // CheckBox+RadioButtons group - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "UseXFB", &bUseXFB), bUseXFB); - if (UI_State.bUseXFB) - iniFile.GetIfExists("Video_Settings", "UseRealXFB", &bUseRealXFB); - } - - { // CheckBox+RadioButtons group - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "SafeTextureCache", &bSafeTextureCache), bSafeTextureCache); - if (UI_State.bSafeTextureCache) - iniFile.GetIfExists("Video_Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples); - } - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "UseNativeMips", &bUseNativeMips), bUseNativeMips); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "ShowFPS", &bShowFPS), bShowFPS); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "ShowInputDisplay", &bShowInputDisplay), bShowInputDisplay); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "OverlayStats", &bOverlayStats), bOverlayStats); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "OverlayProjStats", &bOverlayProjStats), bOverlayProjStats); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions), bShowEFBCopyRegions); - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DLOptimize", &iCompileDLsLevel), iCompileDLsLevel); - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DumpTextures", &bDumpTextures), bDumpTextures); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "HiresTextures", &bHiresTextures), bHiresTextures); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DumpEFBTarget", &bDumpEFBTarget), bDumpEFBTarget); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DumpFrames", &bDumpFrames), bDumpFrames); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "FreeLook", &bFreeLook), bFreeLook); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "UseFFV1", &bUseFFV1), bUseFFV1); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo), bAnaglyphStereo); - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation), iAnaglyphStereoSeparation); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle), iAnaglyphFocalAngle); - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting), bEnablePixelLighting); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth), bEnablePerPixelDepth); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "ShowShaderErrors", &bShowShaderErrors), bShowShaderErrors); - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode), iMultisampleMode); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "EFBScale", &iEFBScale), iEFBScale); // integral - - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass), bDstAlphaPass); + iniFile.GetIfExists("Video_Settings", "SafeTextureCache", &bSafeTextureCache); + iniFile.GetIfExists("Video_Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable), bTexFmtOverlayEnable); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter), bTexFmtOverlayCenter); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "WireFrame", &bWireFrame), bWireFrame); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DisableLighting", &bDisableLighting), bDisableLighting); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DisableTexturing", &bDisableTexturing), bDisableTexturing); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog), bDisableFog); - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL), bEnableOpenCL); -#ifdef _OPENMP - SET_UISTATE(iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder), bOMPDecoder); -#endif - SET_UISTATE(iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering), bForceFiltering); - - SET_UISTATE(iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy), iMaxAnisotropy); // NOTE - this is x in (1 << x) - - { - SET_UISTATE(iniFile.GetIfExists("Video_Enhancements", "PostProcessingShader", &sPostProcessingShader), sPostProcessingShader); - sPostProcessingShader = (sPostProcessingShader == "off") ? "" : sPostProcessingShader; - } - - SET_UISTATE(iniFile.GetIfExists("Video_Enhancements", "Enable3dVision", &b3DVision), b3DVision); + iniFile.GetIfExists("Video_Settings", "ShowFPS", &bShowFPS); + iniFile.GetIfExists("Video_Settings", "ShowInputDisplay", &bShowInputDisplay); + iniFile.GetIfExists("Video_Settings", "OverlayStats", &bOverlayStats); + iniFile.GetIfExists("Video_Settings", "OverlayProjStats", &bOverlayProjStats); + iniFile.GetIfExists("Video_Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions); + iniFile.GetIfExists("Video_Settings", "DLOptimize", &iCompileDLsLevel); + iniFile.GetIfExists("Video_Settings", "DumpTextures", &bDumpTextures); + iniFile.GetIfExists("Video_Settings", "HiresTextures", &bHiresTextures); + iniFile.GetIfExists("Video_Settings", "DumpEFBTarget", &bDumpEFBTarget); + iniFile.GetIfExists("Video_Settings", "DumpFrames", &bDumpFrames); + iniFile.GetIfExists("Video_Settings", "FreeLook", &bFreeLook); + iniFile.GetIfExists("Video_Settings", "UseFFV1", &bUseFFV1); + iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo); + iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation); + iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle); + iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting); + iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth); - SET_UISTATE(iniFile.GetIfExists("Video_Hacks", "EFBAccessEnable", &bEFBAccessEnable), bEFBAccessEnable); - SET_UISTATE(iniFile.GetIfExists("Video_Hacks", "DlistCachingEnable", &bDlistCachingEnable), bDlistCachingEnable); - SET_UISTATE(iniFile.GetIfExists("Video_Hacks", "EFBCopyDisableHotKey", &bOSDHotKey), bOSDHotKey); - - { // CheckBox+RadioButtons group - SET_UISTATE(iniFile.GetIfExists("Video_Hacks", "EFBCopyEnable", &bEFBCopyEnable), bEFBCopyEnable); - if (UI_State.bEFBCopyEnable) - iniFile.GetIfExists("Video_Hacks", "EFBToTextureEnable", &bCopyEFBToTexture); + iniFile.GetIfExists("Video_Settings", "ShowShaderErrors", &bShowShaderErrors); + iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode); + iniFile.GetIfExists("Video_Settings", "EFBScale", &iEFBScale); // integral - SET_UISTATE(iniFile.GetIfExists("Video_Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable), bEFBCopyCacheEnable); - } - - SET_UISTATE(iniFile.GetIfExists("Video_Hacks", "EFBScaledCopy", &bCopyEFBScaled), bCopyEFBScaled); - SET_UISTATE(iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges), bEFBEmulateFormatChanges); + iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass); - SET_UISTATE(iniFile.GetIfExists("Video_Hardware", "Adapter", &iAdapter), iAdapter); - + iniFile.GetIfExists("Video_Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable); + iniFile.GetIfExists("Video_Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter); + iniFile.GetIfExists("Video_Settings", "WireFrame", &bWireFrame); + iniFile.GetIfExists("Video_Settings", "DisableLighting", &bDisableLighting); + iniFile.GetIfExists("Video_Settings", "DisableTexturing", &bDisableTexturing); + iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog); + + iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL); + iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder); + + iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering); + iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x) + iniFile.GetIfExists("Video_Enhancements", "PostProcessingShader", &sPostProcessingShader); + iniFile.GetIfExists("Video_Enhancements", "Enable3dVision", &b3DVision); + + iniFile.GetIfExists("Video_Hacks", "EFBAccessEnable", &bEFBAccessEnable); + iniFile.GetIfExists("Video_Hacks", "DlistCachingEnable", &bDlistCachingEnable); + iniFile.GetIfExists("Video_Hacks", "EFBCopyEnable", &bEFBCopyEnable); + iniFile.GetIfExists("Video_Hacks", "EFBCopyDisableHotKey", &bOSDHotKey); + iniFile.GetIfExists("Video_Hacks", "EFBToTextureEnable", &bCopyEFBToTexture); + iniFile.GetIfExists("Video_Hacks", "EFBScaledCopy", &bCopyEFBScaled); + iniFile.GetIfExists("Video_Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable); + iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges); + + iniFile.GetIfExists("Video_Hardware", "Adapter", &iAdapter); + + + iniFile.GetIfExists("Video", "ForceFiltering", &bForceFiltering); + iniFile.GetIfExists("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x) + iniFile.GetIfExists("Video", "EFBCopyEnable", &bEFBCopyEnable); + iniFile.GetIfExists("Video", "EFBCopyDisableHotKey", &bOSDHotKey); + iniFile.GetIfExists("Video", "EFBAccessEnable", &bEFBAccessEnable); + iniFile.GetIfExists("Video", "EFBToTextureEnable", &bCopyEFBToTexture); + iniFile.GetIfExists("Video", "EFBScaledCopy", &bCopyEFBScaled); + iniFile.GetIfExists("Video", "SafeTextureCache", &bSafeTextureCache); + iniFile.GetIfExists("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples); + + iniFile.GetIfExists("Video", "MSAA", &iMultisampleMode); + iniFile.GetIfExists("Video", "EFBScale", &iEFBScale); + iniFile.GetIfExists("Video", "DstAlphaPass", &bDstAlphaPass); + iniFile.GetIfExists("Video", "UseXFB", &bUseXFB); + iniFile.GetIfExists("Video", "UseRealXFB", &bUseRealXFB); iniFile.GetIfExists("Video", "ProjectionHack", &iPhackvalue[0]); iniFile.GetIfExists("Video", "PH_SZNear", &iPhackvalue[1]); iniFile.GetIfExists("Video", "PH_SZFar", &iPhackvalue[2]); iniFile.GetIfExists("Video", "PH_ExtraParam", &iPhackvalue[3]); iniFile.GetIfExists("Video", "PH_ZNear", &sPhackvalue[0]); iniFile.GetIfExists("Video", "PH_ZFar", &sPhackvalue[1]); - - SET_UISTATE(iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack), bZTPSpeedHack); + iniFile.GetIfExists("Video", "UseNativeMips", &bUseNativeMips); + iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack); + iniFile.GetIfExists("Video", "DlistCachingEnable", &bDlistCachingEnable); VerifyValidity(); } @@ -237,7 +220,7 @@ void VideoConfig::GameIniLoad(const char *ini_file) void VideoConfig::VerifyValidity() { // TODO: Check iMaxAnisotropy value - if (iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0; + if (iAdapter < 0 || iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0; if (iMultisampleMode < 0 || iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0; if (!backend_info.bSupports3DVision) b3DVision = false; if (!backend_info.bSupportsFormatReinterpretation) bEFBEmulateFormatChanges = false; @@ -248,7 +231,6 @@ void VideoConfig::Save(const char *ini_file) { IniFile iniFile; iniFile.Load(ini_file); - iniFile.Set("Hardware", "VSync", bVSync); iniFile.Set("Settings", "AspectRatio", iAspectRatio); iniFile.Set("Settings", "Crop", bCrop); @@ -286,16 +268,14 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Settings", "EFBScale", iEFBScale); iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); - iniFile.Set("Settings", "WireFrame", bWireFrame); + iniFile.Set("Settings", "Wireframe", bWireFrame); iniFile.Set("Settings", "DisableLighting", bDisableLighting); iniFile.Set("Settings", "DisableTexturing", bDisableTexturing); iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass); iniFile.Set("Settings", "DisableFog", bDisableFog); iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL); -#ifdef _OPENMP iniFile.Set("Settings", "OMPDecoder", bOMPDecoder); -#endif iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering); iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy); @@ -318,94 +298,80 @@ void VideoConfig::Save(const char *ini_file) void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini) { + // wxWidgets doesn't provide us with a nice way to change 3-state checkboxes into 2-state ones + // This would allow us to make the "default config" dialog layout to be 2-state based, but the + // "game config" layout to be 3-state based (with the 3rd state being "use default") + // Since we can't do that, we instead just save anything which differs from the default config + // TODO: Make this less ugly + + VideoConfig defCfg; + defCfg.Load(default_ini); IniFile iniFile; iniFile.Load(game_ini); - #define CHECK_UISTATE(section, key, member){\ - if (UI_State.member) iniFile.Set((section), (key), (member)); else iniFile.DeleteKey((section), (key)); } + #define SET_IF_DIFFERS(section, key, member) { if ((member) != (defCfg.member)) iniFile.Set((section), (key), (member)); else iniFile.DeleteKey((section), (key)); } - CHECK_UISTATE("Video_Hardware", "VSync", bVSync); - CHECK_UISTATE("Video_Settings", "wideScreenHack", bWidescreenHack); - CHECK_UISTATE("Video_Settings", "AspectRatio", iAspectRatio); - CHECK_UISTATE("Video_Settings", "Crop", bCrop); + SET_IF_DIFFERS("Video_Hardware", "VSync", bVSync); + SET_IF_DIFFERS("Video_Settings", "wideScreenHack", bWidescreenHack); + SET_IF_DIFFERS("Video_Settings", "AspectRatio", iAspectRatio); + SET_IF_DIFFERS("Video_Settings", "Crop", bCrop); + SET_IF_DIFFERS("Video_Settings", "UseXFB", bUseXFB); + SET_IF_DIFFERS("Video_Settings", "UseRealXFB", bUseRealXFB); + SET_IF_DIFFERS("Video_Settings", "UseNativeMips", bUseNativeMips); - { // CheckBox+RadioButtons group - CHECK_UISTATE("Video_Settings", "UseXFB", bUseXFB); - UI_State.bUseRealXFB = UI_State.bUseXFB; - CHECK_UISTATE("Video_Settings", "UseRealXFB", bUseRealXFB); - } + SET_IF_DIFFERS("Video_Settings", "SafeTextureCache", bSafeTextureCache); + SET_IF_DIFFERS("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); - CHECK_UISTATE("Video_Settings", "UseNativeMips", bUseNativeMips); - - { // CheckBox+RadioButtons group - CHECK_UISTATE("Video_Settings", "SafeTextureCache", bSafeTextureCache); - UI_State.iSafeTextureCache_ColorSamples = UI_State.bSafeTextureCache; - CHECK_UISTATE("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); - } + SET_IF_DIFFERS("Video_Settings", "ShowFPS", bShowFPS); + SET_IF_DIFFERS("Video_Settings", "ShowInputDisplay", bShowInputDisplay); + SET_IF_DIFFERS("Video_Settings", "OverlayStats", bOverlayStats); + SET_IF_DIFFERS("Video_Settings", "OverlayProjStats", bOverlayProjStats); + SET_IF_DIFFERS("Video_Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); + SET_IF_DIFFERS("Video_Settings", "DLOptimize", iCompileDLsLevel); + SET_IF_DIFFERS("Video_Settings", "DumpTextures", bDumpTextures); + SET_IF_DIFFERS("Video_Settings", "HiresTextures", bHiresTextures); + SET_IF_DIFFERS("Video_Settings", "DumpEFBTarget", bDumpEFBTarget); + SET_IF_DIFFERS("Video_Settings", "DumpFrames", bDumpFrames); + SET_IF_DIFFERS("Video_Settings", "FreeLook", bFreeLook); + SET_IF_DIFFERS("Video_Settings", "UseFFV1", bUseFFV1); + SET_IF_DIFFERS("Video_Settings", "AnaglyphStereo", bAnaglyphStereo); + SET_IF_DIFFERS("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); + SET_IF_DIFFERS("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); + SET_IF_DIFFERS("Video_Settings", "EnablePixelLighting", bEnablePixelLighting); + SET_IF_DIFFERS("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth); - CHECK_UISTATE("Video_Settings", "ShowFPS", bShowFPS); - CHECK_UISTATE("Video_Settings", "ShowInputDisplay", bShowInputDisplay); - CHECK_UISTATE("Video_Settings", "OverlayStats", bOverlayStats); - CHECK_UISTATE("Video_Settings", "OverlayProjStats", bOverlayProjStats); - CHECK_UISTATE("Video_Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); - CHECK_UISTATE("Video_Settings", "DLOptimize", iCompileDLsLevel); - CHECK_UISTATE("Video_Settings", "DumpTextures", bDumpTextures); - CHECK_UISTATE("Video_Settings", "HiresTextures", bHiresTextures); - CHECK_UISTATE("Video_Settings", "DumpEFBTarget", bDumpEFBTarget); - CHECK_UISTATE("Video_Settings", "DumpFrames", bDumpFrames); - CHECK_UISTATE("Video_Settings", "FreeLook", bFreeLook); - CHECK_UISTATE("Video_Settings", "UseFFV1", bUseFFV1); - CHECK_UISTATE("Video_Settings", "AnaglyphStereo", bAnaglyphStereo); - CHECK_UISTATE("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); - CHECK_UISTATE("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); - CHECK_UISTATE("Video_Settings", "EnablePixelLighting", bEnablePixelLighting); - CHECK_UISTATE("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth); + SET_IF_DIFFERS("Video_Settings", "ShowShaderErrors", bShowShaderErrors); + SET_IF_DIFFERS("Video_Settings", "MSAA", iMultisampleMode); + SET_IF_DIFFERS("Video_Settings", "EFBScale", iEFBScale); // integral - CHECK_UISTATE("Video_Settings", "ShowShaderErrors", bShowShaderErrors); - CHECK_UISTATE("Video_Settings", "MSAA", iMultisampleMode); - CHECK_UISTATE("Video_Settings", "EFBScale", iEFBScale); // integral + SET_IF_DIFFERS("Video_Settings", "DstAlphaPass", bDstAlphaPass); - CHECK_UISTATE("Video_Settings", "DstAlphaPass", bDstAlphaPass); + SET_IF_DIFFERS("Video_Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); + SET_IF_DIFFERS("Video_Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); + SET_IF_DIFFERS("Video_Settings", "WireFrame", bWireFrame); + SET_IF_DIFFERS("Video_Settings", "DisableLighting", bDisableLighting); + SET_IF_DIFFERS("Video_Settings", "DisableTexturing", bDisableTexturing); + SET_IF_DIFFERS("Video_Settings", "DisableFog", bDisableFog); - CHECK_UISTATE("Video_Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); - CHECK_UISTATE("Video_Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); - CHECK_UISTATE("Video_Settings", "WireFrame", bWireFrame); - CHECK_UISTATE("Video_Settings", "DisableLighting", bDisableLighting); - CHECK_UISTATE("Video_Settings", "DisableTexturing", bDisableTexturing); - CHECK_UISTATE("Video_Settings", "DisableFog", bDisableFog); + SET_IF_DIFFERS("Video_Settings", "EnableOpenCL", bEnableOpenCL); + SET_IF_DIFFERS("Video_Settings", "OMPDecoder", bOMPDecoder); - CHECK_UISTATE("Video_Settings", "EnableOpenCL", bEnableOpenCL); -#ifdef _OPENMP - CHECK_UISTATE("Video_Settings", "OMPDecoder", bOMPDecoder); -#endif + SET_IF_DIFFERS("Video_Enhancements", "ForceFiltering", bForceFiltering); + SET_IF_DIFFERS("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x) + SET_IF_DIFFERS("Video_Enhancements", "PostProcessingShader", sPostProcessingShader); + SET_IF_DIFFERS("Video_Enhancements", "Enable3dVision", b3DVision); - CHECK_UISTATE("Video_Enhancements", "ForceFiltering", bForceFiltering); - CHECK_UISTATE("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x) - - { - sPostProcessingShader = (UI_State.sPostProcessingShader && sPostProcessingShader.empty()) ? "off" : sPostProcessingShader; - CHECK_UISTATE("Video_Enhancements", "PostProcessingShader", sPostProcessingShader); - } - - CHECK_UISTATE("Video_Enhancements", "Enable3dVision", b3DVision); + SET_IF_DIFFERS("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable); + SET_IF_DIFFERS("Video_Hacks", "DlistCachingEnable", bDlistCachingEnable); + SET_IF_DIFFERS("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable); + SET_IF_DIFFERS("Video_Hacks", "EFBCopyDisableHotKey", bOSDHotKey); + SET_IF_DIFFERS("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture); + SET_IF_DIFFERS("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled); + SET_IF_DIFFERS("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); + SET_IF_DIFFERS("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); - CHECK_UISTATE("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable); - CHECK_UISTATE("Video_Hacks", "DlistCachingEnable", bDlistCachingEnable); - CHECK_UISTATE("Video_Hacks", "EFBCopyDisableHotKey", bOSDHotKey); - - { // CheckBox+RadioButtons group - CHECK_UISTATE("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable); - UI_State.bCopyEFBToTexture = UI_State.bEFBCopyEnable; - CHECK_UISTATE("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture); - - CHECK_UISTATE("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); - } - - CHECK_UISTATE("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled); - CHECK_UISTATE("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); - - CHECK_UISTATE("Video_Hardware", "Adapter", iAdapter); + SET_IF_DIFFERS("Video_Hardware", "Adapter", iAdapter); iniFile.Save(game_ini); } diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 6c57870ca1..5f6945b8f7 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -61,17 +61,9 @@ class IniFile; // NEVER inherit from this class. struct VideoConfig { - -private: - // According to new structure-design this member MUST BE private - void GameIniLoad(const char *ini_file); - -public: VideoConfig(); - // You can choose what "INI snapshot" you wish to load... - // GameIni is loaded over MainIni file only if 'fileCheck' argument is passed with success - void Load(const char *main_ini_file, bool fileCheck = false, const char *game_ini_file = ""); - + void Load(const char *ini_file); + void GameIniLoad(const char *ini_file); void VerifyValidity(); void Save(const char *ini_file); void GameIniSave(const char* default_ini, const char* game_ini); @@ -85,7 +77,7 @@ public: int iAspectRatio; bool bCrop; // Aspect ratio controls. bool bUseXFB; - bool bUseRealXFB; // joined to radio button + bool bUseRealXFB; bool bUseNativeMips; // OpenCL/OpenMP @@ -117,7 +109,7 @@ public: // Utility bool bDumpTextures; - bool bHiresTextures; + bool bHiresTextures; bool bDumpEFBTarget; bool bDumpFrames; bool bUseFFV1; @@ -127,16 +119,15 @@ public: int iAnaglyphFocalAngle; bool b3DVision; - // Hacks bool bEFBAccessEnable; - bool bDlistCachingEnable; + bool bDlistCachingEnable; bool bEFBCopyEnable; bool bEFBCopyCacheEnable; bool bEFBEmulateFormatChanges; bool bOSDHotKey; - bool bCopyEFBToTexture; // joined to radio button + bool bCopyEFBToTexture; bool bCopyEFBScaled; bool bSafeTextureCache; int iSafeTextureCache_ColorSamples; @@ -157,66 +148,6 @@ public: // D3D only config, mostly to be merged into the above int iAdapter; - // UI Controls state - struct - { - // IMPORTANT: each member inside this struct MUST HAVE same name corresponding to data member - bool bVSync; - bool bWidescreenHack; - bool iAspectRatio; - bool bCrop; - bool bUseXFB; - bool bUseRealXFB; - bool bUseNativeMips; - bool bEnableOpenCL; - bool iMultisampleMode; - bool iEFBScale; - bool bForceFiltering; - bool iMaxAnisotropy; - bool sPostProcessingShader; - bool bShowFPS; - bool bShowInputDisplay; - bool bOverlayStats; - bool bOverlayProjStats; - bool bTexFmtOverlayEnable; - bool bTexFmtOverlayCenter; - bool bShowEFBCopyRegions; - bool bWireFrame; - bool bDisableLighting; - bool bDisableTexturing; - bool bDstAlphaPass; - bool bDisableFog; - bool bDumpTextures; - bool bHiresTextures; - bool bDumpEFBTarget; - bool bDumpFrames; - bool bUseFFV1; - bool bFreeLook; - bool bAnaglyphStereo; - bool b3DVision; - bool iAnaglyphStereoSeparation; - bool iAnaglyphFocalAngle; - bool bEFBAccessEnable; - bool bOMPDecoder; - bool bDlistCachingEnable; - bool bEFBCopyEnable; - bool bCopyEFBToTexture; - bool bEFBCopyCacheEnable; - bool bEFBEmulateFormatChanges; - bool bOSDHotKey; - bool bCopyEFBScaled; - bool bSafeTextureCache; - bool iSafeTextureCache_ColorSamples; - bool bZTPSpeedHack; - bool bEnablePixelLighting; - bool bEnablePerPixelDepth; - bool iLog; - bool iSaveTargetId; - bool iCompileDLsLevel; - bool bShowShaderErrors; - bool iAdapter; - } UI_State; - // Static config per API struct { diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp index be9d3f2dcd..6fb9551f24 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp @@ -155,9 +155,8 @@ bool VideoBackend::Initialize(void *&window_handle) frameCount = 0; - g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str(), true, - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); - + g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str()); + g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue); UpdateActiveConfig(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index fc3a5f8bc4..c49bbb665e 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -137,9 +137,9 @@ bool VideoBackend::Initialize(void *&window_handle) frameCount = 0; - g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx9.ini").c_str(), true, - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); - + g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx9.ini").c_str()); + g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); + UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue); UpdateActiveConfig(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 62d8c11761..4b027c5adc 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -160,8 +160,8 @@ bool VideoBackend::Initialize(void *&window_handle) frameCount = 0; - g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_opengl.ini").c_str(), true, - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); + g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_opengl.ini").c_str()); + g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); g_Config.UpdateProjectionHack(); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index 503215caaa..a33274d143 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -67,7 +67,7 @@ void VideoSoftware::ShowConfig(void *_hParent) bool VideoSoftware::Initialize(void *&window_handle) { - g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); + g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); if (!OpenGL_Create(window_handle)) {