2009-04-27 02:04:31 +00:00
/* Pcsx2 - Pc Ps2 Emulator
* Copyright ( C ) 2002 - 2009 Pcsx2 Team
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program 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 this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA
*/
# pragma once
class IniInterface ;
2009-07-07 20:53:32 +00:00
enum PluginsEnum_t
{
2009-07-14 06:18:52 +00:00
PluginId_CDVD = 0 ,
PluginId_GS ,
PluginId_PAD ,
PluginId_SPU2 ,
PluginId_USB ,
PluginId_FW ,
PluginId_DEV9 ,
PluginId_Count
2009-07-07 20:53:32 +00:00
} ;
2009-08-04 08:21:10 +00:00
/////////////////////////////////////////////////////////////////////////////////////////
// Pcsx2Config
2009-04-27 02:04:31 +00:00
//
2009-08-04 08:21:10 +00:00
// This is intended to be a public class library, but is *not* meant to be shared data between
// core emulation and plugins or interfaces. Instead data is shared between gui interface and
// emulator via an ini file, which allows data to be communicated in a manner independent of
// class structure and somewhat independent of core emulator options changes.
2009-04-27 02:04:31 +00:00
//
2009-08-04 08:21:10 +00:00
class Pcsx2Config
2009-04-27 02:04:31 +00:00
{
public :
2009-08-04 08:21:10 +00:00
struct ProfilerSettings
2009-04-27 02:04:31 +00:00
{
2009-07-20 00:39:38 +00:00
bool
2009-08-04 08:21:10 +00:00
Enabled : 1 , // universal toggle for the profiler.
RecBlocks_EE : 1 , // Enables per-block profiling for the EE recompiler [unimplemented]
RecBlocks_IOP : 1 , // Enables per-block profiling for the IOP recompiler [unimplemented]
RecBlocks_VU0 : 1 , // Enables per-block profiling for the VU0 recompiler [unimplemented]
RecBlocks_VU1 : 1 ; // Enables per-block profiling for the VU1 recompiler [unimplemented]
2009-07-20 00:39:38 +00:00
2009-07-04 20:53:05 +00:00
void LoadSave ( IniInterface & conf ) ;
2009-04-27 02:04:31 +00:00
} ;
2009-07-08 01:10:59 +00:00
2009-08-04 08:21:10 +00:00
struct RecompilerSettings
2009-04-27 02:04:31 +00:00
{
2009-08-04 08:21:10 +00:00
bool
EnableEE : 1 ,
EnableIOP : 1 ,
EnableVU0 : 1 ,
EnableVU1 : 1 ;
bool
UseMicroVU0 : 1 ,
UseMicroVU1 : 1 ;
2009-07-04 20:53:05 +00:00
void LoadSave ( IniInterface & conf ) ;
2009-07-07 20:53:32 +00:00
2009-08-04 08:21:10 +00:00
} Recompiler ;
2009-04-27 02:04:31 +00:00
2009-07-07 20:53:32 +00:00
// ------------------------------------------------------------------------
2009-08-04 08:21:10 +00:00
struct CpuOptions
2009-04-27 02:04:31 +00:00
{
2009-08-04 08:21:10 +00:00
u32 sseMXCSR ;
u32 sseVUMXCSR ;
2009-04-27 02:04:31 +00:00
2009-08-04 08:21:10 +00:00
bool
vuOverflow : 1 ,
vuExtraOverflow : 1 ,
vuSignOverflow : 1 ,
vuUnderflow : 1 ;
bool
fpuOverflow : 1 ,
fpuExtraOverflow : 1 ,
fpuFullMode : 1 ;
2009-04-27 02:04:31 +00:00
2009-08-04 08:21:10 +00:00
ProfilerSettings Profiler ;
RecompilerSettings Recompiler ;
2009-04-27 02:04:31 +00:00
void LoadSave ( IniInterface & conf ) ;
} ;
2009-07-07 20:53:32 +00:00
// ------------------------------------------------------------------------
2009-04-27 02:04:31 +00:00
struct VideoOptions
{
2009-08-04 08:21:10 +00:00
bool EnableFrameLimiting ;
bool EnableFrameSkipping ;
2009-07-08 01:10:59 +00:00
2009-08-04 08:21:10 +00:00
// The region mode controls the default Maximum/Minimum FPS settings and also
// regulates the vsync rates (which in turn control the IOP's SPU2 tick sync and ensure
// proper audio playback speed).
int DefaultRegionMode ; // 0=NTSC and 1=PAL
int FpsTurbo ; // Limiting kicks in if fps goes beyond this (turbo enabled)
int FpsLimit ; // Limiting kicks in if fps goes beyond this line
int FpsSkip ; // Skipping kicks in if fps drops below this line
int ConsecutiveFrames ; // number of consecutive frames (fields) to render
int ConsecutiveSkip ; // number of consecutive frames (fields) to skip
2009-04-27 02:04:31 +00:00
void LoadSave ( IniInterface & conf ) ;
} ;
2009-07-07 20:53:32 +00:00
// ------------------------------------------------------------------------
2009-04-27 02:04:31 +00:00
struct GamefixOptions
{
bool
VuAddSubHack : 1 , // Fix for Tri-ace games, they use an encryption algorithm that requires VU addi opcode to be bit-accurate.
VuClipFlagHack : 1 , // Fix for Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu.
FpuCompareHack : 1 , // Fix for Persona games, maybe others. It's to do with the VU clip flag (again).
2009-08-04 08:21:10 +00:00
FpuMulHack : 1 , // Fix for Tales of Destiny hangs.
XgKickHack : 1 ; // Fix for Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics, but breaks Tri-ace games and others.
2009-04-27 02:04:31 +00:00
void LoadSave ( ) ;
} ;
2009-07-08 01:10:59 +00:00
2009-07-07 20:53:32 +00:00
// ------------------------------------------------------------------------
2009-04-27 02:04:31 +00:00
struct SpeedhackOptions
{
int
2009-07-23 02:11:45 +00:00
EECycleRate : 2 , // EE cyclerate selector (1.0, 1.5, 2.0)
VUCycleSteal : 3 , // VU Cycle Stealer factor (0, 1, 2, or 3)
2009-04-27 02:04:31 +00:00
IopCycleRate_X2 : 1 , // enables the x2 multiplier of the IOP cyclerate
2009-07-23 02:11:45 +00:00
IntcStat : 1 , // tells Pcsx2 to fast-forward through intc_stat waits.
2009-08-04 08:21:10 +00:00
BIFC0 : 1 , // enables BIFC0 detection and fast-forwarding
vuMinMax : 1 , // microVU specific MinMax hack; Can cause SPS, Black Screens, etc...
vuFlagHack : 1 ; // MicroVU specific flag hack; Can cause Infinite loops, SPS, etc...
2009-04-27 02:04:31 +00:00
void LoadSave ( IniInterface & conf ) ;
} ;
2009-07-08 01:10:59 +00:00
2009-04-27 02:04:31 +00:00
public :
2009-07-07 20:53:32 +00:00
bool CdvdVerboseReads ; // enables cdvd read activity verbosely dumped to the console
2009-08-04 08:21:10 +00:00
bool CdvdDumpBlocks ;
bool EnablePatches ;
2009-07-07 20:53:32 +00:00
2009-08-04 08:21:10 +00:00
// Closes the GS/Video port on escape (good for fullscreen activity)
bool closeGSonEsc ;
2009-07-08 01:10:59 +00:00
2009-08-04 08:21:10 +00:00
// enables simulated ejection of memory cards when loading savestates
bool McdEnableEjection ;
2009-07-08 01:10:59 +00:00
2009-08-04 08:21:10 +00:00
CpuOptions Cpu ;
VideoOptions Video ;
2009-07-07 20:53:32 +00:00
SpeedhackOptions Speedhacks ;
GamefixOptions Gamefixes ;
2009-07-20 00:39:38 +00:00
2009-08-04 08:21:10 +00:00
void Load ( const wxString & srcfile ) ;
void Load ( const wxInputStream & srcstream ) ;
void Save ( const wxString & dstfile ) ;
void Save ( const wxOutputStream & deststream ) ;
2009-07-20 00:39:38 +00:00
2009-08-04 08:21:10 +00:00
void LoadSave ( IniInterface & ini ) ;
} ;
2009-07-20 00:39:38 +00:00
2009-08-04 08:21:10 +00:00
//////////////////////////////////////////////////////////////////////////
// Session Configuration Override Flags
//
// a handful of flags that can override user configurations for the current application session
// only. This allows us to do things like force-disable recompilers if the memory allocations
// for them fail.
struct SessionOverrideFlags
{
bool
ForceDisableEErec : 1 ,
ForceDisableIOPrec : 1 ,
ForceDisableVU0rec : 1 ,
ForceDisableVU1rec : 1 ;
} ;
2009-07-14 06:18:52 +00:00
2009-08-04 08:21:10 +00:00
extern Pcsx2Config EmuConfig ;
extern SessionOverrideFlags g_Session ;
2009-07-08 01:10:59 +00:00
2009-08-04 08:21:10 +00:00
/////////////////////////////////////////////////////////////////////////////////////////
// Helper Macros for Reading Emu Configurations.
//
2009-04-27 02:04:31 +00:00
2009-08-04 08:21:10 +00:00
// ------------ CPU / Recompiler Options ---------------
# define CHECK_MICROVU0 (EmuConfig.Cpu.Recompiler.UseMicroVU0)
# define CHECK_MICROVU1 (EmuConfig.Cpu.Recompiler.UseMicroVU1)
# define CHECK_EEREC (!g_Session.ForceDisableEErec && EmuConfig.Cpu.Recompiler.EnableEE)
# define CHECK_IOPREC (!g_Session.ForceDisableIOPrec && EmuConfig.Cpu.Recompiler.EnableIOP)
# define CHECK_VU0REC (!g_Session.ForceDisableVU0rec && EmuConfig.Cpu.Recompiler.EnableVU0)
# define CHECK_VU1REC (!g_Session.ForceDisableVU1rec && EmuConfig.Cpu.Recompiler.EnableVU1)
//------------ SPECIAL GAME FIXES!!! ---------------
# define CHECK_VUADDSUBHACK (EmuConfig.Gamefixes.VuAddSubHack) // Special Fix for Tri-ace games, they use an encryption algorithm that requires VU addi opcode to be bit-accurate.
# define CHECK_FPUCOMPAREHACK (EmuConfig.Gamefixes.FpuCompareHack) // Special Fix for Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu.
# define CHECK_VUCLIPFLAGHACK (EmuConfig.Gamefixes.VuClipFlagHack) // Special Fix for Persona games, maybe others. It's to do with the VU clip flag (again).
# define CHECK_FPUMULHACK (EmuConfig.Gamefixes.FpuMulHack) // Special Fix for Tales of Destiny hangs.
# define CHECK_DMAEXECHACK (false) //sVU-only, ignored // Special Fix for Fatal Frame; breaks Gust and Tri-Ace games.
# define CHECK_XGKICKHACK (EmuConfig.Gamefixes.XgKickHack) // Special Fix for Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics.
//------------ Advanced Options!!! ---------------
# define CHECK_VU_OVERFLOW (EmuConfig.Cpu.vuOverflow)
# define CHECK_VU_EXTRA_OVERFLOW (EmuConfig.Cpu.vuExtraOverflow) // If enabled, Operands are clamped before being used in the VU recs
# define CHECK_VU_SIGN_OVERFLOW (EmuConfig.Cpu.vuSignOverflow)
# define CHECK_VU_UNDERFLOW (EmuConfig.Cpu.vuUnderflow)
# define CHECK_VU_EXTRA_FLAGS 0 // Always disabled now // Sets correct flags in the sVU recs
# define CHECK_FPU_OVERFLOW (EmuConfig.Cpu.fpuOverflow)
# define CHECK_FPU_EXTRA_OVERFLOW (EmuConfig.Cpu.fpuExtraOverflow) // If enabled, Operands are checked for infinities before being used in the FPU recs
# define CHECK_FPU_EXTRA_FLAGS 1 // Always enabled now // Sets D/I flags on FPU instructions
# define CHECK_FPU_FULL (EmuConfig.Cpu.fpuFullMode)
//------------ DEFAULT sseMXCSR VALUES!!! ---------------
# define DEFAULT_sseMXCSR 0xffc0 //FPU rounding > DaZ, FtZ, "chop"
# define DEFAULT_sseVUMXCSR 0xffc0 //VU rounding > DaZ, FtZ, "chop"
//------------ EE Recompiler defines - Comment to disable a recompiler ---------------
# define SHIFT_RECOMPILE // Speed majorly reduced if disabled
# define BRANCH_RECOMPILE // Speed extremely reduced if disabled - more then shift
// Disabling all the recompilers in this block is interesting, as it still runs at a reasonable rate.
// It also adds a few glitches. Really reminds me of the old Linux 64-bit version. --arcum42
# define ARITHMETICIMM_RECOMPILE
# define ARITHMETIC_RECOMPILE
# define MULTDIV_RECOMPILE
# define JUMP_RECOMPILE
# define LOADSTORE_RECOMPILE
# define MOVE_RECOMPILE
# define MMI_RECOMPILE
# define MMI0_RECOMPILE
# define MMI1_RECOMPILE
# define MMI2_RECOMPILE
# define MMI3_RECOMPILE
# define FPU_RECOMPILE
# define CP0_RECOMPILE
# define CP2_RECOMPILE
// You can't recompile ARITHMETICIMM without ARITHMETIC.
# ifndef ARITHMETIC_RECOMPILE
# undef ARITHMETICIMM_RECOMPILE
# endif
# define EE_CONST_PROP // rec2 - enables constant propagation (faster)