GameConfigLoader: Add GFX Game INI translations

This commit is contained in:
MerryMage 2017-05-18 13:59:38 +01:00
parent d75b536fd7
commit f5f45855f0
13 changed files with 382 additions and 426 deletions

View File

@ -19,6 +19,7 @@
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/Config.h" #include "Core/Config/Config.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigLoaders/GameConfigLoader.h" #include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h" #include "Core/ConfigLoaders/IsSettingSaveable.h"
@ -51,7 +52,59 @@ using INIToLocationMap = std::map<std::pair<std::string, std::string>, ConfigLoc
// See also: MapINIToRealLocation and GetINILocationFromConfig. // See also: MapINIToRealLocation and GetINILocationFromConfig.
static const INIToLocationMap& GetINIToLocationMap() static const INIToLocationMap& GetINIToLocationMap()
{ {
static const INIToLocationMap ini_to_location{}; static const INIToLocationMap ini_to_location = {
{{"Video_Hardware", "VSync"}, {Config::GFX_VSYNC.location}},
{{"Video_Settings", "wideScreenHack"}, {Config::GFX_WIDESCREEN_HACK.location}},
{{"Video_Settings", "AspectRatio"}, {Config::GFX_ASPECT_RATIO.location}},
{{"Video_Settings", "Crop"}, {Config::GFX_CROP.location}},
{{"Video_Settings", "UseXFB"}, {Config::GFX_USE_XFB.location}},
{{"Video_Settings", "UseRealXFB"}, {Config::GFX_USE_REAL_XFB.location}},
{{"Video_Settings", "SafeTextureCacheColorSamples"},
{Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES.location}},
{{"Video_Settings", "HiresTextures"}, {Config::GFX_HIRES_TEXTURES.location}},
{{"Video_Settings", "ConvertHiresTextures"}, {Config::GFX_CONVERT_HIRES_TEXTURES.location}},
{{"Video_Settings", "CacheHiresTextures"}, {Config::GFX_CACHE_HIRES_TEXTURES.location}},
{{"Video_Settings", "EnablePixelLighting"}, {Config::GFX_ENABLE_PIXEL_LIGHTING.location}},
{{"Video_Settings", "FastDepthCalc"}, {Config::GFX_FAST_DEPTH_CALC.location}},
{{"Video_Settings", "MSAA"}, {Config::GFX_MSAA.location}},
{{"Video_Settings", "SSAA"}, {Config::GFX_SSAA.location}},
{{"Video_Settings", "ForceTrueColor"}, {Config::GFX_ENHANCE_FORCE_TRUE_COLOR.location}},
{{"Video_Settings", "EFBScale"}, {Config::GFX_EFB_SCALE.location}},
{{"Video_Settings", "DisableFog"}, {Config::GFX_DISABLE_FOG.location}},
{{"Video_Settings", "BackendMultithreading"}, {Config::GFX_BACKEND_MULTITHREADING.location}},
{{"Video_Settings", "CommandBufferExecuteInterval"},
{Config::GFX_COMMAND_BUFFER_EXECUTE_INTERVAL.location}},
{{"Video_Enhancements", "ForceFiltering"}, {Config::GFX_ENHANCE_FORCE_FILTERING.location}},
{{"Video_Enhancements", "MaxAnisotropy"}, {Config::GFX_ENHANCE_MAX_ANISOTROPY.location}},
{{"Video_Enhancements", "PostProcessingShader"}, {Config::GFX_ENHANCE_POST_SHADER.location}},
{{"Video_Stereoscopy", "StereoConvergence"}, {Config::GFX_STEREO_CONVERGENCE.location}},
{{"Video_Stereoscopy", "StereoEFBMonoDepth"}, {Config::GFX_STEREO_EFB_MONO_DEPTH.location}},
{{"Video_Stereoscopy", "StereoDepthPercentage"},
{Config::GFX_STEREO_DEPTH_PERCENTAGE.location}},
{{"Video_Stereoscopy", "StereoMode"}, {Config::GFX_STEREO_MODE.location}},
{{"Video_Stereoscopy", "StereoDepth"}, {Config::GFX_STEREO_DEPTH.location}},
{{"Video_Stereoscopy", "StereoSwapEyes"}, {Config::GFX_STEREO_SWAP_EYES.location}},
{{"Video_Hacks", "EFBAccessEnable"}, {Config::GFX_HACK_EFB_ACCESS_ENABLE.location}},
{{"Video_Hacks", "BBoxEnable"}, {Config::GFX_HACK_BBOX_ENABLE.location}},
{{"Video_Hacks", "ForceProgressive"}, {Config::GFX_HACK_FORCE_PROGRESSIVE.location}},
{{"Video_Hacks", "EFBToTextureEnable"}, {Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM.location}},
{{"Video_Hacks", "EFBScaledCopy"}, {Config::GFX_EFB_SCALE.location}},
{{"Video_Hacks", "EFBEmulateFormatChanges"},
{Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES.location}},
{{"Video_Hacks", "VertexRounding"}, {Config::GFX_HACK_VERTEX_ROUDING.location}},
{{"Video", "ProjectionHack"}, {Config::GFX_PROJECTION_HACK.location}},
{{"Video", "PH_SZNear"}, {Config::GFX_PROJECTION_HACK_SZNEAR.location}},
{{"Video", "PH_SZFar"}, {Config::GFX_PROJECTION_HACK_SZFAR.location}},
{{"Video", "PH_ZNear"}, {Config::GFX_PROJECTION_HACK_ZNEAR.location}},
{{"Video", "PH_ZFar"}, {Config::GFX_PROJECTION_HACK_ZFAR.location}},
{{"Video", "PerfQueriesEnable"}, {Config::GFX_PERF_QUERIES_ENABLE.location}},
};
return ini_to_location; return ini_to_location;
} }

View File

@ -42,6 +42,7 @@
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/DVD/DVDInterface.h" #include "Core/HW/DVD/DVDInterface.h"
@ -1423,41 +1424,46 @@ void CFrame::ParseHotkeys()
if (IsHotkey(HK_INCREASE_IR)) if (IsHotkey(HK_INCREASE_IR))
{ {
OSDChoice = 1; OSDChoice = 1;
++g_Config.iEFBScale; Config::SetCurrent(Config::GFX_EFB_SCALE, Config::Get(Config::GFX_EFB_SCALE) + 1);
} }
if (IsHotkey(HK_DECREASE_IR)) if (IsHotkey(HK_DECREASE_IR))
{ {
OSDChoice = 1; OSDChoice = 1;
if (--g_Config.iEFBScale < SCALE_AUTO) if (Config::Get(Config::GFX_EFB_SCALE) > SCALE_AUTO)
g_Config.iEFBScale = SCALE_AUTO; Config::SetCurrent(Config::GFX_EFB_SCALE, Config::Get(Config::GFX_EFB_SCALE) - 1);
} }
if (IsHotkey(HK_TOGGLE_CROP)) if (IsHotkey(HK_TOGGLE_CROP))
{ {
g_Config.bCrop = !g_Config.bCrop; Config::SetCurrent(Config::GFX_CROP, !Config::Get(Config::GFX_CROP));
} }
if (IsHotkey(HK_TOGGLE_AR)) if (IsHotkey(HK_TOGGLE_AR))
{ {
OSDChoice = 2; OSDChoice = 2;
// Toggle aspect ratio // Toggle aspect ratio
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3; int aspect_ratio = Config::Get(Config::GFX_ASPECT_RATIO);
aspect_ratio = (aspect_ratio + 1) & 3;
Config::SetCurrent(Config::GFX_ASPECT_RATIO, aspect_ratio);
} }
if (IsHotkey(HK_TOGGLE_EFBCOPIES)) if (IsHotkey(HK_TOGGLE_EFBCOPIES))
{ {
OSDChoice = 3; OSDChoice = 3;
// Toggle EFB copies between EFB2RAM and EFB2Texture // Toggle EFB copies between EFB2RAM and EFB2Texture
g_Config.bSkipEFBCopyToRam = !g_Config.bSkipEFBCopyToRam; Config::SetCurrent(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM,
!Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM));
} }
if (IsHotkey(HK_TOGGLE_FOG)) if (IsHotkey(HK_TOGGLE_FOG))
{ {
OSDChoice = 4; OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog; Config::SetCurrent(Config::GFX_DISABLE_FOG, !Config::Get(Config::GFX_DISABLE_FOG));
} }
if (IsHotkey(HK_TOGGLE_DUMPTEXTURES)) if (IsHotkey(HK_TOGGLE_DUMPTEXTURES))
{ {
g_Config.bDumpTextures = !g_Config.bDumpTextures; Config::SetCurrent(Config::GFX_DUMP_TEXTURES, !Config::Get(Config::GFX_DUMP_TEXTURES));
} }
if (IsHotkey(HK_TOGGLE_TEXTURES)) if (IsHotkey(HK_TOGGLE_TEXTURES))
g_Config.bHiresTextures = !g_Config.bHiresTextures; {
Config::SetCurrent(Config::GFX_HIRES_TEXTURES, !Config::Get(Config::GFX_HIRES_TEXTURES));
}
Core::SetIsThrottlerTempDisabled(IsHotkey(HK_TOGGLE_THROTTLE, true)); Core::SetIsThrottlerTempDisabled(IsHotkey(HK_TOGGLE_THROTTLE, true));
if (IsHotkey(HK_DECREASE_EMULATION_SPEED)) if (IsHotkey(HK_DECREASE_EMULATION_SPEED))
{ {
@ -1503,13 +1509,13 @@ void CFrame::ParseHotkeys()
// turned off when selecting other stereoscopy modes. // turned off when selecting other stereoscopy modes.
if (g_Config.sPostProcessingShader == "dubois") if (g_Config.sPostProcessingShader == "dubois")
{ {
g_Config.sPostProcessingShader = ""; Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
} }
g_Config.iStereoMode = STEREO_SBS; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_SBS));
} }
else else
{ {
g_Config.iStereoMode = STEREO_OFF; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
} }
} }
if (IsHotkey(HK_TOGGLE_STEREO_TAB)) if (IsHotkey(HK_TOGGLE_STEREO_TAB))
@ -1518,13 +1524,13 @@ void CFrame::ParseHotkeys()
{ {
if (g_Config.sPostProcessingShader == "dubois") if (g_Config.sPostProcessingShader == "dubois")
{ {
g_Config.sPostProcessingShader = ""; Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
} }
g_Config.iStereoMode = STEREO_TAB; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_TAB));
} }
else else
{ {
g_Config.iStereoMode = STEREO_OFF; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
} }
} }
if (IsHotkey(HK_TOGGLE_STEREO_ANAGLYPH)) if (IsHotkey(HK_TOGGLE_STEREO_ANAGLYPH))
@ -1533,13 +1539,13 @@ void CFrame::ParseHotkeys()
{ {
// Setting the anaglyph mode also requires a specific // Setting the anaglyph mode also requires a specific
// post-processing shader to be activated. // post-processing shader to be activated.
g_Config.iStereoMode = STEREO_ANAGLYPH; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_ANAGLYPH));
g_Config.sPostProcessingShader = "dubois"; Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string("dubois"));
} }
else else
{ {
g_Config.iStereoMode = STEREO_OFF; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
g_Config.sPostProcessingShader = ""; Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
} }
} }
if (IsHotkey(HK_TOGGLE_STEREO_3DVISION)) if (IsHotkey(HK_TOGGLE_STEREO_3DVISION))
@ -1548,37 +1554,35 @@ void CFrame::ParseHotkeys()
{ {
if (g_Config.sPostProcessingShader == "dubois") if (g_Config.sPostProcessingShader == "dubois")
{ {
g_Config.sPostProcessingShader = ""; Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
} }
g_Config.iStereoMode = STEREO_3DVISION; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_3DVISION));
} }
else else
{ {
g_Config.iStereoMode = STEREO_OFF; Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
} }
} }
if (IsHotkey(HK_DECREASE_DEPTH, true)) if (IsHotkey(HK_DECREASE_DEPTH, true))
{ {
if (--g_Config.iStereoDepth < 0) if (g_Config.iStereoDepth > 0)
g_Config.iStereoDepth = 0; Config::SetCurrent(Config::GFX_STEREO_DEPTH, g_Config.iStereoDepth - 1);
} }
if (IsHotkey(HK_INCREASE_DEPTH, true)) if (IsHotkey(HK_INCREASE_DEPTH, true))
{ {
if (++g_Config.iStereoDepth > 100) if (g_Config.iStereoDepth < 100)
g_Config.iStereoDepth = 100; Config::SetCurrent(Config::GFX_STEREO_DEPTH, g_Config.iStereoDepth + 1);
} }
if (IsHotkey(HK_DECREASE_CONVERGENCE, true)) if (IsHotkey(HK_DECREASE_CONVERGENCE, true))
{ {
g_Config.iStereoConvergence -= 5; int convergence = std::max(0, g_Config.iStereoConvergence - 5);
if (g_Config.iStereoConvergence < 0) Config::SetCurrent(Config::GFX_STEREO_CONVERGENCE, convergence);
g_Config.iStereoConvergence = 0;
} }
if (IsHotkey(HK_INCREASE_CONVERGENCE, true)) if (IsHotkey(HK_INCREASE_CONVERGENCE, true))
{ {
g_Config.iStereoConvergence += 5; int convergence = std::min(500, g_Config.iStereoConvergence + 5);
if (g_Config.iStereoConvergence > 500) Config::SetCurrent(Config::GFX_STEREO_CONVERGENCE, convergence);
g_Config.iStereoConvergence = 500;
} }
static float debugSpeed = 1.0f; static float debugSpeed = 1.0f;

