8 changes: 4 additions & 4 deletions Source/Core/Core/PowerPC/JitArm64/Jit.cpp
Expand Up @@ -67,8 +67,8 @@ void JitArm64::Init()
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CARRY_MERGE);
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW);

m_enable_blr_optimization = jo.enableBlocklink && SConfig::GetInstance().bFastmem &&
!SConfig::GetInstance().bEnableDebugging;
m_enable_blr_optimization =
jo.enableBlocklink && SConfig::GetInstance().bFastmem && !m_enable_debugging;
m_cleanup_after_stackfault = false;

AllocStack();
Expand Down Expand Up @@ -655,7 +655,7 @@ void JitArm64::Jit(u32 em_address, bool clear_cache_and_retry_on_failure)

std::size_t block_size = m_code_buffer.size();

if (SConfig::GetInstance().bEnableDebugging)
if (m_enable_debugging)
{
// Comment out the following to disable breakpoints (speed-up)
block_size = 1;
Expand Down Expand Up @@ -820,7 +820,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.downcountAmount += opinfo->numCycles;
js.isLastInstruction = i == (code_block.m_num_instructions - 1);

if (!SConfig::GetInstance().bEnableDebugging)
if (!m_enable_debugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC);

// Skip calling UpdateLastUsed for lmw/stmw - it usually hurts more than it helps
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
Expand Up @@ -48,6 +48,8 @@ void JitBase::RefreshConfig()
bJITSystemRegistersOff = Config::Get(Config::MAIN_DEBUG_JIT_SYSTEM_REGISTERS_OFF);
bJITBranchOff = Config::Get(Config::MAIN_DEBUG_JIT_BRANCH_OFF);
bJITRegisterCacheOff = Config::Get(Config::MAIN_DEBUG_JIT_REGISTER_CACHE_OFF);
m_enable_debugging = Config::Get(Config::MAIN_ENABLE_DEBUGGING);
analyzer.SetDebuggingEnabled(m_enable_debugging);
}

bool JitBase::CanMergeNextInstructions(int count) const
Expand All @@ -57,8 +59,7 @@ bool JitBase::CanMergeNextInstructions(int count) const
// Be careful: a breakpoint kills flags in between instructions
for (int i = 1; i <= count; i++)
{
if (SConfig::GetInstance().bEnableDebugging &&
PowerPC::breakpoints.IsAddressBreakPoint(js.op[i].address))
if (m_enable_debugging && PowerPC::breakpoints.IsAddressBreakPoint(js.op[i].address))
return false;
if (js.op[i].isBranchTarget)
return false;
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Core/PowerPC/JitCommon/JitBase.h
Expand Up @@ -126,6 +126,7 @@ class JitBase : public CPUCoreBase
bool bJITSystemRegistersOff = false;
bool bJITBranchOff = false;
bool bJITRegisterCacheOff = false;
bool m_enable_debugging = false;

void RefreshConfig();

Expand All @@ -139,6 +140,8 @@ class JitBase : public CPUCoreBase
JitBase();
~JitBase() override;

bool IsDebuggingEnabled() const { return m_enable_debugging; }

static const u8* Dispatch(JitBase& jit);
virtual JitBaseBlockCache* GetBlockCache() = 0;

Expand Down
21 changes: 12 additions & 9 deletions Source/Core/Core/PowerPC/PPCAnalyst.cpp
Expand Up @@ -15,6 +15,7 @@
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/MMU.h"
Expand Down Expand Up @@ -191,18 +192,19 @@ static void AnalyzeFunction2(Common::Symbol* func)
func->flags = flags;
}

