mirror of https://github.com/PCSX2/pcsx2.git
Config: Use SettingsInterface for base config
This commit is contained in:
parent
6fa82da1f1
commit
c1fc018449
|
@ -1037,6 +1037,7 @@ set(pcsx2GuiSources
|
||||||
gui/ThreadingDialogs.cpp
|
gui/ThreadingDialogs.cpp
|
||||||
gui/UpdateUI.cpp
|
gui/UpdateUI.cpp
|
||||||
gui/wxAppWithHelpers.cpp
|
gui/wxAppWithHelpers.cpp
|
||||||
|
gui/wxSettingsInterface.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# gui headers
|
# gui headers
|
||||||
|
@ -1082,6 +1083,7 @@ set(pcsx2GuiHeaders
|
||||||
gui/Saveslots.h
|
gui/Saveslots.h
|
||||||
gui/ThreadingDialogs.h
|
gui/ThreadingDialogs.h
|
||||||
gui/ThreadingDialogs.cpp
|
gui/ThreadingDialogs.cpp
|
||||||
|
gui/wxSettingsInterface.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Warning: the declaration of the .h are mandatory in case of resources files. It will ensure the creation
|
# Warning: the declaration of the .h are mandatory in case of resources files. It will ensure the creation
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
#include "common/Path.h"
|
#include "common/Path.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class IniInterface;
|
class SettingsInterface;
|
||||||
|
class SettingsWrapper;
|
||||||
|
|
||||||
enum class CDVD_SourceType : uint8_t;
|
enum class CDVD_SourceType : uint8_t;
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ struct TraceLogFilters
|
||||||
Enabled = false;
|
Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSave( IniInterface& ini );
|
void LoadSave( SettingsWrapper& ini );
|
||||||
|
|
||||||
bool operator ==( const TraceLogFilters& right ) const
|
bool operator ==( const TraceLogFilters& right ) const
|
||||||
{
|
{
|
||||||
|
@ -230,7 +231,7 @@ struct Pcsx2Config
|
||||||
|
|
||||||
// Default is Disabled, with all recs enabled underneath.
|
// Default is Disabled, with all recs enabled underneath.
|
||||||
ProfilerOptions() : bitset( 0xfffffffe ) {}
|
ProfilerOptions() : bitset( 0xfffffffe ) {}
|
||||||
void LoadSave( IniInterface& conf );
|
void LoadSave( SettingsWrapper& wrap);
|
||||||
|
|
||||||
bool operator ==( const ProfilerOptions& right ) const
|
bool operator ==( const ProfilerOptions& right ) const
|
||||||
{
|
{
|
||||||
|
@ -275,7 +276,7 @@ struct Pcsx2Config
|
||||||
RecompilerOptions();
|
RecompilerOptions();
|
||||||
void ApplySanityCheck();
|
void ApplySanityCheck();
|
||||||
|
|
||||||
void LoadSave( IniInterface& conf );
|
void LoadSave( SettingsWrapper& wrap);
|
||||||
|
|
||||||
bool operator ==( const RecompilerOptions& right ) const
|
bool operator ==( const RecompilerOptions& right ) const
|
||||||
{
|
{
|
||||||
|
@ -298,7 +299,7 @@ struct Pcsx2Config
|
||||||
SSE_MXCSR sseVUMXCSR;
|
SSE_MXCSR sseVUMXCSR;
|
||||||
|
|
||||||
CpuOptions();
|
CpuOptions();
|
||||||
void LoadSave( IniInterface& conf );
|
void LoadSave( SettingsWrapper& wrap);
|
||||||
void ApplySanityCheck();
|
void ApplySanityCheck();
|
||||||
|
|
||||||
bool operator ==( const CpuOptions& right ) const
|
bool operator ==( const CpuOptions& right ) const
|
||||||
|
@ -340,7 +341,7 @@ struct Pcsx2Config
|
||||||
double OffsetX{0.0};
|
double OffsetX{0.0};
|
||||||
double OffsetY{0.0};
|
double OffsetY{0.0};
|
||||||
|
|
||||||
void LoadSave( IniInterface& conf );
|
void LoadSave( SettingsWrapper& wrap);
|
||||||
|
|
||||||
int GetVsync() const;
|
int GetVsync() const;
|
||||||
|
|
||||||
|
@ -393,7 +394,7 @@ struct Pcsx2Config
|
||||||
BITFIELD_END
|
BITFIELD_END
|
||||||
|
|
||||||
GamefixOptions();
|
GamefixOptions();
|
||||||
void LoadSave( IniInterface& conf );
|
void LoadSave( SettingsWrapper& wrap);
|
||||||
GamefixOptions& DisableAll();
|
GamefixOptions& DisableAll();
|
||||||
|
|
||||||
void Set( const wxString& list, bool enabled=true );
|
void Set( const wxString& list, bool enabled=true );
|
||||||
|
@ -431,7 +432,7 @@ struct Pcsx2Config
|
||||||
u8 EECycleSkip; // EE Cycle skip factor (0, 1, 2, or 3)
|
u8 EECycleSkip; // EE Cycle skip factor (0, 1, 2, or 3)
|
||||||
|
|
||||||
SpeedhackOptions();
|
SpeedhackOptions();
|
||||||
void LoadSave(IniInterface& conf);
|
void LoadSave(SettingsWrapper& conf);
|
||||||
SpeedhackOptions& DisableAll();
|
SpeedhackOptions& DisableAll();
|
||||||
|
|
||||||
void Set(SpeedhackId id, bool enabled = true);
|
void Set(SpeedhackId id, bool enabled = true);
|
||||||
|
@ -463,7 +464,7 @@ struct Pcsx2Config
|
||||||
u32 MemoryViewBytesPerRow;
|
u32 MemoryViewBytesPerRow;
|
||||||
|
|
||||||
DebugOptions();
|
DebugOptions();
|
||||||
void LoadSave( IniInterface& conf );
|
void LoadSave( SettingsWrapper& wrap);
|
||||||
|
|
||||||
bool operator ==( const DebugOptions& right ) const
|
bool operator ==( const DebugOptions& right ) const
|
||||||
{
|
{
|
||||||
|
@ -487,7 +488,7 @@ struct Pcsx2Config
|
||||||
double TurboScalar{2.0};
|
double TurboScalar{2.0};
|
||||||
double SlomoScalar{0.5};
|
double SlomoScalar{0.5};
|
||||||
|
|
||||||
void LoadSave(IniInterface& conf);
|
void LoadSave(SettingsWrapper& wrap);
|
||||||
void SanityCheck();
|
void SanityCheck();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -516,7 +517,7 @@ struct Pcsx2Config
|
||||||
std::string Bios;
|
std::string Bios;
|
||||||
|
|
||||||
FilenameOptions();
|
FilenameOptions();
|
||||||
void LoadSave(IniInterface& conf);
|
void LoadSave(SettingsWrapper& wrap);
|
||||||
|
|
||||||
bool operator==(const FilenameOptions& right) const
|
bool operator==(const FilenameOptions& right) const
|
||||||
{
|
{
|
||||||
|
@ -600,13 +601,8 @@ struct Pcsx2Config
|
||||||
LimiterModeType LimiterMode = LimiterModeType::Nominal;
|
LimiterModeType LimiterMode = LimiterModeType::Nominal;
|
||||||
|
|
||||||
Pcsx2Config();
|
Pcsx2Config();
|
||||||
void LoadSave( IniInterface& ini );
|
void LoadSave(SettingsWrapper& wrap);
|
||||||
void LoadSaveMemcards( IniInterface& ini );
|
void LoadSaveMemcards(SettingsWrapper& wrap);
|
||||||
|
|
||||||
void Load( const wxString& srcfile );
|
|
||||||
void Load( const wxInputStream& srcstream );
|
|
||||||
void Save( const wxString& dstfile );
|
|
||||||
void Save( const wxOutputStream& deststream );
|
|
||||||
|
|
||||||
// TODO: Make these std::string when we remove wxFile...
|
// TODO: Make these std::string when we remove wxFile...
|
||||||
wxString FullpathToBios() const;
|
wxString FullpathToBios() const;
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
|
|
||||||
#include <wx/fileconf.h>
|
#include <wx/fileconf.h>
|
||||||
|
|
||||||
#include "common/IniInterface.h"
|
#include "common/SettingsInterface.h"
|
||||||
|
#include "common/SettingsWrapper.h"
|
||||||
|
#include "common/StringUtil.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
#include "CDVD/CDVDaccess.h"
|
#include "CDVD/CDVDaccess.h"
|
||||||
|
@ -27,17 +29,17 @@
|
||||||
#include "gui/AppConfig.h"
|
#include "gui/AppConfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void TraceLogFilters::LoadSave( IniInterface& ini )
|
void TraceLogFilters::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"TraceLog" );
|
SettingsWrapSection("EmuCore/TraceLog");
|
||||||
|
|
||||||
IniEntry( Enabled );
|
SettingsWrapEntry(Enabled);
|
||||||
|
|
||||||
// Retaining backwards compat of the trace log enablers isn't really important, and
|
// Retaining backwards compat of the trace log enablers isn't really important, and
|
||||||
// doing each one by hand would be murder. So let's cheat and just save it as an int:
|
// doing each one by hand would be murder. So let's cheat and just save it as an int:
|
||||||
|
|
||||||
IniEntry( EE.bitset );
|
SettingsWrapEntry(EE.bitset);
|
||||||
IniEntry( IOP.bitset );
|
SettingsWrapEntry(IOP.bitset);
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxChar* const tbl_SpeedhackNames[] =
|
const wxChar* const tbl_SpeedhackNames[] =
|
||||||
|
@ -85,29 +87,29 @@ Pcsx2Config::SpeedhackOptions& Pcsx2Config::SpeedhackOptions::DisableAll()
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::SpeedhackOptions::LoadSave(IniInterface& ini)
|
void Pcsx2Config::SpeedhackOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path(ini, L"Speedhacks");
|
SettingsWrapSection("EmuCore/Speedhacks");
|
||||||
|
|
||||||
IniBitfield(EECycleRate);
|
SettingsWrapBitfield(EECycleRate);
|
||||||
IniBitfield(EECycleSkip);
|
SettingsWrapBitfield(EECycleSkip);
|
||||||
IniBitBool(fastCDVD);
|
SettingsWrapBitBool(fastCDVD);
|
||||||
IniBitBool(IntcStat);
|
SettingsWrapBitBool(IntcStat);
|
||||||
IniBitBool(WaitLoop);
|
SettingsWrapBitBool(WaitLoop);
|
||||||
IniBitBool(vuFlagHack);
|
SettingsWrapBitBool(vuFlagHack);
|
||||||
IniBitBool(vuThread);
|
SettingsWrapBitBool(vuThread);
|
||||||
IniBitBool(vu1Instant);
|
SettingsWrapBitBool(vu1Instant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::ProfilerOptions::LoadSave( IniInterface& ini )
|
void Pcsx2Config::ProfilerOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"Profiler" );
|
SettingsWrapSection("EmuCore/Profiler");
|
||||||
|
|
||||||
IniBitBool( Enabled );
|
SettingsWrapBitBool(Enabled);
|
||||||
IniBitBool( RecBlocks_EE );
|
SettingsWrapBitBool(RecBlocks_EE);
|
||||||
IniBitBool( RecBlocks_IOP );
|
SettingsWrapBitBool(RecBlocks_IOP);
|
||||||
IniBitBool( RecBlocks_VU0 );
|
SettingsWrapBitBool(RecBlocks_VU0);
|
||||||
IniBitBool( RecBlocks_VU1 );
|
SettingsWrapBitBool(RecBlocks_VU1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pcsx2Config::RecompilerOptions::RecompilerOptions()
|
Pcsx2Config::RecompilerOptions::RecompilerOptions()
|
||||||
|
@ -156,8 +158,10 @@ void Pcsx2Config::RecompilerOptions::ApplySanityCheck()
|
||||||
|
|
||||||
bool vuIsOk = true;
|
bool vuIsOk = true;
|
||||||
|
|
||||||
if( vuExtraOverflow ) vuIsOk = vuIsOk && vuOverflow;
|
if (vuExtraOverflow)
|
||||||
if( vuSignOverflow ) vuIsOk = vuIsOk && vuExtraOverflow;
|
vuIsOk = vuIsOk && vuOverflow;
|
||||||
|
if (vuSignOverflow)
|
||||||
|
vuIsOk = vuIsOk && vuExtraOverflow;
|
||||||
|
|
||||||
if (!vuIsOk)
|
if (!vuIsOk)
|
||||||
{
|
{
|
||||||
|
@ -169,28 +173,28 @@ void Pcsx2Config::RecompilerOptions::ApplySanityCheck()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::RecompilerOptions::LoadSave( IniInterface& ini )
|
void Pcsx2Config::RecompilerOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"Recompiler" );
|
SettingsWrapSection("EmuCore/CPU/Recompiler");
|
||||||
|
|
||||||
IniBitBool( EnableEE );
|
SettingsWrapBitBool(EnableEE);
|
||||||
IniBitBool( EnableIOP );
|
SettingsWrapBitBool(EnableIOP);
|
||||||
IniBitBool( EnableEECache );
|
SettingsWrapBitBool(EnableEECache);
|
||||||
IniBitBool( EnableVU0 );
|
SettingsWrapBitBool(EnableVU0);
|
||||||
IniBitBool( EnableVU1 );
|
SettingsWrapBitBool(EnableVU1);
|
||||||
|
|
||||||
IniBitBool( vuOverflow );
|
SettingsWrapBitBool(vuOverflow);
|
||||||
IniBitBool( vuExtraOverflow );
|
SettingsWrapBitBool(vuExtraOverflow);
|
||||||
IniBitBool( vuSignOverflow );
|
SettingsWrapBitBool(vuSignOverflow);
|
||||||
IniBitBool( vuUnderflow );
|
SettingsWrapBitBool(vuUnderflow);
|
||||||
|
|
||||||
IniBitBool( fpuOverflow );
|
SettingsWrapBitBool(fpuOverflow);
|
||||||
IniBitBool( fpuExtraOverflow );
|
SettingsWrapBitBool(fpuExtraOverflow);
|
||||||
IniBitBool( fpuFullMode );
|
SettingsWrapBitBool(fpuFullMode);
|
||||||
|
|
||||||
IniBitBool( StackFrameChecks );
|
SettingsWrapBitBool(StackFrameChecks);
|
||||||
IniBitBool( PreBlockCheckEE );
|
SettingsWrapBitBool(PreBlockCheckEE);
|
||||||
IniBitBool( PreBlockCheckIOP );
|
SettingsWrapBitBool(PreBlockCheckIOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pcsx2Config::CpuOptions::CpuOptions()
|
Pcsx2Config::CpuOptions::CpuOptions()
|
||||||
|
@ -207,62 +211,62 @@ void Pcsx2Config::CpuOptions::ApplySanityCheck()
|
||||||
Recompiler.ApplySanityCheck();
|
Recompiler.ApplySanityCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::CpuOptions::LoadSave( IniInterface& ini )
|
void Pcsx2Config::CpuOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"CPU" );
|
SettingsWrapSection("EmuCore/CPU");
|
||||||
|
|
||||||
IniBitBoolEx( sseMXCSR.DenormalsAreZero, "FPU.DenormalsAreZero" );
|
SettingsWrapBitBoolEx(sseMXCSR.DenormalsAreZero, "FPU.DenormalsAreZero");
|
||||||
IniBitBoolEx( sseMXCSR.FlushToZero, "FPU.FlushToZero" );
|
SettingsWrapBitBoolEx(sseMXCSR.FlushToZero, "FPU.FlushToZero");
|
||||||
IniBitfieldEx( sseMXCSR.RoundingControl, "FPU.Roundmode" );
|
SettingsWrapBitfieldEx(sseMXCSR.RoundingControl, "FPU.Roundmode");
|
||||||
|
|
||||||
IniBitBoolEx( sseVUMXCSR.DenormalsAreZero, "VU.DenormalsAreZero" );
|
SettingsWrapBitBoolEx(sseVUMXCSR.DenormalsAreZero, "VU.DenormalsAreZero");
|
||||||
IniBitBoolEx( sseVUMXCSR.FlushToZero, "VU.FlushToZero" );
|
SettingsWrapBitBoolEx(sseVUMXCSR.FlushToZero, "VU.FlushToZero");
|
||||||
IniBitfieldEx( sseVUMXCSR.RoundingControl, "VU.Roundmode" );
|
SettingsWrapBitfieldEx(sseVUMXCSR.RoundingControl, "VU.Roundmode");
|
||||||
|
|
||||||
Recompiler.LoadSave( ini );
|
Recompiler.LoadSave(wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
|
void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"GS" );
|
SettingsWrapSection("EmuCore/GS");
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
IniEntry( SynchronousMTGS );
|
SettingsWrapEntry(SynchronousMTGS);
|
||||||
#endif
|
#endif
|
||||||
IniEntry( VsyncQueueSize );
|
SettingsWrapEntry(VsyncQueueSize);
|
||||||
|
|
||||||
IniEntry( FrameLimitEnable );
|
SettingsWrapEntry(FrameLimitEnable);
|
||||||
IniEntry( FrameSkipEnable );
|
SettingsWrapEntry(FrameSkipEnable);
|
||||||
ini.EnumEntry( L"VsyncEnable", VsyncEnable, NULL, VsyncEnable );
|
wrap.EnumEntry(CURRENT_SETTINGS_SECTION, "VsyncEnable", VsyncEnable, NULL, VsyncEnable);
|
||||||
|
|
||||||
IniEntry( LimitScalar );
|
SettingsWrapEntry(LimitScalar);
|
||||||
IniEntry( FramerateNTSC );
|
SettingsWrapEntry(FramerateNTSC);
|
||||||
IniEntry( FrameratePAL );
|
SettingsWrapEntry(FrameratePAL);
|
||||||
|
|
||||||
IniEntry( FramesToDraw );
|
SettingsWrapEntry(FramesToDraw);
|
||||||
IniEntry( FramesToSkip );
|
SettingsWrapEntry(FramesToSkip);
|
||||||
|
|
||||||
static const wxChar* AspectRatioNames[] =
|
static const char* AspectRatioNames[] =
|
||||||
{
|
{
|
||||||
L"Stretch",
|
"Stretch",
|
||||||
L"4:3",
|
"4:3",
|
||||||
L"16:9",
|
"16:9",
|
||||||
// WARNING: array must be NULL terminated to compute it size
|
// WARNING: array must be NULL terminated to compute it size
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
#ifdef PCSX2_CORE
|
#ifdef PCSX2_CORE
|
||||||
ini.EnumEntry(L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio);
|
wrap.EnumEntry("AspectRatio", AspectRatio, AspectRatioNames, AspectRatio);
|
||||||
|
|
||||||
static const wxChar* FMVAspectRatioSwitchNames[] =
|
static const char* FMVAspectRatioSwitchNames[] =
|
||||||
{
|
{
|
||||||
L"Off",
|
"Off",
|
||||||
L"4:3",
|
"4:3",
|
||||||
L"16:9",
|
"16:9",
|
||||||
// WARNING: array must be NULL terminated to compute it size
|
// WARNING: array must be NULL terminated to compute it size
|
||||||
NULL};
|
NULL};
|
||||||
ini.EnumEntry(L"FMVAspectRatioSwitch", FMVAspectRatioSwitch, FMVAspectRatioSwitchNames, FMVAspectRatioSwitch);
|
wrap.EnumEntry("FMVAspectRatioSwitch", FMVAspectRatioSwitch, FMVAspectRatioSwitchNames, FMVAspectRatioSwitch);
|
||||||
|
|
||||||
IniEntry(Zoom);
|
SettingsWrapEntry(Zoom);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,12 +277,17 @@ int Pcsx2Config::GSOptions::GetVsync() const
|
||||||
|
|
||||||
// D3D only support a boolean state. OpenGL waits a number of vsync
|
// D3D only support a boolean state. OpenGL waits a number of vsync
|
||||||
// interrupt (negative value for late vsync).
|
// interrupt (negative value for late vsync).
|
||||||
switch (VsyncEnable) {
|
switch (VsyncEnable)
|
||||||
case VsyncMode::Adaptive: return -1;
|
{
|
||||||
case VsyncMode::Off: return 0;
|
case VsyncMode::Adaptive:
|
||||||
case VsyncMode::On: return 1;
|
return -1;
|
||||||
|
case VsyncMode::Off:
|
||||||
|
return 0;
|
||||||
|
case VsyncMode::On:
|
||||||
|
return 1;
|
||||||
|
|
||||||
default: return 0;
|
default:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,9 +343,11 @@ void Pcsx2Config::GamefixOptions::Set( const wxString& list, bool enabled )
|
||||||
GamefixId i;
|
GamefixId i;
|
||||||
for (i = GamefixId_FIRST; i < pxEnumEnd; ++i)
|
for (i = GamefixId_FIRST; i < pxEnumEnd; ++i)
|
||||||
{
|
{
|
||||||
if( token.CmpNoCase( EnumToString(i) ) == 0 ) break;
|
if (token.CmpNoCase(EnumToString(i)) == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if( i < pxEnumEnd ) Set( i );
|
if (i < pxEnumEnd)
|
||||||
|
Set(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,25 +400,25 @@ bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const
|
||||||
return false; // unreachable, but we still need to suppress warnings >_<
|
return false; // unreachable, but we still need to suppress warnings >_<
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
|
void Pcsx2Config::GamefixOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"Gamefixes" );
|
SettingsWrapSection("EmuCore/Gamefixes");
|
||||||
|
|
||||||
IniBitBool( VuAddSubHack );
|
SettingsWrapBitBool( VuAddSubHack );
|
||||||
IniBitBool( FpuMulHack );
|
SettingsWrapBitBool( FpuMulHack );
|
||||||
IniBitBool( FpuNegDivHack );
|
SettingsWrapBitBool( FpuNegDivHack );
|
||||||
IniBitBool( XgKickHack );
|
SettingsWrapBitBool( XgKickHack );
|
||||||
IniBitBool( EETimingHack );
|
SettingsWrapBitBool( EETimingHack );
|
||||||
IniBitBool( SkipMPEGHack );
|
SettingsWrapBitBool( SkipMPEGHack );
|
||||||
IniBitBool( OPHFlagHack );
|
SettingsWrapBitBool( OPHFlagHack );
|
||||||
IniBitBool( DMABusyHack );
|
SettingsWrapBitBool( DMABusyHack );
|
||||||
IniBitBool( VIFFIFOHack );
|
SettingsWrapBitBool( VIFFIFOHack );
|
||||||
IniBitBool( VIF1StallHack );
|
SettingsWrapBitBool( VIF1StallHack );
|
||||||
IniBitBool( GIFFIFOHack );
|
SettingsWrapBitBool( GIFFIFOHack );
|
||||||
IniBitBool( GoemonTlbHack );
|
SettingsWrapBitBool( GoemonTlbHack );
|
||||||
IniBitBool( IbitHack );
|
SettingsWrapBitBool( IbitHack );
|
||||||
IniBitBool( VUKickstartHack );
|
SettingsWrapBitBool( VUKickstartHack );
|
||||||
IniBitBool( VUOverflowHack );
|
SettingsWrapBitBool( VUOverflowHack );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -422,33 +433,32 @@ Pcsx2Config::DebugOptions::DebugOptions()
|
||||||
MemoryViewBytesPerRow = 16;
|
MemoryViewBytesPerRow = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini )
|
void Pcsx2Config::DebugOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"Debugger" );
|
SettingsWrapSection("EmuCore/Debugger");
|
||||||
|
|
||||||
IniBitBool( ShowDebuggerOnStart );
|
SettingsWrapBitBool(ShowDebuggerOnStart);
|
||||||
IniBitBool( AlignMemoryWindowStart );
|
SettingsWrapBitBool(AlignMemoryWindowStart);
|
||||||
IniBitfield( FontWidth );
|
SettingsWrapBitfield(FontWidth);
|
||||||
IniBitfield( FontHeight );
|
SettingsWrapBitfield(FontHeight);
|
||||||
IniBitfield( WindowWidth );
|
SettingsWrapBitfield(WindowWidth);
|
||||||
IniBitfield( WindowHeight );
|
SettingsWrapBitfield(WindowHeight);
|
||||||
IniBitfield( MemoryViewBytesPerRow );
|
SettingsWrapBitfield(MemoryViewBytesPerRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pcsx2Config::FilenameOptions::FilenameOptions()
|
Pcsx2Config::FilenameOptions::FilenameOptions()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::FilenameOptions::LoadSave(IniInterface& ini)
|
void Pcsx2Config::FilenameOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path(ini, L"Filenames");
|
SettingsWrapSection("Filenames");
|
||||||
|
|
||||||
ini.Entry(L"BIOS", Bios, Bios);
|
wrap.Entry(CURRENT_SETTINGS_SECTION, "BIOS", Bios, Bios);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pcsx2Config::FolderOptions::FolderOptions()
|
Pcsx2Config::FolderOptions::FolderOptions()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::FramerateOptions::SanityCheck()
|
void Pcsx2Config::FramerateOptions::SanityCheck()
|
||||||
|
@ -460,16 +470,16 @@ void Pcsx2Config::FramerateOptions::SanityCheck()
|
||||||
SlomoScalar = std::clamp(SlomoScalar, 0.05, 10.0);
|
SlomoScalar = std::clamp(SlomoScalar, 0.05, 10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::FramerateOptions::LoadSave(IniInterface& ini)
|
void Pcsx2Config::FramerateOptions::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path(ini, L"Framerate");
|
SettingsWrapSection("Framerate");
|
||||||
|
|
||||||
IniEntry(NominalScalar);
|
SettingsWrapEntry(NominalScalar);
|
||||||
IniEntry(TurboScalar);
|
SettingsWrapEntry(TurboScalar);
|
||||||
IniEntry(SlomoScalar);
|
SettingsWrapEntry(SlomoScalar);
|
||||||
|
|
||||||
IniEntry(SkipOnLimit);
|
SettingsWrapEntry(SkipOnLimit);
|
||||||
IniEntry(SkipOnTurbo);
|
SettingsWrapEntry(SkipOnTurbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pcsx2Config::Pcsx2Config()
|
Pcsx2Config::Pcsx2Config()
|
||||||
|
@ -500,72 +510,68 @@ Pcsx2Config::Pcsx2Config()
|
||||||
CdvdSource = CDVD_SourceType::Iso;
|
CdvdSource = CDVD_SourceType::Iso;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::LoadSave( IniInterface& ini )
|
void Pcsx2Config::LoadSave(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"EmuCore" );
|
SettingsWrapSection("EmuCore");
|
||||||
|
|
||||||
IniBitBool( CdvdVerboseReads );
|
SettingsWrapBitBool(CdvdVerboseReads);
|
||||||
IniBitBool( CdvdDumpBlocks );
|
SettingsWrapBitBool(CdvdDumpBlocks);
|
||||||
IniBitBool( CdvdShareWrite );
|
SettingsWrapBitBool(CdvdShareWrite);
|
||||||
IniBitBool( EnablePatches );
|
SettingsWrapBitBool(EnablePatches);
|
||||||
IniBitBool( EnableCheats );
|
SettingsWrapBitBool(EnableCheats);
|
||||||
IniBitBool( EnableIPC );
|
SettingsWrapBitBool(EnableIPC);
|
||||||
IniBitBool( EnableWideScreenPatches );
|
SettingsWrapBitBool(EnableWideScreenPatches);
|
||||||
#ifndef DISABLE_RECORDING
|
#ifndef DISABLE_RECORDING
|
||||||
IniBitBool( EnableRecordingTools );
|
SettingsWrapBitBool(EnableRecordingTools);
|
||||||
#endif
|
#endif
|
||||||
IniBitBool( ConsoleToStdio );
|
SettingsWrapBitBool(ConsoleToStdio);
|
||||||
IniBitBool( HostFs );
|
SettingsWrapBitBool(HostFs);
|
||||||
|
|
||||||
IniBitBool( BackupSavestate );
|
SettingsWrapBitBool(BackupSavestate);
|
||||||
IniBitBool( McdEnableEjection );
|
SettingsWrapBitBool(McdEnableEjection);
|
||||||
IniBitBool( McdFolderAutoManage );
|
SettingsWrapBitBool(McdFolderAutoManage);
|
||||||
IniBitBool( MultitapPort0_Enabled );
|
SettingsWrapBitBool(MultitapPort0_Enabled);
|
||||||
IniBitBool( MultitapPort1_Enabled );
|
SettingsWrapBitBool(MultitapPort1_Enabled);
|
||||||
|
|
||||||
// Process various sub-components:
|
// Process various sub-components:
|
||||||
|
|
||||||
Speedhacks .LoadSave( ini );
|
Speedhacks.LoadSave(wrap);
|
||||||
Cpu .LoadSave( ini );
|
Cpu.LoadSave(wrap);
|
||||||
GS .LoadSave( ini );
|
GS.LoadSave(wrap);
|
||||||
Gamefixes .LoadSave( ini );
|
Gamefixes.LoadSave(wrap);
|
||||||
Profiler .LoadSave( ini );
|
Profiler.LoadSave(wrap);
|
||||||
|
|
||||||
Debugger .LoadSave( ini );
|
Debugger.LoadSave(wrap);
|
||||||
Trace .LoadSave( ini );
|
Trace.LoadSave(wrap);
|
||||||
|
|
||||||
IniEntry(GzipIsoIndexTemplate);
|
SettingsWrapEntry(GzipIsoIndexTemplate);
|
||||||
|
|
||||||
// For now, this in the derived config for backwards ini compatibility.
|
// For now, this in the derived config for backwards ini compatibility.
|
||||||
#ifdef PCSX2_CORE
|
#ifdef PCSX2_CORE
|
||||||
BaseFilenames.LoadSave(ini);
|
BaseFilenames.LoadSave(wrap);
|
||||||
Framerate.LoadSave(ini);
|
Framerate.LoadSave(wrap);
|
||||||
LoadSaveMemcards(ini);
|
LoadSaveMemcards(wrap);
|
||||||
|
|
||||||
IniEntry(GzipIsoIndexTemplate);
|
SettingsWrapEntry(GzipIsoIndexTemplate);
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
IniEntry(McdCompressNTFS);
|
SettingsWrapEntry(McdCompressNTFS);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ini.IsLoading())
|
if (wrap.IsLoading())
|
||||||
{
|
{
|
||||||
CurrentAspectRatio = GS.AspectRatio;
|
CurrentAspectRatio = GS.AspectRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.Flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::LoadSaveMemcards( IniInterface& ini )
|
void Pcsx2Config::LoadSaveMemcards(SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
ScopedIniGroup path( ini, L"MemoryCards" );
|
|
||||||
|
|
||||||
for (uint slot = 0; slot < 2; ++slot)
|
for (uint slot = 0; slot < 2; ++slot)
|
||||||
{
|
{
|
||||||
ini.Entry( pxsFmt( L"Slot%u_Enable", slot+1 ),
|
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Slot%u_Enable", slot + 1).c_str(),
|
||||||
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
||||||
ini.Entry( pxsFmt( L"Slot%u_Filename", slot+1 ),
|
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Slot%u_Filename", slot + 1).c_str(),
|
||||||
Mcd[slot].Filename, Mcd[slot].Filename);
|
Mcd[slot].Filename, Mcd[slot].Filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,9 +580,9 @@ void Pcsx2Config::LoadSaveMemcards( IniInterface& ini )
|
||||||
int mtport = FileMcd_GetMtapPort(slot) + 1;
|
int mtport = FileMcd_GetMtapPort(slot) + 1;
|
||||||
int mtslot = FileMcd_GetMtapSlot(slot) + 1;
|
int mtslot = FileMcd_GetMtapSlot(slot) + 1;
|
||||||
|
|
||||||
ini.Entry( pxsFmt( L"Multitap%u_Slot%u_Enable", mtport, mtslot ),
|
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Multitap%u_Slot%u_Enable", mtport, mtslot).c_str(),
|
||||||
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
||||||
ini.Entry( pxsFmt( L"Multitap%u_Slot%u_Filename", mtport, mtslot ),
|
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Multitap%u_Slot%u_Filename", mtport, mtslot).c_str(),
|
||||||
Mcd[slot].Filename, Mcd[slot].Filename);
|
Mcd[slot].Filename, Mcd[slot].Filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,24 +593,6 @@ bool Pcsx2Config::MultitapEnabled( uint port ) const
|
||||||
return (port == 0) ? MultitapPort0_Enabled : MultitapPort1_Enabled;
|
return (port == 0) ? MultitapPort0_Enabled : MultitapPort1_Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2Config::Load( const wxString& srcfile )
|
|
||||||
{
|
|
||||||
//m_IsLoaded = true;
|
|
||||||
|
|
||||||
wxFileConfig cfg( srcfile );
|
|
||||||
IniLoader loader( cfg );
|
|
||||||
LoadSave( loader );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Pcsx2Config::Save( const wxString& dstfile )
|
|
||||||
{
|
|
||||||
//if( !m_IsLoaded ) return;
|
|
||||||
|
|
||||||
wxFileConfig cfg( dstfile );
|
|
||||||
IniSaver saver( cfg );
|
|
||||||
LoadSave( saver );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString Pcsx2Config::FullpathToBios() const
|
wxString Pcsx2Config::FullpathToBios() const
|
||||||
{
|
{
|
||||||
return Path::Combine(Folders.Bios, wxString(BaseFilenames.Bios));
|
return Path::Combine(Folders.Bios, wxString(BaseFilenames.Bios));
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "MainFrame.h"
|
#include "MainFrame.h"
|
||||||
|
|
||||||
#include "common/IniInterface.h"
|
#include "common/IniInterface.h"
|
||||||
|
#include "common/SettingsWrapper.h"
|
||||||
|
#include "wxSettingsInterface.h"
|
||||||
|
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include "DebugTools/Debug.h"
|
#include "DebugTools/Debug.h"
|
||||||
|
@ -549,29 +551,29 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void AppConfig::LoadSave( IniInterface& ini )
|
void AppConfig::LoadSave(IniInterface& ini, SettingsWrapper& wrap)
|
||||||
{
|
{
|
||||||
|
// do all the wx stuff first so it doesn't screw with the wrapper's path
|
||||||
LoadSaveRootItems( ini );
|
LoadSaveRootItems( ini );
|
||||||
EmuOptions.LoadSaveMemcards( ini );
|
|
||||||
|
|
||||||
// Process various sub-components:
|
|
||||||
ProgLogBox.LoadSave(ini, L"ProgramLog");
|
ProgLogBox.LoadSave(ini, L"ProgramLog");
|
||||||
|
|
||||||
Folders.LoadSave(ini);
|
Folders.LoadSave(ini);
|
||||||
|
|
||||||
// sync the EmuOptions folders with what we loaded. what a mess this is....
|
// sync the EmuOptions folders with what we loaded. what a mess this is....
|
||||||
if (ini.IsLoading())
|
if (ini.IsLoading())
|
||||||
EmuOptions.Folders = EmuConfig.Folders;
|
EmuOptions.Folders = EmuConfig.Folders;
|
||||||
|
|
||||||
EmuOptions.BaseFilenames.LoadSave( ini );
|
|
||||||
GSWindow.LoadSave(ini);
|
GSWindow.LoadSave(ini);
|
||||||
EmuOptions.Framerate .LoadSave( ini );
|
|
||||||
#ifndef DISABLE_RECORDING
|
#ifndef DISABLE_RECORDING
|
||||||
inputRecording.loadSave(ini);
|
inputRecording.loadSave(ini);
|
||||||
#endif
|
#endif
|
||||||
AudioCapture.LoadSave(ini);
|
AudioCapture.LoadSave(ini);
|
||||||
Templates.LoadSave(ini);
|
Templates.LoadSave(ini);
|
||||||
|
|
||||||
|
// Process various sub-components:
|
||||||
|
EmuOptions.LoadSaveMemcards(wrap);
|
||||||
|
EmuOptions.BaseFilenames.LoadSave(wrap);
|
||||||
|
EmuOptions.Framerate .LoadSave(wrap);
|
||||||
|
|
||||||
ini.Flush();
|
ini.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,8 +1117,10 @@ static void LoadUiSettings()
|
||||||
ConLog_LoadSaveSettings( loader );
|
ConLog_LoadSaveSettings( loader );
|
||||||
SysTraceLog_LoadSaveSettings( loader );
|
SysTraceLog_LoadSaveSettings( loader );
|
||||||
|
|
||||||
|
wxSettingsInterface wxsi(&loader.GetConfig());
|
||||||
|
SettingsLoadWrapper wrapper(wxsi);
|
||||||
g_Conf = std::make_unique<AppConfig>();
|
g_Conf = std::make_unique<AppConfig>();
|
||||||
g_Conf->LoadSave( loader );
|
g_Conf->LoadSave( loader, wrapper );
|
||||||
|
|
||||||
if( !wxFile::Exists( EmuConfig.CurrentIso ) )
|
if( !wxFile::Exists( EmuConfig.CurrentIso ) )
|
||||||
{
|
{
|
||||||
|
@ -1132,8 +1136,10 @@ static void LoadVmSettings()
|
||||||
// are regulated by the PCSX2 UI.
|
// are regulated by the PCSX2 UI.
|
||||||
|
|
||||||
std::unique_ptr<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
std::unique_ptr<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
||||||
|
wxSettingsInterface wxsi(vmini.get());
|
||||||
IniLoader vmloader(vmini.get());
|
IniLoader vmloader(vmini.get());
|
||||||
g_Conf->EmuOptions.LoadSave( vmloader );
|
SettingsLoadWrapper vmwrapper(wxsi);
|
||||||
|
g_Conf->EmuOptions.LoadSave( vmwrapper );
|
||||||
g_Conf->EmuOptions.GS.LimitScalar = g_Conf->EmuOptions.Framerate.NominalScalar;
|
g_Conf->EmuOptions.GS.LimitScalar = g_Conf->EmuOptions.Framerate.NominalScalar;
|
||||||
|
|
||||||
if (g_Conf->EnablePresets){
|
if (g_Conf->EnablePresets){
|
||||||
|
@ -1161,7 +1167,9 @@ static void SaveUiSettings()
|
||||||
sApp.GetRecentIsoManager().Add( EmuConfig.CurrentIso );
|
sApp.GetRecentIsoManager().Add( EmuConfig.CurrentIso );
|
||||||
|
|
||||||
AppIniSaver saver;
|
AppIniSaver saver;
|
||||||
g_Conf->LoadSave( saver );
|
wxSettingsInterface wxsi(&saver.GetConfig());
|
||||||
|
SettingsSaveWrapper wrapper(wxsi);
|
||||||
|
g_Conf->LoadSave( saver, wrapper );
|
||||||
ConLog_LoadSaveSettings( saver );
|
ConLog_LoadSaveSettings( saver );
|
||||||
SysTraceLog_LoadSaveSettings( saver );
|
SysTraceLog_LoadSaveSettings( saver );
|
||||||
|
|
||||||
|
@ -1171,8 +1179,10 @@ static void SaveUiSettings()
|
||||||
static void SaveVmSettings()
|
static void SaveVmSettings()
|
||||||
{
|
{
|
||||||
std::unique_ptr<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
std::unique_ptr<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
||||||
|
wxSettingsInterface wxsi(vmini.get());
|
||||||
IniSaver vmsaver(vmini.get());
|
IniSaver vmsaver(vmini.get());
|
||||||
g_Conf->EmuOptions.LoadSave( vmsaver );
|
SettingsSaveWrapper vmwrapper(wxsi);
|
||||||
|
g_Conf->EmuOptions.LoadSave(vmwrapper);
|
||||||
|
|
||||||
sApp.DispatchVmSettingsEvent( vmsaver );
|
sApp.DispatchVmSettingsEvent( vmsaver );
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
class SettingsWrapper;
|
||||||
|
|
||||||
enum DocsModeType
|
enum DocsModeType
|
||||||
{
|
{
|
||||||
// uses /home/user or /cwd for the program data. This is the default mode and is the most
|
// uses /home/user or /cwd for the program data. This is the default mode and is the most
|
||||||
|
@ -286,7 +288,7 @@ public:
|
||||||
public:
|
public:
|
||||||
AppConfig();
|
AppConfig();
|
||||||
|
|
||||||
void LoadSave( IniInterface& ini );
|
void LoadSave(IniInterface& ini, SettingsWrapper& wrap);
|
||||||
void LoadSaveRootItems(IniInterface& ini);
|
void LoadSaveRootItems(IniInterface& ini);
|
||||||
|
|
||||||
static int GetMaxPresetIndex();
|
static int GetMaxPresetIndex();
|
||||||
|
|
|
@ -203,7 +203,7 @@ void Panels::BiosSelectorPanel::OnEnumComplete(wxCommandEvent& evt)
|
||||||
if (m_EnumeratorThread.get() != enumThread || m_BiosList->size() < enumThread->Result.size())
|
if (m_EnumeratorThread.get() != enumThread || m_BiosList->size() < enumThread->Result.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const wxFileName& currentBios = g_Conf->EmuOptions.FullpathToBios();
|
const wxFileName currentBios = g_Conf->EmuOptions.FullpathToBios();
|
||||||
m_ComboBox->Clear(); // Clear the "Enumerating BIOSes..."
|
m_ComboBox->Clear(); // Clear the "Enumerating BIOSes..."
|
||||||
|
|
||||||
for (const std::pair<wxString, u32>& result : enumThread->Result)
|
for (const std::pair<wxString, u32>& result : enumThread->Result)
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
/* PCSX2 - PS2 Emulator for PCs
|
||||||
|
* Copyright (C) 2021 PCSX2 Dev Team
|
||||||
|
*
|
||||||
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||||
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||||
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
|
||||||
|
#include "wxSettingsInterface.h"
|
||||||
|
#include "common/Assertions.h"
|
||||||
|
|
||||||
|
wxSettingsInterface::wxSettingsInterface(wxConfigBase* config)
|
||||||
|
: m_config(config)
|
||||||
|
{
|
||||||
|
m_config->SetPath(wxEmptyString);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSettingsInterface::~wxSettingsInterface()
|
||||||
|
{
|
||||||
|
m_config->SetPath(wxEmptyString);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::CheckPath(const char* section) const
|
||||||
|
{
|
||||||
|
if (m_current_path.compare(section) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_current_path = section;
|
||||||
|
m_config->SetPath(wxString::Format("/%s", section));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::Save()
|
||||||
|
{
|
||||||
|
pxFailRel("Not implemented");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::Clear()
|
||||||
|
{
|
||||||
|
pxFailRel("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::GetIntValue(const char* section, const char* key, int* value) const
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
return m_config->Read(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::GetUIntValue(const char* section, const char* key, uint* value) const
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
|
||||||
|
long lvalue;
|
||||||
|
if (!m_config->Read(key, &lvalue))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return static_cast<uint>(lvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::GetFloatValue(const char* section, const char* key, float* value) const
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
return m_config->Read(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::GetDoubleValue(const char* section, const char* key, double* value) const
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
return m_config->Read(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::GetBoolValue(const char* section, const char* key, bool* value) const
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
wxString wxKey(key);
|
||||||
|
if (!m_config->HasEntry(wxKey))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
wxString ret = m_config->Read(wxKey);
|
||||||
|
*value = (ret == wxT("enabled") || ret == wxT("1"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::GetStringValue(const char* section, const char* key, std::string* value) const
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
wxString wxKey(key);
|
||||||
|
if (!m_config->HasEntry(wxKey))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
wxString ret = m_config->Read(wxKey);
|
||||||
|
*value = ret.ToStdString();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::SetIntValue(const char* section, const char* key, int value)
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
m_config->Write(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::SetUIntValue(const char* section, const char* key, uint value)
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
m_config->Write(key, static_cast<unsigned int>(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::SetFloatValue(const char* section, const char* key, float value)
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
m_config->Write(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::SetDoubleValue(const char* section, const char* key, double value)
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
m_config->Write(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::SetBoolValue(const char* section, const char* key, bool value)
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
m_config->Write(key, value ? wxT("enabled") : wxT("disabled"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::SetStringValue(const char* section, const char* key, const char* value)
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
m_config->Write(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> wxSettingsInterface::GetStringList(const char* section, const char* key)
|
||||||
|
{
|
||||||
|
pxFailRel("Not implemented");
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::SetStringList(const char* section, const char* key, const std::vector<std::string>& items)
|
||||||
|
{
|
||||||
|
pxFailRel("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::RemoveFromStringList(const char* section, const char* key, const char* item)
|
||||||
|
{
|
||||||
|
pxFailRel("Not implemented");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSettingsInterface::AddToStringList(const char* section, const char* key, const char* item)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::DeleteValue(const char* section, const char* key)
|
||||||
|
{
|
||||||
|
CheckPath(section);
|
||||||
|
m_config->DeleteEntry(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSettingsInterface::ClearSection(const char* section)
|
||||||
|
{
|
||||||
|
pxFailRel("Not implemented");
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
/* PCSX2 - PS2 Emulator for PCs
|
||||||
|
* Copyright (C) 2021 PCSX2 Dev Team
|
||||||
|
*
|
||||||
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||||
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||||
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <wx/confbase.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "common/SettingsInterface.h"
|
||||||
|
|
||||||
|
class wxSettingsInterface : public SettingsInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxSettingsInterface(wxConfigBase* config);
|
||||||
|
~wxSettingsInterface();
|
||||||
|
|
||||||
|
bool Save() override;
|
||||||
|
void Clear() override;
|
||||||
|
|
||||||
|
bool GetIntValue(const char* section, const char* key, int* value) const override;
|
||||||
|
bool GetUIntValue(const char* section, const char* key, uint* value) const override;
|
||||||
|
bool GetFloatValue(const char* section, const char* key, float* value) const override;
|
||||||
|
bool GetDoubleValue(const char* section, const char* key, double* value) const override;
|
||||||
|
bool GetBoolValue(const char* section, const char* key, bool* value) const override;
|
||||||
|
bool GetStringValue(const char* section, const char* key, std::string* value) const override;
|
||||||
|
|
||||||
|
void SetIntValue(const char* section, const char* key, int value) override;
|
||||||
|
void SetUIntValue(const char* section, const char* key, uint value) override;
|
||||||
|
void SetFloatValue(const char* section, const char* key, float value) override;
|
||||||
|
void SetDoubleValue(const char* section, const char* key, double value) override;
|
||||||
|
void SetBoolValue(const char* section, const char* key, bool value) override;
|
||||||
|
|
||||||
|
void SetStringValue(const char* section, const char* key, const char* value) override;
|
||||||
|
|
||||||
|
std::vector<std::string> GetStringList(const char* section, const char* key) override;
|
||||||
|
void SetStringList(const char* section, const char* key, const std::vector<std::string>& items) override;
|
||||||
|
bool RemoveFromStringList(const char* section, const char* key, const char* item) override;
|
||||||
|
bool AddToStringList(const char* section, const char* key, const char* item) override;
|
||||||
|
|
||||||
|
void DeleteValue(const char* section, const char* key) override;
|
||||||
|
void ClearSection(const char* section) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CheckPath(const char* section) const;
|
||||||
|
|
||||||
|
wxConfigBase* m_config;
|
||||||
|
mutable wxString m_current_path;
|
||||||
|
};
|
|
@ -320,6 +320,7 @@
|
||||||
<ClCompile Include="gui\pxRadioPanel.cpp" />
|
<ClCompile Include="gui\pxRadioPanel.cpp" />
|
||||||
<ClCompile Include="gui\ThreadingDialogs.cpp" />
|
<ClCompile Include="gui\ThreadingDialogs.cpp" />
|
||||||
<ClCompile Include="gui\wxAppWithHelpers.cpp" />
|
<ClCompile Include="gui\wxAppWithHelpers.cpp" />
|
||||||
|
<ClCompile Include="gui\wxSettingsInterface.cpp" />
|
||||||
<ClCompile Include="IopGte.cpp" />
|
<ClCompile Include="IopGte.cpp" />
|
||||||
<ClCompile Include="IPC.cpp" />
|
<ClCompile Include="IPC.cpp" />
|
||||||
<ClCompile Include="FW.cpp" />
|
<ClCompile Include="FW.cpp" />
|
||||||
|
@ -767,6 +768,7 @@
|
||||||
<ClInclude Include="gui\Panels\MemoryCardPanels.h" />
|
<ClInclude Include="gui\Panels\MemoryCardPanels.h" />
|
||||||
<ClInclude Include="gui\ThreadingDialogs.h" />
|
<ClInclude Include="gui\ThreadingDialogs.h" />
|
||||||
<ClInclude Include="gui\wxAppWithHelpers.h" />
|
<ClInclude Include="gui\wxAppWithHelpers.h" />
|
||||||
|
<ClInclude Include="gui\wxSettingsInterface.h" />
|
||||||
<ClInclude Include="Host.h" />
|
<ClInclude Include="Host.h" />
|
||||||
<ClInclude Include="IopGte.h" />
|
<ClInclude Include="IopGte.h" />
|
||||||
<ClInclude Include="IPC.h" />
|
<ClInclude Include="IPC.h" />
|
||||||
|
|
|
@ -1661,6 +1661,9 @@
|
||||||
<ClCompile Include="MemoryCardFolder.cpp">
|
<ClCompile Include="MemoryCardFolder.cpp">
|
||||||
<Filter>System\Ps2\Iop</Filter>
|
<Filter>System\Ps2\Iop</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="gui\wxSettingsInterface.cpp">
|
||||||
|
<Filter>AppHost</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Patch.h">
|
<ClInclude Include="Patch.h">
|
||||||
|
@ -2761,6 +2764,9 @@
|
||||||
<ClInclude Include="Host.h">
|
<ClInclude Include="Host.h">
|
||||||
<Filter>System\Include</Filter>
|
<Filter>System\Include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="gui\wxSettingsInterface.h">
|
||||||
|
<Filter>AppHost</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="windows\wxResources.rc">
|
<ResourceCompile Include="windows\wxResources.rc">
|
||||||
|
|
Loading…
Reference in New Issue