View File

@ -15,19 +15,20 @@
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "DolphinWX/SoftwareVideoConfigDialog.h" #include "DolphinWX/SoftwareVideoConfigDialog.h"
#include "DolphinWX/VideoConfigDiag.h" #include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
template <typename T> IntegerSetting::IntegerSetting(wxWindow* parent, const wxString& label,
IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, const Config::ConfigInfo<int>& setting, int minVal, int maxVal,
int maxVal, long style) long style)
: wxSpinCtrl(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style), : wxSpinCtrl(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style),
m_setting(setting) m_setting(setting)
{ {
SetRange(minVal, maxVal); SetRange(minVal, maxVal);
SetValue(m_setting); SetValue(Config::Get(m_setting));
Bind(wxEVT_SPINCTRL, &IntegerSetting::UpdateValue, this); Bind(wxEVT_SPINCTRL, &IntegerSetting::UpdateValue, this);
} }
@ -35,9 +36,6 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
: wxDialog(parent, wxID_ANY, : wxDialog(parent, wxID_ANY,
wxString(wxString::Format(_("Dolphin %s Graphics Configuration"), title))) wxString(wxString::Format(_("Dolphin %s Graphics Configuration"), title)))
{ {
VideoConfig& vconfig = g_Config;
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
wxNotebook* const notebook = new wxNotebook(this, wxID_ANY); wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);
const int space5 = FromDIP(5); const int space5 = FromDIP(5);
@ -82,7 +80,7 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
// xfb // xfb
szr_rendering->Add( szr_rendering->Add(
new SettingCheckBox(page_general, _("Bypass XFB"), "", vconfig.bUseXFB, true)); new SettingCheckBox(page_general, _("Bypass XFB"), "", Config::GFX_USE_XFB, true));
} }
// - info // - info
@ -95,8 +93,8 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
group_info->Add(szr_info, 0, wxEXPAND | wxLEFT | wxRIGHT, space5); group_info->Add(szr_info, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
group_info->AddSpacer(space5); group_info->AddSpacer(space5);
szr_info->Add( szr_info->Add(new SettingCheckBox(page_general, _("Various Statistics"), "",
new SettingCheckBox(page_general, _("Various Statistics"), "", vconfig.bOverlayStats)); Config::GFX_OVERLAY_STATS));
} }
// - utility // - utility
@ -110,9 +108,9 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
group_utility->AddSpacer(space5); group_utility->AddSpacer(space5);
szr_utility->Add( szr_utility->Add(
new SettingCheckBox(page_general, _("Dump Textures"), "", vconfig.bDumpTextures)); new SettingCheckBox(page_general, _("Dump Textures"), "", Config::GFX_DUMP_TEXTURES));
szr_utility->Add( szr_utility->Add(
new SettingCheckBox(page_general, _("Dump Objects"), "", vconfig.bDumpObjects)); new SettingCheckBox(page_general, _("Dump Objects"), "", Config::GFX_SW_DUMP_OBJECTS));
// - debug only // - debug only
wxStaticBoxSizer* const group_debug_only_utility = wxStaticBoxSizer* const group_debug_only_utility =
@ -124,10 +122,10 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
group_debug_only_utility->Add(szr_debug_only_utility, 0, wxEXPAND | wxBOTTOM, space5); group_debug_only_utility->Add(szr_debug_only_utility, 0, wxEXPAND | wxBOTTOM, space5);
group_debug_only_utility->AddSpacer(space5); group_debug_only_utility->AddSpacer(space5);
szr_debug_only_utility->Add( szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump TEV Stages"), "",
new SettingCheckBox(page_general, _("Dump TEV Stages"), "", vconfig.bDumpTevStages)); Config::GFX_SW_DUMP_TEV_STAGES));
szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump Texture Fetches"), "", szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump Texture Fetches"), "",
vconfig.bDumpTevTextureFetches)); Config::GFX_SW_DUMP_TEV_TEX_FETCHES));
} }
// - misc // - misc
@ -141,8 +139,8 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
group_misc->AddSpacer(space5); group_misc->AddSpacer(space5);
szr_misc->Add( szr_misc->Add(
new IntegerSetting<int>(page_general, _("Start"), vconfig.drawStart, 0, 100000)); new IntegerSetting(page_general, _("Start"), Config::GFX_SW_DRAW_START, 0, 100000));
szr_misc->Add(new IntegerSetting<int>(page_general, _("End"), vconfig.drawEnd, 0, 100000)); szr_misc->Add(new IntegerSetting(page_general, _("End"), Config::GFX_SW_DRAW_END, 0, 100000));
} }
szr_general->AddSpacer(space5); szr_general->AddSpacer(space5);
@ -168,5 +166,5 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
SoftwareVideoConfigDialog::~SoftwareVideoConfigDialog() SoftwareVideoConfigDialog::~SoftwareVideoConfigDialog()
{ {
g_Config.Save((File::GetUserPath(D_CONFIG_IDX) + "GFX.ini").c_str()); Config::Save();
} }

View File