static bool CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b)
bool PPCAnalyzer::CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b) const
{
const GekkoOPInfo* a_info = a.opinfo;
const GekkoOPInfo* b_info = b.opinfo;
u64 a_flags = a_info->flags;
u64 b_flags = b_info->flags;

// can't reorder around breakpoints
if (SConfig::GetInstance().bEnableDebugging &&
(PowerPC::breakpoints.IsAddressBreakPoint(a.address) ||
PowerPC::breakpoints.IsAddressBreakPoint(b.address)))
if (m_is_debugging_enabled && (PowerPC::breakpoints.IsAddressBreakPoint(a.address) ||
PowerPC::breakpoints.IsAddressBreakPoint(b.address)))
{
return false;
}
if (b_flags & (FL_SET_CRx | FL_ENDBLOCK | FL_TIMER | FL_EVIL | FL_SET_OE))
return false;
if ((b_flags & (FL_RC_BIT | FL_RC_BIT_F)) && (b.inst.Rc))
Expand Down Expand Up @@ -449,7 +451,7 @@ static bool isCror(const CodeOp& a)
}

void PPCAnalyzer::ReorderInstructionsCore(u32 instructions, CodeOp* code, bool reverse,
ReorderType type)
ReorderType type) const
{
// Bubbling an instruction sometimes reveals another opportunity to bubble an instruction, so do
// multiple passes.
Expand Down Expand Up @@ -500,7 +502,7 @@ void PPCAnalyzer::ReorderInstructionsCore(u32 instructions, CodeOp* code, bool r
}
}

void PPCAnalyzer::ReorderInstructions(u32 instructions, CodeOp* code)
void PPCAnalyzer::ReorderInstructions(u32 instructions, CodeOp* code) const
{
// Reorder cror instructions upwards (e.g. towards an fcmp). Technically we should be more
// picky about this, but cror seems to almost solely be used for this purpose in real code.
Expand All @@ -519,7 +521,7 @@ void PPCAnalyzer::ReorderInstructions(u32 instructions, CodeOp* code)
}

void PPCAnalyzer::SetInstructionStats(CodeBlock* block, CodeOp* code, const GekkoOPInfo* opinfo,
u32 index)
u32 index) const
{
code->wantsCR0 = false;
code->wantsCR1 = false;
Expand Down Expand Up @@ -682,7 +684,7 @@ void PPCAnalyzer::SetInstructionStats(CodeBlock* block, CodeOp* code, const Gekk
}
}

bool PPCAnalyzer::IsBusyWaitLoop(CodeBlock* block, CodeOp* code, size_t instructions)
bool PPCAnalyzer::IsBusyWaitLoop(CodeBlock* block, CodeOp* code, size_t instructions) const
{
// Very basic algorithm to detect busy wait loops:
// * It loops to itself and does not contain any other branches.
Expand Down Expand Up @@ -735,7 +737,8 @@ bool PPCAnalyzer::IsBusyWaitLoop(CodeBlock* block, CodeOp* code, size_t instruct
return false;
}

u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std::size_t block_size)
u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer,
std::size_t block_size) const
{
// Clear block stats
*block->m_stats = {};
Expand Down
16 changes: 11 additions & 5 deletions Source/Core/Core/PowerPC/PPCAnalyst.h
Expand Up @@ -215,7 +215,8 @@ class PPCAnalyzer
void SetOption(AnalystOption option) { m_options |= option; }
void ClearOption(AnalystOption option) { m_options &= ~(option); }
bool HasOption(AnalystOption option) const { return !!(m_options & option); }
u32 Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std::size_t block_size);
void SetDebuggingEnabled(bool enabled) { m_is_debugging_enabled = enabled; }
u32 Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std::size_t block_size) const;

private:
enum class ReorderType
Expand All @@ -225,13 +226,18 @@ class PPCAnalyzer
CROR
};

