Reworked a few things in PcsxConfig, to make things a little more organized, and make path changes later easier. (May have broken Linux temporarily. If so, I'll fix it in a bit.)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1560 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-07-24 00:53:40 +00:00
parent 20b95fd187
commit a9999cbffa
16 changed files with 168 additions and 145 deletions

View File

@ -132,11 +132,8 @@ struct McdConfig
bool Enabled; bool Enabled;
}; };
struct PcsxConfig struct PluginNames
{ {
public:
char Bios[g_MaxPath];
char GS[g_MaxPath]; char GS[g_MaxPath];
char PAD1[g_MaxPath]; char PAD1[g_MaxPath];
char PAD2[g_MaxPath]; char PAD2[g_MaxPath];
@ -145,10 +142,46 @@ public:
char DEV9[g_MaxPath]; char DEV9[g_MaxPath];
char USB[g_MaxPath]; char USB[g_MaxPath];
char FW[g_MaxPath]; char FW[g_MaxPath];
};
char PluginsDir[g_MaxPath]; // This is intended to be where all the main paths for Pcsx2 are.
char BiosDir[g_MaxPath]; // This may end up being moved to Paths.h. It may also be converted to strings.
char InisDir[g_MaxPath]; // This is intended for the program to populate, and the plugins to read. Obviously can't be saved in the config file. :) struct FilePaths
{
char Working[g_MaxPath];
char Plugins[g_MaxPath];
char Bios[g_MaxPath];
// These are mainly placeholders for later.
char Isos[g_MaxPath];
char Dumps[g_MaxPath];
// This is intended for the program to populate, and the plugins to read.
// Obviously can't be saved in the config file. :)
char Inis[g_MaxPath];
};
struct Hacks_t
{
int EECycleRate;
bool IOPCycleDouble;
//bool WaitCycleExt;
bool INTCSTATSlow;
bool IdleLoopFF;
int VUCycleSteal;
bool vuFlagHack;
bool vuMinMax;
bool ESCExits; // this is a hack!?
};
struct PcsxConfig
{
public:
// The Bios name isn't really a plugin name, so doesn't go with the Plugins.
char Bios[g_MaxPath];
PluginNames Plugins;
FilePaths Paths;
char Lang[g_MaxPath]; char Lang[g_MaxPath];
@ -169,17 +202,9 @@ public:
int Mdec; int Mdec;
int Patch; int Patch;
int CustomFps; int CustomFps;
struct Hacks_t {
int EECycleRate; Hacks_t Hacks;
bool IOPCycleDouble;
//bool WaitCycleExt;
bool INTCSTATSlow;
bool IdleLoopFF;
int VUCycleSteal;
bool vuFlagHack;
bool vuMinMax;
bool ESCExits; // this is a hack!?
} Hacks;
int GameFixes; int GameFixes;
int CustomFrameSkip; int CustomFrameSkip;
int CustomConsecutiveFrames; int CustomConsecutiveFrames;

View File

@ -77,7 +77,7 @@ FILE *_cdvdOpenMechaVer() {
FILE* fd; FILE* fd;
// get the name of the bios file // get the name of the bios file
string Bios( Path::Combine( Config.BiosDir, Config.Bios ) ); string Bios( Path::Combine( Config.Paths.Bios, Config.Bios ) );
// use the bios filename to get the name of the mecha ver file // use the bios filename to get the name of the mecha ver file
// [TODO] : Upgrade this to use std::string! // [TODO] : Upgrade this to use std::string!
@ -125,7 +125,7 @@ FILE *_cdvdOpenNVM() {
FILE* fd; FILE* fd;
// get the name of the bios file // get the name of the bios file
string Bios( Path::Combine( Config.BiosDir, Config.Bios ) ); string Bios( Path::Combine( Config.Paths.Bios, Config.Bios ) );
// use the bios filename to get the name of the nvm file // use the bios filename to get the name of the nvm file
// [TODO] : Upgrade this to use std::string! // [TODO] : Upgrade this to use std::string!

View File

@ -239,7 +239,7 @@ void OnConfConf_BiosPath(GtkButton *button, gpointer user_data)
char reply[g_MaxPath]; char reply[g_MaxPath];
GetDirectory(ConfDlg, "Choose the Bios Directory:", reply); GetDirectory(ConfDlg, "Choose the Bios Directory:", reply);
strcpy(Config.BiosDir, reply); strcpy(Config.Paths.Bios, reply);
UpdateConfDlg(); UpdateConfDlg();
} }
@ -391,10 +391,10 @@ void FindPlugins()
} }
closedir(dir); closedir(dir);
dir = opendir(Config.BiosDir); dir = opendir(Config.Paths.Bios);
if (dir == NULL) if (dir == NULL)
{ {
Msgbox::Alert("Could not open '%s' directory", params Config.BiosDir); Msgbox::Alert("Could not open '%s' directory", params Config.Paths.Bios);
return; return;
} }
@ -403,7 +403,7 @@ void FindPlugins()
struct stat buf; struct stat buf;
char description[50]; //2002-09-28 (Florin) char description[50]; //2002-09-28 (Florin)
sprintf(plugin, "%s%s", Config.BiosDir, ent->d_name); sprintf(plugin, "%s%s", Config.Paths.Bios, ent->d_name);
if (stat(plugin, &buf) == -1) continue; if (stat(plugin, &buf) == -1) continue;
if (buf.st_size > (1024*4096)) continue; //2002-09-28 (Florin) if (buf.st_size > (1024*4096)) continue; //2002-09-28 (Florin)
if (!IsBIOS(ent->d_name, description)) continue;//2002-09-28 (Florin) if (!IsBIOS(ent->d_name, description)) continue;//2002-09-28 (Florin)