@ -46,38 +46,54 @@ template class BoolSetting<wxRadioButton>;
template <> template <>
SettingCheckBox::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, SettingCheckBox::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip,
bool& setting, bool reverse, long style) const Config::ConfigInfo<bool>& setting, bool reverse, long style)
: wxCheckBox(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style), : wxCheckBox(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style),
m_setting(setting), m_reverse(reverse) m_setting(setting), m_reverse(reverse)
{ {
SetToolTip(tooltip); SetToolTip(tooltip);
SetValue(m_setting ^ m_reverse); SetValue(Config::Get(m_setting) ^ m_reverse);
if (Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base)
SetFont(GetFont().MakeBold());
Bind(wxEVT_CHECKBOX, &SettingCheckBox::UpdateValue, this); Bind(wxEVT_CHECKBOX, &SettingCheckBox::UpdateValue, this);
} }
template <> template <>
SettingRadioButton::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, SettingRadioButton::BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip,
bool& setting, bool reverse, long style) const Config::ConfigInfo<bool>& setting, bool reverse, long style)
: wxRadioButton(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style), : wxRadioButton(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style),
m_setting(setting), m_reverse(reverse) m_setting(setting), m_reverse(reverse)
{ {
SetToolTip(tooltip); SetToolTip(tooltip);
SetValue(m_setting ^ m_reverse); SetValue(Config::Get(m_setting) ^ m_reverse);
if (Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base)
SetFont(GetFont().MakeBold());
Bind(wxEVT_RADIOBUTTON, &SettingRadioButton::UpdateValue, this); Bind(wxEVT_RADIOBUTTON, &SettingRadioButton::UpdateValue, this);
} }
SettingChoice::SettingChoice(wxWindow* parent, int& setting, const wxString& tooltip, int num, template <>
const wxString choices[], long style) RefBoolSetting<wxCheckBox>::RefBoolSetting(wxWindow* parent, const wxString& label,
const wxString& tooltip, bool& setting, bool reverse,
long style)
: wxCheckBox(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style),
m_setting(setting), m_reverse(reverse)
{
SetToolTip(tooltip);
SetValue(m_setting ^ m_reverse);
Bind(wxEVT_CHECKBOX, &RefBoolSetting<wxCheckBox>::UpdateValue, this);
}
SettingChoice::SettingChoice(wxWindow* parent, const Config::ConfigInfo<int>& setting,
const wxString& tooltip, int num, const wxString choices[], long style)
: wxChoice(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, num, choices), m_setting(setting) : wxChoice(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, num, choices), m_setting(setting)
{ {
SetToolTip(tooltip); SetToolTip(tooltip);
Select(m_setting); Select(Config::Get(m_setting));
Bind(wxEVT_CHOICE, &SettingChoice::UpdateValue, this); Bind(wxEVT_CHOICE, &SettingChoice::UpdateValue, this);
} }
void SettingChoice::UpdateValue(wxCommandEvent& ev) void SettingChoice::UpdateValue(wxCommandEvent& ev)
{ {
m_setting = ev.GetInt(); Config::SetBaseOrCurrent(m_setting, ev.GetInt());
ev.Skip(); ev.Skip();
} }
@ -359,8 +375,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGetTranslation(StrToWxStr(title)))), wxGetTranslation(StrToWxStr(title)))),
vconfig(g_Config) vconfig(g_Config)
{ {
vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
Bind(wxEVT_UPDATE_UI, &VideoConfigDiag::OnUpdateUI, this); Bind(wxEVT_UPDATE_UI, &VideoConfigDiag::OnUpdateUI, this);
wxNotebook* const notebook = new wxNotebook(this, wxID_ANY); wxNotebook* const notebook = new wxNotebook(this, wxID_ANY);
@ -399,7 +413,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
if (vconfig.backend_info.Adapters.size()) if (vconfig.backend_info.Adapters.size())
{ {
choice_adapter = choice_adapter =
CreateChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_desc)); CreateChoice(page_general, Config::GFX_ADAPTER, wxGetTranslation(adapter_desc));
for (const std::string& adapter : vconfig.backend_info.Adapters) for (const std::string& adapter : vconfig.backend_info.Adapters)
{ {
@ -450,7 +464,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
szr_display->Add(new wxStaticText(page_general, wxID_ANY, _("Aspect Ratio:")), 0, szr_display->Add(new wxStaticText(page_general, wxID_ANY, _("Aspect Ratio:")), 0,
wxALIGN_CENTER_VERTICAL); wxALIGN_CENTER_VERTICAL);
wxChoice* const choice_aspect = wxChoice* const choice_aspect =
CreateChoice(page_general, vconfig.iAspectRatio, wxGetTranslation(ar_desc), CreateChoice(page_general, Config::GFX_ASPECT_RATIO, wxGetTranslation(ar_desc),
sizeof(ar_choices) / sizeof(*ar_choices), ar_choices); sizeof(ar_choices) / sizeof(*ar_choices), ar_choices);
szr_display->Add(choice_aspect, 0, wxALIGN_CENTER_VERTICAL); szr_display->Add(choice_aspect, 0, wxALIGN_CENTER_VERTICAL);
} }
@ -458,10 +472,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
// various other display options // various other display options
{ {
szr_display->Add(CreateCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_desc), szr_display->Add(CreateCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_desc),
vconfig.bVSync)); Config::GFX_VSYNC));
szr_display->Add(CreateCheckBox(page_general, _("Use Fullscreen"), szr_display->Add(CreateCheckBoxRefBool(page_general, _("Use Fullscreen"),
wxGetTranslation(use_fullscreen_desc), wxGetTranslation(use_fullscreen_desc),
SConfig::GetInstance().bFullscreen)); SConfig::GetInstance().bFullscreen));
} }
} }
@ -470,35 +484,35 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
{ {
szr_other->Add(CreateCheckBox(page_general, _("Show FPS"), wxGetTranslation(show_fps_desc), szr_other->Add(CreateCheckBox(page_general, _("Show FPS"), wxGetTranslation(show_fps_desc),
vconfig.bShowFPS)); Config::GFX_SHOW_FPS));
szr_other->Add(CreateCheckBox(page_general, _("Show NetPlay Ping"), szr_other->Add(CreateCheckBox(page_general, _("Show NetPlay Ping"),
wxGetTranslation(show_netplay_ping_desc), wxGetTranslation(show_netplay_ping_desc),
vconfig.bShowNetPlayPing)); Config::GFX_SHOW_NETPLAY_PING));
szr_other->Add(CreateCheckBox(page_general, _("Log Render Time to File"), szr_other->Add(CreateCheckBox(page_general, _("Log Render Time to File"),
wxGetTranslation(log_render_time_to_file_desc), wxGetTranslation(log_render_time_to_file_desc),
vconfig.bLogRenderTimeToFile)); Config::GFX_LOG_RENDER_TIME_TO_FILE));
szr_other->Add(CreateCheckBox(page_general, _("Auto Adjust Window Size"), szr_other->Add(CreateCheckBoxRefBool(page_general, _("Auto Adjust Window Size"),
wxGetTranslation(auto_window_size_desc), wxGetTranslation(auto_window_size_desc),
SConfig::GetInstance().bRenderWindowAutoSize)); SConfig::GetInstance().bRenderWindowAutoSize));
szr_other->Add(CreateCheckBox(page_general, _("Show NetPlay Messages"), szr_other->Add(CreateCheckBox(page_general, _("Show NetPlay Messages"),
wxGetTranslation(show_netplay_messages_desc), wxGetTranslation(show_netplay_messages_desc),
vconfig.bShowNetPlayMessages)); Config::GFX_SHOW_NETPLAY_MESSAGES));
szr_other->Add(CreateCheckBox(page_general, _("Keep Window on Top"), szr_other->Add(CreateCheckBoxRefBool(page_general, _("Keep Window on Top"),
wxGetTranslation(keep_window_on_top_desc), wxGetTranslation(keep_window_on_top_desc),
SConfig::GetInstance().bKeepWindowOnTop)); SConfig::GetInstance().bKeepWindowOnTop));
szr_other->Add(CreateCheckBox(page_general, _("Hide Mouse Cursor"), szr_other->Add(CreateCheckBoxRefBool(page_general, _("Hide Mouse Cursor"),
wxGetTranslation(hide_mouse_cursor_desc), wxGetTranslation(hide_mouse_cursor_desc),
SConfig::GetInstance().bHideCursor)); SConfig::GetInstance().bHideCursor));
szr_other->Add(render_to_main_checkbox = szr_other->Add(render_to_main_checkbox =
CreateCheckBox(page_general, _("Render to Main Window"), CreateCheckBoxRefBool(page_general, _("Render to Main Window"),
wxGetTranslation(render_to_main_win_desc), wxGetTranslation(render_to_main_win_desc),
SConfig::GetInstance().bRenderToMain)); SConfig::GetInstance().bRenderToMain));
if (vconfig.backend_info.bSupportsMultithreading) if (vconfig.backend_info.bSupportsMultithreading)
{ {
szr_other->Add(CreateCheckBox(page_general, _("Enable Multi-threading"), szr_other->Add(CreateCheckBox(page_general, _("Enable Multi-threading"),
wxGetTranslation(backend_multithreading_desc), wxGetTranslation(backend_multithreading_desc),
vconfig.bBackendMultithreading)); Config::GFX_BACKEND_MULTITHREADING));
} }
} }
@ -559,7 +573,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
_("Custom")}; _("Custom")};
wxChoice* const choice_efbscale = CreateChoice( wxChoice* const choice_efbscale = CreateChoice(
page_enh, vconfig.iEFBScale, wxGetTranslation(internal_res_desc), page_enh, Config::GFX_EFB_SCALE, wxGetTranslation(internal_res_desc),
(vconfig.iEFBScale > 11) ? ArraySize(efbscale_choices) : ArraySize(efbscale_choices) - 1, (vconfig.iEFBScale > 11) ? ArraySize(efbscale_choices) : ArraySize(efbscale_choices) - 1,
efbscale_choices); efbscale_choices);
@ -590,8 +604,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
const std::array<wxString, 5> af_choices{{"1x", "2x", "4x", "8x", "16x"}}; const std::array<wxString, 5> af_choices{{"1x", "2x", "4x", "8x", "16x"}};
szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Anisotropic Filtering:")), szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Anisotropic Filtering:")),
wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
szr_enh->Add(CreateChoice(page_enh, vconfig.iMaxAnisotropy, wxGetTranslation(af_desc), szr_enh->Add(CreateChoice(page_enh, Config::GFX_ENHANCE_MAX_ANISOTROPY,
af_choices.size(), af_choices.data()), wxGetTranslation(af_desc), af_choices.size(), af_choices.data()),
wxGBPosition(row, 1), span2, wxALIGN_CENTER_VERTICAL); wxGBPosition(row, 1), span2, wxALIGN_CENTER_VERTICAL);
row += 1; row += 1;
} }
@ -623,18 +637,20 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
// Scaled copy, PL, Bilinear filter // Scaled copy, PL, Bilinear filter
wxGridSizer* const cb_szr = new wxGridSizer(2, space5, space5); wxGridSizer* const cb_szr = new wxGridSizer(2, space5, space5);
cb_szr->Add(CreateCheckBox(page_enh, _("Scaled EFB Copy"), cb_szr->Add(CreateCheckBox(page_enh, _("Scaled EFB Copy"),
wxGetTranslation(scaled_efb_copy_desc), vconfig.bCopyEFBScaled)); wxGetTranslation(scaled_efb_copy_desc),
Config::GFX_HACK_COPY_EFB_ENABLED));
cb_szr->Add(CreateCheckBox(page_enh, _("Per-Pixel Lighting"), cb_szr->Add(CreateCheckBox(page_enh, _("Per-Pixel Lighting"),
wxGetTranslation(pixel_lighting_desc), wxGetTranslation(pixel_lighting_desc),
vconfig.bEnablePixelLighting)); Config::GFX_ENABLE_PIXEL_LIGHTING));
cb_szr->Add(CreateCheckBox(page_enh, _("Force Texture Filtering"), cb_szr->Add(CreateCheckBox(page_enh, _("Force Texture Filtering"),
wxGetTranslation(force_filtering_desc), vconfig.bForceFiltering)); wxGetTranslation(force_filtering_desc),
Config::GFX_ENHANCE_FORCE_FILTERING));
cb_szr->Add(CreateCheckBox(page_enh, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), cb_szr->Add(CreateCheckBox(page_enh, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc),
vconfig.bWidescreenHack)); Config::GFX_WIDESCREEN_HACK));
cb_szr->Add(CreateCheckBox(page_enh, _("Disable Fog"), wxGetTranslation(disable_fog_desc), cb_szr->Add(CreateCheckBox(page_enh, _("Disable Fog"), wxGetTranslation(disable_fog_desc),
vconfig.bDisableFog)); Config::GFX_DISABLE_FOG));
cb_szr->Add(CreateCheckBox(page_enh, _("Force 24-bit Color"), wxGetTranslation(true_color_desc), cb_szr->Add(CreateCheckBox(page_enh, _("Force 24-bit Color"), wxGetTranslation(true_color_desc),
vconfig.bForceTrueColor)); Config::GFX_ENHANCE_FORCE_TRUE_COLOR));
szr_enh->Add(cb_szr, wxGBPosition(row, 0), wxGBSpan(1, 3)); szr_enh->Add(cb_szr, wxGBPosition(row, 0), wxGBSpan(1, 3));
row += 1; row += 1;
@ -659,7 +675,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
const wxString stereo_choices[] = {_("Off"), _("Side-by-Side"), _("Top-and-Bottom"), const wxString stereo_choices[] = {_("Off"), _("Side-by-Side"), _("Top-and-Bottom"),
_("Anaglyph"), _("Nvidia 3D Vision")}; _("Anaglyph"), _("Nvidia 3D Vision")};
wxChoice* stereo_choice = wxChoice* stereo_choice =
CreateChoice(page_enh, vconfig.iStereoMode, wxGetTranslation(stereo_3d_desc), CreateChoice(page_enh, Config::GFX_STEREO_MODE, wxGetTranslation(stereo_3d_desc),
vconfig.backend_info.bSupports3DVision ? ArraySize(stereo_choices) : vconfig.backend_info.bSupports3DVision ? ArraySize(stereo_choices) :
ArraySize(stereo_choices) - 1, ArraySize(stereo_choices) - 1,
stereo_choices); stereo_choices);
@ -687,7 +703,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
szr_stereo->Add(conv_slider); szr_stereo->Add(conv_slider);
szr_stereo->Add(CreateCheckBox(page_enh, _("Swap Eyes"), wxGetTranslation(stereo_swap_desc), szr_stereo->Add(CreateCheckBox(page_enh, _("Swap Eyes"), wxGetTranslation(stereo_swap_desc),
vconfig.bStereoSwapEyes)); Config::GFX_STEREO_SWAP_EYES));
wxStaticBoxSizer* const group_stereo = wxStaticBoxSizer* const group_stereo =
new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Stereoscopy")); new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Stereoscopy"));
@ -715,17 +731,18 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Embedded Frame Buffer (EFB)")); new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Embedded Frame Buffer (EFB)"));
szr_efb->Add(CreateCheckBox(page_hacks, _("Skip EFB Access from CPU"), szr_efb->Add(CreateCheckBox(page_hacks, _("Skip EFB Access from CPU"),
wxGetTranslation(efb_access_desc), vconfig.bEFBAccessEnable, true), wxGetTranslation(efb_access_desc),
Config::GFX_HACK_EFB_ACCESS_ENABLE, true),
0, wxLEFT | wxRIGHT, space5); 0, wxLEFT | wxRIGHT, space5);
szr_efb->AddSpacer(space5); szr_efb->AddSpacer(space5);
szr_efb->Add(CreateCheckBox(page_hacks, _("Ignore Format Changes"), szr_efb->Add(CreateCheckBox(page_hacks, _("Ignore Format Changes"),
wxGetTranslation(efb_emulate_format_changes_desc), wxGetTranslation(efb_emulate_format_changes_desc),
vconfig.bEFBEmulateFormatChanges, true), Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES, true),
0, wxLEFT | wxRIGHT, space5); 0, wxLEFT | wxRIGHT, space5);
szr_efb->AddSpacer(space5); szr_efb->AddSpacer(space5);
szr_efb->Add(CreateCheckBox(page_hacks, _("Store EFB Copies to Texture Only"), szr_efb->Add(CreateCheckBox(page_hacks, _("Store EFB Copies to Texture Only"),
wxGetTranslation(skip_efb_copy_to_ram_desc), wxGetTranslation(skip_efb_copy_to_ram_desc),
vconfig.bSkipEFBCopyToRam), Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM),
0, wxLEFT | wxRIGHT, space5); 0, wxLEFT | wxRIGHT, space5);
szr_efb->AddSpacer(space5); szr_efb->AddSpacer(space5);
@ -766,7 +783,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
{ {
szr_safetex->Add(CreateCheckBox(page_hacks, _("GPU Texture Decoding"), szr_safetex->Add(CreateCheckBox(page_hacks, _("GPU Texture Decoding"),
wxGetTranslation(gpu_texture_decoding_desc), wxGetTranslation(gpu_texture_decoding_desc),
vconfig.bEnableGPUTextureDecoding), Config::GFX_ENABLE_GPU_TEXTURE_DECODING),
1, wxEXPAND | wxLEFT | wxRIGHT, space5); 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
} }
@ -792,11 +809,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("External Frame Buffer (XFB)")); new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("External Frame Buffer (XFB)"));
SettingCheckBox* disable_xfb = CreateCheckBox( SettingCheckBox* disable_xfb = CreateCheckBox(
page_hacks, _("Disable"), wxGetTranslation(xfb_desc), vconfig.bUseXFB, true); page_hacks, _("Disable"), wxGetTranslation(xfb_desc), Config::GFX_USE_XFB, true);
virtual_xfb = CreateRadioButton(page_hacks, _("Virtual"), wxGetTranslation(xfb_virtual_desc), virtual_xfb = CreateRadioButton(page_hacks, _("Virtual"), wxGetTranslation(xfb_virtual_desc),
vconfig.bUseRealXFB, true, wxRB_GROUP); Config::GFX_USE_REAL_XFB, true, wxRB_GROUP);
real_xfb = CreateRadioButton(page_hacks, _("Real"), wxGetTranslation(xfb_real_desc), real_xfb = CreateRadioButton(page_hacks, _("Real"), wxGetTranslation(xfb_real_desc),
vconfig.bUseRealXFB); Config::GFX_USE_REAL_XFB);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
szr->Add(disable_xfb, 0, wxALIGN_CENTER_VERTICAL); szr->Add(disable_xfb, 0, wxALIGN_CENTER_VERTICAL);
@ -816,13 +833,13 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGridSizer* const szr_other = new wxGridSizer(2, space5, space5); wxGridSizer* const szr_other = new wxGridSizer(2, space5, space5);
szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"), szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"),
wxGetTranslation(fast_depth_calc_desc), wxGetTranslation(fast_depth_calc_desc),
vconfig.bFastDepthCalc)); Config::GFX_FAST_DEPTH_CALC));
szr_other->Add(CreateCheckBox(page_hacks, _("Disable Bounding Box"), szr_other->Add(CreateCheckBox(page_hacks, _("Disable Bounding Box"),
wxGetTranslation(disable_bbox_desc), vconfig.bBBoxEnable, wxGetTranslation(disable_bbox_desc),
true)); Config::GFX_HACK_BBOX_ENABLE, true));
vertex_rounding_checkbox = vertex_rounding_checkbox =
CreateCheckBox(page_hacks, _("Vertex Rounding"), wxGetTranslation(vertex_rounding_desc), CreateCheckBox(page_hacks, _("Vertex Rounding"), wxGetTranslation(vertex_rounding_desc),
vconfig.bVertexRounding); Config::GFX_HACK_VERTEX_ROUDING);
szr_other->Add(vertex_rounding_checkbox); szr_other->Add(vertex_rounding_checkbox);
wxStaticBoxSizer* const group_other = wxStaticBoxSizer* const group_other =
@ -851,14 +868,16 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGridSizer* const szr_debug = new wxGridSizer(2, space5, space5); wxGridSizer* const szr_debug = new wxGridSizer(2, space5, space5);
szr_debug->Add(CreateCheckBox(page_advanced, _("Enable Wireframe"), szr_debug->Add(CreateCheckBox(page_advanced, _("Enable Wireframe"),
wxGetTranslation(wireframe_desc), vconfig.bWireFrame)); wxGetTranslation(wireframe_desc),
Config::GFX_ENABLE_WIREFRAME));
szr_debug->Add(CreateCheckBox(page_advanced, _("Show Statistics"), szr_debug->Add(CreateCheckBox(page_advanced, _("Show Statistics"),
wxGetTranslation(show_stats_desc), vconfig.bOverlayStats)); wxGetTranslation(show_stats_desc), Config::GFX_OVERLAY_STATS));
szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"), szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"),
wxGetTranslation(texfmt_desc), vconfig.bTexFmtOverlayEnable)); wxGetTranslation(texfmt_desc),
Config::GFX_TEXFMT_OVERLAY_ENABLE));
szr_debug->Add(CreateCheckBox(page_advanced, _("Enable API Validation Layers"), szr_debug->Add(CreateCheckBox(page_advanced, _("Enable API Validation Layers"),
wxGetTranslation(validation_layer_desc), wxGetTranslation(validation_layer_desc),
vconfig.bEnableValidationLayer)); Config::GFX_ENABLE_VALIDATION_LAYER));
wxStaticBoxSizer* const group_debug = wxStaticBoxSizer* const group_debug =
new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Debugging")); new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Debugging"));
@ -874,29 +893,31 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGridSizer* const szr_utility = new wxGridSizer(2, space5, space5); wxGridSizer* const szr_utility = new wxGridSizer(2, space5, space5);
szr_utility->Add(CreateCheckBox(page_advanced, _("Dump Textures"), szr_utility->Add(CreateCheckBox(page_advanced, _("Dump Textures"),
wxGetTranslation(dump_textures_desc), vconfig.bDumpTextures)); wxGetTranslation(dump_textures_desc),
Config::GFX_DUMP_TEXTURES));
szr_utility->Add(CreateCheckBox(page_advanced, _("Load Custom Textures"), szr_utility->Add(CreateCheckBox(page_advanced, _("Load Custom Textures"),
wxGetTranslation(load_hires_textures_desc), wxGetTranslation(load_hires_textures_desc),
vconfig.bHiresTextures)); Config::GFX_HIRES_TEXTURES));
cache_hires_textures = cache_hires_textures = CreateCheckBox(page_advanced, _("Prefetch Custom Textures"),
CreateCheckBox(page_advanced, _("Prefetch Custom Textures"), wxGetTranslation(cache_hires_textures_desc),
wxGetTranslation(cache_hires_textures_desc), vconfig.bCacheHiresTextures); Config::GFX_CACHE_HIRES_TEXTURES);
szr_utility->Add(cache_hires_textures); szr_utility->Add(cache_hires_textures);
if (vconfig.backend_info.bSupportsInternalResolutionFrameDumps) if (vconfig.backend_info.bSupportsInternalResolutionFrameDumps)
{ {
szr_utility->Add(CreateCheckBox(page_advanced, _("Full Resolution Frame Dumps"), szr_utility->Add(CreateCheckBox(page_advanced, _("Full Resolution Frame Dumps"),
wxGetTranslation(internal_resolution_frame_dumping_desc), wxGetTranslation(internal_resolution_frame_dumping_desc),
vconfig.bInternalResolutionFrameDumps)); Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS));
} }
szr_utility->Add(CreateCheckBox(page_advanced, _("Dump EFB Target"), szr_utility->Add(CreateCheckBox(page_advanced, _("Dump EFB Target"),
wxGetTranslation(dump_efb_desc), vconfig.bDumpEFBTarget)); wxGetTranslation(dump_efb_desc),
Config::GFX_DUMP_EFB_TARGET));
szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"), szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"),
wxGetTranslation(free_look_desc), vconfig.bFreeLook)); wxGetTranslation(free_look_desc), Config::GFX_FREE_LOOK));
#if defined(HAVE_FFMPEG) #if defined(HAVE_FFMPEG)
szr_utility->Add(CreateCheckBox(page_advanced, _("Frame Dumps Use FFV1"), szr_utility->Add(CreateCheckBox(page_advanced, _("Frame Dumps Use FFV1"),
wxGetTranslation(use_ffv1_desc), vconfig.bUseFFV1)); wxGetTranslation(use_ffv1_desc), Config::GFX_USE_FFV1));
#endif #endif
wxStaticBoxSizer* const group_utility = wxStaticBoxSizer* const group_utility =
@ -913,7 +934,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGridSizer* const szr_misc = new wxGridSizer(2, space5, space5); wxGridSizer* const szr_misc = new wxGridSizer(2, space5, space5);
szr_misc->Add( szr_misc->Add(
CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop)); CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), Config::GFX_CROP));
// Progressive Scan // Progressive Scan
{ {
@ -931,7 +952,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
// Borderless Fullscreen // Borderless Fullscreen
borderless_fullscreen = CreateCheckBox(page_advanced, _("Borderless Fullscreen"), borderless_fullscreen = CreateCheckBox(page_advanced, _("Borderless Fullscreen"),
wxGetTranslation(borderless_fullscreen_desc), wxGetTranslation(borderless_fullscreen_desc),
vconfig.bBorderlessFullscreen); Config::GFX_BORDERLESS_FULLSCREEN);
szr_misc->Add(borderless_fullscreen); szr_misc->Add(borderless_fullscreen);
#endif #endif
@ -1040,7 +1061,7 @@ void VideoConfigDiag::Event_ProgressiveScan(wxCommandEvent& ev)
void VideoConfigDiag::Event_SafeTextureCache(wxCommandEvent& ev) void VideoConfigDiag::Event_SafeTextureCache(wxCommandEvent& ev)
{ {
int samples[] = {0, 512, 128}; int samples[] = {0, 512, 128};
vconfig.iSafeTextureCache_ColorSamples = samples[ev.GetInt()]; Config::SetBaseOrCurrent(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES, samples[ev.GetInt()]);
ev.Skip(); ev.Skip();
} }
@ -1048,14 +1069,12 @@ void VideoConfigDiag::Event_SafeTextureCache(wxCommandEvent& ev)
void VideoConfigDiag::Event_PPShader(wxCommandEvent& ev) void VideoConfigDiag::Event_PPShader(wxCommandEvent& ev)
{ {
const int sel = ev.GetInt(); const int sel = ev.GetInt();
if (sel) std::string shader = sel ? WxStrToStr(ev.GetString()) : "";
vconfig.sPostProcessingShader = WxStrToStr(ev.GetString()); Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER, shader);
else
vconfig.sPostProcessingShader.clear();
// Should we enable the configuration button? // Should we enable the configuration button?
PostProcessingShaderConfiguration postprocessing_shader; PostProcessingShaderConfiguration postprocessing_shader;
postprocessing_shader.LoadShader(vconfig.sPostProcessingShader); postprocessing_shader.LoadShader(shader);
button_config_pp->Enable(postprocessing_shader.HasOptions()); button_config_pp->Enable(postprocessing_shader.HasOptions());
ev.Skip(); ev.Skip();
@ -1071,7 +1090,7 @@ void VideoConfigDiag::Event_ConfigurePPShader(wxCommandEvent& ev)
void VideoConfigDiag::Event_StereoDepth(wxCommandEvent& ev) void VideoConfigDiag::Event_StereoDepth(wxCommandEvent& ev)
{ {
vconfig.iStereoDepth = ev.GetInt(); Config::SetBaseOrCurrent(Config::GFX_STEREO_DEPTH, ev.GetInt());
ev.Skip(); ev.Skip();
} }
@ -1083,7 +1102,7 @@ void VideoConfigDiag::Event_StereoConvergence(wxCommandEvent& ev)
if (90 < value && value < 110) if (90 < value && value < 110)
conv_slider->SetValue(100); conv_slider->SetValue(100);
vconfig.iStereoConvergencePercentage = conv_slider->GetValue(); Config::SetBaseOrCurrent(Config::GFX_STEREO_CONVERGENCE_PERCENTAGE, conv_slider->GetValue());
ev.Skip(); ev.Skip();
} }
@ -1101,7 +1120,7 @@ void VideoConfigDiag::Event_StereoMode(wxCommandEvent& ev)
void VideoConfigDiag::Event_Close(wxCommandEvent& ev) void VideoConfigDiag::Event_Close(wxCommandEvent& ev)
{ {
g_Config.Save(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"); Config::Save();
ev.Skip(); ev.Skip();
} }
@ -1153,7 +1172,8 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
} }
SettingCheckBox* VideoConfigDiag::CreateCheckBox(wxWindow* parent, const wxString& label, SettingCheckBox* VideoConfigDiag::CreateCheckBox(wxWindow* parent, const wxString& label,
const wxString& description, bool& setting, const wxString& description,
const Config::ConfigInfo<bool>& setting,
bool reverse, long style) bool reverse, long style)
{ {
SettingCheckBox* const cb = SettingCheckBox* const cb =
@ -1162,7 +1182,18 @@ SettingCheckBox* VideoConfigDiag::CreateCheckBox(wxWindow* parent, const wxStrin
return cb; return cb;
} }
SettingChoice* VideoConfigDiag::CreateChoice(wxWindow* parent, int& setting, RefBoolSetting<wxCheckBox>* VideoConfigDiag::CreateCheckBoxRefBool(wxWindow* parent,
const wxString& label,
const wxString& description,
bool& setting)
{
auto* const cb = new RefBoolSetting<wxCheckBox>(parent, label, wxString(), setting, false, 0);
RegisterControl(cb, description);
return cb;
}
SettingChoice* VideoConfigDiag::CreateChoice(wxWindow* parent,
const Config::ConfigInfo<int>& setting,
const wxString& description, int num, const wxString& description, int num,
const wxString choices[], long style) const wxString choices[], long style)
{ {
@ -1172,7 +1203,8 @@ SettingChoice* VideoConfigDiag::CreateChoice(wxWindow* parent, int& setting,
} }
SettingRadioButton* VideoConfigDiag::CreateRadioButton(wxWindow* parent, const wxString& label, SettingRadioButton* VideoConfigDiag::CreateRadioButton(wxWindow* parent, const wxString& label,
const wxString& description, bool& setting, const wxString& description,
const Config::ConfigInfo<bool>& setting,
bool reverse, long style) bool reverse, long style)
{ {
SettingRadioButton* const rb = SettingRadioButton* const rb =
@ -1275,11 +1307,11 @@ void VideoConfigDiag::PopulatePostProcessingShaders()
if (vconfig.iStereoMode == STEREO_ANAGLYPH) if (vconfig.iStereoMode == STEREO_ANAGLYPH)
{ {
vconfig.sPostProcessingShader = "dubois"; Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string("dubois"));
choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader)); choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader));
} }
else else
vconfig.sPostProcessingShader.clear(); Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
} }
// Should the configuration button be loaded by default? // Should the configuration button be loaded by default?
@ -1335,11 +1367,11 @@ void VideoConfigDiag::OnAAChanged(wxCommandEvent& ev)
size_t mode = ev.GetInt(); size_t mode = ev.GetInt();
ev.Skip(); ev.Skip();
vconfig.bSSAA = mode > m_msaa_modes; Config::SetBaseOrCurrent(Config::GFX_SSAA, mode > m_msaa_modes);
mode -= vconfig.bSSAA * m_msaa_modes; mode -= vconfig.bSSAA * m_msaa_modes;
if (mode >= vconfig.backend_info.AAModes.size()) if (mode >= vconfig.backend_info.AAModes.size())
return; return;
vconfig.iMultisamples = vconfig.backend_info.AAModes[mode]; Config::SetBaseOrCurrent(Config::GFX_MSAA, vconfig.backend_info.AAModes[mode]);
} }