void ReorderInstructionsCore(u32 instructions, CodeOp* code, bool reverse, ReorderType type);
void ReorderInstructions(u32 instructions, CodeOp* code);
void SetInstructionStats(CodeBlock* block, CodeOp* code, const GekkoOPInfo* opinfo, u32 index);
bool IsBusyWaitLoop(CodeBlock* block, CodeOp* code, size_t instructions);
bool CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b) const;
void ReorderInstructionsCore(u32 instructions, CodeOp* code, bool reverse,
ReorderType type) const;
void ReorderInstructions(u32 instructions, CodeOp* code) const;
void SetInstructionStats(CodeBlock* block, CodeOp* code, const GekkoOPInfo* opinfo,
u32 index) const;
bool IsBusyWaitLoop(CodeBlock* block, CodeOp* code, size_t instructions) const;

// Options
u32 m_options = 0;

bool m_is_debugging_enabled = false;
};

void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db);
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/PowerPC/PowerPC.cpp
Expand Up @@ -18,6 +18,7 @@
#include "Common/FloatUtils.h"
#include "Common/Logging/Log.h"

#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
Expand Down Expand Up @@ -264,7 +265,7 @@ void Init(CPUCore cpu_core)
InitializeCPUCore(cpu_core);
ppcState.iCache.Init();

if (SConfig::GetInstance().bEnableDebugging)
if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
breakpoints.ClearAllTemporary();
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/TitleDatabase.cpp
Expand Up @@ -16,7 +16,7 @@
#include "Common/FileUtil.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"
#include "Core/IOS/ES/Formats.h"
#include "DiscIO/Enums.h"

