mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-20 03:24:59 +00:00
Config/Graphics: Add a reset button for all user-defined configurations
This commit is contained in:
parent
edb1db7400
commit
0689ff5a1c
3 changed files with 143 additions and 0 deletions
|
@ -6,6 +6,8 @@
|
|||
#include <string>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/SYSCONFSettings.h"
|
||||
|
||||
enum class AspectMode : int;
|
||||
enum class ShaderCompilationMode : int;
|
||||
|
@ -22,6 +24,8 @@ enum class VertexLoaderType : int;
|
|||
namespace Config
|
||||
{
|
||||
// Configuration Information
|
||||
using InfoVariant = std::variant<Config::Info<u32>, Config::Info<int>, Config::Info<bool>,
|
||||
Config::Info<float>, Config::Info<std::string>>;
|
||||
|
||||
// Graphics.Hardware
|
||||
|
||||
|
@ -192,4 +196,99 @@ extern const Info<std::string> GFX_DRIVER_LIB_NAME;
|
|||
|
||||
extern const Info<VertexLoaderType> GFX_VERTEX_LOADER_TYPE;
|
||||
|
||||
// Array containing the configuration keys in the "Graphics settings" window.
|
||||
// We target only these explicitly specified keys rather than every "GFX" key,
|
||||
// as legacy decisions makes it so we have settings all over the place.
|
||||
const std::array<InfoVariant, 91> GRAPHICS_CONFIG_INFO = {GFX_DISABLE_FOG,
|
||||
GFX_SHOW_SPEED_COLORS,
|
||||
GFX_FRAME_DUMPS_RESOLUTION_TYPE,
|
||||
GFX_ENHANCE_HDR_OUTPUT,
|
||||
GFX_CC_CORRECT_GAMMA,
|
||||
GFX_ENABLE_PIXEL_LIGHTING,
|
||||
GFX_ENHANCE_FORCE_TRUE_COLOR,
|
||||
GFX_STEREO_SWAP_EYES,
|
||||
MAIN_RENDER_WINDOW_AUTOSIZE,
|
||||
GFX_CPU_CULL,
|
||||
GFX_CC_CORRECT_COLOR_SPACE,
|
||||
GFX_HACK_EFB_ACCESS_ENABLE,
|
||||
GFX_STEREO_PER_EYE_RESOLUTION_FULL,
|
||||
GFX_ASPECT_RATIO,
|
||||
GFX_WIDESCREEN_HACK,
|
||||
GFX_SHOW_NETPLAY_PING,
|
||||
SYSCONF_PROGRESSIVE_SCAN,
|
||||
GFX_HACK_SKIP_EFB_COPY_TO_RAM,
|
||||
GFX_DUMP_TEXTURES,
|
||||
MAIN_GFX_BACKEND,
|
||||
GFX_HACK_EFB_DEFER_INVALIDATION,
|
||||
GFX_CC_SDR_DISPLAY_CUSTOM_GAMMA,
|
||||
MAIN_RENDER_TO_MAIN,
|
||||
GFX_SHOW_FTIMES,
|
||||
MAIN_FULLSCREEN,
|
||||
GFX_HACK_FAST_TEXTURE_SAMPLING,
|
||||
GFX_OVERLAY_PROJ_STATS,
|
||||
GFX_WAIT_FOR_SHADERS_BEFORE_STARTING,
|
||||
GFX_STEREO_MODE,
|
||||
GFX_BACKEND_MULTITHREADING,
|
||||
GFX_ENHANCE_POST_SHADER,
|
||||
GFX_USE_LOSSLESS,
|
||||
GFX_HACK_DEFER_EFB_COPIES,
|
||||
GFX_ENABLE_WIREFRAME,
|
||||
GFX_HACK_EFB_EMULATE_FORMAT_CHANGES,
|
||||
GFX_TEXFMT_OVERLAY_ENABLE,
|
||||
GFX_SHOW_VTIMES,
|
||||
GFX_ENHANCE_DISABLE_COPY_FILTER,
|
||||
GFX_ENABLE_GPU_TEXTURE_DECODING,
|
||||
GFX_SHOW_GRAPHS,
|
||||
GFX_SHOW_SPEED,
|
||||
GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION,
|
||||
GFX_CC_SDR_DISPLAY_GAMMA_SRGB,
|
||||
GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION,
|
||||
GFX_DUMP_XFB_TARGET,
|
||||
GFX_LOG_RENDER_TIME_TO_FILE,
|
||||
GFX_OVERLAY_STATS,
|
||||
GFX_CUSTOM_ASPECT_RATIO_WIDTH,
|
||||
GFX_SHOW_FPS,
|
||||
GFX_BITRATE_KBPS,
|
||||
GFX_ENHANCE_MAX_ANISOTROPY,
|
||||
GFX_HACK_BBOX_ENABLE,
|
||||
GFX_HACK_VERTEX_ROUNDING,
|
||||
GFX_HACK_VI_SKIP,
|
||||
GFX_ENHANCE_FORCE_TEXTURE_FILTERING,
|
||||
GFX_CC_GAME_COLOR_SPACE,
|
||||
GFX_STEREO_DEPTH,
|
||||
GFX_DUMP_EFB_TARGET,
|
||||
GFX_HACK_SKIP_XFB_COPY_TO_RAM,
|
||||
GFX_SSAA,
|
||||
GFX_PERF_SAMP_WINDOW,
|
||||
MAIN_PRECISION_FRAME_TIMING,
|
||||
GFX_SHOW_VPS,
|
||||
GFX_SHADER_COMPILATION_MODE,
|
||||
GFX_HACK_SKIP_DUPLICATE_XFBS,
|
||||
GFX_SAVE_TEXTURE_CACHE_TO_STATE,
|
||||
GFX_MODS_ENABLE,
|
||||
GFX_EFB_SCALE,
|
||||
GFX_DUMP_BASE_TEXTURES,
|
||||
GFX_SHOW_NETPLAY_MESSAGES,
|
||||
GFX_FAST_DEPTH_CALC,
|
||||
GFX_MAX_EFB_SCALE,
|
||||
GFX_CC_HDR_PAPER_WHITE_NITS,
|
||||
GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES,
|
||||
GFX_ADAPTER,
|
||||
GFX_DUMP_MIP_TEXTURES,
|
||||
GFX_CACHE_HIRES_TEXTURES,
|
||||
GFX_BORDERLESS_FULLSCREEN,
|
||||
GFX_MSAA,
|
||||
GFX_ENABLE_VALIDATION_LAYER,
|
||||
GFX_STEREO_CONVERGENCE,
|
||||
GFX_HIRES_TEXTURES,
|
||||
GFX_CC_GAME_GAMMA,
|
||||
GFX_HACK_IMMEDIATE_XFB,
|
||||
GFX_PNG_COMPRESSION_LEVEL,
|
||||
GFX_ENHANCE_OUTPUT_RESAMPLING,
|
||||
GFX_VSYNC,
|
||||
GFX_CROP,
|
||||
GFX_CUSTOM_ASPECT_RATIO_HEIGHT,
|
||||
GFX_HACK_DISABLE_COPY_TO_VRAM,
|
||||
GFX_HACK_COPY_EFB_SCALED};
|
||||
|
||||
} // namespace Config
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
#include <QSignalBlocker>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/Config/ConfigInfo.h"
|
||||
#include "Common/Config/Layer.h"
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
@ -26,6 +29,7 @@
|
|||
#include "DolphinQt/Config/GameConfigWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipPushButton.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
@ -122,6 +126,7 @@ void GeneralWidget::CreateWidgets()
|
|||
new ConfigBool(tr("Show NetPlay Messages"), Config::GFX_SHOW_NETPLAY_MESSAGES, m_game_layer);
|
||||
m_render_main_window =
|
||||
new ConfigBool(tr("Render to Main Window"), Config::MAIN_RENDER_TO_MAIN, m_game_layer);
|
||||
m_reset_settings = new ToolTipPushButton(tr("Reset Graphics Settings"));
|
||||
|
||||
m_options_box->setLayout(m_options_layout);
|
||||
|
||||
|
@ -131,6 +136,8 @@ void GeneralWidget::CreateWidgets()
|
|||
m_options_layout->addWidget(m_show_messages, 0, 1);
|
||||
m_options_layout->addWidget(m_show_ping, 1, 1);
|
||||
|
||||
m_options_layout->addWidget(m_reset_settings, 2, 0, 1, 2);
|
||||
|
||||
// Other
|
||||
auto* shader_compilation_box = new QGroupBox(tr("Shader Compilation"));
|
||||
auto* shader_compilation_layout = new QGridLayout();
|
||||
|
@ -177,6 +184,9 @@ void GeneralWidget::ConnectWidgets()
|
|||
m_custom_aspect_height->setHidden(!is_custom_aspect_ratio);
|
||||
});
|
||||
m_aspect_combo->currentIndexChanged(m_aspect_combo->currentIndex());
|
||||
|
||||
// Reset
|
||||
connect(m_reset_settings, &QPushButton::clicked, this, &GeneralWidget::OnResetSettingsClicked);
|
||||
}
|
||||
|
||||
void GeneralWidget::BackendWarning()
|
||||
|
@ -212,6 +222,7 @@ void GeneralWidget::OnEmulationStateChanged(bool running)
|
|||
m_backend_combo->setEnabled(!running);
|
||||
m_render_main_window->setEnabled(!running);
|
||||
m_enable_fullscreen->setEnabled(!running);
|
||||
m_reset_settings->setEnabled(!running);
|
||||
|
||||
const bool supports_adapters = !g_backend_info.Adapters.empty();
|
||||
m_adapter_combo->setEnabled(!running && supports_adapters);
|
||||
|
@ -248,6 +259,10 @@ void GeneralWidget::AddDescriptions()
|
|||
QT_TR_NOOP("Uses the main Dolphin window for rendering rather than "
|
||||
"a separate render window.<br><br><dolphin_emphasis>If unsure, leave "
|
||||
"this unchecked.</dolphin_emphasis>");
|
||||
static const char TR_RESET_GRAPHICS_SETTINGS_DESCRIPTION[] =
|
||||
"Resets ALL graphics settings to their default values.<br><br>"
|
||||
"<dolphin_emphasis>This action is irreversible—any customizations you've made will be "
|
||||
"permanently lost.</dolphin_emphasis>";
|
||||
static const char TR_ASPECT_RATIO_DESCRIPTION[] = QT_TR_NOOP(
|
||||
"Selects which aspect ratio to use for displaying the game."
|
||||
"<br><br>The aspect ratio of the image sent out by the original consoles varied depending on "
|
||||
|
@ -332,6 +347,8 @@ void GeneralWidget::AddDescriptions()
|
|||
|
||||
m_render_main_window->SetDescription(tr(TR_RENDER_TO_MAINWINDOW_DESCRIPTION));
|
||||
|
||||
m_reset_settings->SetDescription(tr(TR_RESET_GRAPHICS_SETTINGS_DESCRIPTION));
|
||||
|
||||
m_shader_compilation_mode[0]->SetDescription(tr(TR_SHADER_COMPILE_SPECIALIZED_DESCRIPTION));
|
||||
|
||||
m_shader_compilation_mode[1]->SetDescription(tr(TR_SHADER_COMPILE_EXCLUSIVE_UBER_DESCRIPTION));
|
||||
|
@ -375,3 +392,26 @@ void GeneralWidget::OnBackendChanged(const QString& backend_name)
|
|||
tr(TR_ADAPTER_UNAVAILABLE_DESCRIPTION)
|
||||
.arg(tr(g_video_backend->GetDisplayName().c_str())));
|
||||
}
|
||||
|
||||
void GeneralWidget::OnResetSettingsClicked()
|
||||
{
|
||||
auto response = ModalMessageBox::question(
|
||||
this, tr("Reset Graphics Settings"),
|
||||
tr("Are you sure you want to restore all Dolphin graphics settings to their default values? "
|
||||
"This action is irreversible!\n"
|
||||
"Any customizations you've made will be permanently lost.\n\n"
|
||||
"Do you wish to continue?"),
|
||||
QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::Cancel,
|
||||
QMessageBox::StandardButton::Cancel);
|
||||
|
||||
if (response != QMessageBox::StandardButton::Yes)
|
||||
return;
|
||||
|
||||
for (const auto& info_variant : Config::GRAPHICS_CONFIG_INFO)
|
||||
{
|
||||
std::visit([](const auto& info) { Config::DeleteKey(GetActiveLayerForConfig(info), info); },
|
||||
info_variant);
|
||||
}
|
||||
|
||||
emit Settings::Instance().ConfigChanged();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipPushButton.h"
|
||||
|
||||
class ConfigBool;
|
||||
class ConfigChoice;
|
||||
class ConfigInteger;
|
||||
|
@ -43,6 +45,7 @@ private:
|
|||
void ConnectWidgets();
|
||||
void AddDescriptions();
|
||||
|
||||
void OnResetSettingsClicked();
|
||||
void OnBackendChanged(const QString& backend_name);
|
||||
void OnEmulationStateChanged(bool running);
|
||||
|
||||
|
@ -57,6 +60,7 @@ private:
|
|||
ConfigBool* m_enable_fullscreen;
|
||||
|
||||
// Options
|
||||
ToolTipPushButton* m_reset_settings;
|
||||
ConfigBool* m_show_ping;
|
||||
ConfigBool* m_autoadjust_window_size;
|
||||
ConfigBool* m_show_messages;
|
||||
|
|
Loading…
Add table
Reference in a new issue