wxgui: separated core emulation options from user interface options (mostly! some interdependencies remain), and stripped out some of the old framelimiting toggle/cycle code, which will be replaced with a better framelimiter system soon.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1602 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-08-04 08:21:10 +00:00
parent bafd21140f
commit 4836aac1f5
44 changed files with 606 additions and 429 deletions

View File

@ -31,7 +31,6 @@
#include "Pcsx2Types.h"
#include "Pcsx2Defs.h"
#include "Pcsx2Config.h"
// Indicate to use the new versions.
#define NEW_PLUGIN_APIS

View File

@ -25,6 +25,8 @@
#include "IsoFStools.h"
#include "CDVD_internal.h"
#include "CDVDisoReader.h"
#include "gs.h" // for gsRegionMode
#include "AppConfig.h"
static cdvdStruct cdvd;
@ -861,7 +863,7 @@ u8 monthmap[13] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
void cdvdVsync() {
cdvd.RTCcount++;
if (cdvd.RTCcount < ((Config.PsxType & 1) ? 50 : 60)) return;
if (cdvd.RTCcount < ((gsRegionMode == Region_NTSC) ? 60 : 50)) return;
cdvd.RTCcount = 0;
cdvd.RTC.second++;
@ -1113,7 +1115,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
CDR_LOG( "CdRead > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%x(%x), ReadMode=%x(%x) (1074=%x)",
cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074));
if( Config.cdvdPrint )
if( EmuConfig.CdvdVerboseReads )
Console::WriteLn("CdRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
params cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed);
@ -1160,7 +1162,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
CDR_LOG( "CdReadCDDA > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%xx(%x), ReadMode=%x(%x) (1074=%x)",
cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074));
if( Config.cdvdPrint )
if( EmuConfig.CdvdVerboseReads )
Console::WriteLn("CdAudioRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
params cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed);
@ -1195,7 +1197,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
CDR_LOG( "DvdRead > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%x(%x), ReadMode=%x(%x) (1074=%x)",
cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074));
if( Config.cdvdPrint )
if( EmuConfig.CdvdVerboseReads )
Console::WriteLn("DvdRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx",
params cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed);

View File

@ -135,17 +135,13 @@ struct cdvdStruct {
struct CDVD_API
{
struct
{
void (CALLBACK *close)();
void (CALLBACK *close)();
// Don't need init or shutdown. iso/nodisc have no init/shutdown and plugin's
// is handled by the PluginManager.
// Don't need pluign specific things like freeze, test, or other stuff here.
// Those are handled by the plugin manager specifically.
} Common;
// Don't need init or shutdown. iso/nodisc have no init/shutdown and plugin's
// is handled by the PluginManager.
// Don't need pluign specific things like freeze, test, or other stuff here.
// Those are handled by the plugin manager specifically.
_CDVDopen open;
_CDVDreadTrack readTrack;

View File

@ -292,7 +292,7 @@ s32 DoCDVDopen(const char* pTitleFilename)
int ret = CDVD->open(pTitleFilename);
int cdtype = DoCDVDdetectDiskType();
if ((Config.Blockdump) && (cdtype != CDVD_TYPE_NODISC))
if (EmuConfig.CdvdDumpBlocks && (cdtype != CDVD_TYPE_NODISC))
{
// TODO: Add a blockdumps configurable folder, and use that instead of CWD().
@ -347,8 +347,8 @@ void DoCDVDclose()
{
CheckNullCDVD();
if(blockDumpFile) isoClose(blockDumpFile);
if( CDVD->Common.close != NULL )
CDVD->Common.close();
if( CDVD->close != NULL )
CDVD->close();
}
s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode)
@ -503,10 +503,7 @@ wxString NODISCgetUniqueFilename()
CDVD_API CDVDapi_NoDisc =
{
{
NODISCclose,
},
NODISCclose,
NODISCopen,
NODISCreadTrack,
NODISCgetBuffer,

View File

@ -393,10 +393,8 @@ wxString ISOgetUniqueFilename()
CDVD_API CDVDapi_Iso =
{
{
ISOclose
},
ISOclose,
ISOopen,
ISOreadTrack,
ISOgetBuffer, // emu shouldn't use this one.

View File

@ -32,116 +32,64 @@ enum PluginsEnum_t
PluginId_Count
};
//////////////////////////////////////////////////////////////////////////////////////////
// Pcsx2 Application Configuration.
/////////////////////////////////////////////////////////////////////////////////////////
// Pcsx2Config
//
// [TODO] : Rename this once we get to the point where the old Pcsx2Config stuff isn't in
// the way anymore. :)
// 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.
//
class AppConfig
class Pcsx2Config
{
public:
// ------------------------------------------------------------------------
struct ConsoleLogOptions
struct ProfilerSettings
{
bool Visible;
// if true, DisplayPos is ignored and the console is automatically docked to the main window.
bool AutoDock;
// Display position used if AutoDock is false (ignored otherwise)
wxPoint DisplayPosition;
wxSize DisplaySize;
// Size of the font in points.
int FontSize;
bool
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]
void LoadSave( IniInterface& conf, const wxChar* title );
void LoadSave( IniInterface& conf );
};
// ------------------------------------------------------------------------
struct FolderOptions
struct RecompilerSettings
{
wxDirName
Plugins,
Settings,
Bios,
Snapshots,
Savestates,
MemoryCards,
Logs;
bool
EnableEE:1,
EnableIOP:1,
EnableVU0:1,
EnableVU1:1;
bool
UseMicroVU0:1,
UseMicroVU1:1;
wxDirName RunIso; // last used location for Iso loading.
void LoadSave( IniInterface& conf );
} Recompiler;
// ------------------------------------------------------------------------
struct CpuOptions
{
u32 sseMXCSR;
u32 sseVUMXCSR;
bool
UseDefaultPlugins:1,
UseDefaultSettings:1,
UseDefaultBios:1,
UseDefaultSnapshots:1,
UseDefaultSavestates:1,
UseDefaultMemoryCards:1,
UseDefaultLogs:1;
vuOverflow:1,
vuExtraOverflow:1,
vuSignOverflow:1,
vuUnderflow:1;
bool
fpuOverflow:1,
fpuExtraOverflow:1,
fpuFullMode:1;
void LoadSave( IniInterface& conf );
void ApplyDefaults();
void Set( FoldersEnum_t folderidx, const wxString& src, bool useDefault );
const wxDirName& operator[]( FoldersEnum_t folderidx ) const;
const bool IsDefault( FoldersEnum_t folderidx ) const;
};
// ------------------------------------------------------------------------
struct FilenameOptions
{
wxFileName Bios;
wxFileName Plugins[PluginId_Count];
void LoadSave( IniInterface& conf );
const wxFileName& operator[]( PluginsEnum_t pluginidx ) const;
};
// ------------------------------------------------------------------------
// Options struct for each memory card.
//
struct McdOptions
{
wxFileName Filename; // user-configured location of this memory card
bool Enabled; // memory card enabled (if false, memcard will not show up in-game)
};
// ------------------------------------------------------------------------
struct McdSysOptions
{
McdOptions Mcd[2];
bool EnableNTFS; // enables automatic ntfs compression of memory cards (Win32 only)
bool EnableEjection; // enables simulated ejection of memory cards when loading savestates
void LoadSave( IniInterface& conf );
};
// ------------------------------------------------------------------------
struct CpuRecompilerOptions
{
struct
{
bool
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_VU1:1; // Enables per-block profiling for the VU1 recompiler [unimplemented]
} Profiler;
struct
{
bool
EnableEE:1,
EnableIOP:1,
EnableVU0:1,
EnableVU1:1;
} Recompiler;
ProfilerSettings Profiler;
RecompilerSettings Recompiler;
void LoadSave( IniInterface& conf );
};
@ -149,15 +97,19 @@ public:
// ------------------------------------------------------------------------
struct VideoOptions
{
bool MultithreadGS; // Uses the multithreaded GS interface.
bool closeOnEsc; // Closes the GS/Video port on escape (good for fullscreen activity)
bool UseFramelimiter;
bool EnableFrameLimiting;
bool EnableFrameSkipping;
int RegionMode; // 0=NTSC and 1=PAL
int CustomFps;
int CustomFrameSkip;
int CustomConsecutiveFrames;
int CustomConsecutiveSkip;
// 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
void LoadSave( IniInterface& conf );
};
@ -169,7 +121,9 @@ public:
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).
FpuMulHack:1; // Fix for Tales of Destiny hangs.
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.
void LoadSave();
};
@ -182,71 +136,117 @@ public:
VUCycleSteal:3, // VU Cycle Stealer factor (0, 1, 2, or 3)
IopCycleRate_X2:1, // enables the x2 multiplier of the IOP cyclerate
IntcStat:1, // tells Pcsx2 to fast-forward through intc_stat waits.
BIFC0:1; // enables BIFC0 detection and fast-forwarding
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...
void LoadSave( IniInterface& conf );
};
public:
bool UseAdminMode; // dictates if the program uses /home/user or /cwd for the program data
wxPoint MainGuiPosition;
bool CdvdVerboseReads; // enables cdvd read activity verbosely dumped to the console
bool CdvdDumpBlocks;
bool EnablePatches;
// Current language in use (correlates to a wxWidgets wxLANGUAGE specifier)
wxLanguage LanguageId;
int RecentFileCount; // number of files displayed in the Recent Isos list.
// String value describing the desktop theme to use for pcsk2 (icons and background images)
// The theme name is used to look up files in the themes folder (relative to the executable).
wxString DeskTheme;
// Closes the GS/Video port on escape (good for fullscreen activity)
bool closeGSonEsc;
// Specifies the size of icons used in Listbooks; specifically the PCSX2 Properties dialog box.
// Realistic values range from 96x96 to 24x24.
int Listbook_ImageSize;
// enables simulated ejection of memory cards when loading savestates
bool McdEnableEjection;
// Specifies the size of each toolbar icon, in pixels (any value >= 2 is valid, but realistically
// values should be between 64 and 16 for usability reasons)
int Toolbar_ImageSize;
// Enables display of toolbar text labels.
bool Toolbar_ShowLabels;
CpuRecompilerOptions Cpu;
CpuOptions Cpu;
VideoOptions Video;
SpeedhackOptions Speedhacks;
GamefixOptions Gamefixes;
VideoOptions Video;
ConsoleLogOptions ProgLogBox;
ConsoleLogOptions Ps2ConBox;
FolderOptions Folders;
FilenameOptions BaseFilenames;
McdSysOptions MemoryCards;
protected:
// indicates if the main AppConfig settings are valid (excludes the status of UseAdminMode,
// which is a special value that's initialized independently of the rest of the config)
bool m_IsLoaded;
void Load( const wxString& srcfile );
void Load( const wxInputStream& srcstream );
void Save( const wxString& dstfile );
void Save( const wxOutputStream& deststream );
public:
AppConfig() :
Listbook_ImageSize( 32 )
, Toolbar_ImageSize( 24 )
, m_IsLoaded( false )
{
}
wxString FullpathToBios() const;
wxString FullpathToMcd( uint mcdidx ) const;
wxString FullpathTo( PluginsEnum_t pluginId ) const;
void Load();
void Save();
void Apply();
void LoadSaveUserMode( IniInterface& ini );
protected:
void LoadSave( IniInterface& ini );
};
extern AppConfig* g_Conf;
//////////////////////////////////////////////////////////////////////////
// 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;
};
extern Pcsx2Config EmuConfig;
extern SessionOverrideFlags g_Session;
/////////////////////////////////////////////////////////////////////////////////////////
// Helper Macros for Reading Emu Configurations.
//
// ------------ 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)

