Config: Port remaining Interface settings to new config system.

This commit is contained in:
Admiral H. Curtiss 2021-12-31 03:00:39 +01:00
parent df0870f79d
commit d6331c1e71
No known key found for this signature in database
GPG key ID: F051B4C4044F33FB
30 changed files with 135 additions and 162 deletions

View file

@ -8,6 +8,7 @@
#include <fmt/format.h> #include <fmt/format.h>
#include "AudioCommon/AudioCommon.h" #include "AudioCommon/AudioCommon.h"
#include "Common/CommonPaths.h"
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Version.h" #include "Common/Version.h"
@ -198,6 +199,19 @@ const Info<bool> MAIN_USE_PANIC_HANDLERS{{System::Main, "Interface", "UsePanicHa
const Info<bool> MAIN_ABORT_ON_PANIC_ALERT{{System::Main, "Interface", "AbortOnPanicAlert"}, false}; const Info<bool> MAIN_ABORT_ON_PANIC_ALERT{{System::Main, "Interface", "AbortOnPanicAlert"}, false};
const Info<bool> MAIN_OSD_MESSAGES{{System::Main, "Interface", "OnScreenDisplayMessages"}, true}; const Info<bool> MAIN_OSD_MESSAGES{{System::Main, "Interface", "OnScreenDisplayMessages"}, true};
const Info<bool> MAIN_SKIP_NKIT_WARNING{{System::Main, "Interface", "SkipNKitWarning"}, false}; const Info<bool> MAIN_SKIP_NKIT_WARNING{{System::Main, "Interface", "SkipNKitWarning"}, false};
const Info<bool> MAIN_CONFIRM_ON_STOP{{System::Main, "Interface", "ConfirmStop"}, true};
const Info<ShowCursor> MAIN_SHOW_CURSOR{{System::Main, "Interface", "CursorVisibility"},
ShowCursor::OnMovement};
const Info<bool> MAIN_LOCK_CURSOR{{System::Main, "Interface", "LockCursor"}, false};
const Info<std::string> MAIN_INTERFACE_LANGUAGE{{System::Main, "Interface", "LanguageCode"}, ""};
const Info<bool> MAIN_EXTENDED_FPS_INFO{{System::Main, "Interface", "ExtendedFPSInfo"}, false};
const Info<bool> MAIN_SHOW_ACTIVE_TITLE{{System::Main, "Interface", "ShowActiveTitle"}, true};
const Info<bool> MAIN_USE_BUILT_IN_TITLE_DATABASE{
{System::Main, "Interface", "UseBuiltinTitleDatabase"}, true};
const Info<std::string> MAIN_THEME_NAME{{System::Main, "Interface", "ThemeName"},
DEFAULT_THEME_DIR};
const Info<bool> MAIN_PAUSE_ON_FOCUS_LOST{{System::Main, "Interface", "PauseOnFocusLost"}, false};
const Info<bool> MAIN_ENABLE_DEBUGGING{{System::Main, "Interface", "DebugModeEnabled"}, false};
// Main.Analytics // Main.Analytics

View file

@ -167,6 +167,24 @@ extern const Info<bool> MAIN_USE_PANIC_HANDLERS;
extern const Info<bool> MAIN_ABORT_ON_PANIC_ALERT; extern const Info<bool> MAIN_ABORT_ON_PANIC_ALERT;
extern const Info<bool> MAIN_OSD_MESSAGES; extern const Info<bool> MAIN_OSD_MESSAGES;
extern const Info<bool> MAIN_SKIP_NKIT_WARNING; extern const Info<bool> MAIN_SKIP_NKIT_WARNING;
extern const Info<bool> MAIN_CONFIRM_ON_STOP;
enum class ShowCursor
{
Never,
Constantly,
OnMovement,
};
extern const Info<ShowCursor> MAIN_SHOW_CURSOR;
extern const Info<bool> MAIN_LOCK_CURSOR;
extern const Info<std::string> MAIN_INTERFACE_LANGUAGE;
extern const Info<bool> MAIN_EXTENDED_FPS_INFO;
extern const Info<bool> MAIN_SHOW_ACTIVE_TITLE;
extern const Info<bool> MAIN_USE_BUILT_IN_TITLE_DATABASE;
extern const Info<std::string> MAIN_THEME_NAME;
extern const Info<bool> MAIN_PAUSE_ON_FOCUS_LOST;
extern const Info<bool> MAIN_ENABLE_DEBUGGING;
// Main.Analytics // Main.Analytics

View file

@ -28,7 +28,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
for (const std::string_view section : for (const std::string_view section :
{"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons", {"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons",
"DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie", "Input", "Debug", "DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie", "Input", "Debug",
"BluetoothPassthrough", "USBPassthrough"}) "BluetoothPassthrough", "USBPassthrough", "Interface"})
{ {
if (config_location.section == section) if (config_location.section == section)
return true; return true;
@ -73,13 +73,6 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::MAIN_REAL_WII_REMOTE_REPEAT_REPORTS.GetLocation(), &Config::MAIN_REAL_WII_REMOTE_REPEAT_REPORTS.GetLocation(),
&Config::MAIN_DSP_HLE.GetLocation(), &Config::MAIN_DSP_HLE.GetLocation(),
// Main.Interface
&Config::MAIN_USE_PANIC_HANDLERS.GetLocation(),
&Config::MAIN_ABORT_ON_PANIC_ALERT.GetLocation(),
&Config::MAIN_OSD_MESSAGES.GetLocation(),
&Config::MAIN_SKIP_NKIT_WARNING.GetLocation(),
// UI.General // UI.General
&Config::MAIN_USE_DISCORD_PRESENCE.GetLocation(), &Config::MAIN_USE_DISCORD_PRESENCE.GetLocation(),

View file

@ -89,7 +89,6 @@ void SConfig::SaveSettings()
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
SaveGeneralSettings(ini); SaveGeneralSettings(ini);
SaveInterfaceSettings(ini);
SaveCoreSettings(ini); SaveCoreSettings(ini);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
@ -129,22 +128,6 @@ void SConfig::SaveGeneralSettings(IniFile& ini)
general->Set("GDBPort", iGDBPort); general->Set("GDBPort", iGDBPort);
} }
void SConfig::SaveInterfaceSettings(IniFile& ini)
{
IniFile::Section* interface = ini.GetOrCreateSection("Interface");
interface->Set("ConfirmStop", bConfirmStop);
interface->Set("CursorVisibility", m_show_cursor);
interface->Set("LockCursor", bLockCursor);
interface->Set("LanguageCode", m_InterfaceLanguage);
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
interface->Set("ShowActiveTitle", m_show_active_title);
interface->Set("UseBuiltinTitleDatabase", m_use_builtin_title_database);
interface->Set("ThemeName", theme_name);
interface->Set("PauseOnFocusLost", m_PauseOnFocusLost);
interface->Set("DebugModeEnabled", bEnableDebugging);
}
void SConfig::SaveCoreSettings(IniFile& ini) void SConfig::SaveCoreSettings(IniFile& ini)
{ {
IniFile::Section* core = ini.GetOrCreateSection("Core"); IniFile::Section* core = ini.GetOrCreateSection("Core");
@ -203,7 +186,6 @@ void SConfig::LoadSettings()
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
LoadGeneralSettings(ini); LoadGeneralSettings(ini);
LoadInterfaceSettings(ini);
LoadCoreSettings(ini); LoadCoreSettings(ini);
} }
@ -234,22 +216,6 @@ void SConfig::LoadGeneralSettings(IniFile& ini)
general->Get("WirelessMac", &m_WirelessMac); general->Get("WirelessMac", &m_WirelessMac);
} }
void SConfig::LoadInterfaceSettings(IniFile& ini)
{
IniFile::Section* interface = ini.GetOrCreateSection("Interface");
interface->Get("ConfirmStop", &bConfirmStop, true);
interface->Get("CursorVisibility", &m_show_cursor, ShowCursor::OnMovement);
interface->Get("LockCursor", &bLockCursor, false);
interface->Get("LanguageCode", &m_InterfaceLanguage, "");
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
interface->Get("ShowActiveTitle", &m_show_active_title, true);
interface->Get("UseBuiltinTitleDatabase", &m_use_builtin_title_database, true);
interface->Get("ThemeName", &theme_name, DEFAULT_THEME_DIR);
interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false);
interface->Get("DebugModeEnabled", &bEnableDebugging, false);
}
void SConfig::LoadCoreSettings(IniFile& ini) void SConfig::LoadCoreSettings(IniFile& ini)
{ {
IniFile::Section* core = ini.GetOrCreateSection("Core"); IniFile::Section* core = ini.GetOrCreateSection("Core");
@ -423,7 +389,6 @@ void SConfig::OnNewTitleLoad()
void SConfig::LoadDefaults() void SConfig::LoadDefaults()
{ {
bEnableDebugging = false;
bAutomaticStart = false; bAutomaticStart = false;
bBootToPause = false; bBootToPause = false;

View file

@ -69,7 +69,6 @@ struct SConfig
std::vector<std::string> m_ISOFolder; std::vector<std::string> m_ISOFolder;
// Settings // Settings
bool bEnableDebugging = false;
int iGDBPort; int iGDBPort;
#ifndef _WIN32 #ifndef _WIN32
std::string gdb_socket; std::string gdb_socket;
@ -115,19 +114,6 @@ struct SConfig
bool bWii = false; bool bWii = false;
bool m_is_mios = false; bool m_is_mios = false;
// Interface settings
bool bConfirmStop = false;
enum class ShowCursor
{
Never,
Constantly,
OnMovement,
} m_show_cursor;
bool bLockCursor = false;
std::string theme_name;
// Custom RTC // Custom RTC
bool bEnableCustomRTC; bool bEnableCustomRTC;
u32 m_customRTCValue; u32 m_customRTCValue;
@ -192,20 +178,12 @@ struct SConfig
std::string m_bba_xlink_ip; std::string m_bba_xlink_ip;
bool m_bba_xlink_chat_osd = true; bool m_bba_xlink_chat_osd = true;
// interface language
std::string m_InterfaceLanguage;
float m_EmulationSpeed; float m_EmulationSpeed;
// other interface settings
bool m_InterfaceExtendedFPSInfo;
bool m_show_active_title = false;
bool m_use_builtin_title_database = true;
std::string m_WirelessMac; std::string m_WirelessMac;
bool m_ShowLag; bool m_ShowLag;
bool m_ShowFrameCount; bool m_ShowFrameCount;
bool m_PauseOnFocusLost;
// Input settings // Input settings
bool m_AdapterRumble[4]; bool m_AdapterRumble[4];
bool m_AdapterKonga[4]; bool m_AdapterKonga[4];
@ -231,11 +209,9 @@ private:
~SConfig(); ~SConfig();
void SaveGeneralSettings(IniFile& ini); void SaveGeneralSettings(IniFile& ini);
void SaveInterfaceSettings(IniFile& ini);
void SaveCoreSettings(IniFile& ini); void SaveCoreSettings(IniFile& ini);
void LoadGeneralSettings(IniFile& ini); void LoadGeneralSettings(IniFile& ini);
void LoadInterfaceSettings(IniFile& ini);
void LoadCoreSettings(IniFile& ini); void LoadCoreSettings(IniFile& ini);
void SetRunningGameMetadata(const std::string& game_id, const std::string& gametdb_id, void SetRunningGameMetadata(const std::string& game_id, const std::string& gametdb_id,

View file

@ -954,7 +954,7 @@ void UpdateTitle(u32 ElapseTime)
else else
{ {
SFPS = fmt::format("FPS: {:.0f} - VPS: {:.0f} - {:.0f}%", FPS, VPS, Speed); SFPS = fmt::format("FPS: {:.0f} - VPS: {:.0f} - {:.0f}%", FPS, VPS, Speed);
if (SConfig::GetInstance().m_InterfaceExtendedFPSInfo) if (Config::Get(Config::MAIN_EXTENDED_FPS_INFO))
{ {
// Use extended or summary information. The summary information does not print the ticks data, // Use extended or summary information. The summary information does not print the ticks data,
// that's more of a debugging interest, it can always be optional of course if someone is // that's more of a debugging interest, it can always be optional of course if someone is
@ -980,7 +980,7 @@ void UpdateTitle(u32 ElapseTime)
} }
std::string message = fmt::format("{} | {} | {}", Common::scm_rev_str, SSettings, SFPS); std::string message = fmt::format("{} | {} | {}", Common::scm_rev_str, SSettings, SFPS);
if (SConfig::GetInstance().m_show_active_title) if (Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE))
{ {
const std::string& title = SConfig::GetInstance().GetTitleDescription(); const std::string& title = SConfig::GetInstance().GetTitleDescription();
if (!title.empty()) if (!title.empty())

View file

@ -189,7 +189,7 @@ HookFlag GetHookFlagsByIndex(u32 index)
bool IsEnabled(HookFlag flag) bool IsEnabled(HookFlag flag)
{ {
return flag != HLE::HookFlag::Debug || SConfig::GetInstance().bEnableDebugging || return flag != HLE::HookFlag::Debug || Config::Get(Config::MAIN_ENABLE_DEBUGGING) ||
PowerPC::GetMode() == PowerPC::CoreMode::Interpreter; PowerPC::GetMode() == PowerPC::CoreMode::Interpreter;
} }

View file

@ -882,7 +882,7 @@ void Update(u64 ticks)
if (s_half_line_of_next_si_poll == s_half_line_count) if (s_half_line_of_next_si_poll == s_half_line_count)
{ {
Core::UpdateInputGate(!Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT), Core::UpdateInputGate(!Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT),
SConfig::GetInstance().bLockCursor); Config::Get(Config::MAIN_LOCK_CURSOR));
SerialInterface::UpdateDevices(); SerialInterface::UpdateDevices();
s_half_line_of_next_si_poll += 2 * SerialInterface::GetPollXLines(); s_half_line_of_next_si_poll += 2 * SerialInterface::GetPollXLines();
} }

View file

@ -273,8 +273,8 @@ void CachedInterpreter::Jit(u32 address)
if (!op.skip) if (!op.skip)
{ {
const bool breakpoint = SConfig::GetInstance().bEnableDebugging && const bool breakpoint =
PowerPC::breakpoints.IsAddressBreakPoint(op.address); m_enable_debugging && PowerPC::breakpoints.IsAddressBreakPoint(op.address);
const bool check_fpu = (op.opinfo->flags & FL_USE_FPU) && !js.firstFPInstructionFound; const bool check_fpu = (op.opinfo->flags & FL_USE_FPU) && !js.firstFPInstructionFound;
const bool endblock = (op.opinfo->flags & FL_ENDBLOCK) != 0; const bool endblock = (op.opinfo->flags & FL_ENDBLOCK) != 0;
const bool memcheck = (op.opinfo->flags & FL_LOADSTORE) && jo.memcheck; const bool memcheck = (op.opinfo->flags & FL_LOADSTORE) && jo.memcheck;

View file

@ -14,7 +14,7 @@
#include "Common/GekkoDisassembler.h" #include "Common/GekkoDisassembler.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/Debugger/Debugger_SymbolMap.h" #include "Core/Debugger/Debugger_SymbolMap.h"
#include "Core/HLE/HLE.h" #include "Core/HLE/HLE.h"
@ -247,7 +247,7 @@ void Interpreter::Run()
CoreTiming::Advance(); CoreTiming::Advance();
// we have to check exceptions at branches apparently (or maybe just rfi?) // we have to check exceptions at branches apparently (or maybe just rfi?)
if (SConfig::GetInstance().bEnableDebugging) if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
{ {
#ifdef SHOW_HISTORY #ifdef SHOW_HISTORY
s_pc_block_vec.push_back(PC); s_pc_block_vec.push_back(PC);

View file

@ -355,8 +355,8 @@ void Jit64::Init()
// BLR optimization has the same consequences as block linking, as well as // BLR optimization has the same consequences as block linking, as well as
// depending on the fault handler to be safe in the event of excessive BL. // depending on the fault handler to be safe in the event of excessive BL.
m_enable_blr_optimization = jo.enableBlocklink && SConfig::GetInstance().bFastmem && m_enable_blr_optimization =
!SConfig::GetInstance().bEnableDebugging; jo.enableBlocklink && SConfig::GetInstance().bFastmem && !m_enable_debugging;
m_cleanup_after_stackfault = false; m_cleanup_after_stackfault = false;
m_stack = nullptr; m_stack = nullptr;
@ -603,8 +603,8 @@ void Jit64::JustWriteExit(u32 destination, bool bl, u32 after)
MOV(32, PPCSTATE(pc), Imm32(destination)); MOV(32, PPCSTATE(pc), Imm32(destination));
// Do not skip breakpoint check if debugging. // Do not skip breakpoint check if debugging.
const u8* dispatcher = SConfig::GetInstance().bEnableDebugging ? asm_routines.dispatcher : const u8* dispatcher =
asm_routines.dispatcher_no_check; m_enable_debugging ? asm_routines.dispatcher : asm_routines.dispatcher_no_check;
// Perform downcount flag check, followed by the requested exit // Perform downcount flag check, followed by the requested exit
if (bl) if (bl)
@ -796,7 +796,7 @@ void Jit64::Jit(u32 em_address, bool clear_cache_and_retry_on_failure)
std::size_t block_size = m_code_buffer.size(); std::size_t block_size = m_code_buffer.size();
if (SConfig::GetInstance().bEnableDebugging) if (m_enable_debugging)
{ {
// We can link blocks as long as we are not single stepping and there are no breakpoints here // We can link blocks as long as we are not single stepping and there are no breakpoints here
EnableBlockLink(); EnableBlockLink();
@ -1007,7 +1007,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.fastmemLoadStore = nullptr; js.fastmemLoadStore = nullptr;
js.fixupExceptionHandler = false; js.fixupExceptionHandler = false;
if (!SConfig::GetInstance().bEnableDebugging) if (!m_enable_debugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC); js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC);
if (i == (code_block.m_num_instructions - 1)) if (i == (code_block.m_num_instructions - 1))
@ -1094,8 +1094,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.firstFPInstructionFound = true; js.firstFPInstructionFound = true;
} }
if (SConfig::GetInstance().bEnableDebugging && breakpoints.IsAddressBreakPoint(op.address) && if (m_enable_debugging && breakpoints.IsAddressBreakPoint(op.address) && !CPU::IsStepping())
!CPU::IsStepping())
{ {
// Turn off block linking if there are breakpoints so that the Step Over command does not // Turn off block linking if there are breakpoints so that the Step Over command does not
// link this block. // link this block.

View file

@ -9,7 +9,7 @@
#include "Common/JitRegister.h" #include "Common/JitRegister.h"
#include "Common/x64ABI.h" #include "Common/x64ABI.h"
#include "Common/x64Emitter.h" #include "Common/x64Emitter.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/HW/CPU.h" #include "Core/HW/CPU.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
@ -37,6 +37,8 @@ void Jit64AsmRoutineManager::Init(u8* stack_top)
void Jit64AsmRoutineManager::Generate() void Jit64AsmRoutineManager::Generate()
{ {
const bool enable_debugging = Config::Get(Config::MAIN_ENABLE_DEBUGGING);
enter_code = AlignCode16(); enter_code = AlignCode16();
// We need to own the beginning of RSP, so we do an extra stack adjustment // We need to own the beginning of RSP, so we do an extra stack adjustment
// for the shadow region before calls in this function. This call will // for the shadow region before calls in this function. This call will
@ -65,8 +67,7 @@ void Jit64AsmRoutineManager::Generate()
ABI_PushRegistersAndAdjustStack({}, 0); ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunction(CoreTiming::Advance); ABI_CallFunction(CoreTiming::Advance);
ABI_PopRegistersAndAdjustStack({}, 0); ABI_PopRegistersAndAdjustStack({}, 0);
FixupBranch skipToRealDispatch = FixupBranch skipToRealDispatch = J(enable_debugging); // skip the sync and compare first time
J(SConfig::GetInstance().bEnableDebugging); // skip the sync and compare first time
dispatcher_mispredicted_blr = GetCodePtr(); dispatcher_mispredicted_blr = GetCodePtr();
AND(32, PPCSTATE(pc), Imm32(0xFFFFFFFC)); AND(32, PPCSTATE(pc), Imm32(0xFFFFFFFC));
@ -88,7 +89,7 @@ void Jit64AsmRoutineManager::Generate()
FixupBranch dbg_exit; FixupBranch dbg_exit;
if (SConfig::GetInstance().bEnableDebugging) if (enable_debugging)
{ {
MOV(64, R(RSCRATCH), ImmPtr(CPU::GetStatePtr())); MOV(64, R(RSCRATCH), ImmPtr(CPU::GetStatePtr()));
TEST(32, MatR(RSCRATCH), Imm32(static_cast<u32>(CPU::State::Stepping))); TEST(32, MatR(RSCRATCH), Imm32(static_cast<u32>(CPU::State::Stepping)));
@ -205,7 +206,7 @@ void Jit64AsmRoutineManager::Generate()
J_CC(CC_Z, outerLoop); J_CC(CC_Z, outerLoop);
// Landing pad for drec space // Landing pad for drec space
if (SConfig::GetInstance().bEnableDebugging) if (enable_debugging)
SetJumpTarget(dbg_exit); SetJumpTarget(dbg_exit);
ResetStack(*this); ResetStack(*this);
if (m_stack_top) if (m_stack_top)

View file

@ -14,9 +14,8 @@ JitBlockCache::JitBlockCache(JitBase& jit) : JitBaseBlockCache{jit}
void JitBlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest) void JitBlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest)
{ {
// Do not skip breakpoint check if debugging. // Do not skip breakpoint check if debugging.
const u8* dispatcher = SConfig::GetInstance().bEnableDebugging ? const u8* dispatcher = m_jit.IsDebuggingEnabled() ? m_jit.GetAsmRoutines()->dispatcher :
m_jit.GetAsmRoutines()->dispatcher : m_jit.GetAsmRoutines()->dispatcher_no_check;
m_jit.GetAsmRoutines()->dispatcher_no_check;
u8* location = source.exitPtrs; u8* location = source.exitPtrs;
const u8* address = dest ? dest->checkedEntry : dispatcher; const u8* address = dest ? dest->checkedEntry : dispatcher;

View file

@ -67,8 +67,8 @@ void JitArm64::Init()
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CARRY_MERGE); analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CARRY_MERGE);
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW); analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW);
m_enable_blr_optimization = jo.enableBlocklink && SConfig::GetInstance().bFastmem && m_enable_blr_optimization =
!SConfig::GetInstance().bEnableDebugging; jo.enableBlocklink && SConfig::GetInstance().bFastmem && !m_enable_debugging;
m_cleanup_after_stackfault = false; m_cleanup_after_stackfault = false;
AllocStack(); AllocStack();
@ -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(); 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) // Comment out the following to disable breakpoints (speed-up)
block_size = 1; block_size = 1;
@ -820,7 +820,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.downcountAmount += opinfo->numCycles; js.downcountAmount += opinfo->numCycles;
js.isLastInstruction = i == (code_block.m_num_instructions - 1); js.isLastInstruction = i == (code_block.m_num_instructions - 1);
if (!SConfig::GetInstance().bEnableDebugging) if (!m_enable_debugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC); js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC);
// Skip calling UpdateLastUsed for lmw/stmw - it usually hurts more than it helps // Skip calling UpdateLastUsed for lmw/stmw - it usually hurts more than it helps

View file

@ -48,6 +48,8 @@ void JitBase::RefreshConfig()
bJITSystemRegistersOff = Config::Get(Config::MAIN_DEBUG_JIT_SYSTEM_REGISTERS_OFF); bJITSystemRegistersOff = Config::Get(Config::MAIN_DEBUG_JIT_SYSTEM_REGISTERS_OFF);
bJITBranchOff = Config::Get(Config::MAIN_DEBUG_JIT_BRANCH_OFF); bJITBranchOff = Config::Get(Config::MAIN_DEBUG_JIT_BRANCH_OFF);
bJITRegisterCacheOff = Config::Get(Config::MAIN_DEBUG_JIT_REGISTER_CACHE_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 bool JitBase::CanMergeNextInstructions(int count) const
@ -57,8 +59,7 @@ bool JitBase::CanMergeNextInstructions(int count) const
// Be careful: a breakpoint kills flags in between instructions // Be careful: a breakpoint kills flags in between instructions
for (int i = 1; i <= count; i++) for (int i = 1; i <= count; i++)
{ {
if (SConfig::GetInstance().bEnableDebugging && if (m_enable_debugging && PowerPC::breakpoints.IsAddressBreakPoint(js.op[i].address))
PowerPC::breakpoints.IsAddressBreakPoint(js.op[i].address))
return false; return false;
if (js.op[i].isBranchTarget) if (js.op[i].isBranchTarget)
return false; return false;

View file

@ -126,6 +126,7 @@ protected:
bool bJITSystemRegistersOff = false; bool bJITSystemRegistersOff = false;
bool bJITBranchOff = false; bool bJITBranchOff = false;
bool bJITRegisterCacheOff = false; bool bJITRegisterCacheOff = false;
bool m_enable_debugging = false;
void RefreshConfig(); void RefreshConfig();
@ -139,6 +140,8 @@ public:
JitBase(); JitBase();
~JitBase() override; ~JitBase() override;
bool IsDebuggingEnabled() const { return m_enable_debugging; }
static const u8* Dispatch(JitBase& jit); static const u8* Dispatch(JitBase& jit);
virtual JitBaseBlockCache* GetBlockCache() = 0; virtual JitBaseBlockCache* GetBlockCache() = 0;

View file

@ -15,6 +15,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/PowerPC/JitCommon/JitBase.h" #include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/MMU.h" #include "Core/PowerPC/MMU.h"
@ -191,7 +192,7 @@ static void AnalyzeFunction2(Common::Symbol* func)
func->flags = flags; func->flags = flags;
} }
static bool CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b) bool PPCAnalyzer::CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b)
{ {
const GekkoOPInfo* a_info = a.opinfo; const GekkoOPInfo* a_info = a.opinfo;
const GekkoOPInfo* b_info = b.opinfo; const GekkoOPInfo* b_info = b.opinfo;
@ -199,10 +200,11 @@ static bool CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b)
u64 b_flags = b_info->flags; u64 b_flags = b_info->flags;
// can't reorder around breakpoints // can't reorder around breakpoints
if (SConfig::GetInstance().bEnableDebugging && if (m_is_debugging_enabled && (PowerPC::breakpoints.IsAddressBreakPoint(a.address) ||
(PowerPC::breakpoints.IsAddressBreakPoint(a.address) || PowerPC::breakpoints.IsAddressBreakPoint(b.address)))
PowerPC::breakpoints.IsAddressBreakPoint(b.address))) {
return false; return false;
}
if (b_flags & (FL_SET_CRx | FL_ENDBLOCK | FL_TIMER | FL_EVIL | FL_SET_OE)) if (b_flags & (FL_SET_CRx | FL_ENDBLOCK | FL_TIMER | FL_EVIL | FL_SET_OE))
return false; return false;
if ((b_flags & (FL_RC_BIT | FL_RC_BIT_F)) && (b.inst.Rc)) if ((b_flags & (FL_RC_BIT | FL_RC_BIT_F)) && (b.inst.Rc))

View file

@ -215,6 +215,7 @@ public:
void SetOption(AnalystOption option) { m_options |= option; } void SetOption(AnalystOption option) { m_options |= option; }
void ClearOption(AnalystOption option) { m_options &= ~(option); } void ClearOption(AnalystOption option) { m_options &= ~(option); }
bool HasOption(AnalystOption option) const { return !!(m_options & option); } bool HasOption(AnalystOption option) const { return !!(m_options & option); }
void SetDebuggingEnabled(bool enabled) { m_is_debugging_enabled = enabled; }
u32 Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std::size_t block_size); u32 Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std::size_t block_size);
private: private:
@ -225,6 +226,7 @@ private:
CROR CROR
}; };
bool CanSwapAdjacentOps(const CodeOp& a, const CodeOp& b);
void ReorderInstructionsCore(u32 instructions, CodeOp* code, bool reverse, ReorderType type); void ReorderInstructionsCore(u32 instructions, CodeOp* code, bool reverse, ReorderType type);
void ReorderInstructions(u32 instructions, CodeOp* code); void ReorderInstructions(u32 instructions, CodeOp* code);
void SetInstructionStats(CodeBlock* block, CodeOp* code, const GekkoOPInfo* opinfo, u32 index); void SetInstructionStats(CodeBlock* block, CodeOp* code, const GekkoOPInfo* opinfo, u32 index);
@ -232,6 +234,8 @@ private:
// Options // Options
u32 m_options = 0; u32 m_options = 0;
bool m_is_debugging_enabled = false;
}; };
void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db); void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db);

View file

@ -18,6 +18,7 @@
#include "Common/FloatUtils.h" #include "Common/FloatUtils.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
@ -264,7 +265,7 @@ void Init(CPUCore cpu_core)
InitializeCPUCore(cpu_core); InitializeCPUCore(cpu_core);
ppcState.iCache.Init(); ppcState.iCache.Init();
if (SConfig::GetInstance().bEnableDebugging) if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
breakpoints.ClearAllTemporary(); breakpoints.ClearAllTemporary();
} }