View File

@ -83,14 +83,14 @@ __forceinline const char *PluginName(int type)
{ {
switch (type) switch (type)
{ {
case GS: return Config.GS; case GS: return Config.Plugins.GS;
case PAD1: return Config.PAD1; case PAD1: return Config.Plugins.PAD1;
case PAD2: return Config.PAD2; case PAD2: return Config.Plugins.PAD2;
case SPU2: return Config.SPU2; case SPU2: return Config.Plugins.SPU2;
case CDVD: return Config.CDVD; case CDVD: return Config.Plugins.CDVD;
case DEV9: return Config.DEV9; case DEV9: return Config.Plugins.DEV9;
case USB: return Config.USB; case USB: return Config.Plugins.USB;
case FW: return Config.FW; case FW: return Config.Plugins.FW;
case BIOS: return Config.Bios; case BIOS: return Config.Bios;
} }
return NULL; return NULL;

View File

@ -28,38 +28,35 @@ const char* g_pRunGSState = NULL;
int efile = 0; int efile = 0;
char elfname[g_MaxPath]; char elfname[g_MaxPath];
char MAIN_DIR[g_MaxPath];
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char *file = NULL; char *file = NULL;
char elfname[g_MaxPath]; char elfname[g_MaxPath];
string MainDirString;
efile = 0; efile = 0;
/* store main dir */ /* store main dir */
MainDirString = Path::GetWorkingDirectory(); strcpy(Config.Paths.Working, Path::GetWorkingDirectory().c_str());
strcpy(MAIN_DIR, MainDirString.c_str()); Console::Notice("Config.Paths.Working is %s", params Config.Paths.Working);
Console::Notice("MAIN_DIR is %s", params MAIN_DIR);
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, "Langs"); bindtextdomain(PACKAGE, "Langs");
textdomain(PACKAGE); textdomain(PACKAGE);
#endif #endif
// Note: Config.InisDir won't do anything till we set up windows and the plugins to use it. // Note: Config.Paths.Inis won't do anything till we set up windows and the plugins to use it.
#ifndef LOCAL_PLUGIN_INIS #ifndef LOCAL_PLUGIN_INIS
mkdir(DEFAULT_INIS_DIR, 0755); mkdir(DEFAULT_INIS_DIR, 0755);
sprintf(Config.InisDir, "%s/%s/", MAIN_DIR, DEFAULT_INIS_DIR); sprintf(Config.Paths.Inis, "%s/%s/", Config.Paths.Working, DEFAULT_INIS_DIR);
sprintf(cfgfile, "%s/pcsx2.cfg", Config.InisDir); sprintf(cfgfile, "%s/pcsx2.cfg", Config.Paths.Inis);
#else #else
Path::CreateDirectory(string("~/.pcsx2")); Path::CreateDirectory(string("~/.pcsx2"));
Path::ChangeDirectory(string("~/.pcsx2")); Path::ChangeDirectory(string("~/.pcsx2"));
Path::CreateDirectory(string(DEFAULT_INIS_DIR)); Path::CreateDirectory(string(DEFAULT_INIS_DIR));
sprintf(Config.InisDir, "~/.pcsx2/%s/", DEFAULT_INIS_DIR); sprintf(Config.Paths.Inis, "~/.pcsx2/%s/", DEFAULT_INIS_DIR);
sprintf(cfgfile, "%s/pcsx2.cfg", Config.InisDir); sprintf(cfgfile, "%s/pcsx2.cfg", Config.Paths.Inis);
Path::ChangeDirectory(string(MAIN_DIR)); Path::ChangeDirectory(string(Config.Paths.Working));
#endif #endif
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
@ -84,10 +81,10 @@ int main(int argc, char *argv[])
{ {
memset(&Config, 0, sizeof(Config)); memset(&Config, 0, sizeof(Config));
sprintf(Config.BiosDir, "%s/%s/", MAIN_DIR, DEFAULT_BIOS_DIR); sprintf(Config.Paths.Bios, "%s/%s/", Config.Paths.Working, DEFAULT_BIOS_DIR);
sprintf(Config.PluginsDir, "%s/%s/", MAIN_DIR, DEFAULT_PLUGINS_DIR); sprintf(Config.Paths.Plugins, "%s/%s/", Config.Paths.Working, DEFAULT_PLUGINS_DIR);
sprintf(Config.Mcd[0].Filename, "%s/%s/%s", MAIN_DIR, MEMCARDS_DIR, DEFAULT_MEMCARD1); sprintf(Config.Mcd[0].Filename, "%s/%s/%s", Config.Paths.Working, MEMCARDS_DIR, DEFAULT_MEMCARD1);
sprintf(Config.Mcd[1].Filename, "%s/%s/%s", MAIN_DIR, MEMCARDS_DIR, DEFAULT_MEMCARD2); sprintf(Config.Mcd[1].Filename, "%s/%s/%s", Config.Paths.Working, MEMCARDS_DIR, DEFAULT_MEMCARD2);
Config.Mcd[0].Enabled = 1; Config.Mcd[0].Enabled = 1;
Config.Mcd[1].Enabled = 1; Config.Mcd[1].Enabled = 1;
Config.McdEnableEject = 1; Config.McdEnableEject = 1;

View File

@ -73,8 +73,8 @@ int LoadConfig()
GetValue("Lang", Config.Lang); GetValue("Lang", Config.Lang);
GetValuel("Ps2Out", Config.PsxOut); GetValuel("Ps2Out", Config.PsxOut);
GetValuel("cdvdPrint", Config.cdvdPrint); GetValuel("cdvdPrint", Config.cdvdPrint);
GetValue("PluginsDir", Config.PluginsDir); GetValue("PluginsDir", Config.Paths.Plugins);
GetValue("BiosDir", Config.BiosDir); GetValue("BiosDir", Config.Paths.Bios);
GetValuel("EnabledCard1", Config.Mcd[0].Enabled); GetValuel("EnabledCard1", Config.Mcd[0].Enabled);
GetValue("Mcd1", Config.Mcd[0].Filename); GetValue("Mcd1", Config.Mcd[0].Filename);
@ -86,14 +86,14 @@ int LoadConfig()
GetValuel("McdEnableEject", Config.McdEnableEject); GetValuel("McdEnableEject", Config.McdEnableEject);
GetValue("GS", Config.GS); GetValue("GS", Config.Plugins.GS);
GetValue("SPU2", Config.SPU2); GetValue("SPU2", Config.Plugins.SPU2);
GetValue("CDVD", Config.CDVD); GetValue("CDVD", Config.Plugins.CDVD);
GetValue("PAD1", Config.PAD1); GetValue("PAD1", Config.Plugins.PAD1);
GetValue("PAD2", Config.PAD2); GetValue("PAD2", Config.Plugins.PAD2);
GetValue("DEV9", Config.DEV9); GetValue("DEV9", Config.Plugins.DEV9);
GetValue("USB", Config.USB); GetValue("USB", Config.Plugins.USB);
GetValue("FW", Config.FW); GetValue("FW", Config.Plugins.FW);
GetValuel("Patch", Config.Patch); GetValuel("Patch", Config.Patch);
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
@ -154,8 +154,8 @@ void SaveConfig()
SetValue("Bios", Config.Bios); SetValue("Bios", Config.Bios);
SetValue("Lang", Config.Lang); SetValue("Lang", Config.Lang);
SetValue("PluginsDir", Config.PluginsDir); SetValue("PluginsDir", Config.Paths.Plugins);
SetValue("BiosDir", Config.BiosDir); SetValue("BiosDir", Config.Paths.Bios);
SetValuel("Ps2Out", Config.PsxOut); SetValuel("Ps2Out", Config.PsxOut);
SetValuel("cdvdPrint", Config.cdvdPrint); SetValuel("cdvdPrint", Config.cdvdPrint);
@ -167,14 +167,14 @@ void SaveConfig()
SetValue("Mcd2", Config.Mcd[1].Filename); SetValue("Mcd2", Config.Mcd[1].Filename);
SetValuel("McdEnableEject", Config.McdEnableEject); SetValuel("McdEnableEject", Config.McdEnableEject);
SetValue("GS", Config.GS); SetValue("GS", Config.Plugins.GS);
SetValue("SPU2", Config.SPU2); SetValue("SPU2", Config.Plugins.SPU2);
SetValue("CDVD", Config.CDVD); SetValue("CDVD", Config.Plugins.CDVD);
SetValue("PAD1", Config.PAD1); SetValue("PAD1", Config.Plugins.PAD1);
SetValue("PAD2", Config.PAD2); SetValue("PAD2", Config.Plugins.PAD2);
SetValue("DEV9", Config.DEV9); SetValue("DEV9", Config.Plugins.DEV9);
SetValue("USB", Config.USB); SetValue("USB", Config.Plugins.USB);
SetValue("FW", Config.FW); SetValue("FW", Config.Plugins.FW);
SetValuel("Options", Config.Options); SetValuel("Options", Config.Options);

View File

@ -90,7 +90,7 @@ void loadBiosRom( const char *ext, u8 *dest, long maxSize )
string Bios1; string Bios1;
long filesize; long filesize;
string Bios( Path::Combine( Config.BiosDir, Config.Bios ) ); string Bios( Path::Combine( Config.Paths.Bios, Config.Bios ) );
// Try first a basic extension concatenation (normally results in something like name.bin.rom1) // Try first a basic extension concatenation (normally results in something like name.bin.rom1)
ssprintf(Bios1, "%hs.%s", &Bios, ext); ssprintf(Bios1, "%hs.%s", &Bios, ext);
@ -101,7 +101,7 @@ void loadBiosRom( const char *ext, u8 *dest, long maxSize )
if( (filesize=Path::getFileSize( Bios1 ) ) <= 0 ) if( (filesize=Path::getFileSize( Bios1 ) ) <= 0 )
{ {
// Try for the old-style method (rom1.bin) // Try for the old-style method (rom1.bin)
Bios1 = Path::Combine( Config.BiosDir, ext ) + ".bin"; Bios1 = Path::Combine( Config.Paths.Bios, ext ) + ".bin";
if( (filesize=Path::getFileSize( Bios1 ) ) <= 0 ) if( (filesize=Path::getFileSize( Bios1 ) ) <= 0 )
{ {
Console::Notice( "Bios Warning > %s not found.", params ext ); Console::Notice( "Bios Warning > %s not found.", params ext );
@ -802,7 +802,7 @@ void memReset()
vtlb_VMapUnmap(0x20000000,0x60000000); vtlb_VMapUnmap(0x20000000,0x60000000);
FILE *fp; FILE *fp;
string Bios( Path::Combine( Config.BiosDir, Config.Bios ) ); string Bios( Path::Combine( Config.Paths.Bios, Config.Bios ) );
long filesize; long filesize;
if( ( filesize = Path::getFileSize( Bios ) ) <= 0 ) if( ( filesize = Path::getFileSize( Bios ) ) <= 0 )

View File

@ -220,7 +220,7 @@ int IsBIOS(const char *filename, char *description)
unsigned int fileOffset=0, found=FALSE; unsigned int fileOffset=0, found=FALSE;
struct romdir rd; struct romdir rd;
string Bios( Path::Combine( Config.BiosDir, filename ) ); string Bios( Path::Combine( Config.Paths.Bios, filename ) );
int biosFileSize = Path::getFileSize( Bios ); int biosFileSize = Path::getFileSize( Bios );
if( biosFileSize <= 0) return FALSE; if( biosFileSize <= 0) return FALSE;

View File

@ -21,9 +21,9 @@
#define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs. #define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs.
#ifdef __LINUX__ //#ifdef __LINUX__
extern char MAIN_DIR[g_MaxPath]; //extern char MAIN_DIR[g_MaxPath];
#endif //#endif
#define DEFAULT_INIS_DIR "inis" #define DEFAULT_INIS_DIR "inis"
#define DEFAULT_BIOS_DIR "bios" #define DEFAULT_BIOS_DIR "bios"

View File

@ -721,14 +721,14 @@ int LoadPlugins()
{ {
if (plugins_loaded) return 0; if (plugins_loaded) return 0;
if (LoadGSplugin( Path::Combine( Config.PluginsDir, Config.GS )) == -1) return -1; if (LoadGSplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.GS )) == -1) return -1;
if (LoadPAD1plugin( Path::Combine( Config.PluginsDir, Config.PAD1 )) == -1) return -1; if (LoadPAD1plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.PAD1 )) == -1) return -1;
if (LoadPAD2plugin( Path::Combine( Config.PluginsDir, Config.PAD2 )) == -1) return -1; if (LoadPAD2plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.PAD2 )) == -1) return -1;
if (LoadSPU2plugin( Path::Combine( Config.PluginsDir, Config.SPU2 )) == -1) return -1; if (LoadSPU2plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.SPU2 )) == -1) return -1;
if (LoadCDVDplugin( Path::Combine( Config.PluginsDir, Config.CDVD )) == -1) return -1; if (LoadCDVDplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.CDVD )) == -1) return -1;
if (LoadDEV9plugin( Path::Combine( Config.PluginsDir, Config.DEV9 )) == -1) return -1; if (LoadDEV9plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.DEV9 )) == -1) return -1;
if (LoadUSBplugin( Path::Combine( Config.PluginsDir, Config.USB )) == -1) return -1; if (LoadUSBplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.USB )) == -1) return -1;
if (LoadFWplugin( Path::Combine( Config.PluginsDir, Config.FW )) == -1) return -1; if (LoadFWplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.FW )) == -1) return -1;
plugins_loaded = true; plugins_loaded = true;