View File

@ -18,6 +18,7 @@
#include <wx/stattext.h> #include <wx/stattext.h>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/Config/GraphicsSettings.h"
class DolphinSlider; class DolphinSlider;
struct VideoConfig; struct VideoConfig;
@ -30,12 +31,30 @@ template <typename W>
class BoolSetting : public W class BoolSetting : public W
{ {
public: public:
BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool& setting, BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip,
bool reverse = false, long style = 0); const Config::ConfigInfo<bool>& setting, bool reverse = false, long style = 0);
void UpdateValue(wxCommandEvent& ev) void UpdateValue(wxCommandEvent& ev)
{ {
m_setting = (ev.GetInt() != 0) ^ m_reverse; Config::SetBaseOrCurrent(m_setting, (ev.GetInt() != 0) != m_reverse);
ev.Skip();
}
private:
Config::ConfigInfo<bool> m_setting;
const bool m_reverse;
};
template <typename W>
class RefBoolSetting : public W
{
public:
RefBoolSetting(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(); ev.Skip();
} }
@ -47,32 +66,31 @@ private:
typedef BoolSetting<wxCheckBox> SettingCheckBox; typedef BoolSetting<wxCheckBox> SettingCheckBox;
typedef BoolSetting<wxRadioButton> SettingRadioButton; typedef BoolSetting<wxRadioButton> SettingRadioButton;
template <typename T>
class IntegerSetting : public wxSpinCtrl class IntegerSetting : public wxSpinCtrl
{ {
public: public:
IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, IntegerSetting(wxWindow* parent, const wxString& label, const Config::ConfigInfo<int>& setting,
long style = 0); int minVal, int maxVal, long style = 0);
void UpdateValue(wxCommandEvent& ev) void UpdateValue(wxCommandEvent& ev)
{ {
m_setting = ev.GetInt(); Config::SetBaseOrCurrent(m_setting, ev.GetInt());
ev.Skip(); ev.Skip();
} }
private: private:
T& m_setting; Config::ConfigInfo<int> m_setting;
}; };
class SettingChoice : public wxChoice class SettingChoice : public wxChoice
{ {
public: public:
SettingChoice(wxWindow* parent, int& setting, const wxString& tooltip, int num = 0, SettingChoice(wxWindow* parent, const Config::ConfigInfo<int>& setting, const wxString& tooltip,
const wxString choices[] = nullptr, long style = 0); int num = 0, const wxString choices[] = nullptr, long style = 0);
void UpdateValue(wxCommandEvent& ev); void UpdateValue(wxCommandEvent& ev);
private: private:
int& m_setting; Config::ConfigInfo<int> m_setting;
}; };
class VideoConfigDiag : public wxDialog class VideoConfigDiag : public wxDialog
@ -100,12 +118,17 @@ protected:
// Creates controls and connects their enter/leave window events to Evt_Enter/LeaveControl // Creates controls and connects their enter/leave window events to Evt_Enter/LeaveControl
SettingCheckBox* CreateCheckBox(wxWindow* parent, const wxString& label, SettingCheckBox* CreateCheckBox(wxWindow* parent, const wxString& label,
const wxString& description, bool& setting, bool reverse = false, const wxString& description,
const Config::ConfigInfo<bool>& setting, bool reverse = false,
long style = 0); long style = 0);
SettingChoice* CreateChoice(wxWindow* parent, int& setting, const wxString& description, RefBoolSetting<wxCheckBox>* CreateCheckBoxRefBool(wxWindow* parent, const wxString& label,
int num = 0, const wxString choices[] = nullptr, long style = 0); const wxString& description, bool& setting);
SettingChoice* CreateChoice(wxWindow* parent, const Config::ConfigInfo<int>& setting,
const wxString& description, int num = 0,
const wxString choices[] = nullptr, long style = 0);
SettingRadioButton* CreateRadioButton(wxWindow* parent, const wxString& label, SettingRadioButton* CreateRadioButton(wxWindow* parent, const wxString& label,
const wxString& description, bool& setting, const wxString& description,
const Config::ConfigInfo<bool>& setting,
bool reverse = false, long style = 0); bool reverse = false, long style = 0);
// Same as above but only connects enter/leave window events // Same as above but only connects enter/leave window events
@ -134,7 +157,7 @@ protected:
wxButton* button_config_pp; wxButton* button_config_pp;
SettingCheckBox* borderless_fullscreen; SettingCheckBox* borderless_fullscreen;
SettingCheckBox* render_to_main_checkbox; RefBoolSetting<wxCheckBox>* render_to_main_checkbox;
SettingRadioButton* virtual_xfb; SettingRadioButton* virtual_xfb;
SettingRadioButton* real_xfb; SettingRadioButton* real_xfb;