View file

@ -16,7 +16,7 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "Core/IOS/ES/Formats.h" #include "Core/IOS/ES/Formats.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
@ -97,7 +97,7 @@ const std::string& TitleDatabase::GetTitleName(const std::string& gametdb_id,
if (it != m_user_title_map.end()) if (it != m_user_title_map.end())
return it->second; return it->second;
if (!SConfig::GetInstance().m_use_builtin_title_database) if (!Config::Get(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE))
return EMPTY_STRING; return EMPTY_STRING;
const Map& map = *m_title_maps.at(language); const Map& map = *m_title_maps.at(language);

View file

@ -13,7 +13,6 @@ static constexpr auto X_None = None;
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Core/Config/MainSettings.h" #include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/State.h" #include "Core/State.h"
@ -70,7 +69,7 @@ PlatformX11::~PlatformX11()
if (m_display) 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); XFreeCursor(m_display, m_blank_cursor);
XCloseDisplay(m_display); XCloseDisplay(m_display);
@ -115,7 +114,7 @@ bool PlatformX11::Init()
m_xrr_config = new X11Utils::XRRConfiguration(m_display, m_window); m_xrr_config = new X11Utils::XRRConfiguration(m_display, m_window);
#endif #endif
if (SConfig::GetInstance().m_show_cursor == SConfig::ShowCursor::Never) if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
{ {
// make a blank cursor // make a blank cursor
Pixmap Blank; Pixmap Blank;
@ -200,13 +199,13 @@ void PlatformX11::ProcessEvents()
{ {
if (Core::GetState() == Core::State::Running) 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); XUndefineCursor(m_display, m_window);
Core::SetState(Core::State::Paused); Core::SetState(Core::State::Paused);
} }
else 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); XDefineCursor(m_display, m_window, m_blank_cursor);
Core::SetState(Core::State::Running); Core::SetState(Core::State::Running);
} }
@ -243,7 +242,7 @@ void PlatformX11::ProcessEvents()
case FocusIn: case FocusIn:
{ {
m_window_focus = true; 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) Core::GetState() != Core::State::Paused)
XDefineCursor(m_display, m_window, m_blank_cursor); XDefineCursor(m_display, m_window, m_blank_cursor);
} }
@ -251,7 +250,7 @@ void PlatformX11::ProcessEvents()
case FocusOut: case FocusOut:
{ {
m_window_focus = false; 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); XUndefineCursor(m_display, m_window);
} }
break; break;