Expand Down Expand Up @@ -97,7 +97,7 @@ const std::string& TitleDatabase::GetTitleName(const std::string& gametdb_id,
if (it != m_user_title_map.end())
return it->second;

if (!SConfig::GetInstance().m_use_builtin_title_database)
if (!Config::Get(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE))
return EMPTY_STRING;

const Map& map = *m_title_maps.at(language);
Expand Down
13 changes: 6 additions & 7 deletions Source/Core/DolphinNoGUI/PlatformX11.cpp
Expand Up @@ -13,7 +13,6 @@ static constexpr auto X_None = None;

#include "Common/MsgHandler.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/State.h"

Expand Down Expand Up @@ -70,7 +69,7 @@ PlatformX11::~PlatformX11()

if (m_display)
{
if (SConfig::GetInstance().m_show_cursor == SConfig::ShowCursor::Never)
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
XFreeCursor(m_display, m_blank_cursor);

XCloseDisplay(m_display);
Expand Down Expand Up @@ -115,7 +114,7 @@ bool PlatformX11::Init()
m_xrr_config = new X11Utils::XRRConfiguration(m_display, m_window);
#endif

if (SConfig::GetInstance().m_show_cursor == SConfig::ShowCursor::Never)
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
{
// make a blank cursor
Pixmap Blank;
Expand Down Expand Up @@ -200,13 +199,13 @@ void PlatformX11::ProcessEvents()
{
if (Core::GetState() == Core::State::Running)
{
if (SConfig::GetInstance().m_show_cursor == SConfig::ShowCursor::Never)
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
XUndefineCursor(m_display, m_window);
Core::SetState(Core::State::Paused);
}
else
{
if (SConfig::GetInstance().m_show_cursor == SConfig::ShowCursor::Never)
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
XDefineCursor(m_display, m_window, m_blank_cursor);
Core::SetState(Core::State::Running);
}
Expand Down Expand Up @@ -243,15 +242,15 @@ void PlatformX11::ProcessEvents()
case FocusIn:
{
m_window_focus = true;
if (SConfig::GetInstance().m_show_cursor == SConfig::ShowCursor::Never &&
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never &&
Core::GetState() != Core::State::Paused)
XDefineCursor(m_display, m_window, m_blank_cursor);
}
break;
case FocusOut:
{
m_window_focus = false;
if (SConfig::GetInstance().m_show_cursor == SConfig::ShowCursor::Never)
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
XUndefineCursor(m_display, m_window);
}
break;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Debugger/JITWidget.cpp
Expand Up @@ -156,6 +156,7 @@ void JITWidget::Update()
PPCAnalyst::BlockRegStats fpa;
PPCAnalyst::CodeBlock code_block;
PPCAnalyst::PPCAnalyzer analyzer;
analyzer.SetDebuggingEnabled(Config::Get(Config::MAIN_ENABLE_DEBUGGING));
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE);
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW);

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/HotkeyScheduler.cpp
Expand Up @@ -254,7 +254,7 @@ void HotkeyScheduler::Run()
if (auto bt = WiiUtils::GetBluetoothRealDevice())
bt->UpdateSyncButtonState(IsHotkey(HK_TRIGGER_SYNC_BUTTON, true));

if (SConfig::GetInstance().bEnableDebugging)
if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
{
CheckDebuggingHotkeys();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/MainWindow.cpp
Expand Up @@ -861,7 +861,7 @@ bool MainWindow::RequestStop()
else
FullScreen();

if (SConfig::GetInstance().bConfirmStop)
if (Config::Get(Config::MAIN_CONFIRM_ON_STOP))
{
if (std::exchange(m_stop_confirm_showing, true))
return true;
Expand Down
17 changes: 8 additions & 9 deletions Source/Core/DolphinQt/RenderWidget.cpp
Expand Up @@ -22,7 +22,6 @@
#include <imgui.h>

#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/State.h"

Expand Down Expand Up @@ -156,14 +155,14 @@ void RenderWidget::UpdateCursor()
// on top of the game window in the background
const bool keep_on_top = (windowFlags() & Qt::WindowStaysOnTopHint) != 0;
const bool should_hide =
(Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) &&
(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never) &&
(keep_on_top || Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT) || isActiveWindow());
setCursor(should_hide ? Qt::BlankCursor : Qt::ArrowCursor);
}
else
{
setCursor((m_cursor_locked &&
Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) ?
Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never) ?
Qt::BlankCursor :
Qt::ArrowCursor);
}
Expand All @@ -189,7 +188,7 @@ void RenderWidget::HandleCursorTimer()
if (!isActiveWindow())
return;
if ((!Settings::Instance().GetLockCursor() || m_cursor_locked) &&
Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::OnMovement)
Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement)
{
setCursor(Qt::BlankCursor);
}
Expand Down Expand Up @@ -272,7 +271,7 @@ void RenderWidget::SetCursorLocked(bool locked, bool follow_aspect_ratio)
{
m_cursor_locked = true;

if (Settings::Instance().GetCursorVisibility() != SConfig::ShowCursor::Constantly)
if (Settings::Instance().GetCursorVisibility() != Config::ShowCursor::Constantly)
{
setCursor(Qt::BlankCursor);
}
Expand Down Expand Up @@ -374,7 +373,7 @@ bool RenderWidget::event(QEvent* event)
break;
case QEvent::MouseMove:
// Unhide on movement
if (Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::OnMovement)
if (Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement)
{
setCursor(Qt::ArrowCursor);
m_mouse_timer->start(MOUSE_HIDE_DELAY);
Expand All @@ -386,7 +385,7 @@ bool RenderWidget::event(QEvent* event)
case QEvent::Show:
// Don't do if "stay on top" changed (or was true)
if (Settings::Instance().GetLockCursor() &&
Settings::Instance().GetCursorVisibility() != SConfig::ShowCursor::Constantly &&
Settings::Instance().GetCursorVisibility() != Config::ShowCursor::Constantly &&
!m_dont_lock_cursor_on_show)
{
// Auto lock when this window is shown (it was hidden)
Expand All @@ -399,7 +398,7 @@ bool RenderWidget::event(QEvent* event)
// Note that this event in Windows is not always aligned to the window that is highlighted,
// it's the window that has keyboard and mouse focus
case QEvent::WindowActivate:
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Paused)
if (Config::Get(Config::MAIN_PAUSE_ON_FOCUS_LOST) && Core::GetState() == Core::State::Paused)
Core::SetState(Core::State::Running);

UpdateCursor();
Expand All @@ -421,7 +420,7 @@ bool RenderWidget::event(QEvent* event)

UpdateCursor();

if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Running)
if (Config::Get(Config::MAIN_PAUSE_ON_FOCUS_LOST) && Core::GetState() == Core::State::Running)
{
// If we are declared as the CPU thread, it means that the real CPU thread is waiting
// for us to finish showing a panic alert (with that panic alert likely being the cause
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/DolphinQt/Resources.cpp
Expand Up @@ -10,7 +10,7 @@

#include "Common/FileUtil.h"

#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"

#include "DolphinQt/Settings.h"

Expand Down Expand Up @@ -52,7 +52,7 @@ QPixmap Resources::GetPixmap(std::string_view name, const QString& dir)

static QString GetCurrentThemeDir()
{
return QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().theme_name));
return QString::fromStdString(File::GetThemeDir(Config::Get(Config::MAIN_THEME_NAME)));
}