View File

@ -46,7 +46,7 @@ struct ComboInitializer
, PS2E_GetLibName( NULL ) , PS2E_GetLibName( NULL )
, PS2E_GetLibVersion2( NULL ) , PS2E_GetLibVersion2( NULL )
{ {
Find = FindFirstFile( Path::Combine( Config.PluginsDir, "*.dll" ).c_str(), &FindData); Find = FindFirstFile( Path::Combine( Config.Paths.Plugins, "*.dll" ).c_str(), &FindData);
} }
~ComboInitializer() ~ComboInitializer()
@ -62,7 +62,7 @@ struct ComboInitializer
bool LoadNextLibrary() bool LoadNextLibrary()
{ {
string tmpStr( Path::Combine( Config.PluginsDir, FindData.cFileName ) ); string tmpStr( Path::Combine( Config.Paths.Plugins, FindData.cFileName ) );
Lib = HostSys::LoadLibrary( tmpStr.c_str() ); Lib = HostSys::LoadLibrary( tmpStr.c_str() );
if (Lib == NULL) if (Lib == NULL)
{ {
@ -129,7 +129,7 @@ BOOL OnConfigureDialog(HWND hW) {
if( !tool.LoadNextLibrary() ) continue; if( !tool.LoadNextLibrary() ) continue;
if( tool.CheckVersion( "GS", PS2E_LT_GS, PS2E_GS_VERSION ) ) if( tool.CheckVersion( "GS", PS2E_LT_GS, PS2E_GS_VERSION ) )
tool.AddPlugin(hWC_GS, winConfig.GS); tool.AddPlugin(hWC_GS, winConfig.Plugins.GS);
if (tool.type & PS2E_LT_PAD) if (tool.type & PS2E_LT_PAD)
{ {
@ -141,27 +141,27 @@ BOOL OnConfigureDialog(HWND hW) {
if( tool.CheckVersion( "PAD", PS2E_LT_PAD, PS2E_PAD_VERSION ) ) if( tool.CheckVersion( "PAD", PS2E_LT_PAD, PS2E_PAD_VERSION ) )
{ {
if (query() & 0x1) if (query() & 0x1)
tool.AddPlugin(hWC_PAD1, winConfig.PAD1); tool.AddPlugin(hWC_PAD1, winConfig.Plugins.PAD1);
if (query() & 0x2) if (query() & 0x2)
tool.AddPlugin(hWC_PAD2, winConfig.PAD2); tool.AddPlugin(hWC_PAD2, winConfig.Plugins.PAD2);
} }
} }
} }
if( tool.CheckVersion( "SPU2", PS2E_LT_SPU2, PS2E_SPU2_VERSION ) ) if( tool.CheckVersion( "SPU2", PS2E_LT_SPU2, PS2E_SPU2_VERSION ) )
tool.AddPlugin(hWC_SPU2, winConfig.SPU2); tool.AddPlugin(hWC_SPU2, winConfig.Plugins.SPU2);
if( tool.CheckVersion( "CDVD", PS2E_LT_CDVD, PS2E_CDVD_VERSION ) ) if( tool.CheckVersion( "CDVD", PS2E_LT_CDVD, PS2E_CDVD_VERSION ) )
tool.AddPlugin(hWC_CDVD, winConfig.CDVD); tool.AddPlugin(hWC_CDVD, winConfig.Plugins.CDVD);
if( tool.CheckVersion( "DEV9", PS2E_LT_DEV9, PS2E_DEV9_VERSION ) ) if( tool.CheckVersion( "DEV9", PS2E_LT_DEV9, PS2E_DEV9_VERSION ) )
tool.AddPlugin(hWC_DEV9, winConfig.DEV9); tool.AddPlugin(hWC_DEV9, winConfig.Plugins.DEV9);
if( tool.CheckVersion( "USB", PS2E_LT_USB, PS2E_USB_VERSION ) ) if( tool.CheckVersion( "USB", PS2E_LT_USB, PS2E_USB_VERSION ) )
tool.AddPlugin(hWC_USB, winConfig.USB); tool.AddPlugin(hWC_USB, winConfig.Plugins.USB);
if( tool.CheckVersion( "FW", PS2E_LT_FW, PS2E_FW_VERSION ) ) if( tool.CheckVersion( "FW", PS2E_LT_FW, PS2E_FW_VERSION ) )
tool.AddPlugin(hWC_FW, winConfig.FW); tool.AddPlugin(hWC_FW, winConfig.Plugins.FW);
} while( tool.FindNext() ); } while( tool.FindNext() );
@ -177,7 +177,7 @@ BOOL OnConfigureDialog(HWND hW) {
HANDLE Find; HANDLE Find;
WIN32_FIND_DATA FindData; WIN32_FIND_DATA FindData;
Find = FindFirstFile( Path::Combine( Config.BiosDir, "*" ).c_str(), &FindData); Find = FindFirstFile( Path::Combine( Config.Paths.Bios, "*" ).c_str(), &FindData);
do do
{ {
@ -268,21 +268,21 @@ char *GetComboSel(HWND hW, int id) {
void OnOK(HWND hW) { void OnOK(HWND hW) {
CheckComboSel(winConfig.Bios, IDC_LISTBIOS); CheckComboSel(winConfig.Bios, IDC_LISTBIOS);
CheckComboSel(winConfig.GS, IDC_LISTGS); CheckComboSel(winConfig.Plugins.GS, IDC_LISTGS);
CheckComboSel(winConfig.PAD1, IDC_LISTPAD1); CheckComboSel(winConfig.Plugins.PAD1, IDC_LISTPAD1);
CheckComboSel(winConfig.PAD2, IDC_LISTPAD2); CheckComboSel(winConfig.Plugins.PAD2, IDC_LISTPAD2);
CheckComboSel(winConfig.SPU2, IDC_LISTSPU2); CheckComboSel(winConfig.Plugins.SPU2, IDC_LISTSPU2);
CheckComboSel(winConfig.CDVD, IDC_LISTCDVD); CheckComboSel(winConfig.Plugins.CDVD, IDC_LISTCDVD);
CheckComboSel(winConfig.DEV9, IDC_LISTDEV9); CheckComboSel(winConfig.Plugins.DEV9, IDC_LISTDEV9);
CheckComboSel(winConfig.USB, IDC_LISTUSB); CheckComboSel(winConfig.Plugins.USB, IDC_LISTUSB);
CheckComboSel(winConfig.FW, IDC_LISTFW); CheckComboSel(winConfig.Plugins.FW, IDC_LISTFW);
CleanUpCombos(hW); CleanUpCombos(hW);
EndDialog(hW, TRUE); EndDialog(hW, TRUE);
// Apply winConfig settings: // Apply winConfig settings:
#define ApplyPluginPath( name ) strcpy( Config.name, winConfig.name ) #define ApplyPluginPath( name ) strcpy( Config.Plugins.name, winConfig.Plugins.name )
ApplyPluginPath( Bios ); strcpy( Config.Bios, winConfig.Bios );
ApplyPluginPath( GS ); ApplyPluginPath( GS );
ApplyPluginPath( PAD1 ); ApplyPluginPath( PAD1 );
ApplyPluginPath( PAD2 ); ApplyPluginPath( PAD2 );
@ -306,7 +306,7 @@ static void ConfPlugin( HWND hW, int confs, const char* name )
if(pDLL==NULL) return; if(pDLL==NULL) return;
drv = SysLoadLibrary( Path::Combine( Config.PluginsDir, pDLL ).c_str() ); drv = SysLoadLibrary( Path::Combine( Config.Paths.Plugins, pDLL ).c_str() );
if (drv == NULL) return; if (drv == NULL) return;
conf = (void (*)()) SysLoadSym(drv, name); conf = (void (*)()) SysLoadSym(drv, name);
@ -385,7 +385,7 @@ static void TestPlugin( HWND hW, int confs, const char* name )
if (pDLL== NULL) return; if (pDLL== NULL) return;
drv = SysLoadLibrary( Path::Combine( Config.PluginsDir, pDLL ).c_str() ); drv = SysLoadLibrary( Path::Combine( Config.Paths.Plugins, pDLL ).c_str() );
if (drv == NULL) return; if (drv == NULL) return;
conf = (int (*)()) SysLoadSym(drv, name); conf = (int (*)()) SysLoadSym(drv, name);
@ -456,7 +456,7 @@ void SetPluginsDir(HWND hW) {
char Path[g_MaxPath]; char Path[g_MaxPath];
if (SelectPath(hW, _("Select Plugins Directory"), Path) == -1) return; if (SelectPath(hW, _("Select Plugins Directory"), Path) == -1) return;
strcpy(Config.PluginsDir, Path); strcpy(Config.Paths.Plugins, Path);
CleanUpCombos(hW); CleanUpCombos(hW);
OnConfigureDialog(hW); OnConfigureDialog(hW);
} }
@ -465,7 +465,7 @@ void SetBiosDir(HWND hW) {
char Path[g_MaxPath]; char Path[g_MaxPath];
if (SelectPath(hW, _("Select Bios Directory"), Path) == -1) return; if (SelectPath(hW, _("Select Bios Directory"), Path) == -1) return;
strcpy(Config.BiosDir, Path); strcpy(Config.Paths.Bios, Path);
CleanUpCombos(hW); CleanUpCombos(hW);
OnConfigureDialog(hW); OnConfigureDialog(hW);
} }

View File

@ -76,7 +76,7 @@ BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
case IDOK: case IDOK:
{ {
PcsxConfig::Hacks_t newhacks; Hacks_t newhacks;
newhacks.EECycleRate = 0; newhacks.EECycleRate = 0;
for( int i=1; i<3; i++ ) for( int i=1; i<3; i++ )

View File

@ -59,7 +59,7 @@ void DlgItem_GetText( HWND hwnd, int dlgId, string& dest )
static const char* _stripPathInfo( const char* src ) static const char* _stripPathInfo( const char* src )
{ {
const char* retval = src; const char* retval = src;
const char* workingfold = g_WorkingFolder; const char* workingfold = Config.Paths.Working;
while( (*retval != 0) && (*workingfold != 0) && (tolower(*retval) == tolower(*workingfold)) ) while( (*retval != 0) && (*workingfold != 0) && (tolower(*retval) == tolower(*workingfold)) )
{ {
@ -115,7 +115,7 @@ void MemcardConfig::Open_Mcd_Proc(HWND hW, int mcd)
if (GetOpenFileName ((LPOPENFILENAME)&ofn)) if (GetOpenFileName ((LPOPENFILENAME)&ofn))
{ {
Edit_SetText(GetDlgItem(hW,mcd == 1 ? IDC_MCD_FILE1 : IDC_MCD_FILE2), Edit_SetText(GetDlgItem(hW,mcd == 1 ? IDC_MCD_FILE1 : IDC_MCD_FILE2),
_stripPathInfo( Path::Combine( g_WorkingFolder, szFileName ).c_str() ) ); _stripPathInfo( Path::Combine( Config.Paths.Working, szFileName ).c_str() ) );
} }
} }
@ -146,13 +146,13 @@ BOOL CALLBACK MemcardConfig::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
if( Config.Mcd[0].Filename[0] == 0 ) if( Config.Mcd[0].Filename[0] == 0 )
{ {
strcpy_s( Config.Mcd[0].Filename, strcpy_s( Config.Mcd[0].Filename,
Path::Combine( g_WorkingFolder, m_Default_MemcardsDir[0] ).c_str() ); Path::Combine( Config.Paths.Working, m_Default_MemcardsDir[0] ).c_str() );
} }
if( Config.Mcd[1].Filename[1] == 0 ) if( Config.Mcd[1].Filename[1] == 0 )
{ {
strcpy_s( Config.Mcd[1].Filename, strcpy_s( Config.Mcd[1].Filename,
Path::Combine( g_WorkingFolder, m_Default_MemcardsDir[1] ).c_str() ); Path::Combine( Config.Paths.Working, m_Default_MemcardsDir[1] ).c_str() );
} }
Edit_SetText( GetDlgItem(hWnd,IDC_MCD_FILE1), _stripPathInfo( Config.Mcd[0].Filename ) ); Edit_SetText( GetDlgItem(hWnd,IDC_MCD_FILE1), _stripPathInfo( Config.Mcd[0].Filename ) );
@ -197,8 +197,8 @@ BOOL CALLBACK MemcardConfig::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
// reassign text with the extra unnecessary path info stripped out. // reassign text with the extra unnecessary path info stripped out.
_tcscpy( Config.Mcd[0].Filename, _stripPathInfo( Path::Combine( g_WorkingFolder, Config.Mcd[0].Filename ).c_str() ) ); _tcscpy( Config.Mcd[0].Filename, _stripPathInfo( Path::Combine( Config.Paths.Working, Config.Mcd[0].Filename ).c_str() ) );
_tcscpy( Config.Mcd[1].Filename, _stripPathInfo( Path::Combine( g_WorkingFolder, Config.Mcd[1].Filename ).c_str() ) ); _tcscpy( Config.Mcd[1].Filename, _stripPathInfo( Path::Combine( Config.Paths.Working, Config.Mcd[1].Filename ).c_str() ) );
if( g_EmulationInProgress ) if( g_EmulationInProgress )
{ {
@ -247,10 +247,10 @@ void IniFile::MemcardSettings( PcsxConfig& conf )
SetCurrentSection( "Memorycards" ); SetCurrentSection( "Memorycards" );
Entry( "Slot1_Path", conf.Mcd[0].Filename, Entry( "Slot1_Path", conf.Mcd[0].Filename,
Path::Combine( g_WorkingFolder, m_Default_MemcardsDir[0] ) ); Path::Combine( Config.Paths.Working, m_Default_MemcardsDir[0] ) );
Entry( "Slot2_Path", conf.Mcd[1].Filename, Entry( "Slot2_Path", conf.Mcd[1].Filename,
Path::Combine( g_WorkingFolder, m_Default_MemcardsDir[1] ) ); Path::Combine( Config.Paths.Working, m_Default_MemcardsDir[1] ) );
Entry( "Slot1_Enabled", conf.Mcd[0].Enabled, true ); Entry( "Slot1_Enabled", conf.Mcd[0].Enabled, true );
Entry( "Slot2_Enabled", conf.Mcd[1].Enabled, true ); Entry( "Slot2_Enabled", conf.Mcd[1].Enabled, true );

View File

@ -43,7 +43,7 @@ int SysPageFaultExceptionFilter(EXCEPTION_POINTERS* eps);
// --->> Ini Configuration [ini.c] // --->> Ini Configuration [ini.c]
extern char g_WorkingFolder[g_MaxPath]; //extern char g_WorkingFolder[g_MaxPath];
extern const char* g_CustomConfigFile; extern const char* g_CustomConfigFile;
bool LoadConfig(); bool LoadConfig();

View File

@ -197,12 +197,12 @@ void WinRun()
memcpy( &winConfig, &Config, sizeof( PcsxConfig ) ); memcpy( &winConfig, &Config, sizeof( PcsxConfig ) );
_doPluginOverride( "GS", g_Startup.gsdll, Config.GS ); _doPluginOverride( "GS", g_Startup.gsdll, Config.Plugins.GS );
_doPluginOverride( "CDVD", g_Startup.cdvddll, Config.CDVD ); _doPluginOverride( "CDVD", g_Startup.cdvddll, Config.Plugins.CDVD );
_doPluginOverride( "SPU2", g_Startup.spudll, Config.SPU2 ); _doPluginOverride( "SPU2", g_Startup.spudll, Config.Plugins.SPU2 );
_doPluginOverride( "PAD1", g_Startup.pad1dll, Config.PAD1 ); _doPluginOverride( "PAD1", g_Startup.pad1dll, Config.Plugins.PAD1 );
_doPluginOverride( "PAD2", g_Startup.pad2dll, Config.PAD2 ); _doPluginOverride( "PAD2", g_Startup.pad2dll, Config.Plugins.PAD2 );
_doPluginOverride( "DEV9", g_Startup.dev9dll, Config.DEV9 ); _doPluginOverride( "DEV9", g_Startup.dev9dll, Config.Plugins.DEV9 );
if( Config.Profiler ) if( Config.Profiler )
@ -268,7 +268,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
textdomain(PACKAGE); textdomain(PACKAGE);
#endif #endif
strcpy(g_WorkingFolder, Path::GetWorkingDirectory().c_str()); //strcpy(g_WorkingFolder, Path::GetWorkingDirectory().c_str());
strcpy(Config.Paths.Working, Path::GetWorkingDirectory().c_str());
int argc; int argc;
TCHAR *const *const argv = _CommandLineToArgv( lpCmdLine, &argc ); TCHAR *const *const argv = _CommandLineToArgv( lpCmdLine, &argc );
@ -739,7 +740,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case ID_CONFIG_CONTROLLERS: case ID_CONFIG_CONTROLLERS:
if (PAD1configure) PAD1configure(); if (PAD1configure) PAD1configure();
if (PAD2configure) { if (PAD2configure) {
if (strcmp(Config.PAD1, Config.PAD2))PAD2configure(); if (strcmp(Config.Plugins.PAD1, Config.Plugins.PAD2))PAD2configure();
} }
break; break;

View File

@ -24,7 +24,7 @@
static const u32 IniVersion = 102; static const u32 IniVersion = 102;
const char* g_CustomConfigFile; const char* g_CustomConfigFile;
char g_WorkingFolder[g_MaxPath]; // Working folder at application startup //char g_WorkingFolder[g_MaxPath]; // Working folder at application startup
// Returns TRUE if the user has invoked the -cfg command line option. // Returns TRUE if the user has invoked the -cfg command line option.
static bool hasCustomConfig() static bool hasCustomConfig()
@ -38,7 +38,7 @@ static string GetConfigFilename()
// Load a user-specified configuration, or use the ini relative to the application's working directory. // Load a user-specified configuration, or use the ini relative to the application's working directory.
// (Our current working directory can change, so we use the one we detected at startup) // (Our current working directory can change, so we use the one we detected at startup)
return Path::Combine( g_WorkingFolder, hasCustomConfig() ? g_CustomConfigFile : (DEFAULT_INIS_DIR "\\pcsx2.ini") ); return Path::Combine( Config.Paths.Working, hasCustomConfig() ? g_CustomConfigFile : (DEFAULT_INIS_DIR "\\pcsx2.ini") );
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -188,9 +188,9 @@ void IniFile::DoConfig( PcsxConfig& Conf )
Entry( "Bios", Conf.Bios ); Entry( "Bios", Conf.Bios );
Entry( "Language", Conf.Lang ); Entry( "Language", Conf.Lang );
string plug = DEFAULT_PLUGINS_DIR; string plug = DEFAULT_PLUGINS_DIR;
Entry( "PluginsDir", Conf.PluginsDir, plug ); Entry( "PluginsDir", Conf.Paths.Plugins, plug );
string bios = DEFAULT_BIOS_DIR; string bios = DEFAULT_BIOS_DIR;
Entry( "BiosDir", Conf.BiosDir, bios ); Entry( "BiosDir", Conf.Paths.Bios, bios );
Entry( "CloseGsOnEscape", Conf.closeGSonEsc, true ); Entry( "CloseGsOnEscape", Conf.closeGSonEsc, true );
SetCurrentSection( "Console" ); SetCurrentSection( "Console" );
@ -208,14 +208,14 @@ void IniFile::DoConfig( PcsxConfig& Conf )
SetCurrentSection( "Plugins" ); SetCurrentSection( "Plugins" );
Entry( "GS", Conf.GS ); Entry( "GS", Conf.Plugins.GS );
Entry( "SPU2", Conf.SPU2 ); Entry( "SPU2", Conf.Plugins.SPU2 );
Entry( "CDVD", Conf.CDVD ); Entry( "CDVD", Conf.Plugins.CDVD );
Entry( "PAD1", Conf.PAD1 ); Entry( "PAD1", Conf.Plugins.PAD1 );
Entry( "PAD2", Conf.PAD2 ); Entry( "PAD2", Conf.Plugins.PAD2 );
Entry( "DEV9", Conf.DEV9 ); Entry( "DEV9", Conf.Plugins.DEV9 );
Entry( "USB", Conf.USB ); Entry( "USB", Conf.Plugins.USB );
Entry( "FW", Conf.FW ); Entry( "FW", Conf.Plugins.FW );
//cpu //cpu
SetCurrentSection( "Cpu" ); SetCurrentSection( "Cpu" );
@ -317,14 +317,14 @@ void SaveConfig()
{ {
PcsxConfig tmpConf = Config; PcsxConfig tmpConf = Config;
strcpy( tmpConf.GS, winConfig.GS ); strcpy( tmpConf.Plugins.GS, winConfig.Plugins.GS );
strcpy( tmpConf.SPU2, winConfig.SPU2 ); strcpy( tmpConf.Plugins.SPU2, winConfig.Plugins.SPU2 );
strcpy( tmpConf.CDVD, winConfig.CDVD ); strcpy( tmpConf.Plugins.CDVD, winConfig.Plugins.CDVD );
strcpy( tmpConf.PAD1, winConfig.PAD1 ); strcpy( tmpConf.Plugins.PAD1, winConfig.Plugins.PAD1 );
strcpy( tmpConf.PAD2, winConfig.PAD2 ); strcpy( tmpConf.Plugins.PAD2, winConfig.Plugins.PAD2 );
strcpy( tmpConf.DEV9, winConfig.DEV9 ); strcpy( tmpConf.Plugins.DEV9, winConfig.Plugins.DEV9 );
strcpy( tmpConf.USB, winConfig.USB ); strcpy( tmpConf.Plugins.USB, winConfig.Plugins.USB );
strcpy( tmpConf.FW, winConfig.FW ); strcpy( tmpConf.Plugins.FW, winConfig.Plugins.FW );
IniFileSaver().DoConfig( tmpConf ); IniFileSaver().DoConfig( tmpConf );
} }