View file

@ -156,6 +156,7 @@ void JITWidget::Update()
PPCAnalyst::BlockRegStats fpa; PPCAnalyst::BlockRegStats fpa;
PPCAnalyst::CodeBlock code_block; PPCAnalyst::CodeBlock code_block;
PPCAnalyst::PPCAnalyzer analyzer; PPCAnalyst::PPCAnalyzer analyzer;
analyzer.SetDebuggingEnabled(Config::Get(Config::MAIN_ENABLE_DEBUGGING));
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE); analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE);
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW); analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW);

View file

@ -254,7 +254,7 @@ void HotkeyScheduler::Run()
if (auto bt = WiiUtils::GetBluetoothRealDevice()) if (auto bt = WiiUtils::GetBluetoothRealDevice())
bt->UpdateSyncButtonState(IsHotkey(HK_TRIGGER_SYNC_BUTTON, true)); bt->UpdateSyncButtonState(IsHotkey(HK_TRIGGER_SYNC_BUTTON, true));
if (SConfig::GetInstance().bEnableDebugging) if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
{ {
CheckDebuggingHotkeys(); CheckDebuggingHotkeys();
} }

View file

@ -861,7 +861,7 @@ bool MainWindow::RequestStop()
else else
FullScreen(); FullScreen();
if (SConfig::GetInstance().bConfirmStop) if (Config::Get(Config::MAIN_CONFIRM_ON_STOP))
{ {
if (std::exchange(m_stop_confirm_showing, true)) if (std::exchange(m_stop_confirm_showing, true))
return true; return true;

View file

@ -22,7 +22,6 @@
#include <imgui.h> #include <imgui.h>
#include "Core/Config/MainSettings.h" #include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/State.h" #include "Core/State.h"
@ -156,14 +155,14 @@ void RenderWidget::UpdateCursor()
// on top of the game window in the background // on top of the game window in the background
const bool keep_on_top = (windowFlags() & Qt::WindowStaysOnTopHint) != 0; const bool keep_on_top = (windowFlags() & Qt::WindowStaysOnTopHint) != 0;
const bool should_hide = 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()); (keep_on_top || Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT) || isActiveWindow());
setCursor(should_hide ? Qt::BlankCursor : Qt::ArrowCursor); setCursor(should_hide ? Qt::BlankCursor : Qt::ArrowCursor);
} }
else else
{ {
setCursor((m_cursor_locked && setCursor((m_cursor_locked &&
Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) ? Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never) ?
Qt::BlankCursor : Qt::BlankCursor :
Qt::ArrowCursor); Qt::ArrowCursor);
} }
@ -189,7 +188,7 @@ void RenderWidget::HandleCursorTimer()
if (!isActiveWindow()) if (!isActiveWindow())
return; return;
if ((!Settings::Instance().GetLockCursor() || m_cursor_locked) && if ((!Settings::Instance().GetLockCursor() || m_cursor_locked) &&
Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::OnMovement) Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement)
{ {
setCursor(Qt::BlankCursor); setCursor(Qt::BlankCursor);
} }
@ -272,7 +271,7 @@ void RenderWidget::SetCursorLocked(bool locked, bool follow_aspect_ratio)
{ {
m_cursor_locked = true; m_cursor_locked = true;
if (Settings::Instance().GetCursorVisibility() != SConfig::ShowCursor::Constantly) if (Settings::Instance().GetCursorVisibility() != Config::ShowCursor::Constantly)
{ {
setCursor(Qt::BlankCursor); setCursor(Qt::BlankCursor);
} }
@ -374,7 +373,7 @@ bool RenderWidget::event(QEvent* event)
break; break;
case QEvent::MouseMove: case QEvent::MouseMove:
// Unhide on movement // Unhide on movement
if (Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::OnMovement) if (Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement)
{ {
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
m_mouse_timer->start(MOUSE_HIDE_DELAY); m_mouse_timer->start(MOUSE_HIDE_DELAY);
@ -386,7 +385,7 @@ bool RenderWidget::event(QEvent* event)
case QEvent::Show: case QEvent::Show:
// Don't do if "stay on top" changed (or was true) // Don't do if "stay on top" changed (or was true)
if (Settings::Instance().GetLockCursor() && if (Settings::Instance().GetLockCursor() &&
Settings::Instance().GetCursorVisibility() != SConfig::ShowCursor::Constantly && Settings::Instance().GetCursorVisibility() != Config::ShowCursor::Constantly &&
!m_dont_lock_cursor_on_show) !m_dont_lock_cursor_on_show)
{ {
// Auto lock when this window is shown (it was hidden) // Auto lock when this window is shown (it was hidden)
@ -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, // 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 // it's the window that has keyboard and mouse focus
case QEvent::WindowActivate: 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); Core::SetState(Core::State::Running);
UpdateCursor(); UpdateCursor();
@ -421,7 +420,7 @@ bool RenderWidget::event(QEvent* event)
UpdateCursor(); 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 // 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 // for us to finish showing a panic alert (with that panic alert likely being the cause

View file

@ -10,7 +10,7 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -52,7 +52,7 @@ QPixmap Resources::GetPixmap(std::string_view name, const QString& dir)
static QString GetCurrentThemeDir() 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() static QString GetResourcesDir()

View file

@ -106,7 +106,7 @@ QSettings& Settings::GetQSettings()
void Settings::SetThemeName(const QString& theme_name) 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(); emit ThemeChanged();
} }
@ -325,27 +325,26 @@ void Settings::SetStateSlot(int slot)
GetQSettings().setValue(QStringLiteral("Emulation/StateSlot"), 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(); 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) void Settings::SetLockCursor(bool lock_cursor)
{ {
SConfig::GetInstance().bLockCursor = lock_cursor; Config::SetBaseOrCurrent(Config::MAIN_LOCK_CURSOR, lock_cursor);
emit LockCursorChanged(); emit LockCursorChanged();
} }
bool Settings::GetLockCursor() const bool Settings::GetLockCursor() const
{ {
return SConfig::GetInstance().bLockCursor; return Config::Get(Config::MAIN_LOCK_CURSOR);
} }
void Settings::SetKeepWindowOnTop(bool top) void Settings::SetKeepWindowOnTop(bool top)
@ -457,7 +456,7 @@ void Settings::SetDebugModeEnabled(bool enabled)
{ {
if (IsDebugModeEnabled() != enabled) if (IsDebugModeEnabled() != enabled)
{ {
SConfig::GetInstance().bEnableDebugging = enabled; Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled);
emit DebugModeToggled(enabled); emit DebugModeToggled(enabled);
} }
if (enabled) if (enabled)
@ -466,7 +465,7 @@ void Settings::SetDebugModeEnabled(bool enabled)
bool Settings::IsDebugModeEnabled() const bool Settings::IsDebugModeEnabled() const
{ {
return SConfig::GetInstance().bEnableDebugging; return Config::Get(Config::MAIN_ENABLE_DEBUGGING);
} }
void Settings::SetRegistersVisible(bool enabled) void Settings::SetRegistersVisible(bool enabled)

View file

@ -10,7 +10,7 @@
#include <QRadioButton> #include <QRadioButton>
#include <QSettings> #include <QSettings>
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
namespace Core namespace Core
@ -99,8 +99,8 @@ public:
void SetUSBKeyboardConnected(bool connected); void SetUSBKeyboardConnected(bool connected);
// Graphics // Graphics
void SetCursorVisibility(SConfig::ShowCursor hideCursor); void SetCursorVisibility(Config::ShowCursor hideCursor);
SConfig::ShowCursor GetCursorVisibility() const; Config::ShowCursor GetCursorVisibility() const;
void SetLockCursor(bool lock_cursor); void SetLockCursor(bool lock_cursor);
bool GetLockCursor() const; bool GetLockCursor() const;
void SetKeepWindowOnTop(bool top); void SetKeepWindowOnTop(bool top);

View file

@ -21,7 +21,6 @@
#include "Core/Config/MainSettings.h" #include "Core/Config/MainSettings.h"
#include "Core/Config/UISettings.h" #include "Core/Config/UISettings.h"
#include "Core/ConfigManager.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -238,13 +237,13 @@ void InterfacePane::ConnectLayout()
void InterfacePane::LoadConfig() void InterfacePane::LoadConfig()
{ {
const SConfig& startup_params = SConfig::GetInstance(); m_checkbox_use_builtin_title_database->setChecked(
m_checkbox_use_builtin_title_database->setChecked(startup_params.m_use_builtin_title_database); Config::Get(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE));
m_checkbox_show_debugging_ui->setChecked(Settings::Instance().IsDebugModeEnabled()); m_checkbox_show_debugging_ui->setChecked(Settings::Instance().IsDebugModeEnabled());
m_combobox_language->setCurrentIndex(m_combobox_language->findData( 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->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 QString userstyle = Settings::Instance().GetCurrentUserStyle();
const int index = m_combobox_userstyle->findData(QFileInfo(userstyle).fileName()); const int index = m_combobox_userstyle->findData(QFileInfo(userstyle).fileName());
@ -261,19 +260,19 @@ void InterfacePane::LoadConfig()
// Render Window Options // Render Window Options
m_checkbox_top_window->setChecked(Settings::Instance().IsKeepWindowOnTopEnabled()); 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_use_panic_handlers->setChecked(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
m_checkbox_enable_osd->setChecked(Config::Get(Config::MAIN_OSD_MESSAGES)); 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_show_active_title->setChecked(Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE));
m_checkbox_pause_on_focus_lost->setChecked(startup_params.m_PauseOnFocusLost); 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_use_covers->setChecked(Config::Get(Config::MAIN_USE_GAME_COVERS));
m_checkbox_focused_hotkeys->setChecked(Config::Get(Config::MAIN_FOCUSED_HOTKEYS)); m_checkbox_focused_hotkeys->setChecked(Config::Get(Config::MAIN_FOCUSED_HOTKEYS));
m_radio_cursor_visible_movement->setChecked(Settings::Instance().GetCursorVisibility() == m_radio_cursor_visible_movement->setChecked(Settings::Instance().GetCursorVisibility() ==
SConfig::ShowCursor::OnMovement); Config::ShowCursor::OnMovement);
m_radio_cursor_visible_always->setChecked(Settings::Instance().GetCursorVisibility() == m_radio_cursor_visible_always->setChecked(Settings::Instance().GetCursorVisibility() ==
SConfig::ShowCursor::Constantly); Config::ShowCursor::Constantly);
m_radio_cursor_visible_never->setChecked(Settings::Instance().GetCursorVisibility() == 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_lock_mouse->setChecked(Settings::Instance().GetLockCursor());
m_checkbox_disable_screensaver->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER)); m_checkbox_disable_screensaver->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER));
@ -281,8 +280,8 @@ void InterfacePane::LoadConfig()
void InterfacePane::OnSaveConfig() void InterfacePane::OnSaveConfig()
{ {
SConfig& settings = SConfig::GetInstance(); Config::SetBase(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE,
settings.m_use_builtin_title_database = m_checkbox_use_builtin_title_database->isChecked(); m_checkbox_use_builtin_title_database->isChecked());
Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked()); Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked());
Settings::Instance().SetUserStylesEnabled(m_checkbox_use_userstyle->isChecked()); Settings::Instance().SetUserStylesEnabled(m_checkbox_use_userstyle->isChecked());
Settings::Instance().SetCurrentUserStyle(m_combobox_userstyle->currentData().toString()); Settings::Instance().SetCurrentUserStyle(m_combobox_userstyle->currentData().toString());
@ -294,18 +293,18 @@ void InterfacePane::OnSaveConfig()
// Render Window Options // Render Window Options
Settings::Instance().SetKeepWindowOnTop(m_checkbox_top_window->isChecked()); 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_USE_PANIC_HANDLERS, m_checkbox_use_panic_handlers->isChecked());
Config::SetBase(Config::MAIN_OSD_MESSAGES, m_checkbox_enable_osd->isChecked()); Config::SetBase(Config::MAIN_OSD_MESSAGES, m_checkbox_enable_osd->isChecked());
settings.m_show_active_title = m_checkbox_show_active_title->isChecked(); Config::SetBase(Config::MAIN_SHOW_ACTIVE_TITLE, m_checkbox_show_active_title->isChecked());
settings.m_PauseOnFocusLost = m_checkbox_pause_on_focus_lost->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)); Common::SetEnableAlert(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
auto new_language = m_combobox_language->currentData().toString().toStdString(); 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( ModalMessageBox::information(
this, tr("Restart Required"), this, tr("Restart Required"),
tr("You must restart Dolphin in order for the change to take effect.")); tr("You must restart Dolphin in order for the change to take effect."));
@ -322,20 +321,20 @@ void InterfacePane::OnSaveConfig()
Config::SetBase(Config::MAIN_FOCUSED_HOTKEYS, m_checkbox_focused_hotkeys->isChecked()); Config::SetBase(Config::MAIN_FOCUSED_HOTKEYS, m_checkbox_focused_hotkeys->isChecked());
Config::SetBase(Config::MAIN_DISABLE_SCREENSAVER, m_checkbox_disable_screensaver->isChecked()); Config::SetBase(Config::MAIN_DISABLE_SCREENSAVER, m_checkbox_disable_screensaver->isChecked());
settings.SaveSettings(); Config::Save();
} }
void InterfacePane::OnCursorVisibleMovement() void InterfacePane::OnCursorVisibleMovement()
{ {
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::OnMovement); Settings::Instance().SetCursorVisibility(Config::ShowCursor::OnMovement);
} }
void InterfacePane::OnCursorVisibleNever() void InterfacePane::OnCursorVisibleNever()
{ {
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Never); Settings::Instance().SetCursorVisibility(Config::ShowCursor::Never);
} }
void InterfacePane::OnCursorVisibleAlways() void InterfacePane::OnCursorVisibleAlways()
{ {
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Constantly); Settings::Instance().SetCursorVisibility(Config::ShowCursor::Constantly);
} }

View file

@ -17,7 +17,7 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/ModalMessageBox.h"
@ -310,7 +310,7 @@ void Translation::Initialize()
[](const char* text) { return QObject::tr(text).toStdString(); }); [](const char* text) { return QObject::tr(text).toStdString(); });
// Hook up Qt translations // 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 (!configured_language.empty())
{ {
if (TryInstallTranslator(QString::fromStdString(configured_language))) if (TryInstallTranslator(QString::fromStdString(configured_language)))
@ -319,7 +319,7 @@ void Translation::Initialize()
ModalMessageBox::warning( ModalMessageBox::warning(
nullptr, QObject::tr("Error"), nullptr, QObject::tr("Error"),
QObject::tr("Error loading selected language. Falling back to system default.")); 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()) for (const auto& lang : QLocale::system().uiLanguages())