static QString GetResourcesDir()
Expand Down
19 changes: 9 additions & 10 deletions Source/Core/DolphinQt/Settings.cpp
Expand Up @@ -106,7 +106,7 @@ QSettings& Settings::GetQSettings()

void Settings::SetThemeName(const QString& theme_name)
{
SConfig::GetInstance().theme_name = theme_name.toStdString();
Config::SetBaseOrCurrent(Config::MAIN_THEME_NAME, theme_name.toStdString());
emit ThemeChanged();
}

Expand Down Expand Up @@ -325,27 +325,26 @@ void Settings::SetStateSlot(int slot)
GetQSettings().setValue(QStringLiteral("Emulation/StateSlot"), slot);
}

void Settings::SetCursorVisibility(SConfig::ShowCursor hideCursor)
void Settings::SetCursorVisibility(Config::ShowCursor hideCursor)
{
SConfig::GetInstance().m_show_cursor = hideCursor;

Config::SetBaseOrCurrent(Config::MAIN_SHOW_CURSOR, hideCursor);
emit CursorVisibilityChanged();
}

SConfig::ShowCursor Settings::GetCursorVisibility() const
Config::ShowCursor Settings::GetCursorVisibility() const
{
return SConfig::GetInstance().m_show_cursor;
return Config::Get(Config::MAIN_SHOW_CURSOR);
}

void Settings::SetLockCursor(bool lock_cursor)
{
SConfig::GetInstance().bLockCursor = lock_cursor;
Config::SetBaseOrCurrent(Config::MAIN_LOCK_CURSOR, lock_cursor);
emit LockCursorChanged();
}

bool Settings::GetLockCursor() const
{
return SConfig::GetInstance().bLockCursor;
return Config::Get(Config::MAIN_LOCK_CURSOR);
}

void Settings::SetKeepWindowOnTop(bool top)
Expand Down Expand Up @@ -457,7 +456,7 @@ void Settings::SetDebugModeEnabled(bool enabled)
{
if (IsDebugModeEnabled() != enabled)
{
SConfig::GetInstance().bEnableDebugging = enabled;
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled);
emit DebugModeToggled(enabled);
}
if (enabled)
Expand All @@ -466,7 +465,7 @@ void Settings::SetDebugModeEnabled(bool enabled)

bool Settings::IsDebugModeEnabled() const
{
return SConfig::GetInstance().bEnableDebugging;
return Config::Get(Config::MAIN_ENABLE_DEBUGGING);
}

void Settings::SetRegistersVisible(bool enabled)
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/DolphinQt/Settings.h
Expand Up @@ -10,7 +10,7 @@
#include <QRadioButton>
#include <QSettings>

#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"
#include "DiscIO/Enums.h"

namespace Core
Expand Down Expand Up @@ -99,8 +99,8 @@ class Settings final : public QObject
void SetUSBKeyboardConnected(bool connected);

