Config: Get rid of subset mutators and const global

This commit is contained in:
Connor McLaughlin 2021-09-16 07:52:00 +10:00 committed by Kojin
parent 4b2a81e7ff
commit 3f265b3f1c
3 changed files with 4 additions and 44 deletions

View File

@ -526,13 +526,7 @@ struct Pcsx2Config
} }
}; };
extern const Pcsx2Config EmuConfig; extern Pcsx2Config EmuConfig;
Pcsx2Config::GSOptions& SetGSConfig();
Pcsx2Config::RecompilerOptions& SetRecompilerConfig();
Pcsx2Config::GamefixOptions& SetGameFixConfig();
TraceLogFilters& SetTraceConfig();
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
// Helper Macros for Reading Emu Configurations. // Helper Macros for Reading Emu Configurations.

View File

@ -148,41 +148,7 @@ void SysOutOfMemory_EmergencyResponse(uptr blocksize)
#include "svnrev.h" #include "svnrev.h"
const Pcsx2Config EmuConfig; Pcsx2Config EmuConfig;
// Provides an accessor for quick modification of GS options. All GS options are allowed to be
// changed "on the fly" by the *main/gui thread only*.
Pcsx2Config::GSOptions& SetGSConfig()
{
//DbgCon.WriteLn( "Direct modification of EmuConfig.GS detected" );
AffinityAssert_AllowFrom_MainUI();
return const_cast<Pcsx2Config::GSOptions&>(EmuConfig.GS);
}
// Provides an accessor for quick modification of Recompiler options.
// Used by loadGameSettings() to set clamp modes via database at game startup.
Pcsx2Config::RecompilerOptions& SetRecompilerConfig()
{
//DbgCon.WriteLn( "Direct modification of EmuConfig.Gamefixes detected" );
AffinityAssert_AllowFrom_MainUI();
return const_cast<Pcsx2Config::RecompilerOptions&>(EmuConfig.Cpu.Recompiler);
}
// Provides an accessor for quick modification of Gamefix options.
// Used by loadGameSettings() to set gamefixes via database at game startup.
Pcsx2Config::GamefixOptions& SetGameFixConfig()
{
//DbgCon.WriteLn( "Direct modification of EmuConfig.Gamefixes detected" );
AffinityAssert_AllowFrom_MainUI();
return const_cast<Pcsx2Config::GamefixOptions&>(EmuConfig.Gamefixes);
}
TraceLogFilters& SetTraceConfig()
{
//DbgCon.WriteLn( "Direct modification of EmuConfig.TraceLog detected" );
AffinityAssert_AllowFrom_MainUI();
return const_cast<TraceLogFilters&>(EmuConfig.Trace);
}
// This function should be called once during program execution. // This function should be called once during program execution.

View File

@ -74,7 +74,7 @@ namespace Implementations
void Frameskip_Toggle() void Frameskip_Toggle()
{ {
g_Conf->EmuOptions.GS.FrameSkipEnable = !g_Conf->EmuOptions.GS.FrameSkipEnable; g_Conf->EmuOptions.GS.FrameSkipEnable = !g_Conf->EmuOptions.GS.FrameSkipEnable;
SetGSConfig().FrameSkipEnable = g_Conf->EmuOptions.GS.FrameSkipEnable; EmuConfig.GS.FrameSkipEnable = g_Conf->EmuOptions.GS.FrameSkipEnable;
if (EmuConfig.GS.FrameSkipEnable) if (EmuConfig.GS.FrameSkipEnable)
{ {
@ -408,7 +408,7 @@ namespace Implementations
// FIXME: Some of the trace logs will require recompiler resets to be activated properly. // FIXME: Some of the trace logs will require recompiler resets to be activated properly.
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
SetTraceConfig().Enabled = !EmuConfig.Trace.Enabled; EmuConfig.Trace.Enabled = !EmuConfig.Trace.Enabled;
Console.WriteLn(EmuConfig.Trace.Enabled ? "Logging Enabled." : "Logging Disabled."); Console.WriteLn(EmuConfig.Trace.Enabled ? "Logging Enabled." : "Logging Disabled.");
#endif #endif
} }