summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2017-05-18 13:59:38 +0100
committerMerryMage <MerryMage@users.noreply.github.com>2017-06-03 18:13:02 +0100
commitf5f45855f03a7396dce07cdd65017e9b1ab5bfe7 (patch)
tree96cdb46685ba94f5c8f2f6ac3fc2ba17d05de1e7
parentd75b536fd7809dab10bb2e0194312673e977a3fe (diff)
GameConfigLoader: Add GFX Game INI translations
-rw-r--r--Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp55
-rw-r--r--Source/Core/DolphinWX/Frame.cpp68
-rw-r--r--Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp34
-rw-r--r--Source/Core/DolphinWX/VideoConfigDiag.cpp204
-rw-r--r--Source/Core/DolphinWX/VideoConfigDiag.h55
-rw-r--r--Source/Core/VideoBackends/D3D/D3DBase.cpp3
-rw-r--r--Source/Core/VideoBackends/OGL/PostProcessing.cpp4
-rw-r--r--Source/Core/VideoBackends/OGL/Render.cpp3
-rw-r--r--Source/Core/VideoBackends/Software/SWRenderer.cpp5
-rw-r--r--Source/Core/VideoCommon/HiresTextures.cpp3
-rw-r--r--Source/Core/VideoCommon/MainBase.cpp3
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp379
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h4
13 files changed, 388 insertions, 432 deletions
diff --git a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp
index 0d776ed815..1143da3111 100644
--- a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp
+++ b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp
@@ -19,6 +19,7 @@
#include "Common/StringUtil.h"
#include "Core/Config/Config.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigLoaders/GameConfigLoader.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.
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;
}
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 57e4af278b..2439f37589 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -42,6 +42,7 @@
#include "Common/StringUtil.h"
#include "Common/Thread.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HW/DVD/DVDInterface.h"
@@ -1423,41 +1424,46 @@ void CFrame::ParseHotkeys()
if (IsHotkey(HK_INCREASE_IR))
{
OSDChoice = 1;
- ++g_Config.iEFBScale;
+ Config::SetCurrent(Config::GFX_EFB_SCALE, Config::Get(Config::GFX_EFB_SCALE) + 1);
}
if (IsHotkey(HK_DECREASE_IR))
{
OSDChoice = 1;
- if (--g_Config.iEFBScale < SCALE_AUTO)
- g_Config.iEFBScale = SCALE_AUTO;
+ if (Config::Get(Config::GFX_EFB_SCALE) > SCALE_AUTO)
+ Config::SetCurrent(Config::GFX_EFB_SCALE, Config::Get(Config::GFX_EFB_SCALE) - 1);
}
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))
{
OSDChoice = 2;
// 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))
{
OSDChoice = 3;
// 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))
{
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))
{
- g_Config.bDumpTextures = !g_Config.bDumpTextures;
+ Config::SetCurrent(Config::GFX_DUMP_TEXTURES, !Config::Get(Config::GFX_DUMP_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));
if (IsHotkey(HK_DECREASE_EMULATION_SPEED))
{
@@ -1503,13 +1509,13 @@ void CFrame::ParseHotkeys()
// turned off when selecting other stereoscopy modes.
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
{
- g_Config.iStereoMode = STEREO_OFF;
+ Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
}
}
if (IsHotkey(HK_TOGGLE_STEREO_TAB))
@@ -1518,13 +1524,13 @@ void CFrame::ParseHotkeys()
{
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
{
- g_Config.iStereoMode = STEREO_OFF;
+ Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
}
}
if (IsHotkey(HK_TOGGLE_STEREO_ANAGLYPH))
@@ -1533,13 +1539,13 @@ void CFrame::ParseHotkeys()
{
// Setting the anaglyph mode also requires a specific
// post-processing shader to be activated.
- g_Config.iStereoMode = STEREO_ANAGLYPH;
- g_Config.sPostProcessingShader = "dubois";
+ Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_ANAGLYPH));
+ Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string("dubois"));
}
else
{
- g_Config.iStereoMode = STEREO_OFF;
- g_Config.sPostProcessingShader = "";
+ Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
+ Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
}
}
if (IsHotkey(HK_TOGGLE_STEREO_3DVISION))
@@ -1548,37 +1554,35 @@ void CFrame::ParseHotkeys()
{
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
{
- g_Config.iStereoMode = STEREO_OFF;
+ Config::SetCurrent(Config::GFX_STEREO_MODE, static_cast<int>(STEREO_OFF));
}
}
if (IsHotkey(HK_DECREASE_DEPTH, true))
{
- if (--g_Config.iStereoDepth < 0)
- g_Config.iStereoDepth = 0;
+ if (g_Config.iStereoDepth > 0)
+ Config::SetCurrent(Config::GFX_STEREO_DEPTH, g_Config.iStereoDepth - 1);
}
if (IsHotkey(HK_INCREASE_DEPTH, true))
{
- if (++g_Config.iStereoDepth > 100)
- g_Config.iStereoDepth = 100;
+ if (g_Config.iStereoDepth < 100)
+ Config::SetCurrent(Config::GFX_STEREO_DEPTH, g_Config.iStereoDepth + 1);
}
if (IsHotkey(HK_DECREASE_CONVERGENCE, true))
{
- g_Config.iStereoConvergence -= 5;
- if (g_Config.iStereoConvergence < 0)
- g_Config.iStereoConvergence = 0;
+ int convergence = std::max(0, g_Config.iStereoConvergence - 5);
+ Config::SetCurrent(Config::GFX_STEREO_CONVERGENCE, convergence);
}
if (IsHotkey(HK_INCREASE_CONVERGENCE, true))
{
- g_Config.iStereoConvergence += 5;
- if (g_Config.iStereoConvergence > 500)
- g_Config.iStereoConvergence = 500;
+ int convergence = std::min(500, g_Config.iStereoConvergence + 5);
+ Config::SetCurrent(Config::GFX_STEREO_CONVERGENCE, convergence);
}
static float debugSpeed = 1.0f;
diff --git a/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp b/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp
index 046a7343d6..af1ab0485a 100644
--- a/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp
+++ b/Source/Core/DolphinWX/SoftwareVideoConfigDialog.cpp
@@ -15,19 +15,20 @@
#include <wx/textctrl.h>
#include "Common/FileUtil.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/Core.h"
#include "DolphinWX/SoftwareVideoConfigDialog.h"
#include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/WxUtils.h"
-template <typename T>
-IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal,
- int maxVal, long style)
+IntegerSetting::IntegerSetting(wxWindow* parent, const wxString& label,
+ const Config::ConfigInfo<int>& setting, int minVal, int maxVal,
+ long style)
: wxSpinCtrl(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, style),
m_setting(setting)
{
SetRange(minVal, maxVal);
- SetValue(m_setting);
+ SetValue(Config::Get(m_setting));
Bind(wxEVT_SPINCTRL, &IntegerSetting::UpdateValue, this);
}
@@ -35,9 +36,6 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
: wxDialog(parent, wxID_ANY,
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);
const int space5 = FromDIP(5);
@@ -82,7 +80,7 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
// xfb
szr_rendering->Add(
- new SettingCheckBox(page_general, _("Bypass XFB"), "", vconfig.bUseXFB, true));
+ new SettingCheckBox(page_general, _("Bypass XFB"), "", Config::GFX_USE_XFB, true));
}
// - info
@@ -95,8 +93,8 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
group_info->Add(szr_info, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
group_info->AddSpacer(space5);
- szr_info->Add(
- new SettingCheckBox(page_general, _("Various Statistics"), "", vconfig.bOverlayStats));
+ szr_info->Add(new SettingCheckBox(page_general, _("Various Statistics"), "",
+ Config::GFX_OVERLAY_STATS));
}
// - utility
@@ -110,9 +108,9 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
group_utility->AddSpacer(space5);
szr_utility->Add(
- new SettingCheckBox(page_general, _("Dump Textures"), "", vconfig.bDumpTextures));
+ new SettingCheckBox(page_general, _("Dump Textures"), "", Config::GFX_DUMP_TEXTURES));
szr_utility->Add(
- new SettingCheckBox(page_general, _("Dump Objects"), "", vconfig.bDumpObjects));
+ new SettingCheckBox(page_general, _("Dump Objects"), "", Config::GFX_SW_DUMP_OBJECTS));
// - debug only
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->AddSpacer(space5);
- szr_debug_only_utility->Add(
- new SettingCheckBox(page_general, _("Dump TEV Stages"), "", vconfig.bDumpTevStages));
+ szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump TEV Stages"), "",
+ Config::GFX_SW_DUMP_TEV_STAGES));
szr_debug_only_utility->Add(new SettingCheckBox(page_general, _("Dump Texture Fetches"), "",
- vconfig.bDumpTevTextureFetches));
+ Config::GFX_SW_DUMP_TEV_TEX_FETCHES));
}
// - misc
@@ -141,8 +139,8 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
group_misc->AddSpacer(space5);
szr_misc->Add(
- new IntegerSetting<int>(page_general, _("Start"), vconfig.drawStart, 0, 100000));
- szr_misc->Add(new IntegerSetting<int>(page_general, _("End"), vconfig.drawEnd, 0, 100000));
+ new IntegerSetting(page_general, _("Start"), Config::GFX_SW_DRAW_START, 0, 100000));
+ szr_misc->Add(new IntegerSetting(page_general, _("End"), Config::GFX_SW_DRAW_END, 0, 100000));
}
szr_general->AddSpacer(space5);
@@ -168,5 +166,5 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
SoftwareVideoConfigDialog::~SoftwareVideoConfigDialog()
{
- g_Config.Save((File::GetUserPath(D_CONFIG_IDX) + "GFX.ini").c_str());
+ Config::Save();
}
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp
index cafff392e1..65dc4c3603 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.cpp
+++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp
@@ -46,38 +46,54 @@ template class BoolSetting<wxRadioButton>;
template <>
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),
m_setting(setting), m_reverse(reverse)
{
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);
}
template <>
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),
m_setting(setting), m_reverse(reverse)
{
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);
}
-SettingChoice::SettingChoice(wxWindow* parent, int& setting, const wxString& tooltip, int num,
- const wxString choices[], long style)
+template <>
+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)
{
SetToolTip(tooltip);
- Select(m_setting);
+ Select(Config::Get(m_setting));
Bind(wxEVT_CHOICE, &SettingChoice::UpdateValue, this);
}
void SettingChoice::UpdateValue(wxCommandEvent& ev)
{
- m_setting = ev.GetInt();
+ Config::SetBaseOrCurrent(m_setting, ev.GetInt());
ev.Skip();
}
@@ -359,8 +375,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGetTranslation(StrToWxStr(title)))),
vconfig(g_Config)
{
- vconfig.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
-
Bind(wxEVT_UPDATE_UI, &VideoConfigDiag::OnUpdateUI, this);
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())
{
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)
{
@@ -450,7 +464,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
szr_display->Add(new wxStaticText(page_general, wxID_ANY, _("Aspect Ratio:")), 0,
wxALIGN_CENTER_VERTICAL);
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);
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
{
szr_display->Add(CreateCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_desc),
- vconfig.bVSync));
- szr_display->Add(CreateCheckBox(page_general, _("Use Fullscreen"),
- wxGetTranslation(use_fullscreen_desc),
- SConfig::GetInstance().bFullscreen));
+ Config::GFX_VSYNC));
+ szr_display->Add(CreateCheckBoxRefBool(page_general, _("Use Fullscreen"),
+ wxGetTranslation(use_fullscreen_desc),
+ 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),
- vconfig.bShowFPS));
+ Config::GFX_SHOW_FPS));
szr_other->Add(CreateCheckBox(page_general, _("Show NetPlay Ping"),
wxGetTranslation(show_netplay_ping_desc),
- vconfig.bShowNetPlayPing));
+ Config::GFX_SHOW_NETPLAY_PING));
szr_other->Add(CreateCheckBox(page_general, _("Log Render Time to File"),
wxGetTranslation(log_render_time_to_file_desc),
- vconfig.bLogRenderTimeToFile));
- szr_other->Add(CreateCheckBox(page_general, _("Auto Adjust Window Size"),
- wxGetTranslation(auto_window_size_desc),
- SConfig::GetInstance().bRenderWindowAutoSize));
+ Config::GFX_LOG_RENDER_TIME_TO_FILE));
+ szr_other->Add(CreateCheckBoxRefBool(page_general, _("Auto Adjust Window Size"),
+ wxGetTranslation(auto_window_size_desc),
+ SConfig::GetInstance().bRenderWindowAutoSize));
szr_other->Add(CreateCheckBox(page_general, _("Show NetPlay Messages"),
wxGetTranslation(show_netplay_messages_desc),
- vconfig.bShowNetPlayMessages));
- szr_other->Add(CreateCheckBox(page_general, _("Keep Window on Top"),
- wxGetTranslation(keep_window_on_top_desc),
- SConfig::GetInstance().bKeepWindowOnTop));
- szr_other->Add(CreateCheckBox(page_general, _("Hide Mouse Cursor"),
- wxGetTranslation(hide_mouse_cursor_desc),
- SConfig::GetInstance().bHideCursor));
+ Config::GFX_SHOW_NETPLAY_MESSAGES));
+ szr_other->Add(CreateCheckBoxRefBool(page_general, _("Keep Window on Top"),
+ wxGetTranslation(keep_window_on_top_desc),
+ SConfig::GetInstance().bKeepWindowOnTop));
+ szr_other->Add(CreateCheckBoxRefBool(page_general, _("Hide Mouse Cursor"),
+ wxGetTranslation(hide_mouse_cursor_desc),
+ SConfig::GetInstance().bHideCursor));
szr_other->Add(render_to_main_checkbox =
- CreateCheckBox(page_general, _("Render to Main Window"),
- wxGetTranslation(render_to_main_win_desc),
- SConfig::GetInstance().bRenderToMain));
+ CreateCheckBoxRefBool(page_general, _("Render to Main Window"),
+ wxGetTranslation(render_to_main_win_desc),
+ SConfig::GetInstance().bRenderToMain));
if (vconfig.backend_info.bSupportsMultithreading)
{
szr_other->Add(CreateCheckBox(page_general, _("Enable Multi-threading"),
wxGetTranslation(backend_multithreading_desc),
- vconfig.bBackendMultithreading));
+ Config::GFX_BACKEND_MULTITHREADING));
}
}
@@ -559,7 +573,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
_("Custom")};
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,
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"}};
szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Anisotropic Filtering:")),
wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- szr_enh->Add(CreateChoice(page_enh, vconfig.iMaxAnisotropy, wxGetTranslation(af_desc),
- af_choices.size(), af_choices.data()),
+ szr_enh->Add(CreateChoice(page_enh, Config::GFX_ENHANCE_MAX_ANISOTROPY,
+ wxGetTranslation(af_desc), af_choices.size(), af_choices.data()),
wxGBPosition(row, 1), span2, wxALIGN_CENTER_VERTICAL);
row += 1;
}
@@ -623,18 +637,20 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
// Scaled copy, PL, Bilinear filter
wxGridSizer* const cb_szr = new wxGridSizer(2, space5, space5);
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"),
wxGetTranslation(pixel_lighting_desc),
- vconfig.bEnablePixelLighting));
+ Config::GFX_ENABLE_PIXEL_LIGHTING));
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),
- vconfig.bWidescreenHack));
+ Config::GFX_WIDESCREEN_HACK));
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),
- vconfig.bForceTrueColor));
+ Config::GFX_ENHANCE_FORCE_TRUE_COLOR));
szr_enh->Add(cb_szr, wxGBPosition(row, 0), wxGBSpan(1, 3));
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"),
_("Anaglyph"), _("Nvidia 3D Vision")};
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) :
ArraySize(stereo_choices) - 1,
stereo_choices);
@@ -687,7 +703,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
szr_stereo->Add(conv_slider);
szr_stereo->Add(CreateCheckBox(page_enh, _("Swap Eyes"), wxGetTranslation(stereo_swap_desc),
- vconfig.bStereoSwapEyes));
+ Config::GFX_STEREO_SWAP_EYES));
wxStaticBoxSizer* const group_stereo =
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)"));
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);
szr_efb->AddSpacer(space5);
szr_efb->Add(CreateCheckBox(page_hacks, _("Ignore Format Changes"),
wxGetTranslation(efb_emulate_format_changes_desc),
- vconfig.bEFBEmulateFormatChanges, true),
+ Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES, true),
0, wxLEFT | wxRIGHT, space5);
szr_efb->AddSpacer(space5);
szr_efb->Add(CreateCheckBox(page_hacks, _("Store EFB Copies to Texture Only"),
wxGetTranslation(skip_efb_copy_to_ram_desc),
- vconfig.bSkipEFBCopyToRam),
+ Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM),
0, wxLEFT | wxRIGHT, 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"),
wxGetTranslation(gpu_texture_decoding_desc),
- vconfig.bEnableGPUTextureDecoding),
+ Config::GFX_ENABLE_GPU_TEXTURE_DECODING),
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)"));
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),
- vconfig.bUseRealXFB, true, wxRB_GROUP);
+ Config::GFX_USE_REAL_XFB, true, wxRB_GROUP);
real_xfb = CreateRadioButton(page_hacks, _("Real"), wxGetTranslation(xfb_real_desc),
- vconfig.bUseRealXFB);
+ Config::GFX_USE_REAL_XFB);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
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);
szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"),
wxGetTranslation(fast_depth_calc_desc),
- vconfig.bFastDepthCalc));
+ Config::GFX_FAST_DEPTH_CALC));
szr_other->Add(CreateCheckBox(page_hacks, _("Disable Bounding Box"),
- wxGetTranslation(disable_bbox_desc), vconfig.bBBoxEnable,
- true));
+ wxGetTranslation(disable_bbox_desc),
+ Config::GFX_HACK_BBOX_ENABLE, true));
vertex_rounding_checkbox =
CreateCheckBox(page_hacks, _("Vertex Rounding"), wxGetTranslation(vertex_rounding_desc),
- vconfig.bVertexRounding);
+ Config::GFX_HACK_VERTEX_ROUDING);
szr_other->Add(vertex_rounding_checkbox);
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);
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"),
- wxGetTranslation(show_stats_desc), vconfig.bOverlayStats));
+ wxGetTranslation(show_stats_desc), Config::GFX_OVERLAY_STATS));
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"),
wxGetTranslation(validation_layer_desc),
- vconfig.bEnableValidationLayer));
+ Config::GFX_ENABLE_VALIDATION_LAYER));
wxStaticBoxSizer* const group_debug =
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);
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"),
wxGetTranslation(load_hires_textures_desc),
- vconfig.bHiresTextures));
- cache_hires_textures =
- CreateCheckBox(page_advanced, _("Prefetch Custom Textures"),
- wxGetTranslation(cache_hires_textures_desc), vconfig.bCacheHiresTextures);
+ Config::GFX_HIRES_TEXTURES));
+ cache_hires_textures = CreateCheckBox(page_advanced, _("Prefetch Custom Textures"),
+ wxGetTranslation(cache_hires_textures_desc),
+ Config::GFX_CACHE_HIRES_TEXTURES);
szr_utility->Add(cache_hires_textures);
if (vconfig.backend_info.bSupportsInternalResolutionFrameDumps)
{
szr_utility->Add(CreateCheckBox(page_advanced, _("Full Resolution Frame Dumps"),
wxGetTranslation(internal_resolution_frame_dumping_desc),
- vconfig.bInternalResolutionFrameDumps));
+ Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS));
}
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"),
- wxGetTranslation(free_look_desc), vconfig.bFreeLook));
+ wxGetTranslation(free_look_desc), Config::GFX_FREE_LOOK));
#if defined(HAVE_FFMPEG)
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
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);
szr_misc->Add(
- CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop));
+ CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), Config::GFX_CROP));
// Progressive Scan
{
@@ -931,7 +952,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
// Borderless Fullscreen
borderless_fullscreen = CreateCheckBox(page_advanced, _("Borderless Fullscreen"),
wxGetTranslation(borderless_fullscreen_desc),
- vconfig.bBorderlessFullscreen);
+ Config::GFX_BORDERLESS_FULLSCREEN);
szr_misc->Add(borderless_fullscreen);
#endif
@@ -1040,7 +1061,7 @@ void VideoConfigDiag::Event_ProgressiveScan(wxCommandEvent& ev)
void VideoConfigDiag::Event_SafeTextureCache(wxCommandEvent& ev)
{
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();
}
@@ -1048,14 +1069,12 @@ void VideoConfigDiag::Event_SafeTextureCache(wxCommandEvent& ev)
void VideoConfigDiag::Event_PPShader(wxCommandEvent& ev)
{
const int sel = ev.GetInt();
- if (sel)
- vconfig.sPostProcessingShader = WxStrToStr(ev.GetString());
- else
- vconfig.sPostProcessingShader.clear();
+ std::string shader = sel ? WxStrToStr(ev.GetString()) : "";
+ Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER, shader);
// Should we enable the configuration button?
PostProcessingShaderConfiguration postprocessing_shader;
- postprocessing_shader.LoadShader(vconfig.sPostProcessingShader);
+ postprocessing_shader.LoadShader(shader);
button_config_pp->Enable(postprocessing_shader.HasOptions());
ev.Skip();
@@ -1071,7 +1090,7 @@ void VideoConfigDiag::Event_ConfigurePPShader(wxCommandEvent& ev)
void VideoConfigDiag::Event_StereoDepth(wxCommandEvent& ev)
{
- vconfig.iStereoDepth = ev.GetInt();
+ Config::SetBaseOrCurrent(Config::GFX_STEREO_DEPTH, ev.GetInt());
ev.Skip();
}
@@ -1083,7 +1102,7 @@ void VideoConfigDiag::Event_StereoConvergence(wxCommandEvent& ev)
if (90 < value && value < 110)
conv_slider->SetValue(100);
- vconfig.iStereoConvergencePercentage = conv_slider->GetValue();
+ Config::SetBaseOrCurrent(Config::GFX_STEREO_CONVERGENCE_PERCENTAGE, conv_slider->GetValue());
ev.Skip();
}
@@ -1101,7 +1120,7 @@ void VideoConfigDiag::Event_StereoMode(wxCommandEvent& ev)
void VideoConfigDiag::Event_Close(wxCommandEvent& ev)
{
- g_Config.Save(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
+ Config::Save();
ev.Skip();
}
@@ -1153,7 +1172,8 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
}
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)
{
SettingCheckBox* const cb =
@@ -1162,7 +1182,18 @@ SettingCheckBox* VideoConfigDiag::CreateCheckBox(wxWindow* parent, const wxStrin
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 choices[], long style)
{
@@ -1172,7 +1203,8 @@ SettingChoice* VideoConfigDiag::CreateChoice(wxWindow* parent, int& setting,
}
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)
{
SettingRadioButton* const rb =
@@ -1275,11 +1307,11 @@ void VideoConfigDiag::PopulatePostProcessingShaders()
if (vconfig.iStereoMode == STEREO_ANAGLYPH)
{
- vconfig.sPostProcessingShader = "dubois";
+ Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string("dubois"));
choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader));
}
else
- vconfig.sPostProcessingShader.clear();
+ Config::SetCurrent(Config::GFX_ENHANCE_POST_SHADER, std::string(""));
}
// Should the configuration button be loaded by default?
@@ -1335,11 +1367,11 @@ void VideoConfigDiag::OnAAChanged(wxCommandEvent& ev)
size_t mode = ev.GetInt();
ev.Skip();
- vconfig.bSSAA = mode > m_msaa_modes;
+ Config::SetBaseOrCurrent(Config::GFX_SSAA, mode > m_msaa_modes);
mode -= vconfig.bSSAA * m_msaa_modes;
if (mode >= vconfig.backend_info.AAModes.size())
return;
- vconfig.iMultisamples = vconfig.backend_info.AAModes[mode];
+ Config::SetBaseOrCurrent(Config::GFX_MSAA, vconfig.backend_info.AAModes[mode]);
}
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.h b/Source/Core/DolphinWX/VideoConfigDiag.h
index d34ef79aae..431b6cdae9 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.h
+++ b/Source/Core/DolphinWX/VideoConfigDiag.h
@@ -18,6 +18,7 @@
#include <wx/stattext.h>
#include "Common/CommonTypes.h"
+#include "Core/Config/GraphicsSettings.h"
class DolphinSlider;
struct VideoConfig;
@@ -30,12 +31,30 @@ template <typename W>
class BoolSetting : public W
{
public:
- BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip, bool& setting,
- bool reverse = false, long style = 0);
+ BoolSetting(wxWindow* parent, const wxString& label, const wxString& tooltip,
+ const Config::ConfigInfo<bool>& setting, bool reverse = false, long style = 0);
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();
}
@@ -47,32 +66,31 @@ private:
typedef BoolSetting<wxCheckBox> SettingCheckBox;
typedef BoolSetting<wxRadioButton> SettingRadioButton;
-template <typename T>
class IntegerSetting : public wxSpinCtrl
{
public:
- IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal,
- long style = 0);
+ IntegerSetting(wxWindow* parent, const wxString& label, const Config::ConfigInfo<int>& setting,
+ int minVal, int maxVal, long style = 0);
void UpdateValue(wxCommandEvent& ev)
{
- m_setting = ev.GetInt();
+ Config::SetBaseOrCurrent(m_setting, ev.GetInt());
ev.Skip();
}
private:
- T& m_setting;
+ Config::ConfigInfo<int> m_setting;
};
class SettingChoice : public wxChoice
{
public:
- SettingChoice(wxWindow* parent, int& setting, const wxString& tooltip, int num = 0,
- const wxString choices[] = nullptr, long style = 0);
+ SettingChoice(wxWindow* parent, const Config::ConfigInfo<int>& setting, const wxString& tooltip,
+ int num = 0, const wxString choices[] = nullptr, long style = 0);
void UpdateValue(wxCommandEvent& ev);
private:
- int& m_setting;
+ Config::ConfigInfo<int> m_setting;
};
class VideoConfigDiag : public wxDialog
@@ -100,12 +118,17 @@ protected:
// Creates controls and connects their enter/leave window events to Evt_Enter/LeaveControl
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);
- SettingChoice* CreateChoice(wxWindow* parent, int& setting, const wxString& description,
- int num = 0, const wxString choices[] = nullptr, long style = 0);
+ RefBoolSetting<wxCheckBox>* CreateCheckBoxRefBool(wxWindow* parent, const wxString& label,
+ 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,
- const wxString& description, bool& setting,
+ const wxString& description,
+ const Config::ConfigInfo<bool>& setting,
bool reverse = false, long style = 0);
// Same as above but only connects enter/leave window events
@@ -134,7 +157,7 @@ protected:
wxButton* button_config_pp;
SettingCheckBox* borderless_fullscreen;
- SettingCheckBox* render_to_main_checkbox;
+ RefBoolSetting<wxCheckBox>* render_to_main_checkbox;
SettingRadioButton* virtual_xfb;
SettingRadioButton* real_xfb;
diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp
index 06ee82b450..8000f15a31 100644
--- a/Source/Core/VideoBackends/D3D/D3DBase.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp
@@ -8,6 +8,7 @@
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h"
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoBackends/D3D/D3DState.h"
@@ -319,7 +320,7 @@ HRESULT Create(HWND wnd)
return desc.Count == g_Config.iMultisamples;
}) == aa_modes.end())
{
- g_Config.iMultisamples = 1;
+ Config::SetCurrent(Config::GFX_MSAA, 1);
UpdateActiveConfig();
}
diff --git a/Source/Core/VideoBackends/OGL/PostProcessing.cpp b/Source/Core/VideoBackends/OGL/PostProcessing.cpp
index 928480567b..f400bc56ef 100644
--- a/Source/Core/VideoBackends/OGL/PostProcessing.cpp
+++ b/Source/Core/VideoBackends/OGL/PostProcessing.cpp
@@ -9,6 +9,8 @@
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
+#include "Core/Config/GraphicsSettings.h"
+
#include "VideoBackends/OGL/FramebufferManager.h"
#include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoBackends/OGL/SamplerCache.h"
@@ -139,7 +141,7 @@ void OpenGLPostProcessing::ApplyShader()
if (!ProgramShaderCache::CompileShader(m_shader, s_vertex_shader, code))
{
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();
ProgramShaderCache::CompileShader(m_shader, s_vertex_shader, code);
}
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index d9edb74327..ebec5e98a9 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -23,6 +23,7 @@
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/Core.h"
#include "VideoBackends/OGL/BoundingBox.h"
@@ -518,7 +519,7 @@ Renderer::Renderer()
{
// GLES 3.1 can't support stereo rendering and MSAA
OSD::AddMessage("MSAA Stereo rendering isn't supported by your GPU.", 10000);
- g_ActiveConfig.iMultisamples = 1;
+ Config::SetCurrent(Config::GFX_MSAA, 1);
}
}
else
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp
index fb239f06c5..9e85a2981c 100644
--- a/Source/Core/VideoBackends/Software/SWRenderer.cpp
+++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp
@@ -12,6 +12,7 @@
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/HW/Memmap.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
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)
diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp
index d601370fb5..654530dc20 100644
--- a/Source/Core/VideoCommon/HiresTextures.cpp
+++ b/Source/Core/VideoCommon/HiresTextures.cpp
@@ -27,6 +27,7 @@
#include "Common/Swap.h"
#include "Common/Thread.h"
#include "Common/Timer.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/VideoConfig.h"
@@ -196,7 +197,7 @@ void HiresTexture::Prefetch()
if (size_sum > max_mem)
{
- g_Config.bCacheHiresTextures = false;
+ Config::SetCurrent(Config::GFX_HIRES_TEXTURES, false);
OSD::AddMessage(
StringFromFormat(
diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp
index dbec53a096..2817c983a3 100644
--- a/Source/Core/VideoCommon/MainBase.cpp
+++ b/Source/Core/VideoCommon/MainBase.cpp
@@ -190,8 +190,7 @@ void VideoBackendBase::InitializeShared()
GeometryShaderManager::Init();
PixelShaderManager::Init();
- g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "GFX.ini");
- g_Config.GameIniLoad();
+ g_Config.Refresh();
g_Config.UpdateProjectionHack();
g_Config.VerifyValidity();
UpdateActiveConfig();
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index 3865095f4b..619b8212b5 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -10,6 +10,7 @@
#include "Common/IniFile.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
+#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/Movie.h"
@@ -19,6 +20,7 @@
VideoConfig g_Config;
VideoConfig g_ActiveConfig;
+static bool s_has_registered_callback = false;
void UpdateActiveConfig()
{
@@ -47,92 +49,118 @@ VideoConfig::VideoConfig()
bBackendMultithreading = true;
}
-void VideoConfig::Load(const std::string& ini_file)
+void VideoConfig::Refresh()
{
- IniFile iniFile;
- iniFile.Load(ini_file);
-
- IniFile::Section* hardware = iniFile.GetOrCreateSection("Hardware");
- hardware->Get("VSync", &bVSync, false);
- hardware->Get("Adapter", &iAdapter, 0);
-
- IniFile::Section* settings = iniFile.GetOrCreateSection("Settings");
- settings->Get("wideScreenHack", &bWidescreenHack, false);
- settings->Get("AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
- settings->Get("Crop", &bCrop, false);
- settings->Get("UseXFB", &bUseXFB, false);
- settings->Get("UseRealXFB", &bUseRealXFB, false);
- settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 128);
- settings->Get("ShowFPS", &bShowFPS, false);
- settings->Get("ShowNetPlayPing", &bShowNetPlayPing, false);
- settings->Get("ShowNetPlayMessages", &bShowNetPlayMessages, false);
- settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false);
- settings->Get("OverlayStats", &bOverlayStats, false);
- settings->Get("OverlayProjStats", &bOverlayProjStats, false);
- settings->Get("DumpTextures", &bDumpTextures, false);
- settings->Get("HiresTextures", &bHiresTextures, false);
- settings->Get("ConvertHiresTextures", &bConvertHiresTextures, false);
- settings->Get("CacheHiresTextures", &bCacheHiresTextures, false);
- settings->Get("DumpEFBTarget", &bDumpEFBTarget, false);
- settings->Get("DumpFramesAsImages", &bDumpFramesAsImages, false);
- settings->Get("FreeLook", &bFreeLook, false);
- settings->Get("UseFFV1", &bUseFFV1, false);
- settings->Get("DumpFormat", &sDumpFormat, "avi");
- settings->Get("DumpCodec", &sDumpCodec, "");
- settings->Get("DumpPath", &sDumpPath, "");
- settings->Get("BitrateKbps", &iBitrateKbps, 2500);
- settings->Get("InternalResolutionFrameDumps", &bInternalResolutionFrameDumps, false);
- settings->Get("EnableGPUTextureDecoding", &bEnableGPUTextureDecoding, false);
- settings->Get("EnablePixelLighting", &bEnablePixelLighting, false);
- settings->Get("FastDepthCalc", &bFastDepthCalc, true);
- settings->Get("MSAA", &iMultisamples, 1);
- settings->Get("SSAA", &bSSAA, false);
- settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native
- settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, false);
- settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, false);
- settings->Get("WireFrame", &bWireFrame, false);
- settings->Get("DisableFog", &bDisableFog, false);
- settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false);
- settings->Get("EnableValidationLayer", &bEnableValidationLayer, false);
- settings->Get("BackendMultithreading", &bBackendMultithreading, true);
- settings->Get("CommandBufferExecuteInterval", &iCommandBufferExecuteInterval, 100);
- settings->Get("ShaderCache", &bShaderCache, true);
-
- settings->Get("SWZComploc", &bZComploc, true);
- settings->Get("SWZFreeze", &bZFreeze, true);
- settings->Get("SWDumpObjects", &bDumpObjects, false);
- settings->Get("SWDumpTevStages", &bDumpTevStages, false);
- settings->Get("SWDumpTevTexFetches", &bDumpTevTextureFetches, false);
- settings->Get("SWDrawStart", &drawStart, 0);
- settings->Get("SWDrawEnd", &drawEnd, 100000);
-
- IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements");
- enhancements->Get("ForceFiltering", &bForceFiltering, false);
- enhancements->Get("MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x)
- enhancements->Get("PostProcessingShader", &sPostProcessingShader, "");
- enhancements->Get("ForceTrueColor", &bForceTrueColor, true);
-
- IniFile::Section* stereoscopy = iniFile.GetOrCreateSection("Stereoscopy");
- stereoscopy->Get("StereoMode", &iStereoMode, 0);
- stereoscopy->Get("StereoDepth", &iStereoDepth, 20);
- stereoscopy->Get("StereoConvergencePercentage", &iStereoConvergencePercentage, 100);
- stereoscopy->Get("StereoSwapEyes", &bStereoSwapEyes, false);
-
- IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks");
- hacks->Get("EFBAccessEnable", &bEFBAccessEnable, true);
- hacks->Get("BBoxEnable", &bBBoxEnable, false);
- hacks->Get("BBoxPreferStencilImplementation", &bBBoxPreferStencilImplementation, false);
- hacks->Get("ForceProgressive", &bForceProgressive, true);
- hacks->Get("EFBToTextureEnable", &bSkipEFBCopyToRam, true);
- hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true);
- hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);
- hacks->Get("VertexRounding", &bVertexRounding, false);
+ if (!s_has_registered_callback)
+ {
+ Config::AddConfigChangedCallback([]() { g_Config.Refresh(); });
+ s_has_registered_callback = true;
+ }
- // hacks which are disabled by default
- iPhackvalue[0] = 0;
- bPerfQueriesEnable = false;
+ bVSync = Config::Get(Config::GFX_VSYNC);
+ iAdapter = Config::Get(Config::GFX_ADAPTER);
+
+ bWidescreenHack = Config::Get(Config::GFX_WIDESCREEN_HACK);
+ iAspectRatio = Config::Get(Config::GFX_ASPECT_RATIO);
+ bCrop = Config::Get(Config::GFX_CROP);
+ bUseXFB = Config::Get(Config::GFX_USE_XFB);
+ bUseRealXFB = Config::Get(Config::GFX_USE_REAL_XFB);
+ iSafeTextureCache_ColorSamples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
+ bShowFPS = Config::Get(Config::GFX_SHOW_FPS);
+ bShowNetPlayPing = Config::Get(Config::GFX_SHOW_NETPLAY_PING);
+ bShowNetPlayMessages = Config::Get(Config::GFX_SHOW_NETPLAY_MESSAGES);
+ bLogRenderTimeToFile = Config::Get(Config::GFX_LOG_RENDER_TIME_TO_FILE);
+ bOverlayStats = Config::Get(Config::GFX_OVERLAY_STATS);
+ bOverlayProjStats = Config::Get(Config::GFX_OVERLAY_PROJ_STATS);
+ bDumpTextures = Config::Get(Config::GFX_DUMP_TEXTURES);
+ bHiresTextures = Config::Get(Config::GFX_HIRES_TEXTURES);
+ bConvertHiresTextures = Config::Get(Config::GFX_CONVERT_HIRES_TEXTURES);
+ bCacheHiresTextures = Config::Get(Config::GFX_CACHE_HIRES_TEXTURES);
+ bDumpEFBTarget = Config::Get(Config::GFX_DUMP_EFB_TARGET);
+ bDumpFramesAsImages = Config::Get(Config::GFX_DUMP_FRAMES_AS_IMAGES);
+ bFreeLook = Config::Get(Config::GFX_FREE_LOOK);
+ bUseFFV1 = Config::Get(Config::GFX_USE_FFV1);
+ sDumpFormat = Config::Get(Config::GFX_DUMP_FORMAT);
+ sDumpCodec = Config::Get(Config::GFX_DUMP_CODEC);
+ sDumpPath = Config::Get(Config::GFX_DUMP_PATH);
+ iBitrateKbps = Config::Get(Config::GFX_BITRATE_KBPS);
+ bInternalResolutionFrameDumps = Config::Get(Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS);
+ bEnableGPUTextureDecoding = Config::Get(Config::GFX_ENABLE_GPU_TEXTURE_DECODING);
+ bEnablePixelLighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING);
+ bFastDepthCalc = Config::Get(Config::GFX_FAST_DEPTH_CALC);
+ iMultisamples = Config::Get(Config::GFX_MSAA);
+ bSSAA = Config::Get(Config::GFX_SSAA);
+ iEFBScale = Config::Get(Config::GFX_EFB_SCALE);
+ bTexFmtOverlayEnable = Config::Get(Config::GFX_TEXFMT_OVERLAY_ENABLE);
+ bTexFmtOverlayCenter = Config::Get(Config::GFX_TEXFMT_OVERLAY_CENTER);
+ bWireFrame = Config::Get(Config::GFX_ENABLE_WIREFRAME);
+ bDisableFog = Config::Get(Config::GFX_DISABLE_FOG);
+ bBorderlessFullscreen = Config::Get(Config::GFX_BORDERLESS_FULLSCREEN);
+ bEnableValidationLayer = Config::Get(Config::GFX_ENABLE_VALIDATION_LAYER);
+ bBackendMultithreading = Config::Get(Config::GFX_BACKEND_MULTITHREADING);
+ iCommandBufferExecuteInterval = Config::Get(Config::GFX_COMMAND_BUFFER_EXECUTE_INTERVAL);
+ bShaderCache = Config::Get(Config::GFX_SHADER_CACHE);
+
+ bZComploc = Config::Get(Config::GFX_SW_ZCOMPLOC);
+ bZFreeze = Config::Get(Config::GFX_SW_ZFREEZE);
+ bDumpObjects = Config::Get(Config::GFX_SW_DUMP_OBJECTS);
+ bDumpTevStages = Config::Get(Config::GFX_SW_DUMP_TEV_STAGES);
+ bDumpTevTextureFetches = Config::Get(Config::GFX_SW_DUMP_TEV_TEX_FETCHES);
+ drawStart = Config::Get(Config::GFX_SW_DRAW_START);
+ drawEnd = Config::Get(Config::GFX_SW_DRAW_END);
+
+ bForceFiltering = Config::Get(Config::GFX_ENHANCE_FORCE_FILTERING);
+ iMaxAnisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
+ sPostProcessingShader = Config::Get(Config::GFX_ENHANCE_POST_SHADER);
+ bForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR);
+
+ iStereoMode = Config::Get(Config::GFX_STEREO_MODE);
+ iStereoDepth = Config::Get(Config::GFX_STEREO_DEPTH);
+ iStereoConvergencePercentage = Config::Get(Config::GFX_STEREO_CONVERGENCE_PERCENTAGE);
+ bStereoSwapEyes = Config::Get(Config::GFX_STEREO_SWAP_EYES);
+ iStereoConvergence = Config::Get(Config::GFX_STEREO_CONVERGENCE);
+ bStereoEFBMonoDepth = Config::Get(Config::GFX_STEREO_EFB_MONO_DEPTH);
+ iStereoDepthPercentage = Config::Get(Config::GFX_STEREO_DEPTH_PERCENTAGE);
+
+ bEFBAccessEnable = Config::Get(Config::GFX_HACK_EFB_ACCESS_ENABLE);
+ bBBoxEnable = Config::Get(Config::GFX_HACK_BBOX_ENABLE);
+ bBBoxPreferStencilImplementation =
+ Config::Get(Config::GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION);
+ bForceProgressive = Config::Get(Config::GFX_HACK_FORCE_PROGRESSIVE);
+ bSkipEFBCopyToRam = Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
+ bCopyEFBScaled = Config::Get(Config::GFX_HACK_COPY_EFB_ENABLED);
+ bEFBEmulateFormatChanges = Config::Get(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES);
+ bVertexRounding = Config::Get(Config::GFX_HACK_VERTEX_ROUDING);
+
+ iPhackvalue[0] = Config::Get(Config::GFX_PROJECTION_HACK);
+ iPhackvalue[1] = Config::Get(Config::GFX_PROJECTION_HACK_SZNEAR);
+ 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
+ IniFile iniFile;
iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile::Section* interface = iniFile.GetOrCreateSection("Interface");
bool bTmp;
@@ -142,109 +170,6 @@ void VideoConfig::Load(const std::string& ini_file)
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()
{
// 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()
{
return bVSync && !Core::GetIsThrottlerTempDisabled();
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index 44eac32dc9..707afae84c 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -54,10 +54,8 @@ enum StereoMode
struct VideoConfig final
{
VideoConfig();
- void Load(const std::string& ini_file);
- void GameIniLoad();
+ void Refresh();
void VerifyValidity();
- void Save(const std::string& ini_file);
void UpdateProjectionHack();
bool IsVSync();