View File

@ -227,7 +227,7 @@ static void vSyncInfoCalc( vSyncTimingInfo* info, u32 framesPerSecond, u32 scans
u32 UpdateVSyncRate()
{
const char *limiterMsg = "Framelimiter rate updated (UpdateVSyncRate): %d.%d fps";
static const char *limiterMsg = "Framelimiter rate updated (UpdateVSyncRate): %d.%d fps";
// fixme - According to some docs, progressive-scan modes actually refresh slower than
// interlaced modes. But I can't fathom how, since the refresh rate is a function of
@ -237,7 +237,7 @@ u32 UpdateVSyncRate()
//#define VBLANK_NTSC ((Config.PsxType & 2) ? 59.94 : 59.82) //59.94 is more precise
//#define VBLANK_PAL ((Config.PsxType & 2) ? 50.00 : 49.76)
if(Config.PsxType & 1)
if( gsRegionMode == Region_PAL )
{
if( vSyncInfo.Framerate != FRAMERATE_PAL )
vSyncInfoCalc( &vSyncInfo, FRAMERATE_PAL, SCANLINES_TOTAL_PAL );
@ -251,14 +251,14 @@ u32 UpdateVSyncRate()
hsyncCounter.CycleT = vSyncInfo.hRender; // Amount of cycles before the counter will be updated
vsyncCounter.CycleT = vSyncInfo.Render; // Amount of cycles before the counter will be updated
if (Config.CustomFps > 0)
if( EmuConfig.Video.EnableFrameLimiting && (EmuConfig.Video.FpsLimit > 0) )
{
s64 ticks = GetTickFrequency() / Config.CustomFps;
s64 ticks = GetTickFrequency() / EmuConfig.Video.FpsLimit;
if( m_iTicks != ticks )
{
m_iTicks = ticks;
gsOnModeChanged( vSyncInfo.Framerate, m_iTicks );
Console::Status( limiterMsg, params Config.CustomFps, 0 );
Console::Status( limiterMsg, params EmuConfig.Video.FpsLimit, 0 );
}
}
else
@ -288,8 +288,8 @@ void frameLimitReset()
// See the GS FrameSkip function for details on why this is here and not in the GS.
static __forceinline void frameLimit()
{
if( CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_NORMAL ) return;
if( Config.CustomFps >= 999 ) return; // means the user would rather just have framelimiting turned off...
// 999 means the user would rather just have framelimiting turned off...
if( !EmuConfig.Video.EnableFrameLimiting || EmuConfig.Video.FpsLimit >= 999 ) return;
s64 sDeltaTime;
u64 uExpectedEnd;
@ -351,7 +351,7 @@ static __forceinline void VSyncStart(u32 sCycle)
psxVBlankStart();
if (gates) rcntStartGate(true, sCycle); // Counters Start Gate code
if (Config.Patch) applypatch(1); // Apply patches (ToDo: clean up patch code)
//if (Config.Patch) applypatch(1); // fixme - Apply patches
// INTC - VB Blank Start Hack --
// Hack fix! This corrects a freezeup in Granda 2 where it decides to spin
@ -802,7 +802,6 @@ void SaveState::rcntFreeze()
Freeze( vsyncCounter );
Freeze( nextCounter );
Freeze( nextsCounter );
Freeze( Config.PsxType );
if( IsLoading() )
{

View File

@ -18,8 +18,6 @@
#pragma once
#include "Pcsx2Config.h"
extern FILE *emuLog;
extern char* disVU0MicroUF(u32 code, u32 pc);

View File

@ -24,6 +24,8 @@
#include "iR5900.h"
#include "IPU/IPU.h"
#include "AppConfig.h"
using namespace R5900;
// fixme: currently should not be uncommented.
//#define TEST_BROKEN_DUMP_ROUTINES

View File

@ -23,4 +23,4 @@ extern void iDumpPsxRegisters(u32 startpc, u32 temp);
extern void iDumpVU0Registers();
extern void iDumpVU1Registers();
extern void iDumpBlock( int startpc, u8 * ptr );
extern void iIopDumpBlock( int startpc, u8 * ptr );
extern void iIopDumpBlock( int startpc, u8 * ptr );

View File

@ -476,7 +476,7 @@ void ElfApplyPatches()
// if patches found the following status msg will be overwritten
Console::SetTitle( wxsFormat( _("Game running [CRC=%s]"), filename.c_str() ) );
if( !Config.Patch ) return;
if( !EmuConfig.EnablePatches ) return;
if(LoadPatch( filename ) != 0)
{

View File

@ -100,10 +100,10 @@ void _gs_ChangeTimings( u32 framerate, u32 iTicks )
{
m_iSlowStart = GetCPUTicks();
u32 frameSkipThreshold = Config.CustomFrameSkip*50;
if( Config.CustomFrameSkip == 0)
u32 frameSkipThreshold = EmuConfig.Video.FpsSkip*50;
if( frameSkipThreshold == 0)
{
// default: load the frameSkipThreshold with a value roughly 90% of our current framerate
// default: load the frameSkipThreshold with a value roughly 90% of the PS2 native framerate
frameSkipThreshold = ( framerate * 242 ) / 256;
}
@ -126,22 +126,16 @@ void gsOnModeChanged( u32 framerate, u32 newTickrate )
mtgsThread->SendSimplePacket( GS_RINGTYPE_MODECHANGE, framerate, newTickrate, 0 );
}
void gsSetVideoRegionType( u32 isPal )
{
if( isPal )
{
if( Config.PsxType & 1 ) return;
Console::WriteLn( "PAL Display Mode Initialized." );
Config.PsxType |= 1;
}
else
{
if( !(Config.PsxType & 1 ) ) return;
Console::WriteLn( "NTSC Display Mode Initialized." );
Config.PsxType &= ~1;
}
static bool gsIsInterlaced = false;
GS_RegionMode gsRegionMode = Region_NTSC;
// If we made it this far it means the refresh rate changed, so update the vsync timers:
void gsSetRegionMode( GS_RegionMode region )
{
if( gsRegionMode == region ) return;
gsRegionMode = region;
Console::WriteLn( "%s Display Mode Initialized.", params (( gsRegionMode == Region_PAL ) ? "PAL" : "NTSC") );
UpdateVSyncRate();
}
@ -149,17 +143,16 @@ void gsSetVideoRegionType( u32 isPal )
// Make sure framelimiter options are in sync with the plugin's capabilities.
void gsInit()
{
if( (CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_SKIP) && (GSsetFrameSkip == NULL) )
if( EmuConfig.Video.EnableFrameSkipping && (GSsetFrameSkip == NULL) )
{
Config.Options &= ~PCSX2_FRAMELIMIT_MASK;
Console::WriteLn("Notice: Disabling frameskip -- GS plugin does not support it.");
EmuConfig.Video.EnableFrameSkipping = false;
Console::WriteLn("Notice: Disabling frameskipping -- GS plugin does not support it.");
}
}
// Opens the gsRingbuffer thread.
s32 gsOpen()
{
u32 curFrameLimit = Config.Options & PCSX2_FRAMELIMIT_MASK;
if( m_gsOpened ) return 0;
//video
@ -186,13 +179,16 @@ s32 gsOpen()
);
}*/
// FIXME : This is the gs/vsync tie-in for framelimiting, but it really
// needs to be called from the hotkey framelimiter enable/disable too.
if(GSsetFrameLimit == NULL)
{
DevCon::Notice("Notice: GS Plugin does not implement GSsetFrameLimit.");
}
else
{
GSsetFrameLimit(curFrameLimit != PCSX2_FRAMELIMIT_NORMAL);
GSsetFrameLimit( EmuConfig.Video.EnableFrameLimiting );
}
return !m_gsOpened;
@ -212,7 +208,7 @@ void gsReset()
mtgsThread->Reset();
gsOnModeChanged(
(Config.PsxType & 1) ? FRAMERATE_PAL : FRAMERATE_NTSC,
(gsRegionMode == Region_NTSC) ? FRAMERATE_NTSC : FRAMERATE_PAL,
UpdateVSyncRate()
);
@ -329,14 +325,11 @@ __forceinline void _gsSMODEwrite( u32 mem, u32 value )
switch (mem)
{
case GS_SMODE1:
gsSetVideoRegionType( (value & 0x6000) == 0x6000 );
gsSetRegionMode( ((value & 0x6000) == 0x6000) ? Region_PAL : Region_NTSC );
break;
case GS_SMODE2:
if(value & 0x1)
Config.PsxType |= 2; // Interlaced
else
Config.PsxType &= ~2; // Non-Interlaced
gsIsInterlaced = (value & 0x1);
break;
}
}
@ -519,6 +512,7 @@ void gsSyncLimiterLostTime( s32 deltaTime )
);
}
/////////////////////////////////////////////////////////////////////////////////////////
// FrameSkipper - Measures delta time between calls and issues frameskips
// it the time is too long. Also regulates the status of the EE's framelimiter.
@ -539,15 +533,15 @@ __forceinline void gsFrameSkip( bool forceskip )
static u8 FramesToRender = 0;
static u8 FramesToSkip = 0;
if( CHECK_FRAMELIMIT != PCSX2_FRAMELIMIT_SKIP ) return;
if( !EmuConfig.Video.EnableFrameSkipping ) return;
// FrameSkip and VU-Skip Magic!
// Skips a sequence of consecutive frames after a sequence of rendered frames
// This is the least number of consecutive frames we will render w/o skipping
const int noSkipFrames = ((Config.CustomConsecutiveFrames>0) ? Config.CustomConsecutiveFrames : 1);
const int noSkipFrames = ((EmuConfig.Video.ConsecutiveFrames>0) ? EmuConfig.Video.ConsecutiveFrames : 1);
// This is the number of consecutive frames we will skip
const int yesSkipFrames = ((Config.CustomConsecutiveSkip>0) ? Config.CustomConsecutiveSkip : 1);
const int yesSkipFrames = ((EmuConfig.Video.ConsecutiveSkip>0) ? EmuConfig.Video.ConsecutiveSkip : 1);
const u64 iEnd = GetCPUTicks();
const s64 uSlowExpectedEnd = m_iSlowStart + m_iSlowTicks;

View File

@ -16,13 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __GS_H__
#define __GS_H__
// GCC needs these includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma once
#include "Common.h"
#include "Utilities/Threading.h"
@ -32,7 +26,15 @@ PCSX2_ALIGNED16( extern u8 g_RealGSMem[0x2000] );
#define GSIMR *((u32*)(g_RealGSMem+0x1010))
#define GSSIGLBLID ((GSRegSIGBLID*)(g_RealGSMem+0x1080))
/////////////////////////////////////////////////////////////////////////////
enum GS_RegionMode
{
Region_NTSC,
Region_PAL
};
extern GS_RegionMode gsRegionMode;
/////////////////////////////////////////////////////////////////////////////////////////
// MTGS GIFtag Parser - Declaration
//
// The MTGS needs a dummy "GS plugin" for processing SIGNAL, FINISH, and LABEL
@ -291,7 +293,7 @@ extern s32 gsOpen();
extern void gsClose();
extern void gsReset();
extern void gsOnModeChanged( u32 framerate, u32 newTickrate );
extern void gsSetVideoRegionType( u32 isPal );
extern void gsSetRegionMode( GS_RegionMode isPal );
extern void gsResetFrameSkip();
extern void gsSyncLimiterLostTime( s32 deltaTime );
extern void gsDynamicSkipEnable();
@ -368,4 +370,3 @@ extern gzSavingState* g_fGSSave;
void RunGSState(gzLoadingState& f);
#endif

View File

@ -50,6 +50,7 @@ BIOS
#include "VUmicro.h"
#include "GS.h"
#include "IPU/IPU.h"
#include "AppConfig.h"
#ifdef ENABLECACHE
@ -759,8 +760,8 @@ void memReset()
_ext_memWrite8<1>, _ext_memWrite16<1>, hwWrite32_page_0E, hwWrite64_page_0E, hwWrite128_generic
);
vtlbMemR32FP* page0F32( Config.Hacks.INTCSTATSlow ? hwRead32_page_0F_INTC_HACK : hwRead32_page_0F );
vtlbMemR64FP* page0F64( Config.Hacks.INTCSTATSlow ? hwRead64_generic_INTC_HACK : hwRead64_generic );
vtlbMemR32FP* page0F32( EmuConfig.Speedhacks.IntcStat ? hwRead32_page_0F_INTC_HACK : hwRead32_page_0F );
vtlbMemR64FP* page0F64( EmuConfig.Speedhacks.IntcStat ? hwRead64_generic_INTC_HACK : hwRead64_generic );
hw_by_page[0xf] = vtlb_RegisterHandler(
_ext_memRead8<1>, _ext_memRead16<1>, page0F32, page0F64, hwRead128_generic,

View File

@ -1,25 +1,31 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2008 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
*/
* Copyright (C) 2002-2008 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
*/
// Note: This file is meant to be part of the HostGui/App, and not part of the
// emu. The emu accesses it from the SIO interface. It's possible this could be
// transformed into a plugin, although the benefit of such a system probably isn't
// significant.
#include "PrecompiledHeader.h"
#include "System.h"
#include "MemoryCard.h"
#include "AppConfig.h"
#include <wx/file.h>
@ -35,7 +41,7 @@ void MemoryCard::Init()
{
for( int i=0; i<2; i++ )
{
if( Config.Mcd[i].Enabled && !cardfile[i].IsOpened() )
if( g_Conf->Mcd[i].Enabled && !cardfile[i].IsOpened() )
Load( i );
}
}
@ -68,7 +74,7 @@ void MemoryCard::Load( uint mcd )
Create( str );
#ifdef WIN32
NTFS_CompressFile( str, Config.McdEnableNTFS );
NTFS_CompressFile( str, g_Conf->McdEnableNTFS );
#endif
cardfile[mcd].Open( str.c_str(), wxFile::write );

View File

@ -34,7 +34,7 @@
#include "VUmicro.h"
#include "VU.h"
#include "iCore.h"
#include "sVU_zerorec.h"
//#include "sVU_zerorec.h"
#include "BaseblockEx.h" // included for devbuild block dumping (which may or may not work anymore?)
#include "GS.h"
@ -42,11 +42,11 @@
#include "Cache.h"
#include "Dump.h"
#include "AppConfig.h"
using namespace std;
using namespace R5900;
PcsxConfig Config;
u32 BiosVersion;
static int g_Pcsx2Recording = 0; // true 1 if recording video and sound
bool renderswitch = 0;
@ -389,82 +389,6 @@ static wxString GetGSStateFilename()
return Path::Combine( g_Conf->Folders.Savestates, wxsFormat( L"/%8.8X.%d.gs", ElfCRC, StatesC ) );
}
void CycleFrameLimit(int dir)
{
const char* limitMsg;
u32 newOptions;
u32 curFrameLimit = Config.Options & PCSX2_FRAMELIMIT_MASK;
u32 newFrameLimit = 0;
static u32 oldFrameLimit = PCSX2_FRAMELIMIT_LIMIT;
if( dir == 0 ) {
// turn off limit or restore previous limit mode
if (curFrameLimit) {
oldFrameLimit = curFrameLimit;
newFrameLimit = 0;
} else
newFrameLimit = oldFrameLimit;
}
else if (dir > 0) // next
{
newFrameLimit = curFrameLimit + PCSX2_FRAMELIMIT_LIMIT;
if( newFrameLimit > PCSX2_FRAMELIMIT_SKIP )
newFrameLimit = 0;
}
else // previous
{
if( newFrameLimit == 0 )
newFrameLimit = PCSX2_FRAMELIMIT_SKIP;
else
newFrameLimit = curFrameLimit - PCSX2_FRAMELIMIT_LIMIT;
}
newOptions = (Config.Options & ~PCSX2_FRAMELIMIT_MASK) | newFrameLimit;
gsResetFrameSkip();
// Allows sync to vblank only when framelimit is on, if GS can.
if(GSsetFrameLimit == NULL)
{
DevCon::Notice("Notice: GS Plugin does not implement GSsetFrameLimit.");
}
else
{
GSsetFrameLimit(newFrameLimit);
}
switch(newFrameLimit) {
case PCSX2_FRAMELIMIT_NORMAL:
limitMsg = "None/Normal";
break;
case PCSX2_FRAMELIMIT_LIMIT:
limitMsg = "Limit";
break;
case PCSX2_FRAMELIMIT_SKIP:
if( GSsetFrameSkip == NULL )
{
newOptions &= ~PCSX2_FRAMELIMIT_MASK;
Console::Notice("Notice: GS Plugin does not support frameskipping.");
limitMsg = "None/Normal";
}
else
{
// When enabling Skipping we have to make sure Skipper (GS) and Limiter (EE)
// are properly synchronized.
gsDynamicSkipEnable();
limitMsg = "Skip";
}
break;
}
Threading::AtomicExchange( Config.Options, newOptions );
Console::Notice("Frame Limit Mode Changed: %s", params limitMsg );
// [Air]: Do we really want to save runtime changes to frameskipping?
//SaveConfig();
}
void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
{
assert(fkey >= 1 && fkey <= 12 );
@ -535,7 +459,8 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
break;
case 4:
CycleFrameLimit(keymod->shift ? -1 : 1);
// FIXME : Reimplement framelimiting using new oolean system
//CycleFrameLimit(keymod->shift ? -1 : 1);
break;
// note: VK_F5-VK_F7 are reserved for GS

View File

@ -44,10 +44,6 @@ extern u32 g_sseVUMXCSR, g_sseMXCSR;
extern void ProcessFKeys(int fkey, struct KeyModifiers *keymod); // processes fkey related commands value 1-12
extern bool IsBIOS(const wxString& filename, wxString& description);
//extern const char *LabelAuthors;
//extern const char *LabelGreets;
void CycleFrameLimit(int dir);
void SaveGSState(const wxString& file);
void LoadGSState(const wxString& file);

View File

@ -709,8 +709,8 @@ void patchFunc_roundmode( char * cmd, char * param )
int index;
char * pText;
u32 eetype = (Config.sseMXCSR & 0x6000);
u32 vutype = (Config.sseVUMXCSR & 0x6000);
u32 eetype = (EmuConfig.Cpu.sseMXCSR & 0x6000);
u32 vutype = (EmuConfig.Cpu.sseVUMXCSR & 0x6000);
index = 0;
pText = strtok( param, ", " );
@ -755,5 +755,5 @@ void patchFunc_zerogs(char* cmd, char* param)
void SetRoundMode(u32 ee, u32 vu)
{
SetCPUState( (Config.sseMXCSR & 0x9fff) | ee, (Config.sseVUMXCSR & 0x9fff) | vu);
SetCPUState( (EmuConfig.Cpu.sseMXCSR & 0x9fff) | ee, (EmuConfig.Cpu.sseVUMXCSR & 0x9fff) | vu);
}

107
pcsx2/Pcsx2Config.cpp Normal file
View File

@ -0,0 +1,107 @@
/* 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
*/
#include "PrecompiledHeader.h"
#include "IniInterface.h"
#include "Config.h"
#include <wx/fileconf.h>
void Pcsx2Config::SpeedhackOptions::LoadSave( IniInterface& ini )
{
ini.SetPath( L"Speedhacks" );
IniBitfield( EECycleRate, 0 );
IniBitfield( VUCycleSteal, 0 );
IniBitBool( IopCycleRate_X2, false );
IniBitBool( IntcStat, false );
IniBitBool( BIFC0, false );
ini.SetPath( L".." );
}
void Pcsx2Config::ProfilerSettings::LoadSave( IniInterface& ini )
{
ini.SetPath( L"Profiler" );
IniBitBool( Enabled, false );
IniBitBool( RecBlocks_EE, true );
IniBitBool( RecBlocks_IOP, true );
IniBitBool( RecBlocks_VU0, true );
IniBitBool( RecBlocks_VU1, true );
ini.SetPath( L".." );
}
void Pcsx2Config::RecompilerSettings::LoadSave( IniInterface& ini )
{
ini.SetPath( L"Recompiler" );
IniBitBool( EnableEE, true );
IniBitBool( EnableIOP, true );
IniBitBool( EnableVU0, true );
IniBitBool( EnableVU1, true );
ini.SetPath( L".." );
}
void Pcsx2Config::CpuOptions::LoadSave( IniInterface& ini )
{
IniEntry( sseMXCSR, DEFAULT_sseMXCSR );
IniEntry( sseVUMXCSR, DEFAULT_sseVUMXCSR );
IniBitBool( vuOverflow, true );
IniBitBool( vuExtraOverflow, false );
IniBitBool( vuSignOverflow, false );
IniBitBool( vuUnderflow, false );
IniBitBool( fpuOverflow, true );
IniBitBool( fpuExtraOverflow, false );
IniBitBool( fpuFullMode, false );
Recompiler.LoadSave( ini );
Profiler.LoadSave( ini );
}
void Pcsx2Config::LoadSave( IniInterface& ini )
{
ini.SetPath( L"EmuCore" );
IniEntry( CdvdVerboseReads, false );
// Process various sub-components:
Speedhacks.LoadSave( ini );
Cpu.LoadSave( ini );
ini.SetPath( L".." );
ini.Flush();
}
void Pcsx2Config::Load( const wxString& srcfile )
{
//m_IsLoaded = true;
// Note: Extra parenthesis resolves "I think this is a function" issues with C++.
wxFileConfig cfg( srcfile );
IniLoader loader( (IniLoader( cfg )) );
LoadSave( loader );
}
void Pcsx2Config::Save( const wxString& dstfile )
{
//if( !m_IsLoaded ) return;
wxFileConfig cfg( dstfile );
IniSaver saver( (IniSaver( cfg )) );
LoadSave( saver );
}

View File

@ -26,6 +26,7 @@
#include "GS.h"
#include "HostGui.h"
#include "CDVD/CDVDisoReader.h"
#include "AppConfig.h"
// ----------------------------------------------------------------------------
// Yay, order of this array shouldn't be important. :)
@ -380,11 +381,9 @@ static void CALLBACK CDVDplugin_Close()
g_plugins->Close( PluginId_CDVD );
}
CDVD_API CDVDapi_Plugin=
CDVD_API CDVDapi_Plugin =
{
{
CDVDplugin_Close
},
CDVDplugin_Close,
// The rest are filled in by the plugin manager
NULL

View File

@ -105,7 +105,8 @@ void psxException(u32 code, u32 bd) {
PSXMu32(psxRegs.CP0.n.EPC)&= ~0x02000000;
}*/
if (Config.PsxOut && !CHECK_EEREC) {
if (!CHECK_IOPREC)
{
u32 call = psxRegs.GPR.n.t1 & 0xff;
switch (psxRegs.pc & 0x1fffff) {
case 0xa0:

View File

@ -207,8 +207,6 @@ void zeroEx()
char *fname = NULL;
int i;
if (!Config.PsxOut) return;
pc = psxRegs.pc;
while (iopMemRead32(pc) != 0x41e00000) pc-=4;

View File

@ -559,8 +559,7 @@ __forceinline void cpuTestHwInts() {
void cpuExecuteBios()
{
// Set the video mode to user's default request:
// (right now we always default to NTSC)
gsSetVideoRegionType( Config.PsxType & 1 );
gsSetRegionMode( (GS_RegionMode)EmuConfig.Video.DefaultRegionMode );
Console::Notice( "* PCSX2 *: ExecuteBios" );

View File

@ -30,6 +30,7 @@
#include "GS.h"
#include "COP0.h"
#include "Cache.h"
#include "AppConfig.h"
using namespace R5900;

View File

@ -684,19 +684,20 @@ void SaveState::sioFreeze()
}
Freeze( m_mcdCRCs );
if( IsLoading() && Config.McdEnableEject )
if( IsLoading() && EmuConfig.McdEnableEjection )
{
// Note: TOTA works with values as low as 20 here.
// It "times out" with values around 1800 (forces user to check the memcard
// twice to find it). Other games could be different. :|
// Notes:
// * TOTA works with values as low as 20 here.
// It "times out" with values around 1800 (forces user to check the memcard
// twice to find it). Other games could be different. :|
//
// * At 64: Disgaea 1 and 2, and Grandia 2 end up displaying a quick "no memcard!"
// notice before finding the memorycard and re-enumerating it. A very minor
// annoyance, but no breakages.
// At 64: Disgaea 1 and 2, and Grandia 2 end up displaying a quick "no memcard!"
// notice before finding the memorycard and re-enumerating it. A very minor
// annoyance, but no breakages.
// GuitarHero will break completely with almost any value here, by design, because
// it has a "rule" that the memcard should never be ejected during a song. So by
// ejecting it, the game freezes (which is actually good emulation, but annoying!)
// * GuitarHero will break completely with almost any value here, by design, because
// it has a "rule" that the memcard should never be ejected during a song. So by
// ejecting it, the game freezes (which is actually good emulation, but annoying!)
for( int i=0; i<2; ++i )
{

View File

@ -33,12 +33,13 @@
using namespace std;
Pcsx2Config EmuConfig = {0};
// disable all session overrides by default...
SessionOverrideFlags g_Session = {false};
bool sysInitialized = false;
// -----------------------------------------------------------------------
// This function should be called once during program execution.
//
@ -326,10 +327,10 @@ void SysExecute()
// call to SysExecute.
void SysEndExecution()
{
if( Config.closeGSonEsc )
if( EmuConfig.closeGSonEsc )
StateRecovery::MakeGsOnly();
ClosePlugins( Config.closeGSonEsc );
ClosePlugins( EmuConfig.closeGSonEsc );
g_ReturnToGui = true;
}
@ -351,7 +352,7 @@ void SysPrepareExecution( const wxString& elf_file, bool use_bios )
return;
}
g_Startup.BootMode = (elf_file) ? BootMode_Elf : BootMode_Normal;
//g_Startup.BootMode = (elf_file) ? BootMode_Elf : BootMode_Normal;
OpenPlugins(NULL);

View File

@ -19,7 +19,6 @@
#pragma once
#include "Paths.h"
#include "Pcsx2Config.h"
#include "Utilities/SafeArray.h"
#include "Utilities/Threading.h" // to use threading stuff, include the Threading namespace in your file.
#include "Misc.h"

View File

@ -23,6 +23,7 @@
#include <wx/imaglist.h>
#include <wx/docview.h>
#include "AppConfig.h"
#include "System.h"
using namespace Threading;

View File

@ -343,15 +343,7 @@ wxString AppConfig::FullpathTo( PluginsEnum_t pluginidx ) const
}
wxString AppConfig::FullpathToBios() const { return Path::Combine( Folders.Bios, BaseFilenames.Bios ); }
wxString AppConfig::FullpathToMcd( uint mcdidx ) const { return Path::Combine( Folders.MemoryCards, MemoryCards.Mcd[mcdidx].Filename ); }
// ------------------------------------------------------------------------
// GCC Note: wxT() macro is required when using string token pasting. For some reason L generates
// syntax errors. >_<
//
#define IniEntry( varname, defval ) ini.Entry( wxT(#varname), varname, defval )
#define IniBitfield( varname, defval ) varname = ini.EntryBitfield( wxT(#varname), varname, defval )
#define IniBitBool( varname, defval ) varname = ini.EntryBitBool( wxT(#varname), !!varname, defval )
wxString AppConfig::FullpathToMcd( uint mcdidx ) const { return Path::Combine( Folders.MemoryCards, Mcd[mcdidx].Filename ); }
// ------------------------------------------------------------------------
void AppConfig::LoadSaveUserMode( IniInterface& ini )
@ -373,19 +365,18 @@ void AppConfig::LoadSave( IniInterface& ini )
IniEntry( Toolbar_ImageSize, 24 );
IniEntry( Toolbar_ShowLabels, true );
IniEntry( CdvdVerboseReads, false );
// Process various sub-components:
ProgLogBox.LoadSave( ini, L"ProgramLog" );
Ps2ConBox.LoadSave( ini, L"Ps2Console" );
Speedhacks.LoadSave( ini );
Folders.LoadSave( ini );
BaseFilenames.LoadSave( ini );
if( ini.IsSaving() && (g_RecentIsoList != NULL) )
g_RecentIsoList->Save( ini.GetConfig() );
EmuOptions.LoadSave( ini );
ini.Flush();
}
@ -407,7 +398,7 @@ void AppConfig::Apply()
// Update the compression attribute on the Memcards folder.
// Memcards generally compress very well via NTFS compression.
NTFS_CompressFile( g_Conf->Folders.MemoryCards.ToString(), g_Conf->MemoryCards.EnableNTFS );
NTFS_CompressFile( g_Conf->Folders.MemoryCards.ToString(), g_Conf->McdEnableNTFS );
if( !i18n_SetLanguage( LanguageId ) )
{
@ -465,20 +456,6 @@ void AppConfig::ConsoleLogOptions::LoadSave( IniInterface& ini, const wxChar* lo
ini.SetPath( L".." );
}
// ------------------------------------------------------------------------
void AppConfig::SpeedhackOptions::LoadSave( IniInterface& ini )
{
ini.SetPath( L"Speedhacks" );
IniBitfield( EECycleRate, 0 );
IniBitfield( VUCycleSteal, 0 );
IniBitBool( IopCycleRate_X2, false );
IniBitBool( IntcStat, false );
IniBitBool( BIFC0, false );
ini.SetPath( L".." );
}
void AppConfig::FolderOptions::ApplyDefaults()
{
if( UseDefaultPlugins ) Plugins = PathDefs::GetPlugins();

163
pcsx2/gui/AppConfig.h Normal file
View File

@ -0,0 +1,163 @@
/* 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;
//////////////////////////////////////////////////////////////////////////////////////////
// Pcsx2 Application Configuration.
//
//
class AppConfig
{
public:
// ------------------------------------------------------------------------
struct ConsoleLogOptions
{
bool Visible;
// if true, DisplayPos is ignored and the console is automatically docked to the main window.
bool AutoDock;
// Display position used if AutoDock is false (ignored otherwise)
wxPoint DisplayPosition;
wxSize DisplaySize;
// Size of the font in points.
int FontSize;
void LoadSave( IniInterface& conf, const wxChar* title );
};
// ------------------------------------------------------------------------
struct FolderOptions
{
wxDirName
Plugins,
Settings,
Bios,
Snapshots,
Savestates,
MemoryCards,
Logs;
wxDirName RunIso; // last used location for Iso loading.
bool
UseDefaultPlugins:1,
UseDefaultSettings:1,
UseDefaultBios:1,
UseDefaultSnapshots:1,
UseDefaultSavestates:1,
UseDefaultMemoryCards:1,
UseDefaultLogs:1;
void LoadSave( IniInterface& conf );
void ApplyDefaults();
void Set( FoldersEnum_t folderidx, const wxString& src, bool useDefault );
const wxDirName& operator[]( FoldersEnum_t folderidx ) const;
const bool IsDefault( FoldersEnum_t folderidx ) const;
};
// ------------------------------------------------------------------------
struct FilenameOptions
{
wxFileName Bios;
wxFileName Plugins[PluginId_Count];
void LoadSave( IniInterface& conf );
const wxFileName& operator[]( PluginsEnum_t pluginidx ) const;
};
// ------------------------------------------------------------------------
// Options struct for each memory card.
//
struct McdOptions
{
wxFileName Filename; // user-configured location of this memory card
bool Enabled; // memory card enabled (if false, memcard will not show up in-game)
};
public:
bool UseAdminMode; // dictates if the program uses /home/user or /cwd for the program data
wxPoint MainGuiPosition;
// Current language in use (correlates to a wxWidgets wxLANGUAGE specifier)
wxLanguage LanguageId;
int RecentFileCount; // number of files displayed in the Recent Isos list.
// String value describing the desktop theme to use for pcsk2 (icons and background images)
// The theme name is used to look up files in the themes folder (relative to the executable).
wxString DeskTheme;
// Specifies the size of icons used in Listbooks; specifically the PCSX2 Properties dialog box.
// Realistic values range from 96x96 to 24x24.
int Listbook_ImageSize;
// Specifies the size of each toolbar icon, in pixels (any value >= 2 is valid, but realistically
// values should be between 64 and 16 for usability reasons)
int Toolbar_ImageSize;
// Enables display of toolbar text labels.
bool Toolbar_ShowLabels;
// enables automatic ntfs compression of memory cards (Win32 only)
bool McdEnableNTFS;
McdOptions Mcd[2];
ConsoleLogOptions ProgLogBox;
ConsoleLogOptions Ps2ConBox;
FolderOptions Folders;
FilenameOptions BaseFilenames;
// PCSX2-core emulation options, which are passed to the emu core prior to initiating
// an emulation session. Note these are the options saved into the GUI ini file and
// which are shown as options in the gui preferences, but *not* necessarily the options
// used by emulation. The gui allows temporary per-game and commandline level overrides.
Pcsx2Config EmuOptions;
protected:
// indicates if the main AppConfig settings are valid (excludes the status of UseAdminMode,
// which is a special value that's initialized independently of the rest of the config)
bool m_IsLoaded;
public:
AppConfig() :
Listbook_ImageSize( 32 )
, Toolbar_ImageSize( 24 )
, m_IsLoaded( false )
{
}
wxString FullpathToBios() const;
wxString FullpathToMcd( uint mcdidx ) const;
wxString FullpathTo( PluginsEnum_t pluginId ) const;
void Load();
void Save();
void Apply();
void LoadSaveUserMode( IniInterface& ini );
protected:
void LoadSave( IniInterface& ini );
};
extern AppConfig* g_Conf;

View File

@ -147,3 +147,10 @@ protected:
void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue );
};
// ------------------------------------------------------------------------
// GCC Note: wxT() macro is required when using string token pasting. For some reason L generates
// syntax errors. >_<
//
#define IniEntry( varname, defval ) ini.Entry( wxT(#varname), varname, defval )
#define IniBitfield( varname, defval ) varname = ini.EntryBitfield( wxT(#varname), varname, defval )
#define IniBitBool( varname, defval ) varname = ini.EntryBitBool( wxT(#varname), !!varname, defval )

View File

@ -29,6 +29,7 @@
#include <wx/bookctrl.h>
#include <list>
#include "AppConfig.h"
#include "wxHelpers.h"
#include "Utilities/SafeArray.h"
#include "Utilities/Threading.h"

View File

@ -92,6 +92,8 @@ const wxChar* Panels::SpeedHacksPanel::GetVUcycleSliderMsg( int val )
Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
BaseApplicableConfigPanel( &parent, idealWidth )
{
const Pcsx2Config::SpeedhackOptions& opts( g_Conf->EmuOptions.Speedhacks );
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer& cycleHacksSizer = *new wxFlexGridSizer( 2 );
@ -113,7 +115,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
// ------------------------------------------------------------------------
// EE Cyclerate Hack Section:
m_slider_eecycle = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.EECycleRate+1, 1, 3,
m_slider_eecycle = new wxSlider( this, wxID_ANY, opts.EECycleRate+1, 1, 3,
wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
tooltip = pxE( ".Tooltips:Speedhacks:EECycleRate Slider",
@ -123,7 +125,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
);
cyclerateSizer.Add( m_slider_eecycle, sliderFlags );
m_msg_eecycle = &AddStaticText( cyclerateSizer, GetEEcycleSliderMsg( g_Conf->Speedhacks.EECycleRate+1 ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
m_msg_eecycle = &AddStaticText( cyclerateSizer, GetEEcycleSliderMsg( opts.EECycleRate+1 ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) );
m_msg_eecycle->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 4) ) );
@ -133,7 +135,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
// ------------------------------------------------------------------------
// VU Cycle Stealing Hack Section:
m_slider_vustealer = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.VUCycleSteal, 0, 4, wxDefaultPosition, wxDefaultSize,
m_slider_vustealer = new wxSlider( this, wxID_ANY, opts.VUCycleSteal, 0, 4, wxDefaultPosition, wxDefaultSize,
wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
tooltip = pxE( ".Tooltips:Speedhacks:VUCycleStealing Slider",
@ -145,7 +147,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
// are run, which works as a rough-guess skipping of what would normally be idle time spent running on the EE.
stealerSizer.Add( m_slider_vustealer, wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
m_msg_vustealer = &AddStaticText(stealerSizer, GetVUcycleSliderMsg( g_Conf->Speedhacks.VUCycleSteal ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
m_msg_vustealer = &AddStaticText(stealerSizer, GetVUcycleSliderMsg( opts.VUCycleSteal ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) );
m_msg_vustealer->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 4) ) );
@ -190,12 +192,13 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
void Panels::SpeedHacksPanel::Apply( AppConfig& conf )
{
conf.Speedhacks.EECycleRate = m_slider_eecycle->GetValue()-1;
conf.Speedhacks.VUCycleSteal = m_slider_vustealer->GetValue();
Pcsx2Config::SpeedhackOptions& opts( conf.EmuOptions.Speedhacks );
opts.EECycleRate = m_slider_eecycle->GetValue()-1;
opts.VUCycleSteal = m_slider_vustealer->GetValue();
conf.Speedhacks.BIFC0 = m_check_b1fc0->GetValue();
conf.Speedhacks.IopCycleRate_X2 = m_check_IOPx2->GetValue();
conf.Speedhacks.IntcStat = m_check_intc->GetValue();
opts.BIFC0 = m_check_b1fc0->GetValue();
opts.IopCycleRate_X2 = m_check_IOPx2->GetValue();
opts.IntcStat = m_check_intc->GetValue();
}
void Panels::SpeedHacksPanel::EECycleRate_Scroll(wxScrollEvent &event)

View File

@ -18,6 +18,7 @@
#include "PrecompiledHeader.h"
#include "i18n.h"
#include "AppConfig.h"
#include "Utilities/SafeArray.h"

View File

@ -362,6 +362,10 @@
RelativePath="..\..\Patch.h"
>
</File>
<File
RelativePath="..\..\Pcsx2Config.cpp"
>
</File>
<File
RelativePath="..\..\PrecompiledHeader.cpp"
>
@ -2275,6 +2279,10 @@
</File>
</Filter>
</Filter>
<File
RelativePath="..\..\gui\AppConfig.h"
>
</File>
<File
RelativePath="..\..\Common.h"
>

View File

@ -17,7 +17,6 @@
*/
#include "PrecompiledHeader.h"
#include "Pcsx2Config.h"
u32 g_sseMXCSR = DEFAULT_sseMXCSR;
u32 g_sseVUMXCSR = DEFAULT_sseVUMXCSR;

View File

@ -38,6 +38,8 @@
#include "SamplProf.h"
#include "NakedAsm.h"
#include "AppConfig.h"
using namespace x86Emitter;
@ -778,7 +780,7 @@ void psxSetBranchImm( u32 imm )
static __forceinline u32 psxScaleBlockCycles()
{
return s_psxBlockCycles * (Config.Hacks.IOPCycleDouble ? 2 : 1);
return s_psxBlockCycles * (EmuConfig.Speedhacks.IopCycleRate_X2 ? 2 : 1);
}
static void iPsxBranchTest(u32 newpc, u32 cpuBranch)

View File

@ -24,7 +24,6 @@
#include "R5900.h"
#include "VU.h"
#include "iCore.h"
#include "Pcsx2Config.h"
#define PC_GETBLOCK(x) PC_GETBLOCK_(x, recLUT)

View File

@ -515,7 +515,7 @@ void recResetEE( void )
x86FpuState = FPU_STATE;
branch = 0;
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
SetCPUState(EmuConfig.Cpu.sseMXCSR, EmuConfig.Cpu.sseVUMXCSR);
}
static void recShutdown( void )
@ -990,7 +990,7 @@ static u32 scaleBlockCycles_helper()
// caused by sync hacks and such, since games seem to care a lot more about
// these small blocks having accurate cycle counts.
if( s_nBlockCycles <= (5<<3) || (Config.Hacks.EECycleRate == 0) )
if( s_nBlockCycles <= (5<<3) || (EmuConfig.Speedhacks.EECycleRate == 0) )
return s_nBlockCycles >> 3;
uint scalarLow, scalarMid, scalarHigh;
@ -998,7 +998,7 @@ static u32 scaleBlockCycles_helper()
// Note: larger blocks get a smaller scalar, to help keep
// them from becoming "too fat" and delaying branch tests.
switch( Config.Hacks.EECycleRate )
switch( EmuConfig.Speedhacks.EECycleRate )
{
case 0: return s_nBlockCycles >> 3;
@ -1052,7 +1052,7 @@ static void iBranchTest(u32 newpc, bool noDispatch)
// cpuRegs.cycle += blockcycles;
// if( cpuRegs.cycle > g_nextBranchCycle ) { DoEvents(); }
if (Config.Hacks.IdleLoopFF && s_nBlockFF) {
if (EmuConfig.Speedhacks.BIFC0 && s_nBlockFF) {
xMOV(eax, ptr32[&g_nextBranchCycle]);
xADD(ptr32[&cpuRegs.cycle], eeScaleBlockCycles());
xCMP(eax, ptr32[&cpuRegs.cycle]);

View File

@ -452,7 +452,7 @@ void vtlb_DynGenRead32_Const( u32 bits, bool sign, u32 addr_const )
}
// Shortcut for the INTC_STAT register, which many games like to spin on heavily.
if( (bits == 32) && !Config.Hacks.INTCSTATSlow && (paddr == INTC_STAT) )
if( (bits == 32) && !EmuConfig.Speedhacks.IntcStat && (paddr == INTC_STAT) )
{
xMOV( eax, &psHu32( INTC_STAT ) );
}

View File

@ -129,7 +129,7 @@ microVUx(void) mVUcleanUp() {
mVUcacheCheck(x86Ptr, mVU->prog.x86start, (uptr)(mVU->prog.x86end - mVU->prog.x86start));
mVU->cycles = mVU->totalCycles - mVU->cycles;
mVU->regs->cycle += mVU->cycles;
cpuRegs.cycle += ((mVU->cycles < 3000) ? mVU->cycles : 3000) * Config.Hacks.VUCycleSteal;
cpuRegs.cycle += ((mVU->cycles < 3000) ? mVU->cycles : 3000) * EmuConfig.Speedhacks.VUCycleSteal;
}
//------------------------------------------------------------------

View File

@ -272,8 +272,8 @@ typedef u32 (__fastcall *mVUCall)(void*, void*);
// Speed Hacks
#define CHECK_VU_CONSTHACK 0 // Only use for GoW (will be slower on other games)
#define CHECK_VU_FLAGHACK (u32)Config.Hacks.vuFlagHack // (Can cause Infinite loops, SPS, etc...)
#define CHECK_VU_MINMAXHACK (u32)Config.Hacks.vuMinMax // (Can cause SPS, Black Screens, etc...)
#define CHECK_VU_FLAGHACK (EmuConfig.Speedhacks.vuFlagHack) // (Can cause Infinite loops, SPS, etc...)
#define CHECK_VU_MINMAXHACK (EmuConfig.Speedhacks.vuMinMax) // (Can cause SPS, Black Screens, etc...)
// Unknown Data
#define mVU_XGKICK_CYCLES ((CHECK_XGKICKHACK) ? 3 : 1)

View File

@ -41,6 +41,7 @@
#include "sVU_zerorec.h"
#include "SamplProf.h"
#include "NakedAsm.h"
#include "AppConfig.h"
using namespace std;
@ -2550,9 +2551,9 @@ void SuperVUCleanupProgram(u32 startpc, int vuindex)
//VU cycle stealing hack, 3000 cycle maximum so it doesn't get out of hand
if (s_TotalVUCycles < 3000)
cpuRegs.cycle += s_TotalVUCycles * Config.Hacks.VUCycleSteal;
cpuRegs.cycle += s_TotalVUCycles * EmuConfig.Speedhacks.VUCycleSteal;
else
cpuRegs.cycle += 3000 * Config.Hacks.VUCycleSteal;
cpuRegs.cycle += 3000 * EmuConfig.Speedhacks.VUCycleSteal;
if ((int)s_writeQ > 0) VU->VI[REG_Q] = VU->q;
if ((int)s_writeP > 0)

View File

@ -207,24 +207,19 @@ Global
{5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release|x64.ActiveCfg = Release|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|Win32.ActiveCfg = Debug SSE2|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|Win32.Build.0 = Debug SSE2|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|x64.ActiveCfg = Debug|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|x64.Build.0 = Debug|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|x64.ActiveCfg = Debug|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Devel|Win32.ActiveCfg = Release SSE2|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Devel|Win32.Build.0 = Release SSE2|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Devel|x64.ActiveCfg = Debug SSE4|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Devel|x64.Build.0 = Debug SSE4|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Devel|x64.ActiveCfg = Debug|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|Win32.ActiveCfg = Release SSE2|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|Win32.Build.0 = Release SSE2|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|x64.ActiveCfg = Release SSE2|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|x64.Build.0 = Release SSE2|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|x64.ActiveCfg = Release SSE2|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|Win32.ActiveCfg = Release SSE4|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|Win32.Build.0 = Release SSE4|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|x64.ActiveCfg = Release SSE4|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|x64.Build.0 = Release SSE4|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|x64.ActiveCfg = Release SSE4|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|Win32.ActiveCfg = Release SSSE3|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|Win32.Build.0 = Release SSSE3|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|x64.ActiveCfg = Release SSSE3|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|x64.Build.0 = Release SSSE3|x64
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|x64.ActiveCfg = Release SSSE3|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release|Win32.ActiveCfg = Release|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release|Win32.Build.0 = Release|Win32
{18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release|x64.ActiveCfg = Release|Win32