// Graphics
void SetCursorVisibility(SConfig::ShowCursor hideCursor);
SConfig::ShowCursor GetCursorVisibility() const;
void SetCursorVisibility(Config::ShowCursor hideCursor);
Config::ShowCursor GetCursorVisibility() const;
void SetLockCursor(bool lock_cursor);
bool GetLockCursor() const;
void SetKeepWindowOnTop(bool top);
Expand Down
43 changes: 21 additions & 22 deletions Source/Core/DolphinQt/Settings/InterfacePane.cpp
Expand Up @@ -21,7 +21,6 @@

#include "Core/Config/MainSettings.h"
#include "Core/Config/UISettings.h"
#include "Core/ConfigManager.h"

#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h"
Expand Down Expand Up @@ -238,13 +237,13 @@ void InterfacePane::ConnectLayout()

void InterfacePane::LoadConfig()
{
const SConfig& startup_params = SConfig::GetInstance();
m_checkbox_use_builtin_title_database->setChecked(startup_params.m_use_builtin_title_database);
m_checkbox_use_builtin_title_database->setChecked(
Config::Get(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE));
m_checkbox_show_debugging_ui->setChecked(Settings::Instance().IsDebugModeEnabled());
m_combobox_language->setCurrentIndex(m_combobox_language->findData(
QString::fromStdString(SConfig::GetInstance().m_InterfaceLanguage)));
QString::fromStdString(Config::Get(Config::MAIN_INTERFACE_LANGUAGE))));
m_combobox_theme->setCurrentIndex(
m_combobox_theme->findText(QString::fromStdString(SConfig::GetInstance().theme_name)));
m_combobox_theme->findText(QString::fromStdString(Config::Get(Config::MAIN_THEME_NAME))));

const QString userstyle = Settings::Instance().GetCurrentUserStyle();
const int index = m_combobox_userstyle->findData(QFileInfo(userstyle).fileName());
Expand All @@ -261,28 +260,28 @@ void InterfacePane::LoadConfig()

// Render Window Options
m_checkbox_top_window->setChecked(Settings::Instance().IsKeepWindowOnTopEnabled());
m_checkbox_confirm_on_stop->setChecked(startup_params.bConfirmStop);
m_checkbox_confirm_on_stop->setChecked(Config::Get(Config::MAIN_CONFIRM_ON_STOP));
m_checkbox_use_panic_handlers->setChecked(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
m_checkbox_enable_osd->setChecked(Config::Get(Config::MAIN_OSD_MESSAGES));
m_checkbox_show_active_title->setChecked(startup_params.m_show_active_title);
m_checkbox_pause_on_focus_lost->setChecked(startup_params.m_PauseOnFocusLost);
m_checkbox_show_active_title->setChecked(Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE));
m_checkbox_pause_on_focus_lost->setChecked(Config::Get(Config::MAIN_PAUSE_ON_FOCUS_LOST));
m_checkbox_use_covers->setChecked(Config::Get(Config::MAIN_USE_GAME_COVERS));
m_checkbox_focused_hotkeys->setChecked(Config::Get(Config::MAIN_FOCUSED_HOTKEYS));
m_radio_cursor_visible_movement->setChecked(Settings::Instance().GetCursorVisibility() ==
SConfig::ShowCursor::OnMovement);
Config::ShowCursor::OnMovement);
m_radio_cursor_visible_always->setChecked(Settings::Instance().GetCursorVisibility() ==
SConfig::ShowCursor::Constantly);
Config::ShowCursor::Constantly);
m_radio_cursor_visible_never->setChecked(Settings::Instance().GetCursorVisibility() ==
SConfig::ShowCursor::Never);
Config::ShowCursor::Never);

m_checkbox_lock_mouse->setChecked(Settings::Instance().GetLockCursor());
m_checkbox_disable_screensaver->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER));
}