View File

@ -8,6 +8,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "VideoBackends/D3D/D3DBase.h" #include "VideoBackends/D3D/D3DBase.h"
#include "VideoBackends/D3D/D3DState.h" #include "VideoBackends/D3D/D3DState.h"
@ -319,7 +320,7 @@ HRESULT Create(HWND wnd)
return desc.Count == g_Config.iMultisamples; return desc.Count == g_Config.iMultisamples;
}) == aa_modes.end()) }) == aa_modes.end())
{ {
g_Config.iMultisamples = 1; Config::SetCurrent(Config::GFX_MSAA, 1);
UpdateActiveConfig(); UpdateActiveConfig();
} }

View File

@ -9,6 +9,8 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/GraphicsSettings.h"
#include "VideoBackends/OGL/FramebufferManager.h" #include "VideoBackends/OGL/FramebufferManager.h"
#include "VideoBackends/OGL/ProgramShaderCache.h" #include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoBackends/OGL/SamplerCache.h" #include "VideoBackends/OGL/SamplerCache.h"
@ -139,7 +141,7 @@ void OpenGLPostProcessing::ApplyShader()
if (!ProgramShaderCache::CompileShader(m_shader, s_vertex_shader, code)) if (!ProgramShaderCache::CompileShader(m_shader, s_vertex_shader, code))
{ {
ERROR_LOG(VIDEO, "Failed to compile post-processing shader %s", m_config.GetShader().c_str()); ERROR_LOG(VIDEO, "Failed to compile post-processing shader %s", m_config.GetShader().c_str());
g_ActiveConfig.sPostProcessingShader.clear(); Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
code = m_config.LoadShader(); code = m_config.LoadShader();
ProgramShaderCache::CompileShader(m_shader, s_vertex_shader, code); ProgramShaderCache::CompileShader(m_shader, s_vertex_shader, code);
} }

