2009-09-12 02:58:22 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2021-04-25 02:17:59 +00:00
|
|
|
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
2009-11-12 12:51:00 +00:00
|
|
|
*
|
2009-09-12 02:58:22 +00:00
|
|
|
* 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"
|
2009-11-14 12:02:56 +00:00
|
|
|
|
|
|
|
#include <wx/fileconf.h>
|
|
|
|
|
2021-09-01 20:31:46 +00:00
|
|
|
#include "common/IniInterface.h"
|
2009-09-12 02:58:22 +00:00
|
|
|
#include "Config.h"
|
|
|
|
#include "GS.h"
|
2021-09-17 08:25:52 +00:00
|
|
|
#include "CDVD/CDVDaccess.h"
|
2021-09-17 08:42:39 +00:00
|
|
|
#include "MemoryCardFile.h"
|
2021-09-17 08:25:52 +00:00
|
|
|
|
|
|
|
#ifndef PCSX2_CORE
|
|
|
|
#include "gui/AppConfig.h"
|
|
|
|
#endif
|
2009-09-12 02:58:22 +00:00
|
|
|
|
2009-11-11 11:36:13 +00:00
|
|
|
void TraceLogFilters::LoadSave( IniInterface& ini )
|
|
|
|
{
|
2010-08-04 19:10:41 +00:00
|
|
|
ScopedIniGroup path( ini, L"TraceLog" );
|
2009-11-11 11:36:13 +00:00
|
|
|
|
|
|
|
IniEntry( Enabled );
|
2010-08-06 05:46:09 +00:00
|
|
|
|
2009-11-11 11:36:13 +00:00
|
|
|
// 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 );
|
|
|
|
}
|
|
|
|
|
2020-12-14 02:23:28 +00:00
|
|
|
const wxChar* const tbl_SpeedhackNames[] =
|
|
|
|
{
|
|
|
|
L"mvuFlag",
|
|
|
|
L"InstantVU1"};
|
|
|
|
|
|
|
|
const __fi wxChar* EnumToString(SpeedhackId id)
|
|
|
|
{
|
|
|
|
return tbl_SpeedhackNames[id];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::SpeedhackOptions::Set(SpeedhackId id, bool enabled)
|
|
|
|
{
|
|
|
|
EnumAssert(id);
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case Speedhack_mvuFlag:
|
|
|
|
vuFlagHack = enabled;
|
|
|
|
break;
|
|
|
|
case Speedhack_InstantVU1:
|
|
|
|
vu1Instant = enabled;
|
|
|
|
break;
|
|
|
|
jNO_DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-23 06:54:24 +00:00
|
|
|
Pcsx2Config::SpeedhackOptions::SpeedhackOptions()
|
2009-09-12 02:58:22 +00:00
|
|
|
{
|
2010-09-29 13:48:36 +00:00
|
|
|
DisableAll();
|
2020-12-14 02:23:28 +00:00
|
|
|
|
2010-09-26 17:31:23 +00:00
|
|
|
// Set recommended speedhacks to enabled by default. They'll still be off globally on resets.
|
|
|
|
WaitLoop = true;
|
|
|
|
IntcStat = true;
|
|
|
|
vuFlagHack = true;
|
2020-12-12 03:33:24 +00:00
|
|
|
vu1Instant = true;
|
2009-11-23 06:54:24 +00:00
|
|
|
}
|
|
|
|
|
2010-09-29 13:48:36 +00:00
|
|
|
Pcsx2Config::SpeedhackOptions& Pcsx2Config::SpeedhackOptions::DisableAll()
|
|
|
|
{
|
2020-12-14 02:23:28 +00:00
|
|
|
bitset = 0;
|
|
|
|
EECycleRate = 0;
|
|
|
|
EECycleSkip = 0;
|
|
|
|
|
2010-09-29 13:48:36 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2020-12-14 02:23:28 +00:00
|
|
|
void Pcsx2Config::SpeedhackOptions::LoadSave(IniInterface& ini)
|
2009-09-12 02:58:22 +00:00
|
|
|
{
|
2020-12-14 02:23:28 +00:00
|
|
|
ScopedIniGroup path(ini, L"Speedhacks");
|
|
|
|
|
|
|
|
IniBitfield(EECycleRate);
|
|
|
|
IniBitfield(EECycleSkip);
|
|
|
|
IniBitBool(fastCDVD);
|
|
|
|
IniBitBool(IntcStat);
|
|
|
|
IniBitBool(WaitLoop);
|
|
|
|
IniBitBool(vuFlagHack);
|
|
|
|
IniBitBool(vuThread);
|
|
|
|
IniBitBool(vu1Instant);
|
2009-09-12 02:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::ProfilerOptions::LoadSave( IniInterface& ini )
|
|
|
|
{
|
2010-08-04 19:10:41 +00:00
|
|
|
ScopedIniGroup path( ini, L"Profiler" );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
|
|
|
IniBitBool( Enabled );
|
|
|
|
IniBitBool( RecBlocks_EE );
|
|
|
|
IniBitBool( RecBlocks_IOP );
|
|
|
|
IniBitBool( RecBlocks_VU0 );
|
|
|
|
IniBitBool( RecBlocks_VU1 );
|
|
|
|
}
|
|
|
|
|
2009-11-21 07:44:11 +00:00
|
|
|
Pcsx2Config::RecompilerOptions::RecompilerOptions()
|
2009-11-01 11:27:50 +00:00
|
|
|
{
|
2009-11-21 07:44:11 +00:00
|
|
|
bitset = 0;
|
|
|
|
|
2010-07-04 11:14:06 +00:00
|
|
|
//StackFrameChecks = false;
|
2010-09-29 13:48:36 +00:00
|
|
|
//PreBlockCheckEE = false;
|
2009-11-21 07:44:11 +00:00
|
|
|
|
2009-11-01 11:27:50 +00:00
|
|
|
// All recs are enabled by default.
|
|
|
|
|
2009-11-21 07:44:11 +00:00
|
|
|
EnableEE = true;
|
2011-02-17 21:27:24 +00:00
|
|
|
EnableEECache = false;
|
2009-11-21 07:44:11 +00:00
|
|
|
EnableIOP = true;
|
|
|
|
EnableVU0 = true;
|
|
|
|
EnableVU1 = true;
|
2009-11-01 11:27:50 +00:00
|
|
|
|
|
|
|
// vu and fpu clamping default to standard overflow.
|
2009-11-21 07:44:11 +00:00
|
|
|
vuOverflow = true;
|
2009-11-01 11:27:50 +00:00
|
|
|
//vuExtraOverflow = false;
|
|
|
|
//vuSignOverflow = false;
|
|
|
|
//vuUnderflow = false;
|
|
|
|
|
2009-11-21 07:44:11 +00:00
|
|
|
fpuOverflow = true;
|
2009-11-01 11:27:50 +00:00
|
|
|
//fpuExtraOverflow = false;
|
|
|
|
//fpuFullMode = false;
|
|
|
|
}
|
|
|
|
|
2009-11-01 16:49:20 +00:00
|
|
|
void Pcsx2Config::RecompilerOptions::ApplySanityCheck()
|
|
|
|
{
|
2009-11-02 07:00:59 +00:00
|
|
|
bool fpuIsRight = true;
|
|
|
|
|
|
|
|
if( fpuExtraOverflow )
|
|
|
|
fpuIsRight = fpuOverflow;
|
|
|
|
|
|
|
|
if( fpuFullMode )
|
2009-11-26 13:09:23 +00:00
|
|
|
fpuIsRight = fpuOverflow && fpuExtraOverflow;
|
2009-11-02 07:00:59 +00:00
|
|
|
|
|
|
|
if( !fpuIsRight )
|
2009-11-01 16:49:20 +00:00
|
|
|
{
|
|
|
|
// Values are wonky; assume the defaults.
|
|
|
|
fpuOverflow = RecompilerOptions().fpuOverflow;
|
|
|
|
fpuExtraOverflow= RecompilerOptions().fpuExtraOverflow;
|
|
|
|
fpuFullMode = RecompilerOptions().fpuFullMode;
|
|
|
|
}
|
|
|
|
|
2009-11-02 07:00:59 +00:00
|
|
|
bool vuIsOk = true;
|
2009-11-01 16:49:20 +00:00
|
|
|
|
2009-11-02 07:00:59 +00:00
|
|
|
if( vuExtraOverflow ) vuIsOk = vuIsOk && vuOverflow;
|
|
|
|
if( vuSignOverflow ) vuIsOk = vuIsOk && vuExtraOverflow;
|
|
|
|
|
|
|
|
if( !vuIsOk )
|
2009-11-01 16:49:20 +00:00
|
|
|
{
|
|
|
|
// Values are wonky; assume the defaults.
|
|
|
|
vuOverflow = RecompilerOptions().vuOverflow;
|
|
|
|
vuExtraOverflow = RecompilerOptions().vuExtraOverflow;
|
|
|
|
vuSignOverflow = RecompilerOptions().vuSignOverflow;
|
2009-11-02 07:00:59 +00:00
|
|
|
vuUnderflow = RecompilerOptions().vuUnderflow;
|
2009-11-01 16:49:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-12 02:58:22 +00:00
|
|
|
void Pcsx2Config::RecompilerOptions::LoadSave( IniInterface& ini )
|
|
|
|
{
|
2010-08-04 19:10:41 +00:00
|
|
|
ScopedIniGroup path( ini, L"Recompiler" );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
|
|
|
IniBitBool( EnableEE );
|
|
|
|
IniBitBool( EnableIOP );
|
2011-02-17 21:27:24 +00:00
|
|
|
IniBitBool( EnableEECache );
|
2009-09-12 02:58:22 +00:00
|
|
|
IniBitBool( EnableVU0 );
|
|
|
|
IniBitBool( EnableVU1 );
|
2009-09-18 14:40:24 +00:00
|
|
|
|
2009-11-01 11:27:50 +00:00
|
|
|
IniBitBool( vuOverflow );
|
|
|
|
IniBitBool( vuExtraOverflow );
|
|
|
|
IniBitBool( vuSignOverflow );
|
|
|
|
IniBitBool( vuUnderflow );
|
|
|
|
|
|
|
|
IniBitBool( fpuOverflow );
|
|
|
|
IniBitBool( fpuExtraOverflow );
|
|
|
|
IniBitBool( fpuFullMode );
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2009-11-21 07:44:11 +00:00
|
|
|
IniBitBool( StackFrameChecks );
|
2010-07-04 11:14:06 +00:00
|
|
|
IniBitBool( PreBlockCheckEE );
|
|
|
|
IniBitBool( PreBlockCheckIOP );
|
2009-09-12 02:58:22 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 07:00:59 +00:00
|
|
|
Pcsx2Config::CpuOptions::CpuOptions()
|
2009-09-12 02:58:22 +00:00
|
|
|
{
|
2009-11-02 07:00:59 +00:00
|
|
|
sseMXCSR.bitmask = DEFAULT_sseMXCSR;
|
|
|
|
sseVUMXCSR.bitmask = DEFAULT_sseVUMXCSR;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::CpuOptions::ApplySanityCheck()
|
|
|
|
{
|
|
|
|
sseMXCSR.ClearExceptionFlags().DisableExceptions();
|
|
|
|
sseVUMXCSR.ClearExceptionFlags().DisableExceptions();
|
|
|
|
|
|
|
|
Recompiler.ApplySanityCheck();
|
2009-09-12 02:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::CpuOptions::LoadSave( IniInterface& ini )
|
|
|
|
{
|
2010-08-04 19:10:41 +00:00
|
|
|
ScopedIniGroup path( ini, L"CPU" );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
2009-11-02 07:00:59 +00:00
|
|
|
IniBitBoolEx( sseMXCSR.DenormalsAreZero, "FPU.DenormalsAreZero" );
|
|
|
|
IniBitBoolEx( sseMXCSR.FlushToZero, "FPU.FlushToZero" );
|
|
|
|
IniBitfieldEx( sseMXCSR.RoundingControl, "FPU.Roundmode" );
|
|
|
|
|
|
|
|
IniBitBoolEx( sseVUMXCSR.DenormalsAreZero, "VU.DenormalsAreZero" );
|
|
|
|
IniBitBoolEx( sseVUMXCSR.FlushToZero, "VU.FlushToZero" );
|
|
|
|
IniBitfieldEx( sseVUMXCSR.RoundingControl, "VU.Roundmode" );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
|
|
|
Recompiler.LoadSave( ini );
|
|
|
|
}
|
|
|
|
|
2009-12-03 15:51:39 +00:00
|
|
|
void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
|
2009-09-12 02:58:22 +00:00
|
|
|
{
|
2010-08-04 19:10:41 +00:00
|
|
|
ScopedIniGroup path( ini, L"GS" );
|
2009-12-03 15:51:39 +00:00
|
|
|
|
2021-09-28 11:11:12 +00:00
|
|
|
#ifdef PCSX2_DEVBUILD
|
2010-01-04 11:51:09 +00:00
|
|
|
IniEntry( SynchronousMTGS );
|
2021-09-28 11:11:12 +00:00
|
|
|
#endif
|
2010-07-12 19:40:30 +00:00
|
|
|
IniEntry( VsyncQueueSize );
|
2010-01-04 11:51:09 +00:00
|
|
|
|
2009-12-03 15:51:39 +00:00
|
|
|
IniEntry( FrameLimitEnable );
|
|
|
|
IniEntry( FrameSkipEnable );
|
2017-07-14 13:15:37 +00:00
|
|
|
ini.EnumEntry( L"VsyncEnable", VsyncEnable, NULL, VsyncEnable );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
2009-12-03 15:51:39 +00:00
|
|
|
IniEntry( LimitScalar );
|
|
|
|
IniEntry( FramerateNTSC );
|
|
|
|
IniEntry( FrameratePAL );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
2010-01-04 11:51:09 +00:00
|
|
|
IniEntry( FramesToDraw );
|
|
|
|
IniEntry( FramesToSkip );
|
2021-09-16 10:54:06 +00:00
|
|
|
|
|
|
|
static const wxChar* AspectRatioNames[] =
|
|
|
|
{
|
|
|
|
L"Stretch",
|
|
|
|
L"4:3",
|
|
|
|
L"16:9",
|
|
|
|
// WARNING: array must be NULL terminated to compute it size
|
|
|
|
NULL};
|
|
|
|
|
|
|
|
#ifdef PCSX2_CORE
|
|
|
|
ini.EnumEntry(L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio);
|
|
|
|
|
|
|
|
static const wxChar* FMVAspectRatioSwitchNames[] =
|
|
|
|
{
|
|
|
|
L"Off",
|
|
|
|
L"4:3",
|
|
|
|
L"16:9",
|
|
|
|
// WARNING: array must be NULL terminated to compute it size
|
|
|
|
NULL};
|
|
|
|
ini.EnumEntry(L"FMVAspectRatioSwitch", FMVAspectRatioSwitch, FMVAspectRatioSwitchNames, FMVAspectRatioSwitch);
|
|
|
|
|
|
|
|
IniEntry(Zoom);
|
|
|
|
#endif
|
2009-09-12 02:58:22 +00:00
|
|
|
}
|
|
|
|
|
2017-07-14 13:10:46 +00:00
|
|
|
int Pcsx2Config::GSOptions::GetVsync() const
|
|
|
|
{
|
2021-09-16 10:54:06 +00:00
|
|
|
if (EmuConfig.LimiterMode == LimiterModeType::Turbo || !FrameLimitEnable)
|
2017-07-14 13:10:46 +00:00
|
|
|
return 0;
|
|
|
|
|
2017-07-14 13:15:37 +00:00
|
|
|
// 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;
|
|
|
|
|
|
|
|
default: return 0;
|
|
|
|
}
|
2017-07-14 13:10:46 +00:00
|
|
|
}
|
|
|
|
|
2010-06-15 14:13:23 +00:00
|
|
|
const wxChar *const tbl_GamefixNames[] =
|
|
|
|
{
|
|
|
|
L"FpuMul",
|
|
|
|
L"FpuNegDiv",
|
2021-09-29 10:02:27 +00:00
|
|
|
L"GoemonTlb",
|
2020-11-14 03:46:35 +00:00
|
|
|
L"SkipMPEG",
|
2011-03-30 10:54:43 +00:00
|
|
|
L"OPHFlag",
|
2021-09-29 10:02:27 +00:00
|
|
|
L"EETiming",
|
2011-04-30 18:30:31 +00:00
|
|
|
L"DMABusy",
|
2021-09-29 10:02:27 +00:00
|
|
|
L"GIFFIFO",
|
2011-08-25 16:23:25 +00:00
|
|
|
L"VIFFIFO",
|
2011-08-29 23:05:22 +00:00
|
|
|
L"VIF1Stall",
|
2021-09-29 10:02:27 +00:00
|
|
|
L"VuAddSub",
|
2021-06-08 17:42:55 +00:00
|
|
|
L"Ibit",
|
2021-09-29 09:50:49 +00:00
|
|
|
L"VUKickstart",
|
2021-09-29 10:02:27 +00:00
|
|
|
L"VUOverflow",
|
|
|
|
L"XGKick"
|
2010-06-15 14:13:23 +00:00
|
|
|
};
|
|
|
|
|
2010-08-09 04:10:38 +00:00
|
|
|
const __fi wxChar* EnumToString( GamefixId id )
|
2010-06-15 14:13:23 +00:00
|
|
|
{
|
|
|
|
return tbl_GamefixNames[id];
|
|
|
|
}
|
|
|
|
|
2010-09-29 13:48:36 +00:00
|
|
|
// all gamefixes are disabled by default.
|
|
|
|
Pcsx2Config::GamefixOptions::GamefixOptions()
|
|
|
|
{
|
|
|
|
DisableAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
Pcsx2Config::GamefixOptions& Pcsx2Config::GamefixOptions::DisableAll()
|
|
|
|
{
|
|
|
|
bitset = 0;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2010-06-15 14:13:23 +00:00
|
|
|
// Enables a full list of gamefixes. The list can be either comma or pipe-delimited.
|
|
|
|
// Example: "XGKick,IpuWait" or "EEtiming,FpuCompare"
|
|
|
|
// 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 )
|
|
|
|
{
|
|
|
|
wxStringTokenizer izer( list, L",|", wxTOKEN_STRTOK );
|
|
|
|
|
|
|
|
while( izer.HasMoreTokens() )
|
|
|
|
{
|
|
|
|
wxString token( izer.GetNextToken() );
|
|
|
|
|
|
|
|
GamefixId i;
|
|
|
|
for (i=GamefixId_FIRST; i < pxEnumEnd; ++i)
|
|
|
|
{
|
|
|
|
if( token.CmpNoCase( EnumToString(i) ) == 0 ) break;
|
|
|
|
}
|
|
|
|
if( i < pxEnumEnd ) Set( i );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::GamefixOptions::Set( GamefixId id, bool enabled )
|
|
|
|
{
|
2010-07-07 07:41:44 +00:00
|
|
|
EnumAssert( id );
|
2010-06-15 14:13:23 +00:00
|
|
|
switch(id)
|
|
|
|
{
|
|
|
|
case Fix_VuAddSub: VuAddSubHack = enabled; break;
|
|
|
|
case Fix_FpuMultiply: FpuMulHack = enabled; break;
|
|
|
|
case Fix_FpuNegDiv: FpuNegDivHack = enabled; break;
|
|
|
|
case Fix_XGKick: XgKickHack = enabled; break;
|
|
|
|
case Fix_EETiming: EETimingHack = enabled; break;
|
|
|
|
case Fix_SkipMpeg: SkipMPEGHack = enabled; break;
|
2010-07-26 18:55:18 +00:00
|
|
|
case Fix_OPHFlag: OPHFlagHack = enabled; break;
|
2011-03-30 10:54:43 +00:00
|
|
|
case Fix_DMABusy: DMABusyHack = enabled; break;
|
2011-04-30 18:30:31 +00:00
|
|
|
case Fix_VIFFIFO: VIFFIFOHack = enabled; break;
|
2011-08-25 16:23:25 +00:00
|
|
|
case Fix_VIF1Stall: VIF1StallHack = enabled; break;
|
2016-04-30 15:17:40 +00:00
|
|
|
case Fix_GIFFIFO: GIFFIFOHack = enabled; break;
|
2014-06-08 16:00:37 +00:00
|
|
|
case Fix_GoemonTlbMiss: GoemonTlbHack = enabled; break;
|
2021-06-08 17:42:55 +00:00
|
|
|
case Fix_Ibit: IbitHack = enabled; break;
|
2021-09-29 09:50:49 +00:00
|
|
|
case Fix_VUKickstart: VUKickstartHack = enabled; break;
|
|
|
|
case Fix_VUOverflow: VUOverflowHack = enabled; break;
|
2010-06-15 14:13:23 +00:00
|
|
|
jNO_DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const
|
|
|
|
{
|
2010-07-07 07:41:44 +00:00
|
|
|
EnumAssert( id );
|
2010-06-15 14:13:23 +00:00
|
|
|
switch(id)
|
|
|
|
{
|
|
|
|
case Fix_VuAddSub: return VuAddSubHack;
|
|
|
|
case Fix_FpuMultiply: return FpuMulHack;
|
|
|
|
case Fix_FpuNegDiv: return FpuNegDivHack;
|
|
|
|
case Fix_XGKick: return XgKickHack;
|
|
|
|
case Fix_EETiming: return EETimingHack;
|
|
|
|
case Fix_SkipMpeg: return SkipMPEGHack;
|
2010-07-26 18:55:18 +00:00
|
|
|
case Fix_OPHFlag: return OPHFlagHack;
|
2011-03-30 10:54:43 +00:00
|
|
|
case Fix_DMABusy: return DMABusyHack;
|
2011-04-30 18:30:31 +00:00
|
|
|
case Fix_VIFFIFO: return VIFFIFOHack;
|
2011-08-25 16:23:25 +00:00
|
|
|
case Fix_VIF1Stall: return VIF1StallHack;
|
2016-04-30 15:17:40 +00:00
|
|
|
case Fix_GIFFIFO: return GIFFIFOHack;
|
2014-06-08 16:00:37 +00:00
|
|
|
case Fix_GoemonTlbMiss: return GoemonTlbHack;
|
2021-06-08 17:42:55 +00:00
|
|
|
case Fix_Ibit: return IbitHack;
|
2021-07-15 12:58:34 +00:00
|
|
|
case Fix_VUKickstart: return VUKickstartHack;
|
2021-09-29 09:50:49 +00:00
|
|
|
case Fix_VUOverflow: return VUOverflowHack;
|
2011-04-30 18:30:31 +00:00
|
|
|
jNO_DEFAULT;
|
2010-06-15 14:13:23 +00:00
|
|
|
}
|
|
|
|
return false; // unreachable, but we still need to suppress warnings >_<
|
|
|
|
}
|
|
|
|
|
2009-09-12 02:58:22 +00:00
|
|
|
void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
|
|
|
|
{
|
2010-08-04 19:10:41 +00:00
|
|
|
ScopedIniGroup path( ini, L"Gamefixes" );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
|
|
|
IniBitBool( VuAddSubHack );
|
|
|
|
IniBitBool( FpuMulHack );
|
2009-10-05 06:25:56 +00:00
|
|
|
IniBitBool( FpuNegDivHack );
|
2009-09-12 02:58:22 +00:00
|
|
|
IniBitBool( XgKickHack );
|
2010-05-19 09:58:27 +00:00
|
|
|
IniBitBool( EETimingHack );
|
2010-05-30 01:52:43 +00:00
|
|
|
IniBitBool( SkipMPEGHack );
|
2010-07-26 18:55:18 +00:00
|
|
|
IniBitBool( OPHFlagHack );
|
2011-03-30 10:54:43 +00:00
|
|
|
IniBitBool( DMABusyHack );
|
2011-04-30 18:30:31 +00:00
|
|
|
IniBitBool( VIFFIFOHack );
|
2011-08-25 16:23:25 +00:00
|
|
|
IniBitBool( VIF1StallHack );
|
2016-04-30 15:17:40 +00:00
|
|
|
IniBitBool( GIFFIFOHack );
|
2014-06-08 16:00:37 +00:00
|
|
|
IniBitBool( GoemonTlbHack );
|
2021-06-08 17:42:55 +00:00
|
|
|
IniBitBool( IbitHack );
|
2021-07-15 12:58:34 +00:00
|
|
|
IniBitBool( VUKickstartHack );
|
2021-09-29 09:50:49 +00:00
|
|
|
IniBitBool( VUOverflowHack );
|
2009-09-12 02:58:22 +00:00
|
|
|
}
|
|
|
|
|
2014-02-24 10:48:06 +00:00
|
|
|
|
|
|
|
Pcsx2Config::DebugOptions::DebugOptions()
|
|
|
|
{
|
|
|
|
ShowDebuggerOnStart = false;
|
2017-04-15 07:41:40 +00:00
|
|
|
AlignMemoryWindowStart = true;
|
2014-02-24 10:48:06 +00:00
|
|
|
FontWidth = 8;
|
|
|
|
FontHeight = 12;
|
2015-12-28 16:41:19 +00:00
|
|
|
WindowWidth = 0;
|
|
|
|
WindowHeight = 0;
|
2017-04-15 07:41:40 +00:00
|
|
|
MemoryViewBytesPerRow = 16;
|
2014-02-24 10:48:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::DebugOptions::LoadSave( IniInterface& ini )
|
|
|
|
{
|
|
|
|
ScopedIniGroup path( ini, L"Debugger" );
|
|
|
|
|
|
|
|
IniBitBool( ShowDebuggerOnStart );
|
2017-04-15 07:41:40 +00:00
|
|
|
IniBitBool( AlignMemoryWindowStart );
|
|
|
|
IniBitfield( FontWidth );
|
|
|
|
IniBitfield( FontHeight );
|
|
|
|
IniBitfield( WindowWidth );
|
|
|
|
IniBitfield( WindowHeight );
|
|
|
|
IniBitfield( MemoryViewBytesPerRow );
|
2014-02-24 10:48:06 +00:00
|
|
|
}
|
|
|
|
|
2021-09-16 10:14:42 +00:00
|
|
|
void Pcsx2Config::FilenameOptions::LoadSave(IniInterface& ini)
|
|
|
|
{
|
|
|
|
ScopedIniGroup path(ini, L"Filenames");
|
|
|
|
|
|
|
|
static const wxFileName pc(L"Please Configure");
|
|
|
|
|
|
|
|
//when saving in portable mode, we just save the non-full-path filename
|
|
|
|
// --> on load they'll be initialized with default (relative) paths (works for bios)
|
|
|
|
//note: this will break if converting from install to portable, and custom folders are used. We can live with that.
|
2021-09-17 08:25:52 +00:00
|
|
|
#ifndef PCSX2_CORE
|
2021-09-16 10:14:42 +00:00
|
|
|
bool needRelativeName = ini.IsSaving() && IsPortable();
|
2021-09-17 08:25:52 +00:00
|
|
|
#else
|
|
|
|
bool needRelativeName = ini.IsSaving();
|
|
|
|
#endif
|
2021-09-16 10:14:42 +00:00
|
|
|
|
|
|
|
if (needRelativeName)
|
|
|
|
{
|
|
|
|
wxFileName bios_filename = wxFileName(Bios.GetFullName());
|
|
|
|
ini.Entry(L"BIOS", bios_filename, pc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ini.Entry(L"BIOS", Bios, pc);
|
|
|
|
}
|
2014-02-24 10:48:06 +00:00
|
|
|
|
2021-09-16 10:14:42 +00:00
|
|
|
Pcsx2Config::FolderOptions::FolderOptions()
|
|
|
|
{
|
2014-02-24 10:48:06 +00:00
|
|
|
|
2021-09-16 10:14:42 +00:00
|
|
|
}
|
2014-02-24 10:48:06 +00:00
|
|
|
|
2021-09-16 10:54:06 +00:00
|
|
|
void Pcsx2Config::FramerateOptions::SanityCheck()
|
|
|
|
{
|
|
|
|
// Ensure Conformation of various options...
|
|
|
|
|
|
|
|
NominalScalar = std::clamp(NominalScalar, 0.05, 10.0);
|
|
|
|
TurboScalar = std::clamp(TurboScalar, 0.05, 10.0);
|
|
|
|
SlomoScalar = std::clamp(SlomoScalar, 0.05, 10.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::FramerateOptions::LoadSave(IniInterface& ini)
|
|
|
|
{
|
|
|
|
ScopedIniGroup path(ini, L"Framerate");
|
|
|
|
|
|
|
|
IniEntry(NominalScalar);
|
|
|
|
IniEntry(TurboScalar);
|
|
|
|
IniEntry(SlomoScalar);
|
|
|
|
|
|
|
|
IniEntry(SkipOnLimit);
|
|
|
|
IniEntry(SkipOnTurbo);
|
|
|
|
}
|
|
|
|
|
2009-12-03 15:51:39 +00:00
|
|
|
Pcsx2Config::Pcsx2Config()
|
2009-09-12 02:58:22 +00:00
|
|
|
{
|
2009-12-03 15:51:39 +00:00
|
|
|
bitset = 0;
|
2010-09-26 17:31:23 +00:00
|
|
|
// Set defaults for fresh installs / reset settings
|
2010-05-26 23:06:31 +00:00
|
|
|
McdEnableEjection = true;
|
2015-05-25 12:39:35 +00:00
|
|
|
McdFolderAutoManage = true;
|
2010-09-26 17:31:23 +00:00
|
|
|
EnablePatches = true;
|
2011-08-30 06:33:05 +00:00
|
|
|
BackupSavestate = true;
|
2021-09-16 10:14:42 +00:00
|
|
|
|
2021-09-17 08:42:39 +00:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
McdCompressNTFS = true;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// To be moved to FileMemoryCard pluign (someday)
|
|
|
|
for (uint slot = 0; slot < 8; ++slot)
|
|
|
|
{
|
|
|
|
Mcd[slot].Enabled = !FileMcd_IsMultitapSlot(slot); // enables main 2 slots
|
|
|
|
Mcd[slot].Filename = FileMcd_GetDefaultName(slot);
|
|
|
|
|
|
|
|
// Folder memory card is autodetected later.
|
|
|
|
Mcd[slot].Type = MemoryCardType::MemoryCard_File;
|
|
|
|
}
|
|
|
|
|
2021-09-21 10:05:11 +00:00
|
|
|
GzipIsoIndexTemplate = "$(f).pindex.tmp";
|
2021-09-17 08:25:52 +00:00
|
|
|
|
2021-09-16 10:14:42 +00:00
|
|
|
CdvdSource = CDVD_SourceType::Iso;
|
2009-09-12 02:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::LoadSave( IniInterface& ini )
|
|
|
|
{
|
2010-08-04 19:10:41 +00:00
|
|
|
ScopedIniGroup path( ini, L"EmuCore" );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
|
|
|
IniBitBool( CdvdVerboseReads );
|
|
|
|
IniBitBool( CdvdDumpBlocks );
|
2014-08-15 20:48:12 +00:00
|
|
|
IniBitBool( CdvdShareWrite );
|
2009-09-12 02:58:22 +00:00
|
|
|
IniBitBool( EnablePatches );
|
2010-05-17 05:37:32 +00:00
|
|
|
IniBitBool( EnableCheats );
|
2020-08-08 06:43:41 +00:00
|
|
|
IniBitBool( EnableIPC );
|
2013-08-14 09:48:36 +00:00
|
|
|
IniBitBool( EnableWideScreenPatches );
|
2018-07-03 00:40:44 +00:00
|
|
|
#ifndef DISABLE_RECORDING
|
2018-11-30 05:13:30 +00:00
|
|
|
IniBitBool( EnableRecordingTools );
|
2018-07-03 00:40:44 +00:00
|
|
|
#endif
|
2009-11-12 12:51:00 +00:00
|
|
|
IniBitBool( ConsoleToStdio );
|
2010-05-28 10:33:15 +00:00
|
|
|
IniBitBool( HostFs );
|
2009-11-12 12:51:00 +00:00
|
|
|
|
2010-11-21 12:35:59 +00:00
|
|
|
IniBitBool( BackupSavestate );
|
2009-09-12 02:58:22 +00:00
|
|
|
IniBitBool( McdEnableEjection );
|
2015-05-25 12:39:35 +00:00
|
|
|
IniBitBool( McdFolderAutoManage );
|
2009-09-13 17:11:35 +00:00
|
|
|
IniBitBool( MultitapPort0_Enabled );
|
|
|
|
IniBitBool( MultitapPort1_Enabled );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
|
|
|
// Process various sub-components:
|
|
|
|
|
2009-12-03 15:51:39 +00:00
|
|
|
Speedhacks .LoadSave( ini );
|
|
|
|
Cpu .LoadSave( ini );
|
|
|
|
GS .LoadSave( ini );
|
|
|
|
Gamefixes .LoadSave( ini );
|
|
|
|
Profiler .LoadSave( ini );
|
2009-09-12 02:58:22 +00:00
|
|
|
|
2014-02-24 10:48:06 +00:00
|
|
|
Debugger .LoadSave( ini );
|
2009-12-03 15:51:39 +00:00
|
|
|
Trace .LoadSave( ini );
|
2009-11-11 11:36:13 +00:00
|
|
|
|
2021-09-17 08:25:52 +00:00
|
|
|
IniEntry(GzipIsoIndexTemplate);
|
|
|
|
|
2021-09-16 10:14:42 +00:00
|
|
|
// For now, this in the derived config for backwards ini compatibility.
|
2021-09-16 10:54:06 +00:00
|
|
|
#ifdef PCSX2_CORE
|
|
|
|
BaseFilenames.LoadSave(ini);
|
|
|
|
Framerate.LoadSave(ini);
|
2021-09-17 08:42:39 +00:00
|
|
|
LoadSaveMemcards(ini);
|
|
|
|
|
|
|
|
IniEntry(GzipIsoIndexTemplate);
|
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
IniEntry(McdCompressNTFS);
|
|
|
|
#endif
|
2021-09-16 10:54:06 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (ini.IsLoading())
|
|
|
|
{
|
|
|
|
CurrentAspectRatio = GS.AspectRatio;
|
|
|
|
}
|
2021-09-16 10:14:42 +00:00
|
|
|
|
2009-09-12 02:58:22 +00:00
|
|
|
ini.Flush();
|
|
|
|
}
|
|
|
|
|
2021-09-17 08:42:39 +00:00
|
|
|
void Pcsx2Config::LoadSaveMemcards( IniInterface& ini )
|
|
|
|
{
|
|
|
|
ScopedIniGroup path( ini, L"MemoryCards" );
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
for( uint slot=2; slot<8; ++slot )
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
bool Pcsx2Config::MultitapEnabled( uint port ) const
|
|
|
|
{
|
|
|
|
pxAssert( port < 2 );
|
|
|
|
return (port==0) ? MultitapPort0_Enabled : MultitapPort1_Enabled;
|
|
|
|
}
|
|
|
|
|
2009-09-12 02:58:22 +00:00
|
|
|
void Pcsx2Config::Load( const wxString& srcfile )
|
|
|
|
{
|
|
|
|
//m_IsLoaded = true;
|
|
|
|
|
|
|
|
wxFileConfig cfg( srcfile );
|
2011-01-13 20:33:13 +00:00
|
|
|
IniLoader loader( cfg );
|
2009-09-12 02:58:22 +00:00
|
|
|
LoadSave( loader );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Pcsx2Config::Save( const wxString& dstfile )
|
|
|
|
{
|
|
|
|
//if( !m_IsLoaded ) return;
|
|
|
|
|
|
|
|
wxFileConfig cfg( dstfile );
|
2011-01-13 20:33:13 +00:00
|
|
|
IniSaver saver( cfg );
|
2009-09-12 02:58:22 +00:00
|
|
|
LoadSave( saver );
|
|
|
|
}
|
2021-09-16 10:14:42 +00:00
|
|
|
|
|
|
|
wxString Pcsx2Config::FullpathToBios() const
|
|
|
|
{
|
|
|
|
return Path::Combine(Folders.Bios, BaseFilenames.Bios);
|
|
|
|
}
|
|
|
|
|
2021-09-17 08:42:39 +00:00
|
|
|
wxString Pcsx2Config::FullpathToMcd(uint slot) const
|
|
|
|
{
|
|
|
|
return Path::Combine(Folders.MemoryCards, Mcd[slot].Filename);
|
|
|
|
}
|
|
|
|
|
2021-09-16 10:14:42 +00:00
|
|
|
void Pcsx2Config::CopyConfig(const Pcsx2Config& cfg)
|
|
|
|
{
|
|
|
|
Cpu = cfg.Cpu;
|
|
|
|
GS = cfg.GS;
|
|
|
|
Speedhacks = cfg.Speedhacks;
|
|
|
|
Gamefixes = cfg.Gamefixes;
|
|
|
|
Profiler = cfg.Profiler;
|
|
|
|
Debugger = cfg.Debugger;
|
|
|
|
Trace = cfg.Trace;
|
|
|
|
BaseFilenames = cfg.BaseFilenames;
|
2021-09-16 10:54:06 +00:00
|
|
|
Framerate = cfg.Framerate;
|
2021-09-17 08:42:39 +00:00
|
|
|
for (u32 i = 0; i < sizeof(Mcd) / sizeof(Mcd[0]); i++)
|
|
|
|
Mcd[i] = cfg.Mcd[i];
|
2021-09-16 10:14:42 +00:00
|
|
|
|
2021-09-17 08:25:52 +00:00
|
|
|
GzipIsoIndexTemplate = cfg.GzipIsoIndexTemplate;
|
|
|
|
|
2021-09-16 10:14:42 +00:00
|
|
|
CdvdVerboseReads = cfg.CdvdVerboseReads;
|
|
|
|
CdvdDumpBlocks = cfg.CdvdDumpBlocks;
|
|
|
|
CdvdShareWrite = cfg.CdvdShareWrite;
|
|
|
|
EnablePatches = cfg.EnablePatches;
|
|
|
|
EnableCheats = cfg.EnableCheats;
|
|
|
|
EnableIPC = cfg.EnableIPC;
|
|
|
|
EnableWideScreenPatches = cfg.EnableWideScreenPatches;
|
|
|
|
#ifndef DISABLE_RECORDING
|
|
|
|
EnableRecordingTools = cfg.EnableRecordingTools;
|
|
|
|
#endif
|
|
|
|
UseBOOT2Injection = cfg.UseBOOT2Injection;
|
|
|
|
BackupSavestate = cfg.BackupSavestate;
|
|
|
|
McdEnableEjection = cfg.McdEnableEjection;
|
|
|
|
McdFolderAutoManage = cfg.McdFolderAutoManage;
|
|
|
|
MultitapPort0_Enabled = cfg.MultitapPort0_Enabled;
|
|
|
|
MultitapPort1_Enabled = cfg.MultitapPort1_Enabled;
|
|
|
|
ConsoleToStdio = cfg.ConsoleToStdio;
|
|
|
|
HostFs = cfg.HostFs;
|
2021-09-17 08:42:39 +00:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
McdCompressNTFS = cfg.McdCompressNTFS;
|
|
|
|
#endif
|
2021-09-16 10:14:42 +00:00
|
|
|
}
|