void InterfacePane::OnSaveConfig()
{
SConfig& settings = SConfig::GetInstance();
settings.m_use_builtin_title_database = m_checkbox_use_builtin_title_database->isChecked();
Config::SetBase(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE,
m_checkbox_use_builtin_title_database->isChecked());
Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked());
Settings::Instance().SetUserStylesEnabled(m_checkbox_use_userstyle->isChecked());
Settings::Instance().SetCurrentUserStyle(m_combobox_userstyle->currentData().toString());
Expand All @@ -294,18 +293,18 @@ void InterfacePane::OnSaveConfig()

// Render Window Options
Settings::Instance().SetKeepWindowOnTop(m_checkbox_top_window->isChecked());
settings.bConfirmStop = m_checkbox_confirm_on_stop->isChecked();
Config::SetBase(Config::MAIN_CONFIRM_ON_STOP, m_checkbox_confirm_on_stop->isChecked());
Config::SetBase(Config::MAIN_USE_PANIC_HANDLERS, m_checkbox_use_panic_handlers->isChecked());
Config::SetBase(Config::MAIN_OSD_MESSAGES, m_checkbox_enable_osd->isChecked());
settings.m_show_active_title = m_checkbox_show_active_title->isChecked();
settings.m_PauseOnFocusLost = m_checkbox_pause_on_focus_lost->isChecked();
Config::SetBase(Config::MAIN_SHOW_ACTIVE_TITLE, m_checkbox_show_active_title->isChecked());
Config::SetBase(Config::MAIN_PAUSE_ON_FOCUS_LOST, m_checkbox_pause_on_focus_lost->isChecked());

Common::SetEnableAlert(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));

auto new_language = m_combobox_language->currentData().toString().toStdString();
if (new_language != SConfig::GetInstance().m_InterfaceLanguage)
if (new_language != Config::Get(Config::MAIN_INTERFACE_LANGUAGE))
{
SConfig::GetInstance().m_InterfaceLanguage = new_language;
Config::SetBase(Config::MAIN_INTERFACE_LANGUAGE, new_language);
ModalMessageBox::information(
this, tr("Restart Required"),
tr("You must restart Dolphin in order for the change to take effect."));
Expand All @@ -322,20 +321,20 @@ void InterfacePane::OnSaveConfig()
Config::SetBase(Config::MAIN_FOCUSED_HOTKEYS, m_checkbox_focused_hotkeys->isChecked());
Config::SetBase(Config::MAIN_DISABLE_SCREENSAVER, m_checkbox_disable_screensaver->isChecked());

settings.SaveSettings();
Config::Save();
}

void InterfacePane::OnCursorVisibleMovement()
{
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::OnMovement);
Settings::Instance().SetCursorVisibility(Config::ShowCursor::OnMovement);
}

void InterfacePane::OnCursorVisibleNever()
{
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Never);
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Never);
}

void InterfacePane::OnCursorVisibleAlways()
{
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Constantly);
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Constantly);
}
6 changes: 3 additions & 3 deletions Source/Core/DolphinQt/Translation.cpp
Expand Up @@ -17,7 +17,7 @@
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"

#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"

#include "DolphinQt/QtUtils/ModalMessageBox.h"

Expand Down Expand Up @@ -310,7 +310,7 @@ void Translation::Initialize()
[](const char* text) { return QObject::tr(text).toStdString(); });

// Hook up Qt translations
auto& configured_language = SConfig::GetInstance().m_InterfaceLanguage;
std::string configured_language = Config::Get(Config::MAIN_INTERFACE_LANGUAGE);
if (!configured_language.empty())
{
if (TryInstallTranslator(QString::fromStdString(configured_language)))
Expand All @@ -319,7 +319,7 @@ void Translation::Initialize()
ModalMessageBox::warning(
nullptr, QObject::tr("Error"),
QObject::tr("Error loading selected language. Falling back to system default."));
configured_language.clear();
Config::SetBase(Config::MAIN_INTERFACE_LANGUAGE, "");
}

for (const auto& lang : QLocale::system().uiLanguages())
Expand Down