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/UpdateUI.cpp
|
||||
gui/wxAppWithHelpers.cpp
|
||||
gui/wxSettingsInterface.cpp
|
||||
)
|
||||
|
||||
# gui headers
|
||||
|
@ -1082,6 +1083,7 @@ set(pcsx2GuiHeaders
|
|||
gui/Saveslots.h
|
||||
gui/ThreadingDialogs.h
|
||||
gui/ThreadingDialogs.cpp
|
||||
gui/wxSettingsInterface.cpp
|
||||
)
|
||||
|
||||
# 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 <string>
|
||||
|
||||
class IniInterface;
|
||||
class SettingsInterface;
|
||||
class SettingsWrapper;
|
||||
|
||||
enum class CDVD_SourceType : uint8_t;
|
||||
|
||||
|
@ -191,7 +192,7 @@ struct TraceLogFilters
|
|||
Enabled = false;
|
||||
}
|
||||
|
||||
void LoadSave( IniInterface& ini );
|
||||
void LoadSave( SettingsWrapper& ini );
|
||||
|
||||
bool operator ==( const TraceLogFilters& right ) const
|
||||
{
|
||||
|
@ -230,7 +231,7 @@ struct Pcsx2Config
|
|||
|
||||
// Default is Disabled, with all recs enabled underneath.
|
||||
ProfilerOptions() : bitset( 0xfffffffe ) {}
|
||||
void LoadSave( IniInterface& conf );
|
||||
void LoadSave( SettingsWrapper& wrap);
|
||||
|
||||
bool operator ==( const ProfilerOptions& right ) const
|
||||
{
|
||||
|
@ -275,7 +276,7 @@ struct Pcsx2Config
|
|||
RecompilerOptions();
|
||||
void ApplySanityCheck();
|
||||
|
||||
void LoadSave( IniInterface& conf );
|
||||
void LoadSave( SettingsWrapper& wrap);
|
||||
|
||||
bool operator ==( const RecompilerOptions& right ) const
|
||||
{
|
||||
|
@ -298,7 +299,7 @@ struct Pcsx2Config
|
|||
SSE_MXCSR sseVUMXCSR;
|
||||
|
||||
CpuOptions();
|
||||
void LoadSave( IniInterface& conf );
|
||||
void LoadSave( SettingsWrapper& wrap);
|
||||
void ApplySanityCheck();
|
||||
|
||||
bool operator ==( const CpuOptions& right ) const
|
||||
|
@ -340,7 +341,7 @@ struct Pcsx2Config
|
|||
double OffsetX{0.0};
|
||||
double OffsetY{0.0};
|
||||
|
||||
void LoadSave( IniInterface& conf );
|
||||
void LoadSave( SettingsWrapper& wrap);
|
||||
|
||||
int GetVsync() const;
|
||||
|
||||
|
@ -393,7 +394,7 @@ struct Pcsx2Config
|
|||
BITFIELD_END
|
||||
|
||||
GamefixOptions();
|
||||
void LoadSave( IniInterface& conf );
|
||||
void LoadSave( SettingsWrapper& wrap);
|
||||
GamefixOptions& DisableAll();
|
||||
|
||||
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)
|
||||
|
||||
SpeedhackOptions();
|
||||
void LoadSave(IniInterface& conf);
|
||||
void LoadSave(SettingsWrapper& conf);
|
||||
SpeedhackOptions& DisableAll();
|
||||
|
||||
void Set(SpeedhackId id, bool enabled = true);
|
||||
|
@ -463,7 +464,7 @@ struct Pcsx2Config
|
|||
u32 MemoryViewBytesPerRow;
|
||||
|
||||
DebugOptions();
|
||||
void LoadSave( IniInterface& conf );
|
||||
void LoadSave( SettingsWrapper& wrap);
|
||||
|
||||
bool operator ==( const DebugOptions& right ) const
|
||||
{
|
||||
|
@ -487,7 +488,7 @@ struct Pcsx2Config
|
|||
double TurboScalar{2.0};
|
||||
double SlomoScalar{0.5};
|
||||
|
||||
void LoadSave(IniInterface& conf);
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
void SanityCheck();
|
||||
};
|
||||
|
||||
|
@ -516,7 +517,7 @@ struct Pcsx2Config
|
|||
std::string Bios;
|
||||
|
||||
FilenameOptions();
|
||||
void LoadSave(IniInterface& conf);
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
|
||||
bool operator==(const FilenameOptions& right) const
|
||||
{
|
||||
|
@ -600,13 +601,8 @@ struct Pcsx2Config
|
|||
LimiterModeType LimiterMode = LimiterModeType::Nominal;
|
||||
|
||||
Pcsx2Config();
|
||||
void LoadSave( IniInterface& ini );
|
||||
void LoadSaveMemcards( IniInterface& ini );
|
||||
|
||||
void Load( const wxString& srcfile );
|
||||
void Load( const wxInputStream& srcstream );
|
||||
void Save( const wxString& dstfile );
|
||||
void Save( const wxOutputStream& deststream );
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
void LoadSaveMemcards(SettingsWrapper& wrap);
|
||||
|
||||
// TODO: Make these std::string when we remove wxFile...
|
||||
wxString FullpathToBios() const;
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
|
||||
#include <wx/fileconf.h>
|
||||
|
||||
#include "common/IniInterface.h"
|
||||
#include "common/SettingsInterface.h"
|
||||
#include "common/SettingsWrapper.h"
|
||||
#include "common/StringUtil.h"
|
||||
#include "Config.h"
|
||||
#include "GS.h"
|
||||
#include "CDVD/CDVDaccess.h"
|
||||
|
@ -27,17 +29,17 @@
|
|||
#include "gui/AppConfig.h"
|
||||
#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
|
||||
// doing each one by hand would be murder. So let's cheat and just save it as an int:
|
||||
|
||||
IniEntry( EE.bitset );
|
||||
IniEntry( IOP.bitset );
|
||||
SettingsWrapEntry(EE.bitset);
|
||||
SettingsWrapEntry(IOP.bitset);
|
||||
}
|
||||
|
||||
const wxChar* const tbl_SpeedhackNames[] =
|
||||
|
@ -85,53 +87,53 @@ Pcsx2Config::SpeedhackOptions& Pcsx2Config::SpeedhackOptions::DisableAll()
|
|||
return *this;
|
||||
}
|
||||
|
||||
void Pcsx2Config::SpeedhackOptions::LoadSave(IniInterface& ini)
|
||||
void Pcsx2Config::SpeedhackOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
ScopedIniGroup path(ini, L"Speedhacks");
|
||||
SettingsWrapSection("EmuCore/Speedhacks");
|
||||
|
||||
IniBitfield(EECycleRate);
|
||||
IniBitfield(EECycleSkip);
|
||||
IniBitBool(fastCDVD);
|
||||
IniBitBool(IntcStat);
|
||||
IniBitBool(WaitLoop);
|
||||
IniBitBool(vuFlagHack);
|
||||
IniBitBool(vuThread);
|
||||
IniBitBool(vu1Instant);
|
||||
SettingsWrapBitfield(EECycleRate);
|
||||
SettingsWrapBitfield(EECycleSkip);
|
||||
SettingsWrapBitBool(fastCDVD);
|
||||
SettingsWrapBitBool(IntcStat);
|
||||
SettingsWrapBitBool(WaitLoop);
|
||||
SettingsWrapBitBool(vuFlagHack);
|
||||
SettingsWrapBitBool(vuThread);
|
||||
SettingsWrapBitBool(vu1Instant);
|
||||
}
|
||||
|
||||
void Pcsx2Config::ProfilerOptions::LoadSave( IniInterface& ini )
|
||||
void Pcsx2Config::ProfilerOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
ScopedIniGroup path( ini, L"Profiler" );
|
||||
SettingsWrapSection("EmuCore/Profiler");
|
||||
|
||||
IniBitBool( Enabled );
|
||||
IniBitBool( RecBlocks_EE );
|
||||
IniBitBool( RecBlocks_IOP );
|
||||
IniBitBool( RecBlocks_VU0 );
|
||||
IniBitBool( RecBlocks_VU1 );
|
||||
SettingsWrapBitBool(Enabled);
|
||||
SettingsWrapBitBool(RecBlocks_EE);
|
||||
SettingsWrapBitBool(RecBlocks_IOP);
|
||||
SettingsWrapBitBool(RecBlocks_VU0);
|
||||
SettingsWrapBitBool(RecBlocks_VU1);
|
||||
}
|
||||
|
||||
Pcsx2Config::RecompilerOptions::RecompilerOptions()
|
||||
{
|
||||
bitset = 0;
|
||||
bitset = 0;
|
||||
|
||||
//StackFrameChecks = false;
|
||||
//PreBlockCheckEE = false;
|
||||
|
||||
// All recs are enabled by default.
|
||||
|
||||
EnableEE = true;
|
||||
EnableEE = true;
|
||||
EnableEECache = false;
|
||||
EnableIOP = true;
|
||||
EnableVU0 = true;
|
||||
EnableVU1 = true;
|
||||
EnableIOP = true;
|
||||
EnableVU0 = true;
|
||||
EnableVU1 = true;
|
||||
|
||||
// vu and fpu clamping default to standard overflow.
|
||||
vuOverflow = true;
|
||||
vuOverflow = true;
|
||||
//vuExtraOverflow = false;
|
||||
//vuSignOverflow = false;
|
||||
//vuUnderflow = false;
|
||||
|
||||
fpuOverflow = true;
|
||||
fpuOverflow = true;
|
||||
//fpuExtraOverflow = false;
|
||||
//fpuFullMode = false;
|
||||
}
|
||||
|
@ -140,63 +142,65 @@ void Pcsx2Config::RecompilerOptions::ApplySanityCheck()
|
|||
{
|
||||
bool fpuIsRight = true;
|
||||
|
||||
if( fpuExtraOverflow )
|
||||
if (fpuExtraOverflow)
|
||||
fpuIsRight = fpuOverflow;
|
||||
|
||||
if( fpuFullMode )
|
||||
if (fpuFullMode)
|
||||
fpuIsRight = fpuOverflow && fpuExtraOverflow;
|
||||
|
||||
if( !fpuIsRight )
|
||||
if (!fpuIsRight)
|
||||
{
|
||||
// Values are wonky; assume the defaults.
|
||||
fpuOverflow = RecompilerOptions().fpuOverflow;
|
||||
fpuExtraOverflow= RecompilerOptions().fpuExtraOverflow;
|
||||
fpuFullMode = RecompilerOptions().fpuFullMode;
|
||||
fpuOverflow = RecompilerOptions().fpuOverflow;
|
||||
fpuExtraOverflow = RecompilerOptions().fpuExtraOverflow;
|
||||
fpuFullMode = RecompilerOptions().fpuFullMode;
|
||||
}
|
||||
|
||||
bool vuIsOk = true;
|
||||
|
||||
if( vuExtraOverflow ) vuIsOk = vuIsOk && vuOverflow;
|
||||
if( vuSignOverflow ) vuIsOk = vuIsOk && vuExtraOverflow;
|
||||
if (vuExtraOverflow)
|
||||
vuIsOk = vuIsOk && vuOverflow;
|
||||
if (vuSignOverflow)
|
||||
vuIsOk = vuIsOk && vuExtraOverflow;
|
||||
|
||||
if( !vuIsOk )
|
||||
if (!vuIsOk)
|
||||
{
|
||||
// Values are wonky; assume the defaults.
|
||||
vuOverflow = RecompilerOptions().vuOverflow;
|
||||
vuExtraOverflow = RecompilerOptions().vuExtraOverflow;
|
||||
vuSignOverflow = RecompilerOptions().vuSignOverflow;
|
||||
vuUnderflow = RecompilerOptions().vuUnderflow;
|
||||
vuOverflow = RecompilerOptions().vuOverflow;
|
||||
vuExtraOverflow = RecompilerOptions().vuExtraOverflow;
|
||||
vuSignOverflow = RecompilerOptions().vuSignOverflow;
|
||||
vuUnderflow = RecompilerOptions().vuUnderflow;
|
||||
}
|
||||
}
|
||||
|
||||
void Pcsx2Config::RecompilerOptions::LoadSave( IniInterface& ini )
|
||||
void Pcsx2Config::RecompilerOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
ScopedIniGroup path( ini, L"Recompiler" );
|
||||
SettingsWrapSection("EmuCore/CPU/Recompiler");
|
||||
|
||||
IniBitBool( EnableEE );
|
||||
IniBitBool( EnableIOP );
|
||||
IniBitBool( EnableEECache );
|
||||
IniBitBool( EnableVU0 );
|
||||
IniBitBool( EnableVU1 );
|
||||
SettingsWrapBitBool(EnableEE);
|
||||
SettingsWrapBitBool(EnableIOP);
|
||||
SettingsWrapBitBool(EnableEECache);
|
||||
SettingsWrapBitBool(EnableVU0);
|
||||
SettingsWrapBitBool(EnableVU1);
|
||||
|
||||
IniBitBool( vuOverflow );
|
||||
IniBitBool( vuExtraOverflow );
|
||||
IniBitBool( vuSignOverflow );
|
||||
IniBitBool( vuUnderflow );
|
||||
SettingsWrapBitBool(vuOverflow);
|
||||
SettingsWrapBitBool(vuExtraOverflow);
|
||||
SettingsWrapBitBool(vuSignOverflow);
|
||||
SettingsWrapBitBool(vuUnderflow);
|
||||
|
||||
IniBitBool( fpuOverflow );
|
||||
IniBitBool( fpuExtraOverflow );
|
||||
IniBitBool( fpuFullMode );
|
||||
SettingsWrapBitBool(fpuOverflow);
|
||||
SettingsWrapBitBool(fpuExtraOverflow);
|
||||
SettingsWrapBitBool(fpuFullMode);
|
||||
|
||||
IniBitBool( StackFrameChecks );
|
||||
IniBitBool( PreBlockCheckEE );
|
||||
IniBitBool( PreBlockCheckIOP );
|
||||
SettingsWrapBitBool(StackFrameChecks);
|
||||
SettingsWrapBitBool(PreBlockCheckEE);
|
||||
SettingsWrapBitBool(PreBlockCheckIOP);
|
||||
}
|
||||
|
||||
Pcsx2Config::CpuOptions::CpuOptions()
|
||||
{
|
||||
sseMXCSR.bitmask = DEFAULT_sseMXCSR;
|
||||
sseVUMXCSR.bitmask = DEFAULT_sseVUMXCSR;
|
||||
sseMXCSR.bitmask = DEFAULT_sseMXCSR;
|
||||
sseVUMXCSR.bitmask = DEFAULT_sseVUMXCSR;
|
||||
}
|
||||
|
||||
void Pcsx2Config::CpuOptions::ApplySanityCheck()
|
||||
|
@ -207,62 +211,62 @@ void Pcsx2Config::CpuOptions::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" );
|
||||
IniBitBoolEx( sseMXCSR.FlushToZero, "FPU.FlushToZero" );
|
||||
IniBitfieldEx( sseMXCSR.RoundingControl, "FPU.Roundmode" );
|
||||
SettingsWrapBitBoolEx(sseMXCSR.DenormalsAreZero, "FPU.DenormalsAreZero");
|
||||
SettingsWrapBitBoolEx(sseMXCSR.FlushToZero, "FPU.FlushToZero");
|
||||
SettingsWrapBitfieldEx(sseMXCSR.RoundingControl, "FPU.Roundmode");
|
||||
|
||||
IniBitBoolEx( sseVUMXCSR.DenormalsAreZero, "VU.DenormalsAreZero" );
|
||||
IniBitBoolEx( sseVUMXCSR.FlushToZero, "VU.FlushToZero" );
|
||||
IniBitfieldEx( sseVUMXCSR.RoundingControl, "VU.Roundmode" );
|
||||
SettingsWrapBitBoolEx(sseVUMXCSR.DenormalsAreZero, "VU.DenormalsAreZero");
|
||||
SettingsWrapBitBoolEx(sseVUMXCSR.FlushToZero, "VU.FlushToZero");
|
||||
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
|
||||
IniEntry( SynchronousMTGS );
|
||||
SettingsWrapEntry(SynchronousMTGS);
|
||||
#endif
|
||||
IniEntry( VsyncQueueSize );
|
||||
SettingsWrapEntry(VsyncQueueSize);
|
||||
|
||||
IniEntry( FrameLimitEnable );
|
||||
IniEntry( FrameSkipEnable );
|
||||
ini.EnumEntry( L"VsyncEnable", VsyncEnable, NULL, VsyncEnable );
|
||||
SettingsWrapEntry(FrameLimitEnable);
|
||||
SettingsWrapEntry(FrameSkipEnable);
|
||||
wrap.EnumEntry(CURRENT_SETTINGS_SECTION, "VsyncEnable", VsyncEnable, NULL, VsyncEnable);
|
||||
|
||||
IniEntry( LimitScalar );
|
||||
IniEntry( FramerateNTSC );
|
||||
IniEntry( FrameratePAL );
|
||||
SettingsWrapEntry(LimitScalar);
|
||||
SettingsWrapEntry(FramerateNTSC);
|
||||
SettingsWrapEntry(FrameratePAL);
|
||||
|
||||
IniEntry( FramesToDraw );
|
||||
IniEntry( FramesToSkip );
|
||||
SettingsWrapEntry(FramesToDraw);
|
||||
SettingsWrapEntry(FramesToSkip);
|
||||
|
||||
static const wxChar* AspectRatioNames[] =
|
||||
static const char* AspectRatioNames[] =
|
||||
{
|
||||
L"Stretch",
|
||||
L"4:3",
|
||||
L"16:9",
|
||||
"Stretch",
|
||||
"4:3",
|
||||
"16:9",
|
||||
// WARNING: array must be NULL terminated to compute it size
|
||||
NULL};
|
||||
|
||||
#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",
|
||||
L"4:3",
|
||||
L"16:9",
|
||||
"Off",
|
||||
"4:3",
|
||||
"16:9",
|
||||
// WARNING: array must be NULL terminated to compute it size
|
||||
NULL};
|
||||
ini.EnumEntry(L"FMVAspectRatioSwitch", FMVAspectRatioSwitch, FMVAspectRatioSwitchNames, FMVAspectRatioSwitch);
|
||||
wrap.EnumEntry("FMVAspectRatioSwitch", FMVAspectRatioSwitch, FMVAspectRatioSwitchNames, FMVAspectRatioSwitch);
|
||||
|
||||
IniEntry(Zoom);
|
||||
SettingsWrapEntry(Zoom);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -273,12 +277,17 @@ int Pcsx2Config::GSOptions::GetVsync() const
|
|||
|
||||
// D3D only support a boolean state. OpenGL waits a number of vsync
|
||||
// interrupt (negative value for late vsync).
|
||||
switch (VsyncEnable) {
|
||||
case VsyncMode::Adaptive: return -1;
|
||||
case VsyncMode::Off: return 0;
|
||||
case VsyncMode::On: return 1;
|
||||
switch (VsyncEnable)
|
||||
{
|
||||
case VsyncMode::Adaptive:
|
||||
return -1;
|
||||
case VsyncMode::Off:
|
||||
return 0;
|
||||
case VsyncMode::On:
|
||||
return 1;
|
||||
|
||||
default: return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,27 +332,29 @@ Pcsx2Config::GamefixOptions& Pcsx2Config::GamefixOptions::DisableAll()
|
|||
// If an unrecognized tag is encountered, a warning is printed to the console, but no error
|
||||
// is generated. This allows the system to function in the event that future versions of
|
||||
// PCSX2 remove old hacks once they become obsolete.
|
||||
void Pcsx2Config::GamefixOptions::Set( const wxString& list, bool enabled )
|
||||
void Pcsx2Config::GamefixOptions::Set(const wxString& list, bool enabled)
|
||||
{
|
||||
wxStringTokenizer izer( list, L",|", wxTOKEN_STRTOK );
|
||||
wxStringTokenizer izer(list, L",|", wxTOKEN_STRTOK);
|
||||
|
||||
while( izer.HasMoreTokens() )
|
||||
while (izer.HasMoreTokens())
|
||||
{
|
||||
wxString token( izer.GetNextToken() );
|
||||
wxString token(izer.GetNextToken());
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void Pcsx2Config::GamefixOptions::Set( GamefixId id, bool enabled )
|
||||
void Pcsx2Config::GamefixOptions::Set(GamefixId id, bool enabled)
|
||||
{
|
||||
EnumAssert( id );
|
||||
switch(id)
|
||||
EnumAssert(id);
|
||||
switch (id)
|
||||
{
|
||||
case Fix_VuAddSub: VuAddSubHack = enabled; break;
|
||||
case Fix_FpuMultiply: FpuMulHack = enabled; break;
|
||||
|
@ -364,10 +375,10 @@ void Pcsx2Config::GamefixOptions::Set( GamefixId id, bool enabled )
|
|||
}
|
||||
}
|
||||
|
||||
bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const
|
||||
bool Pcsx2Config::GamefixOptions::Get(GamefixId id) const
|
||||
{
|
||||
EnumAssert( id );
|
||||
switch(id)
|
||||
EnumAssert(id);
|
||||
switch (id)
|
||||
{
|
||||
case Fix_VuAddSub: return VuAddSubHack;
|
||||
case Fix_FpuMultiply: return FpuMulHack;
|
||||
|
@ -386,28 +397,28 @@ bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const
|
|||
case Fix_VUOverflow: return VUOverflowHack;
|
||||
jNO_DEFAULT;
|
||||
}
|
||||
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 );
|
||||
IniBitBool( FpuMulHack );
|
||||
IniBitBool( FpuNegDivHack );
|
||||
IniBitBool( XgKickHack );
|
||||
IniBitBool( EETimingHack );
|
||||
IniBitBool( SkipMPEGHack );
|
||||
IniBitBool( OPHFlagHack );
|
||||
IniBitBool( DMABusyHack );
|
||||
IniBitBool( VIFFIFOHack );
|
||||
IniBitBool( VIF1StallHack );
|
||||
IniBitBool( GIFFIFOHack );
|
||||
IniBitBool( GoemonTlbHack );
|
||||
IniBitBool( IbitHack );
|
||||
IniBitBool( VUKickstartHack );
|
||||
IniBitBool( VUOverflowHack );
|
||||
SettingsWrapBitBool( VuAddSubHack );
|
||||
SettingsWrapBitBool( FpuMulHack );
|
||||
SettingsWrapBitBool( FpuNegDivHack );
|
||||
SettingsWrapBitBool( XgKickHack );
|
||||
SettingsWrapBitBool( EETimingHack );
|
||||
SettingsWrapBitBool( SkipMPEGHack );
|
||||
SettingsWrapBitBool( OPHFlagHack );
|
||||
SettingsWrapBitBool( DMABusyHack );
|
||||
SettingsWrapBitBool( VIFFIFOHack );
|
||||
SettingsWrapBitBool( VIF1StallHack );
|
||||
SettingsWrapBitBool( GIFFIFOHack );
|
||||
SettingsWrapBitBool( GoemonTlbHack );
|
||||
SettingsWrapBitBool( IbitHack );
|
||||
SettingsWrapBitBool( VUKickstartHack );
|
||||
SettingsWrapBitBool( VUOverflowHack );
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,33 +433,32 @@ Pcsx2Config::DebugOptions::DebugOptions()
|
|||
MemoryViewBytesPerRow = 16;
|
||||
}
|
||||
|
||||
void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini )
|
||||
void Pcsx2Config::DebugOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
ScopedIniGroup path( ini, L"Debugger" );
|
||||
SettingsWrapSection("EmuCore/Debugger");
|
||||
|
||||
IniBitBool( ShowDebuggerOnStart );
|
||||
IniBitBool( AlignMemoryWindowStart );
|
||||
IniBitfield( FontWidth );
|
||||
IniBitfield( FontHeight );
|
||||
IniBitfield( WindowWidth );
|
||||
IniBitfield( WindowHeight );
|
||||
IniBitfield( MemoryViewBytesPerRow );
|
||||
SettingsWrapBitBool(ShowDebuggerOnStart);
|
||||
SettingsWrapBitBool(AlignMemoryWindowStart);
|
||||
SettingsWrapBitfield(FontWidth);
|
||||
SettingsWrapBitfield(FontHeight);
|
||||
SettingsWrapBitfield(WindowWidth);
|
||||
SettingsWrapBitfield(WindowHeight);
|
||||
SettingsWrapBitfield(MemoryViewBytesPerRow);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Pcsx2Config::FramerateOptions::SanityCheck()
|
||||
|
@ -460,16 +470,16 @@ void Pcsx2Config::FramerateOptions::SanityCheck()
|
|||
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);
|
||||
IniEntry(TurboScalar);
|
||||
IniEntry(SlomoScalar);
|
||||
SettingsWrapEntry(NominalScalar);
|
||||
SettingsWrapEntry(TurboScalar);
|
||||
SettingsWrapEntry(SlomoScalar);
|
||||
|
||||
IniEntry(SkipOnLimit);
|
||||
IniEntry(SkipOnTurbo);
|
||||
SettingsWrapEntry(SkipOnLimit);
|
||||
SettingsWrapEntry(SkipOnTurbo);
|
||||
}
|
||||
|
||||
Pcsx2Config::Pcsx2Config()
|
||||
|
@ -500,109 +510,87 @@ Pcsx2Config::Pcsx2Config()
|
|||
CdvdSource = CDVD_SourceType::Iso;
|
||||
}
|
||||
|
||||
void Pcsx2Config::LoadSave( IniInterface& ini )
|
||||
void Pcsx2Config::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
ScopedIniGroup path( ini, L"EmuCore" );
|
||||
SettingsWrapSection("EmuCore");
|
||||
|
||||
IniBitBool( CdvdVerboseReads );
|
||||
IniBitBool( CdvdDumpBlocks );
|
||||
IniBitBool( CdvdShareWrite );
|
||||
IniBitBool( EnablePatches );
|
||||
IniBitBool( EnableCheats );
|
||||
IniBitBool( EnableIPC );
|
||||
IniBitBool( EnableWideScreenPatches );
|
||||
SettingsWrapBitBool(CdvdVerboseReads);
|
||||
SettingsWrapBitBool(CdvdDumpBlocks);
|
||||
SettingsWrapBitBool(CdvdShareWrite);
|
||||
SettingsWrapBitBool(EnablePatches);
|
||||
SettingsWrapBitBool(EnableCheats);
|
||||
SettingsWrapBitBool(EnableIPC);
|
||||
SettingsWrapBitBool(EnableWideScreenPatches);
|
||||
#ifndef DISABLE_RECORDING
|
||||
IniBitBool( EnableRecordingTools );
|
||||
SettingsWrapBitBool(EnableRecordingTools);
|
||||
#endif
|
||||
IniBitBool( ConsoleToStdio );
|
||||
IniBitBool( HostFs );
|
||||
SettingsWrapBitBool(ConsoleToStdio);
|
||||
SettingsWrapBitBool(HostFs);
|
||||
|
||||
IniBitBool( BackupSavestate );
|
||||
IniBitBool( McdEnableEjection );
|
||||
IniBitBool( McdFolderAutoManage );
|
||||
IniBitBool( MultitapPort0_Enabled );
|
||||
IniBitBool( MultitapPort1_Enabled );
|
||||
SettingsWrapBitBool(BackupSavestate);
|
||||
SettingsWrapBitBool(McdEnableEjection);
|
||||
SettingsWrapBitBool(McdFolderAutoManage);
|
||||
SettingsWrapBitBool(MultitapPort0_Enabled);
|
||||
SettingsWrapBitBool(MultitapPort1_Enabled);
|
||||
|
||||
// Process various sub-components:
|
||||
|
||||
Speedhacks .LoadSave( ini );
|
||||
Cpu .LoadSave( ini );
|
||||
GS .LoadSave( ini );
|
||||
Gamefixes .LoadSave( ini );
|
||||
Profiler .LoadSave( ini );
|
||||
Speedhacks.LoadSave(wrap);
|
||||
Cpu.LoadSave(wrap);
|
||||
GS.LoadSave(wrap);
|
||||
Gamefixes.LoadSave(wrap);
|
||||
Profiler.LoadSave(wrap);
|
||||
|
||||
Debugger .LoadSave( ini );
|
||||
Trace .LoadSave( ini );
|
||||
Debugger.LoadSave(wrap);
|
||||
Trace.LoadSave(wrap);
|
||||
|
||||
IniEntry(GzipIsoIndexTemplate);
|
||||
SettingsWrapEntry(GzipIsoIndexTemplate);
|
||||
|
||||
// For now, this in the derived config for backwards ini compatibility.
|
||||
#ifdef PCSX2_CORE
|
||||
BaseFilenames.LoadSave(ini);
|
||||
Framerate.LoadSave(ini);
|
||||
LoadSaveMemcards(ini);
|
||||
BaseFilenames.LoadSave(wrap);
|
||||
Framerate.LoadSave(wrap);
|
||||
LoadSaveMemcards(wrap);
|
||||
|
||||
IniEntry(GzipIsoIndexTemplate);
|
||||
SettingsWrapEntry(GzipIsoIndexTemplate);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
IniEntry(McdCompressNTFS);
|
||||
SettingsWrapEntry(McdCompressNTFS);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (ini.IsLoading())
|
||||
if (wrap.IsLoading())
|
||||
{
|
||||
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 ),
|
||||
Mcd[slot].Enabled, Mcd[slot].Enabled );
|
||||
ini.Entry( pxsFmt( L"Slot%u_Filename", slot+1 ),
|
||||
Mcd[slot].Filename, Mcd[slot].Filename );
|
||||
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Slot%u_Enable", slot + 1).c_str(),
|
||||
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
||||
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Slot%u_Filename", slot + 1).c_str(),
|
||||
Mcd[slot].Filename, Mcd[slot].Filename);
|
||||
}
|
||||
|
||||
for( uint slot=2; slot<8; ++slot )
|
||||
for (uint slot = 2; slot < 8; ++slot)
|
||||
{
|
||||
int mtport = FileMcd_GetMtapPort(slot)+1;
|
||||
int mtslot = FileMcd_GetMtapSlot(slot)+1;
|
||||
int mtport = FileMcd_GetMtapPort(slot) + 1;
|
||||
int mtslot = FileMcd_GetMtapSlot(slot) + 1;
|
||||
|
||||
ini.Entry( pxsFmt( L"Multitap%u_Slot%u_Enable", mtport, mtslot ),
|
||||
Mcd[slot].Enabled, Mcd[slot].Enabled );
|
||||
ini.Entry( pxsFmt( L"Multitap%u_Slot%u_Filename", mtport, mtslot ),
|
||||
Mcd[slot].Filename, Mcd[slot].Filename );
|
||||
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Multitap%u_Slot%u_Enable", mtport, mtslot).c_str(),
|
||||
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
||||
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Multitap%u_Slot%u_Filename", mtport, mtslot).c_str(),
|
||||
Mcd[slot].Filename, Mcd[slot].Filename);
|
||||
}
|
||||
}
|
||||
|
||||
bool Pcsx2Config::MultitapEnabled( uint port ) const
|
||||
bool Pcsx2Config::MultitapEnabled(uint port) const
|
||||
{
|
||||
pxAssert( port < 2 );
|
||||
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 );
|
||||
pxAssert(port < 2);
|
||||
return (port == 0) ? MultitapPort0_Enabled : MultitapPort1_Enabled;
|
||||
}
|
||||
|
||||
wxString Pcsx2Config::FullpathToBios() const
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include "MainFrame.h"
|
||||
|
||||
#include "common/IniInterface.h"
|
||||
#include "common/SettingsWrapper.h"
|
||||
#include "wxSettingsInterface.h"
|
||||
|
||||
#include <wx/stdpaths.h>
|
||||
#include "DebugTools/Debug.h"
|
||||
|
@ -549,28 +551,28 @@ 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 );
|
||||
EmuOptions.LoadSaveMemcards( ini );
|
||||
ProgLogBox.LoadSave(ini, L"ProgramLog");
|
||||
Folders.LoadSave(ini);
|
||||
|
||||
// Process various sub-components:
|
||||
ProgLogBox .LoadSave( ini, L"ProgramLog" );
|
||||
|
||||
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())
|
||||
EmuOptions.Folders = EmuConfig.Folders;
|
||||
|
||||
EmuOptions.BaseFilenames.LoadSave( ini );
|
||||
GSWindow .LoadSave( ini );
|
||||
EmuOptions.Framerate .LoadSave( ini );
|
||||
GSWindow.LoadSave(ini);
|
||||
#ifndef DISABLE_RECORDING
|
||||
inputRecording.loadSave(ini);
|
||||
#endif
|
||||
AudioCapture.LoadSave( ini );
|
||||
Templates .LoadSave( ini );
|
||||
AudioCapture.LoadSave(ini);
|
||||
Templates.LoadSave(ini);
|
||||
|
||||
// Process various sub-components:
|
||||
EmuOptions.LoadSaveMemcards(wrap);
|
||||
EmuOptions.BaseFilenames.LoadSave(wrap);
|
||||
EmuOptions.Framerate .LoadSave(wrap);
|
||||
|
||||
ini.Flush();
|
||||
}
|
||||
|
@ -1115,8 +1117,10 @@ static void LoadUiSettings()
|
|||
ConLog_LoadSaveSettings( loader );
|
||||
SysTraceLog_LoadSaveSettings( loader );
|
||||
|
||||
wxSettingsInterface wxsi(&loader.GetConfig());
|
||||
SettingsLoadWrapper wrapper(wxsi);
|
||||
g_Conf = std::make_unique<AppConfig>();
|
||||
g_Conf->LoadSave( loader );
|
||||
g_Conf->LoadSave( loader, wrapper );
|
||||
|
||||
if( !wxFile::Exists( EmuConfig.CurrentIso ) )
|
||||
{
|
||||
|
@ -1132,8 +1136,10 @@ static void LoadVmSettings()
|
|||
// are regulated by the PCSX2 UI.
|
||||
|
||||
std::unique_ptr<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
||||
IniLoader vmloader( vmini.get() );
|
||||
g_Conf->EmuOptions.LoadSave( vmloader );
|
||||
wxSettingsInterface wxsi(vmini.get());
|
||||
IniLoader vmloader(vmini.get());
|
||||
SettingsLoadWrapper vmwrapper(wxsi);
|
||||
g_Conf->EmuOptions.LoadSave( vmwrapper );
|
||||
g_Conf->EmuOptions.GS.LimitScalar = g_Conf->EmuOptions.Framerate.NominalScalar;
|
||||
|
||||
if (g_Conf->EnablePresets){
|
||||
|
@ -1161,7 +1167,9 @@ static void SaveUiSettings()
|
|||
sApp.GetRecentIsoManager().Add( EmuConfig.CurrentIso );
|
||||
|
||||
AppIniSaver saver;
|
||||
g_Conf->LoadSave( saver );
|
||||
wxSettingsInterface wxsi(&saver.GetConfig());
|
||||
SettingsSaveWrapper wrapper(wxsi);
|
||||
g_Conf->LoadSave( saver, wrapper );
|
||||
ConLog_LoadSaveSettings( saver );
|
||||
SysTraceLog_LoadSaveSettings( saver );
|
||||
|
||||
|
@ -1171,8 +1179,10 @@ static void SaveUiSettings()
|
|||
static void SaveVmSettings()
|
||||
{
|
||||
std::unique_ptr<wxFileConfig> vmini( OpenFileConfig( GetVmSettingsFilename() ) );
|
||||
IniSaver vmsaver( vmini.get() );
|
||||
g_Conf->EmuOptions.LoadSave( vmsaver );
|
||||
wxSettingsInterface wxsi(vmini.get());
|
||||
IniSaver vmsaver(vmini.get());
|
||||
SettingsSaveWrapper vmwrapper(wxsi);
|
||||
g_Conf->EmuOptions.LoadSave(vmwrapper);
|
||||
|
||||
sApp.DispatchVmSettingsEvent( vmsaver );
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <wx/gdicmn.h>
|
||||
#include <memory>
|
||||
|
||||
class SettingsWrapper;
|
||||
|
||||
enum DocsModeType
|
||||
{
|
||||
// uses /home/user or /cwd for the program data. This is the default mode and is the most
|
||||
|
@ -286,8 +288,8 @@ public:
|
|||
public:
|
||||
AppConfig();
|
||||
|
||||
void LoadSave( IniInterface& ini );
|
||||
void LoadSaveRootItems( IniInterface& ini );
|
||||
void LoadSave(IniInterface& ini, SettingsWrapper& wrap);
|
||||
void LoadSaveRootItems(IniInterface& ini);
|
||||
|
||||
static int GetMaxPresetIndex();
|
||||
static bool isOkGetPresetTextAndColor(int n, wxString& label, wxColor& c);
|
||||
|
|
|
@ -203,7 +203,7 @@ void Panels::BiosSelectorPanel::OnEnumComplete(wxCommandEvent& evt)
|
|||
if (m_EnumeratorThread.get() != enumThread || m_BiosList->size() < enumThread->Result.size())
|
||||
return;
|
||||
|
||||
const wxFileName& currentBios = g_Conf->EmuOptions.FullpathToBios();
|
||||
const wxFileName currentBios = g_Conf->EmuOptions.FullpathToBios();
|
||||
m_ComboBox->Clear(); // Clear the "Enumerating BIOSes..."
|
||||
|
||||
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\ThreadingDialogs.cpp" />
|
||||
<ClCompile Include="gui\wxAppWithHelpers.cpp" />
|
||||
<ClCompile Include="gui\wxSettingsInterface.cpp" />
|
||||
<ClCompile Include="IopGte.cpp" />
|
||||
<ClCompile Include="IPC.cpp" />
|
||||
<ClCompile Include="FW.cpp" />
|
||||
|
@ -767,6 +768,7 @@
|
|||
<ClInclude Include="gui\Panels\MemoryCardPanels.h" />
|
||||
<ClInclude Include="gui\ThreadingDialogs.h" />
|
||||
<ClInclude Include="gui\wxAppWithHelpers.h" />
|
||||
<ClInclude Include="gui\wxSettingsInterface.h" />
|
||||
<ClInclude Include="Host.h" />
|
||||
<ClInclude Include="IopGte.h" />
|
||||
<ClInclude Include="IPC.h" />
|
||||
|
|
|
@ -1661,6 +1661,9 @@
|
|||
<ClCompile Include="MemoryCardFolder.cpp">
|
||||
<Filter>System\Ps2\Iop</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="gui\wxSettingsInterface.cpp">
|
||||
<Filter>AppHost</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Patch.h">
|
||||
|
@ -2761,6 +2764,9 @@
|
|||
<ClInclude Include="Host.h">
|
||||
<Filter>System\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="gui\wxSettingsInterface.h">
|
||||
<Filter>AppHost</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="windows\wxResources.rc">
|
||||
|
|
Loading…
Reference in New Issue