View File

@ -23,6 +23,7 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "VideoBackends/OGL/BoundingBox.h" #include "VideoBackends/OGL/BoundingBox.h"
@ -518,7 +519,7 @@ Renderer::Renderer()
{ {
// GLES 3.1 can't support stereo rendering and MSAA // GLES 3.1 can't support stereo rendering and MSAA
OSD::AddMessage("MSAA Stereo rendering isn't supported by your GPU.", 10000); OSD::AddMessage("MSAA Stereo rendering isn't supported by your GPU.", 10000);
g_ActiveConfig.iMultisamples = 1; Config::SetCurrent(Config::GFX_MSAA, 1);
} }
} }
else else

View File

@ -12,6 +12,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "VideoBackends/Software/EfbCopy.h" #include "VideoBackends/Software/EfbCopy.h"
@ -142,7 +143,9 @@ void SWRenderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
// virtual XFB is not supported // virtual XFB is not supported
if (g_ActiveConfig.bUseXFB) if (g_ActiveConfig.bUseXFB)
g_ActiveConfig.bUseRealXFB = true; {
Config::SetCurrent(Config::GFX_USE_REAL_XFB, true);
}
} }
u32 SWRenderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData) u32 SWRenderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)

View File

@ -27,6 +27,7 @@
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
@ -196,7 +197,7 @@ void HiresTexture::Prefetch()
if (size_sum > max_mem) if (size_sum > max_mem)
{ {
g_Config.bCacheHiresTextures = false; Config::SetCurrent(Config::GFX_HIRES_TEXTURES, false);
OSD::AddMessage( OSD::AddMessage(
StringFromFormat( StringFromFormat(

View File

@ -190,8 +190,7 @@ void VideoBackendBase::InitializeShared()
GeometryShaderManager::Init(); GeometryShaderManager::Init();
PixelShaderManager::Init(); PixelShaderManager::Init();
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini"); g_Config.Refresh();
g_Config.GameIniLoad();
g_Config.UpdateProjectionHack(); g_Config.UpdateProjectionHack();
g_Config.VerifyValidity(); g_Config.VerifyValidity();
UpdateActiveConfig(); UpdateActiveConfig();

View File

@ -10,6 +10,7 @@
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/Movie.h" #include "Core/Movie.h"
@ -19,6 +20,7 @@
VideoConfig g_Config; VideoConfig g_Config;
VideoConfig g_ActiveConfig; VideoConfig g_ActiveConfig;
static bool s_has_registered_callback = false;
void UpdateActiveConfig() void UpdateActiveConfig()
{ {
@ -47,92 +49,118 @@ VideoConfig::VideoConfig()
bBackendMultithreading = true; bBackendMultithreading = true;
} }
void VideoConfig::Load(const std::string& ini_file) void VideoConfig::Refresh()
{ {
IniFile iniFile; if (!s_has_registered_callback)
iniFile.Load(ini_file); {
Config::AddConfigChangedCallback([]() { g_Config.Refresh(); });
s_has_registered_callback = true;
}
IniFile::Section* hardware = iniFile.GetOrCreateSection("Hardware"); bVSync = Config::Get(Config::GFX_VSYNC);
hardware->Get("VSync", &bVSync, false); iAdapter = Config::Get(Config::GFX_ADAPTER);
hardware->Get("Adapter", &iAdapter, 0);
IniFile::Section* settings = iniFile.GetOrCreateSection("Settings"); bWidescreenHack = Config::Get(Config::GFX_WIDESCREEN_HACK);
settings->Get("wideScreenHack", &bWidescreenHack, false); iAspectRatio = Config::Get(Config::GFX_ASPECT_RATIO);
settings->Get("AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); bCrop = Config::Get(Config::GFX_CROP);
settings->Get("Crop", &bCrop, false); bUseXFB = Config::Get(Config::GFX_USE_XFB);
settings->Get("UseXFB", &bUseXFB, false); bUseRealXFB = Config::Get(Config::GFX_USE_REAL_XFB);
settings->Get("UseRealXFB", &bUseRealXFB, false); iSafeTextureCache_ColorSamples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 128); bShowFPS = Config::Get(Config::GFX_SHOW_FPS);
settings->Get("ShowFPS", &bShowFPS, false); bShowNetPlayPing = Config::Get(Config::GFX_SHOW_NETPLAY_PING);
settings->Get("ShowNetPlayPing", &bShowNetPlayPing, false); bShowNetPlayMessages = Config::Get(Config::GFX_SHOW_NETPLAY_MESSAGES);
settings->Get("ShowNetPlayMessages", &bShowNetPlayMessages, false); bLogRenderTimeToFile = Config::Get(Config::GFX_LOG_RENDER_TIME_TO_FILE);
settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false); bOverlayStats = Config::Get(Config::GFX_OVERLAY_STATS);
settings->Get("OverlayStats", &bOverlayStats, false); bOverlayProjStats = Config::Get(Config::GFX_OVERLAY_PROJ_STATS);
settings->Get("OverlayProjStats", &bOverlayProjStats, false); bDumpTextures = Config::Get(Config::GFX_DUMP_TEXTURES);
settings->Get("DumpTextures", &bDumpTextures, false); bHiresTextures = Config::Get(Config::GFX_HIRES_TEXTURES);
settings->Get("HiresTextures", &bHiresTextures, false); bConvertHiresTextures = Config::Get(Config::GFX_CONVERT_HIRES_TEXTURES);
settings->Get("ConvertHiresTextures", &bConvertHiresTextures, false); bCacheHiresTextures = Config::Get(Config::GFX_CACHE_HIRES_TEXTURES);
settings->Get("CacheHiresTextures", &bCacheHiresTextures, false); bDumpEFBTarget = Config::Get(Config::GFX_DUMP_EFB_TARGET);
settings->Get("DumpEFBTarget", &bDumpEFBTarget, false); bDumpFramesAsImages = Config::Get(Config::GFX_DUMP_FRAMES_AS_IMAGES);
settings->Get("DumpFramesAsImages", &bDumpFramesAsImages, false); bFreeLook = Config::Get(Config::GFX_FREE_LOOK);
settings->Get("FreeLook", &bFreeLook, false); bUseFFV1 = Config::Get(Config::GFX_USE_FFV1);
settings->Get("UseFFV1", &bUseFFV1, false); sDumpFormat = Config::Get(Config::GFX_DUMP_FORMAT);
settings->Get("DumpFormat", &sDumpFormat, "avi"); sDumpCodec = Config::Get(Config::GFX_DUMP_CODEC);
settings->Get("DumpCodec", &sDumpCodec, ""); sDumpPath = Config::Get(Config::GFX_DUMP_PATH);
settings->Get("DumpPath", &sDumpPath, ""); iBitrateKbps = Config::Get(Config::GFX_BITRATE_KBPS);
settings->Get("BitrateKbps", &iBitrateKbps, 2500); bInternalResolutionFrameDumps = Config::Get(Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS);
settings->Get("InternalResolutionFrameDumps", &bInternalResolutionFrameDumps, false); bEnableGPUTextureDecoding = Config::Get(Config::GFX_ENABLE_GPU_TEXTURE_DECODING);
settings->Get("EnableGPUTextureDecoding", &bEnableGPUTextureDecoding, false); bEnablePixelLighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING);
settings->Get("EnablePixelLighting", &bEnablePixelLighting, false); bFastDepthCalc = Config::Get(Config::GFX_FAST_DEPTH_CALC);
settings->Get("FastDepthCalc", &bFastDepthCalc, true); iMultisamples = Config::Get(Config::GFX_MSAA);
settings->Get("MSAA", &iMultisamples, 1); bSSAA = Config::Get(Config::GFX_SSAA);
settings->Get("SSAA", &bSSAA, false); iEFBScale = Config::Get(Config::GFX_EFB_SCALE);
settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native bTexFmtOverlayEnable = Config::Get(Config::GFX_TEXFMT_OVERLAY_ENABLE);
settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, false); bTexFmtOverlayCenter = Config::Get(Config::GFX_TEXFMT_OVERLAY_CENTER);
settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, false); bWireFrame = Config::Get(Config::GFX_ENABLE_WIREFRAME);
settings->Get("WireFrame", &bWireFrame, false); bDisableFog = Config::Get(Config::GFX_DISABLE_FOG);
settings->Get("DisableFog", &bDisableFog, false); bBorderlessFullscreen = Config::Get(Config::GFX_BORDERLESS_FULLSCREEN);
settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false); bEnableValidationLayer = Config::Get(Config::GFX_ENABLE_VALIDATION_LAYER);
settings->Get("EnableValidationLayer", &bEnableValidationLayer, false); bBackendMultithreading = Config::Get(Config::GFX_BACKEND_MULTITHREADING);
settings->Get("BackendMultithreading", &bBackendMultithreading, true); iCommandBufferExecuteInterval = Config::Get(Config::GFX_COMMAND_BUFFER_EXECUTE_INTERVAL);
settings->Get("CommandBufferExecuteInterval", &iCommandBufferExecuteInterval, 100); bShaderCache = Config::Get(Config::GFX_SHADER_CACHE);
settings->Get("ShaderCache", &bShaderCache, true);
settings->Get("SWZComploc", &bZComploc, true); bZComploc = Config::Get(Config::GFX_SW_ZCOMPLOC);
settings->Get("SWZFreeze", &bZFreeze, true); bZFreeze = Config::Get(Config::GFX_SW_ZFREEZE);
settings->Get("SWDumpObjects", &bDumpObjects, false); bDumpObjects = Config::Get(Config::GFX_SW_DUMP_OBJECTS);
settings->Get("SWDumpTevStages", &bDumpTevStages, false); bDumpTevStages = Config::Get(Config::GFX_SW_DUMP_TEV_STAGES);
settings->Get("SWDumpTevTexFetches", &bDumpTevTextureFetches, false); bDumpTevTextureFetches = Config::Get(Config::GFX_SW_DUMP_TEV_TEX_FETCHES);
settings->Get("SWDrawStart", &drawStart, 0); drawStart = Config::Get(Config::GFX_SW_DRAW_START);
settings->Get("SWDrawEnd", &drawEnd, 100000); drawEnd = Config::Get(Config::GFX_SW_DRAW_END);
IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements"); bForceFiltering = Config::Get(Config::GFX_ENHANCE_FORCE_FILTERING);
enhancements->Get("ForceFiltering", &bForceFiltering, false); iMaxAnisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
enhancements->Get("MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x) sPostProcessingShader = Config::Get(Config::GFX_ENHANCE_POST_SHADER);
enhancements->Get("PostProcessingShader", &sPostProcessingShader, ""); bForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR);
enhancements->Get("ForceTrueColor", &bForceTrueColor, true);
IniFile::Section* stereoscopy = iniFile.GetOrCreateSection("Stereoscopy"); iStereoMode = Config::Get(Config::GFX_STEREO_MODE);
stereoscopy->Get("StereoMode", &iStereoMode, 0); iStereoDepth = Config::Get(Config::GFX_STEREO_DEPTH);
stereoscopy->Get("StereoDepth", &iStereoDepth, 20); iStereoConvergencePercentage = Config::Get(Config::GFX_STEREO_CONVERGENCE_PERCENTAGE);
stereoscopy->Get("StereoConvergencePercentage", &iStereoConvergencePercentage, 100); bStereoSwapEyes = Config::Get(Config::GFX_STEREO_SWAP_EYES);
stereoscopy->Get("StereoSwapEyes", &bStereoSwapEyes, false); iStereoConvergence = Config::Get(Config::GFX_STEREO_CONVERGENCE);
bStereoEFBMonoDepth = Config::Get(Config::GFX_STEREO_EFB_MONO_DEPTH);
iStereoDepthPercentage = Config::Get(Config::GFX_STEREO_DEPTH_PERCENTAGE);
IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks"); bEFBAccessEnable = Config::Get(Config::GFX_HACK_EFB_ACCESS_ENABLE);
hacks->Get("EFBAccessEnable", &bEFBAccessEnable, true); bBBoxEnable = Config::Get(Config::GFX_HACK_BBOX_ENABLE);
hacks->Get("BBoxEnable", &bBBoxEnable, false); bBBoxPreferStencilImplementation =
hacks->Get("BBoxPreferStencilImplementation", &bBBoxPreferStencilImplementation, false); Config::Get(Config::GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION);
hacks->Get("ForceProgressive", &bForceProgressive, true); bForceProgressive = Config::Get(Config::GFX_HACK_FORCE_PROGRESSIVE);
hacks->Get("EFBToTextureEnable", &bSkipEFBCopyToRam, true); bSkipEFBCopyToRam = Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true); bCopyEFBScaled = Config::Get(Config::GFX_HACK_COPY_EFB_ENABLED);
hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false); bEFBEmulateFormatChanges = Config::Get(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES);
hacks->Get("VertexRounding", &bVertexRounding, false); bVertexRounding = Config::Get(Config::GFX_HACK_VERTEX_ROUDING);
// hacks which are disabled by default iPhackvalue[0] = Config::Get(Config::GFX_PROJECTION_HACK);
iPhackvalue[0] = 0; iPhackvalue[1] = Config::Get(Config::GFX_PROJECTION_HACK_SZNEAR);
bPerfQueriesEnable = false; iPhackvalue[2] = Config::Get(Config::GFX_PROJECTION_HACK_SZFAR);
sPhackvalue[0] = Config::Get(Config::GFX_PROJECTION_HACK_ZNEAR);
sPhackvalue[1] = Config::Get(Config::GFX_PROJECTION_HACK_ZFAR);
bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE);
if (iEFBScale == SCALE_FORCE_INTEGRAL)
{
// Round down to multiple of native IR
switch (Config::GetBase(Config::GFX_EFB_SCALE))
{
case SCALE_AUTO:
iEFBScale = SCALE_AUTO_INTEGRAL;
break;
case SCALE_1_5X:
iEFBScale = SCALE_1X;
break;
case SCALE_2_5X:
iEFBScale = SCALE_2X;
break;
default:
iEFBScale = Config::GetBase(Config::GFX_EFB_SCALE);
break;
}
}
// Load common settings // Load common settings
IniFile iniFile;
iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile::Section* interface = iniFile.GetOrCreateSection("Interface"); IniFile::Section* interface = iniFile.GetOrCreateSection("Interface");
bool bTmp; bool bTmp;
@ -142,109 +170,6 @@ void VideoConfig::Load(const std::string& ini_file)
VerifyValidity(); VerifyValidity();
} }
void VideoConfig::GameIniLoad()
{
bool gfx_override_exists = false;
// XXX: Again, bad place to put OSD messages at (see delroth's comment above)
// XXX: This will add an OSD message for each projection hack value... meh
#define CHECK_SETTING(section, key, var) \
do \
{ \
decltype(var) temp = var; \
if (iniFile.GetIfExists(section, key, &var) && var != temp) \
{ \
std::string msg = StringFromFormat("Note: Option \"%s\" is overridden by game ini.", key); \
OSD::AddMessage(msg, 7500); \
gfx_override_exists = true; \
} \
} while (0)
IniFile iniFile = SConfig::GetInstance().LoadGameIni();
CHECK_SETTING("Video_Hardware", "VSync", bVSync);
CHECK_SETTING("Video_Settings", "wideScreenHack", bWidescreenHack);
CHECK_SETTING("Video_Settings", "AspectRatio", iAspectRatio);
CHECK_SETTING("Video_Settings", "Crop", bCrop);
CHECK_SETTING("Video_Settings", "UseXFB", bUseXFB);
CHECK_SETTING("Video_Settings", "UseRealXFB", bUseRealXFB);
CHECK_SETTING("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
CHECK_SETTING("Video_Settings", "HiresTextures", bHiresTextures);
CHECK_SETTING("Video_Settings", "ConvertHiresTextures", bConvertHiresTextures);
CHECK_SETTING("Video_Settings", "CacheHiresTextures", bCacheHiresTextures);
CHECK_SETTING("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
CHECK_SETTING("Video_Settings", "FastDepthCalc", bFastDepthCalc);
CHECK_SETTING("Video_Settings", "MSAA", iMultisamples);
CHECK_SETTING("Video_Settings", "SSAA", bSSAA);
CHECK_SETTING("Video_Settings", "ForceTrueColor", bForceTrueColor);
int tmp = -9000;
CHECK_SETTING("Video_Settings", "EFBScale", tmp); // integral
if (tmp != -9000)
{
if (tmp != SCALE_FORCE_INTEGRAL)
{
iEFBScale = tmp;
}
else // Round down to multiple of native IR
{
switch (iEFBScale)
{
case SCALE_AUTO:
iEFBScale = SCALE_AUTO_INTEGRAL;
break;
case SCALE_1_5X:
iEFBScale = SCALE_1X;
break;
case SCALE_2_5X:
iEFBScale = SCALE_2X;
break;
default:
break;
}
}
}
CHECK_SETTING("Video_Settings", "DisableFog", bDisableFog);
CHECK_SETTING("Video_Settings", "BackendMultithreading", bBackendMultithreading);
CHECK_SETTING("Video_Settings", "CommandBufferExecuteInterval", iCommandBufferExecuteInterval);
CHECK_SETTING("Video_Enhancements", "ForceFiltering", bForceFiltering);
CHECK_SETTING("Video_Enhancements", "MaxAnisotropy",
iMaxAnisotropy); // NOTE - this is x in (1 << x)
CHECK_SETTING("Video_Enhancements", "PostProcessingShader", sPostProcessingShader);
// These are not overrides, they are per-game stereoscopy parameters, hence no warning
iniFile.GetIfExists("Video_Stereoscopy", "StereoConvergence", &iStereoConvergence, 20);
iniFile.GetIfExists("Video_Stereoscopy", "StereoEFBMonoDepth", &bStereoEFBMonoDepth, false);
iniFile.GetIfExists("Video_Stereoscopy", "StereoDepthPercentage", &iStereoDepthPercentage, 100);
CHECK_SETTING("Video_Stereoscopy", "StereoMode", iStereoMode);
CHECK_SETTING("Video_Stereoscopy", "StereoDepth", iStereoDepth);
CHECK_SETTING("Video_Stereoscopy", "StereoSwapEyes", bStereoSwapEyes);
CHECK_SETTING("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable);
CHECK_SETTING("Video_Hacks", "BBoxEnable", bBBoxEnable);
CHECK_SETTING("Video_Hacks", "ForceProgressive", bForceProgressive);
CHECK_SETTING("Video_Hacks", "EFBToTextureEnable", bSkipEFBCopyToRam);
CHECK_SETTING("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled);
CHECK_SETTING("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
CHECK_SETTING("Video_Hacks", "VertexRounding", bVertexRounding);
CHECK_SETTING("Video", "ProjectionHack", iPhackvalue[0]);
CHECK_SETTING("Video", "PH_SZNear", iPhackvalue[1]);
CHECK_SETTING("Video", "PH_SZFar", iPhackvalue[2]);
CHECK_SETTING("Video", "PH_ZNear", sPhackvalue[0]);
CHECK_SETTING("Video", "PH_ZFar", sPhackvalue[1]);
CHECK_SETTING("Video", "PerfQueriesEnable", bPerfQueriesEnable);
if (gfx_override_exists)
OSD::AddMessage(
"Warning: Opening the graphics configuration will reset settings and might cause issues!",
10000);
}
void VideoConfig::VerifyValidity() void VideoConfig::VerifyValidity()
{ {
// TODO: Check iMaxAnisotropy value // TODO: Check iMaxAnisotropy value
@ -274,90 +199,6 @@ void VideoConfig::VerifyValidity()
} }
} }
void VideoConfig::Save(const std::string& ini_file)
{
IniFile iniFile;
iniFile.Load(ini_file);
IniFile::Section* hardware = iniFile.GetOrCreateSection("Hardware");
hardware->Set("VSync", bVSync);
hardware->Set("Adapter", iAdapter);
IniFile::Section* settings = iniFile.GetOrCreateSection("Settings");
settings->Set("AspectRatio", iAspectRatio);
settings->Set("Crop", bCrop);
settings->Set("wideScreenHack", bWidescreenHack);
settings->Set("UseXFB", bUseXFB);
settings->Set("UseRealXFB", bUseRealXFB);
settings->Set("SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
settings->Set("ShowFPS", bShowFPS);
settings->Set("ShowNetPlayPing", bShowNetPlayPing);
settings->Set("ShowNetPlayMessages", bShowNetPlayMessages);
settings->Set("LogRenderTimeToFile", bLogRenderTimeToFile);
settings->Set("OverlayStats", bOverlayStats);
settings->Set("OverlayProjStats", bOverlayProjStats);
settings->Set("DumpTextures", bDumpTextures);
settings->Set("HiresTextures", bHiresTextures);
settings->Set("ConvertHiresTextures", bConvertHiresTextures);
settings->Set("CacheHiresTextures", bCacheHiresTextures);
settings->Set("DumpEFBTarget", bDumpEFBTarget);
settings->Set("DumpFramesAsImages", bDumpFramesAsImages);
settings->Set("FreeLook", bFreeLook);
settings->Set("UseFFV1", bUseFFV1);
settings->Set("DumpFormat", sDumpFormat);
settings->Set("DumpCodec", sDumpCodec);
settings->Set("DumpPath", sDumpPath);
settings->Set("BitrateKbps", iBitrateKbps);
settings->Set("InternalResolutionFrameDumps", bInternalResolutionFrameDumps);
settings->Set("EnableGPUTextureDecoding", bEnableGPUTextureDecoding);
settings->Set("EnablePixelLighting", bEnablePixelLighting);
settings->Set("FastDepthCalc", bFastDepthCalc);
settings->Set("MSAA", iMultisamples);
settings->Set("SSAA", bSSAA);
settings->Set("EFBScale", iEFBScale);
settings->Set("TexFmtOverlayEnable", bTexFmtOverlayEnable);
settings->Set("TexFmtOverlayCenter", bTexFmtOverlayCenter);
settings->Set("Wireframe", bWireFrame);
settings->Set("DisableFog", bDisableFog);
settings->Set("BorderlessFullscreen", bBorderlessFullscreen);
settings->Set("EnableValidationLayer", bEnableValidationLayer);
settings->Set("BackendMultithreading", bBackendMultithreading);
settings->Set("CommandBufferExecuteInterval", iCommandBufferExecuteInterval);
settings->Set("ShaderCache", bShaderCache);
settings->Set("SWZComploc", bZComploc);
settings->Set("SWZFreeze", bZFreeze);
settings->Set("SWDumpObjects", bDumpObjects);
settings->Set("SWDumpTevStages", bDumpTevStages);
settings->Set("SWDumpTevTexFetches", bDumpTevTextureFetches);
settings->Set("SWDrawStart", drawStart);
settings->Set("SWDrawEnd", drawEnd);
IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements");
enhancements->Set("ForceFiltering", bForceFiltering);
enhancements->Set("MaxAnisotropy", iMaxAnisotropy);
enhancements->Set("PostProcessingShader", sPostProcessingShader);
enhancements->Set("ForceTrueColor", bForceTrueColor);
IniFile::Section* stereoscopy = iniFile.GetOrCreateSection("Stereoscopy");
stereoscopy->Set("StereoMode", iStereoMode);
stereoscopy->Set("StereoDepth", iStereoDepth);
stereoscopy->Set("StereoConvergencePercentage", iStereoConvergencePercentage);
stereoscopy->Set("StereoSwapEyes", bStereoSwapEyes);
IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks");
hacks->Set("EFBAccessEnable", bEFBAccessEnable);
hacks->Set("BBoxEnable", bBBoxEnable);
hacks->Set("BBoxPreferStencilImplementation", bBBoxPreferStencilImplementation);
hacks->Set("ForceProgressive", bForceProgressive);
hacks->Set("EFBToTextureEnable", bSkipEFBCopyToRam);
hacks->Set("EFBScaledCopy", bCopyEFBScaled);
hacks->Set("EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
hacks->Set("VertexRounding", bVertexRounding);
iniFile.Save(ini_file);
}
bool VideoConfig::IsVSync() bool VideoConfig::IsVSync()
{ {
return bVSync && !Core::GetIsThrottlerTempDisabled(); return bVSync && !Core::GetIsThrottlerTempDisabled();

View File

@ -54,10 +54,8 @@ enum StereoMode
struct VideoConfig final struct VideoConfig final
{ {
VideoConfig(); VideoConfig();
void Load(const std::string& ini_file); void Refresh();
void GameIniLoad();
void VerifyValidity(); void VerifyValidity();
void Save(const std::string& ini_file);
void UpdateProjectionHack(); void UpdateProjectionHack();
bool IsVSync(); bool IsVSync();