diff --git a/common/include/Pcsx2Config.h b/common/include/Pcsx2Config.h index 4623f14110..15f6fbe709 100644 --- a/common/include/Pcsx2Config.h +++ b/common/include/Pcsx2Config.h @@ -132,11 +132,8 @@ struct McdConfig bool Enabled; }; -struct PcsxConfig +struct PluginNames { -public: - char Bios[g_MaxPath]; - char GS[g_MaxPath]; char PAD1[g_MaxPath]; char PAD2[g_MaxPath]; @@ -145,10 +142,46 @@ public: char DEV9[g_MaxPath]; char USB[g_MaxPath]; char FW[g_MaxPath]; +}; - char PluginsDir[g_MaxPath]; - char BiosDir[g_MaxPath]; - 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. :) +// This is intended to be where all the main paths for Pcsx2 are. +// This may end up being moved to Paths.h. It may also be converted to strings. +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]; @@ -169,17 +202,9 @@ public: int Mdec; int Patch; int CustomFps; - 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!? - } Hacks; + + Hacks_t Hacks; + int GameFixes; int CustomFrameSkip; int CustomConsecutiveFrames; diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 00d6ded5c4..9825cae210 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -77,7 +77,7 @@ FILE *_cdvdOpenMechaVer() { FILE* fd; // 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 // [TODO] : Upgrade this to use std::string! @@ -125,7 +125,7 @@ FILE *_cdvdOpenNVM() { FILE* fd; // 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 // [TODO] : Upgrade this to use std::string! diff --git a/pcsx2/Linux/ConfigDlg.cpp b/pcsx2/Linux/ConfigDlg.cpp index dd0f3f924d..120eeea56a 100644 --- a/pcsx2/Linux/ConfigDlg.cpp +++ b/pcsx2/Linux/ConfigDlg.cpp @@ -239,7 +239,7 @@ void OnConfConf_BiosPath(GtkButton *button, gpointer user_data) char reply[g_MaxPath]; GetDirectory(ConfDlg, "Choose the Bios Directory:", reply); - strcpy(Config.BiosDir, reply); + strcpy(Config.Paths.Bios, reply); UpdateConfDlg(); } @@ -391,10 +391,10 @@ void FindPlugins() } closedir(dir); - dir = opendir(Config.BiosDir); + dir = opendir(Config.Paths.Bios); 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; } @@ -403,7 +403,7 @@ void FindPlugins() struct stat buf; 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 (buf.st_size > (1024*4096)) continue; //2002-09-28 (Florin) if (!IsBIOS(ent->d_name, description)) continue;//2002-09-28 (Florin) diff --git a/pcsx2/Linux/ConfigDlg.h b/pcsx2/Linux/ConfigDlg.h index 081e2c0a3f..09e5d1a42d 100644 --- a/pcsx2/Linux/ConfigDlg.h +++ b/pcsx2/Linux/ConfigDlg.h @@ -83,14 +83,14 @@ __forceinline const char *PluginName(int type) { switch (type) { - case GS: return Config.GS; - case PAD1: return Config.PAD1; - case PAD2: return Config.PAD2; - case SPU2: return Config.SPU2; - case CDVD: return Config.CDVD; - case DEV9: return Config.DEV9; - case USB: return Config.USB; - case FW: return Config.FW; + case GS: return Config.Plugins.GS; + case PAD1: return Config.Plugins.PAD1; + case PAD2: return Config.Plugins.PAD2; + case SPU2: return Config.Plugins.SPU2; + case CDVD: return Config.Plugins.CDVD; + case DEV9: return Config.Plugins.DEV9; + case USB: return Config.Plugins.USB; + case FW: return Config.Plugins.FW; case BIOS: return Config.Bios; } return NULL; diff --git a/pcsx2/Linux/LnxMain.cpp b/pcsx2/Linux/LnxMain.cpp index 86125d5995..f8e0faf723 100644 --- a/pcsx2/Linux/LnxMain.cpp +++ b/pcsx2/Linux/LnxMain.cpp @@ -28,38 +28,35 @@ const char* g_pRunGSState = NULL; int efile = 0; char elfname[g_MaxPath]; -char MAIN_DIR[g_MaxPath]; int main(int argc, char *argv[]) { char *file = NULL; char elfname[g_MaxPath]; - string MainDirString; efile = 0; /* store main dir */ - MainDirString = Path::GetWorkingDirectory(); - strcpy(MAIN_DIR, MainDirString.c_str()); - Console::Notice("MAIN_DIR is %s", params MAIN_DIR); + strcpy(Config.Paths.Working, Path::GetWorkingDirectory().c_str()); + Console::Notice("Config.Paths.Working is %s", params Config.Paths.Working); #ifdef ENABLE_NLS setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, "Langs"); textdomain(PACKAGE); #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 mkdir(DEFAULT_INIS_DIR, 0755); - sprintf(Config.InisDir, "%s/%s/", MAIN_DIR, DEFAULT_INIS_DIR); - sprintf(cfgfile, "%s/pcsx2.cfg", Config.InisDir); + sprintf(Config.Paths.Inis, "%s/%s/", Config.Paths.Working, DEFAULT_INIS_DIR); + sprintf(cfgfile, "%s/pcsx2.cfg", Config.Paths.Inis); #else Path::CreateDirectory(string("~/.pcsx2")); Path::ChangeDirectory(string("~/.pcsx2")); Path::CreateDirectory(string(DEFAULT_INIS_DIR)); - sprintf(Config.InisDir, "~/.pcsx2/%s/", DEFAULT_INIS_DIR); - sprintf(cfgfile, "%s/pcsx2.cfg", Config.InisDir); - Path::ChangeDirectory(string(MAIN_DIR)); + sprintf(Config.Paths.Inis, "~/.pcsx2/%s/", DEFAULT_INIS_DIR); + sprintf(cfgfile, "%s/pcsx2.cfg", Config.Paths.Inis); + Path::ChangeDirectory(string(Config.Paths.Working)); #endif #ifdef PCSX2_DEVBUILD @@ -84,10 +81,10 @@ int main(int argc, char *argv[]) { memset(&Config, 0, sizeof(Config)); - sprintf(Config.BiosDir, "%s/%s/", MAIN_DIR, DEFAULT_BIOS_DIR); - sprintf(Config.PluginsDir, "%s/%s/", MAIN_DIR, DEFAULT_PLUGINS_DIR); - sprintf(Config.Mcd[0].Filename, "%s/%s/%s", MAIN_DIR, MEMCARDS_DIR, DEFAULT_MEMCARD1); - sprintf(Config.Mcd[1].Filename, "%s/%s/%s", MAIN_DIR, MEMCARDS_DIR, DEFAULT_MEMCARD2); + sprintf(Config.Paths.Bios, "%s/%s/", Config.Paths.Working, DEFAULT_BIOS_DIR); + sprintf(Config.Paths.Plugins, "%s/%s/", Config.Paths.Working, DEFAULT_PLUGINS_DIR); + sprintf(Config.Mcd[0].Filename, "%s/%s/%s", Config.Paths.Working, MEMCARDS_DIR, DEFAULT_MEMCARD1); + sprintf(Config.Mcd[1].Filename, "%s/%s/%s", Config.Paths.Working, MEMCARDS_DIR, DEFAULT_MEMCARD2); Config.Mcd[0].Enabled = 1; Config.Mcd[1].Enabled = 1; Config.McdEnableEject = 1; diff --git a/pcsx2/Linux/Pref.cpp b/pcsx2/Linux/Pref.cpp index 77ebfb3db0..916af5829d 100644 --- a/pcsx2/Linux/Pref.cpp +++ b/pcsx2/Linux/Pref.cpp @@ -73,8 +73,8 @@ int LoadConfig() GetValue("Lang", Config.Lang); GetValuel("Ps2Out", Config.PsxOut); GetValuel("cdvdPrint", Config.cdvdPrint); - GetValue("PluginsDir", Config.PluginsDir); - GetValue("BiosDir", Config.BiosDir); + GetValue("PluginsDir", Config.Paths.Plugins); + GetValue("BiosDir", Config.Paths.Bios); GetValuel("EnabledCard1", Config.Mcd[0].Enabled); GetValue("Mcd1", Config.Mcd[0].Filename); @@ -86,14 +86,14 @@ int LoadConfig() GetValuel("McdEnableEject", Config.McdEnableEject); - GetValue("GS", Config.GS); - GetValue("SPU2", Config.SPU2); - GetValue("CDVD", Config.CDVD); - GetValue("PAD1", Config.PAD1); - GetValue("PAD2", Config.PAD2); - GetValue("DEV9", Config.DEV9); - GetValue("USB", Config.USB); - GetValue("FW", Config.FW); + GetValue("GS", Config.Plugins.GS); + GetValue("SPU2", Config.Plugins.SPU2); + GetValue("CDVD", Config.Plugins.CDVD); + GetValue("PAD1", Config.Plugins.PAD1); + GetValue("PAD2", Config.Plugins.PAD2); + GetValue("DEV9", Config.Plugins.DEV9); + GetValue("USB", Config.Plugins.USB); + GetValue("FW", Config.Plugins.FW); GetValuel("Patch", Config.Patch); #ifdef PCSX2_DEVBUILD @@ -154,8 +154,8 @@ void SaveConfig() SetValue("Bios", Config.Bios); SetValue("Lang", Config.Lang); - SetValue("PluginsDir", Config.PluginsDir); - SetValue("BiosDir", Config.BiosDir); + SetValue("PluginsDir", Config.Paths.Plugins); + SetValue("BiosDir", Config.Paths.Bios); SetValuel("Ps2Out", Config.PsxOut); SetValuel("cdvdPrint", Config.cdvdPrint); @@ -167,14 +167,14 @@ void SaveConfig() SetValue("Mcd2", Config.Mcd[1].Filename); SetValuel("McdEnableEject", Config.McdEnableEject); - SetValue("GS", Config.GS); - SetValue("SPU2", Config.SPU2); - SetValue("CDVD", Config.CDVD); - SetValue("PAD1", Config.PAD1); - SetValue("PAD2", Config.PAD2); - SetValue("DEV9", Config.DEV9); - SetValue("USB", Config.USB); - SetValue("FW", Config.FW); + SetValue("GS", Config.Plugins.GS); + SetValue("SPU2", Config.Plugins.SPU2); + SetValue("CDVD", Config.Plugins.CDVD); + SetValue("PAD1", Config.Plugins.PAD1); + SetValue("PAD2", Config.Plugins.PAD2); + SetValue("DEV9", Config.Plugins.DEV9); + SetValue("USB", Config.Plugins.USB); + SetValue("FW", Config.Plugins.FW); SetValuel("Options", Config.Options); diff --git a/pcsx2/Memory.cpp b/pcsx2/Memory.cpp index 8a7f22fc9d..9cdc11a4e0 100644 --- a/pcsx2/Memory.cpp +++ b/pcsx2/Memory.cpp @@ -90,7 +90,7 @@ void loadBiosRom( const char *ext, u8 *dest, long maxSize ) string Bios1; 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) 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 ) { // 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 ) { Console::Notice( "Bios Warning > %s not found.", params ext ); @@ -802,7 +802,7 @@ void memReset() vtlb_VMapUnmap(0x20000000,0x60000000); FILE *fp; - string Bios( Path::Combine( Config.BiosDir, Config.Bios ) ); + string Bios( Path::Combine( Config.Paths.Bios, Config.Bios ) ); long filesize; if( ( filesize = Path::getFileSize( Bios ) ) <= 0 ) diff --git a/pcsx2/Misc.cpp b/pcsx2/Misc.cpp index dab17662ac..3077150e82 100644 --- a/pcsx2/Misc.cpp +++ b/pcsx2/Misc.cpp @@ -220,7 +220,7 @@ int IsBIOS(const char *filename, char *description) unsigned int fileOffset=0, found=FALSE; struct romdir rd; - string Bios( Path::Combine( Config.BiosDir, filename ) ); + string Bios( Path::Combine( Config.Paths.Bios, filename ) ); int biosFileSize = Path::getFileSize( Bios ); if( biosFileSize <= 0) return FALSE; diff --git a/pcsx2/Paths.h b/pcsx2/Paths.h index 348d74d755..b8ae430236 100644 --- a/pcsx2/Paths.h +++ b/pcsx2/Paths.h @@ -21,9 +21,9 @@ #define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs. -#ifdef __LINUX__ -extern char MAIN_DIR[g_MaxPath]; -#endif +//#ifdef __LINUX__ +//extern char MAIN_DIR[g_MaxPath]; +//#endif #define DEFAULT_INIS_DIR "inis" #define DEFAULT_BIOS_DIR "bios" diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index 9734d535c7..edc4682081 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -721,14 +721,14 @@ int LoadPlugins() { if (plugins_loaded) return 0; - if (LoadGSplugin( Path::Combine( Config.PluginsDir, Config.GS )) == -1) return -1; - if (LoadPAD1plugin( Path::Combine( Config.PluginsDir, Config.PAD1 )) == -1) return -1; - if (LoadPAD2plugin( Path::Combine( Config.PluginsDir, Config.PAD2 )) == -1) return -1; - if (LoadSPU2plugin( Path::Combine( Config.PluginsDir, Config.SPU2 )) == -1) return -1; - if (LoadCDVDplugin( Path::Combine( Config.PluginsDir, Config.CDVD )) == -1) return -1; - if (LoadDEV9plugin( Path::Combine( Config.PluginsDir, Config.DEV9 )) == -1) return -1; - if (LoadUSBplugin( Path::Combine( Config.PluginsDir, Config.USB )) == -1) return -1; - if (LoadFWplugin( Path::Combine( Config.PluginsDir, Config.FW )) == -1) return -1; + if (LoadGSplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.GS )) == -1) return -1; + if (LoadPAD1plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.PAD1 )) == -1) return -1; + if (LoadPAD2plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.PAD2 )) == -1) return -1; + if (LoadSPU2plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.SPU2 )) == -1) return -1; + if (LoadCDVDplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.CDVD )) == -1) return -1; + if (LoadDEV9plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.DEV9 )) == -1) return -1; + if (LoadUSBplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.USB )) == -1) return -1; + if (LoadFWplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.FW )) == -1) return -1; plugins_loaded = true; diff --git a/pcsx2/windows/ConfigDlg.cpp b/pcsx2/windows/ConfigDlg.cpp index 82592ed3aa..05fe13c98f 100644 --- a/pcsx2/windows/ConfigDlg.cpp +++ b/pcsx2/windows/ConfigDlg.cpp @@ -46,7 +46,7 @@ struct ComboInitializer , PS2E_GetLibName( 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() @@ -62,7 +62,7 @@ struct ComboInitializer 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() ); if (Lib == NULL) { @@ -129,7 +129,7 @@ BOOL OnConfigureDialog(HWND hW) { if( !tool.LoadNextLibrary() ) continue; 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) { @@ -141,27 +141,27 @@ BOOL OnConfigureDialog(HWND hW) { if( tool.CheckVersion( "PAD", PS2E_LT_PAD, PS2E_PAD_VERSION ) ) { if (query() & 0x1) - tool.AddPlugin(hWC_PAD1, winConfig.PAD1); + tool.AddPlugin(hWC_PAD1, winConfig.Plugins.PAD1); 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 ) ) - tool.AddPlugin(hWC_SPU2, winConfig.SPU2); + tool.AddPlugin(hWC_SPU2, winConfig.Plugins.SPU2); 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 ) ) - tool.AddPlugin(hWC_DEV9, winConfig.DEV9); + tool.AddPlugin(hWC_DEV9, winConfig.Plugins.DEV9); 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 ) ) - tool.AddPlugin(hWC_FW, winConfig.FW); + tool.AddPlugin(hWC_FW, winConfig.Plugins.FW); } while( tool.FindNext() ); @@ -177,7 +177,7 @@ BOOL OnConfigureDialog(HWND hW) { HANDLE Find; WIN32_FIND_DATA FindData; - Find = FindFirstFile( Path::Combine( Config.BiosDir, "*" ).c_str(), &FindData); + Find = FindFirstFile( Path::Combine( Config.Paths.Bios, "*" ).c_str(), &FindData); do { @@ -268,21 +268,21 @@ char *GetComboSel(HWND hW, int id) { void OnOK(HWND hW) { CheckComboSel(winConfig.Bios, IDC_LISTBIOS); - CheckComboSel(winConfig.GS, IDC_LISTGS); - CheckComboSel(winConfig.PAD1, IDC_LISTPAD1); - CheckComboSel(winConfig.PAD2, IDC_LISTPAD2); - CheckComboSel(winConfig.SPU2, IDC_LISTSPU2); - CheckComboSel(winConfig.CDVD, IDC_LISTCDVD); - CheckComboSel(winConfig.DEV9, IDC_LISTDEV9); - CheckComboSel(winConfig.USB, IDC_LISTUSB); - CheckComboSel(winConfig.FW, IDC_LISTFW); + CheckComboSel(winConfig.Plugins.GS, IDC_LISTGS); + CheckComboSel(winConfig.Plugins.PAD1, IDC_LISTPAD1); + CheckComboSel(winConfig.Plugins.PAD2, IDC_LISTPAD2); + CheckComboSel(winConfig.Plugins.SPU2, IDC_LISTSPU2); + CheckComboSel(winConfig.Plugins.CDVD, IDC_LISTCDVD); + CheckComboSel(winConfig.Plugins.DEV9, IDC_LISTDEV9); + CheckComboSel(winConfig.Plugins.USB, IDC_LISTUSB); + CheckComboSel(winConfig.Plugins.FW, IDC_LISTFW); CleanUpCombos(hW); EndDialog(hW, TRUE); // Apply winConfig settings: - #define ApplyPluginPath( name ) strcpy( Config.name, winConfig.name ) - ApplyPluginPath( Bios ); + #define ApplyPluginPath( name ) strcpy( Config.Plugins.name, winConfig.Plugins.name ) + strcpy( Config.Bios, winConfig.Bios ); ApplyPluginPath( GS ); ApplyPluginPath( PAD1 ); ApplyPluginPath( PAD2 ); @@ -306,7 +306,7 @@ static void ConfPlugin( HWND hW, int confs, const char* name ) 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; conf = (void (*)()) SysLoadSym(drv, name); @@ -385,7 +385,7 @@ static void TestPlugin( HWND hW, int confs, const char* name ) 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; conf = (int (*)()) SysLoadSym(drv, name); @@ -456,7 +456,7 @@ void SetPluginsDir(HWND hW) { char Path[g_MaxPath]; if (SelectPath(hW, _("Select Plugins Directory"), Path) == -1) return; - strcpy(Config.PluginsDir, Path); + strcpy(Config.Paths.Plugins, Path); CleanUpCombos(hW); OnConfigureDialog(hW); } @@ -465,7 +465,7 @@ void SetBiosDir(HWND hW) { char Path[g_MaxPath]; if (SelectPath(hW, _("Select Bios Directory"), Path) == -1) return; - strcpy(Config.BiosDir, Path); + strcpy(Config.Paths.Bios, Path); CleanUpCombos(hW); OnConfigureDialog(hW); } diff --git a/pcsx2/windows/HacksDlg.cpp b/pcsx2/windows/HacksDlg.cpp index 55ad85e67a..07f67d48e8 100644 --- a/pcsx2/windows/HacksDlg.cpp +++ b/pcsx2/windows/HacksDlg.cpp @@ -76,7 +76,7 @@ BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { case IDOK: { - PcsxConfig::Hacks_t newhacks; + Hacks_t newhacks; newhacks.EECycleRate = 0; for( int i=1; i<3; i++ ) diff --git a/pcsx2/windows/McdConfigDlg.cpp b/pcsx2/windows/McdConfigDlg.cpp index c78c1075aa..826bd78c38 100644 --- a/pcsx2/windows/McdConfigDlg.cpp +++ b/pcsx2/windows/McdConfigDlg.cpp @@ -59,7 +59,7 @@ void DlgItem_GetText( HWND hwnd, int dlgId, string& dest ) static const char* _stripPathInfo( const char* 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)) ) { @@ -115,7 +115,7 @@ void MemcardConfig::Open_Mcd_Proc(HWND hW, int mcd) if (GetOpenFileName ((LPOPENFILENAME)&ofn)) { 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 ) { 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 ) { 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 ) ); @@ -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. - _tcscpy( Config.Mcd[0].Filename, _stripPathInfo( Path::Combine( g_WorkingFolder, 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[0].Filename, _stripPathInfo( Path::Combine( Config.Paths.Working, Config.Mcd[0].Filename ).c_str() ) ); + _tcscpy( Config.Mcd[1].Filename, _stripPathInfo( Path::Combine( Config.Paths.Working, Config.Mcd[1].Filename ).c_str() ) ); if( g_EmulationInProgress ) { @@ -247,10 +247,10 @@ void IniFile::MemcardSettings( PcsxConfig& conf ) SetCurrentSection( "Memorycards" ); 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, - 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( "Slot2_Enabled", conf.Mcd[1].Enabled, true ); diff --git a/pcsx2/windows/Win32.h b/pcsx2/windows/Win32.h index 252475101e..a0c4f8f652 100644 --- a/pcsx2/windows/Win32.h +++ b/pcsx2/windows/Win32.h @@ -43,7 +43,7 @@ int SysPageFaultExceptionFilter(EXCEPTION_POINTERS* eps); // --->> Ini Configuration [ini.c] -extern char g_WorkingFolder[g_MaxPath]; +//extern char g_WorkingFolder[g_MaxPath]; extern const char* g_CustomConfigFile; bool LoadConfig(); diff --git a/pcsx2/windows/WinMain.cpp b/pcsx2/windows/WinMain.cpp index 66fda867ae..6dfe9e492d 100644 --- a/pcsx2/windows/WinMain.cpp +++ b/pcsx2/windows/WinMain.cpp @@ -197,12 +197,12 @@ void WinRun() memcpy( &winConfig, &Config, sizeof( PcsxConfig ) ); - _doPluginOverride( "GS", g_Startup.gsdll, Config.GS ); - _doPluginOverride( "CDVD", g_Startup.cdvddll, Config.CDVD ); - _doPluginOverride( "SPU2", g_Startup.spudll, Config.SPU2 ); - _doPluginOverride( "PAD1", g_Startup.pad1dll, Config.PAD1 ); - _doPluginOverride( "PAD2", g_Startup.pad2dll, Config.PAD2 ); - _doPluginOverride( "DEV9", g_Startup.dev9dll, Config.DEV9 ); + _doPluginOverride( "GS", g_Startup.gsdll, Config.Plugins.GS ); + _doPluginOverride( "CDVD", g_Startup.cdvddll, Config.Plugins.CDVD ); + _doPluginOverride( "SPU2", g_Startup.spudll, Config.Plugins.SPU2 ); + _doPluginOverride( "PAD1", g_Startup.pad1dll, Config.Plugins.PAD1 ); + _doPluginOverride( "PAD2", g_Startup.pad2dll, Config.Plugins.PAD2 ); + _doPluginOverride( "DEV9", g_Startup.dev9dll, Config.Plugins.DEV9 ); if( Config.Profiler ) @@ -268,7 +268,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine textdomain(PACKAGE); #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; 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: if (PAD1configure) PAD1configure(); if (PAD2configure) { - if (strcmp(Config.PAD1, Config.PAD2))PAD2configure(); + if (strcmp(Config.Plugins.PAD1, Config.Plugins.PAD2))PAD2configure(); } break; diff --git a/pcsx2/windows/ini.cpp b/pcsx2/windows/ini.cpp index e31086c5fd..2092ef6d8c 100644 --- a/pcsx2/windows/ini.cpp +++ b/pcsx2/windows/ini.cpp @@ -24,7 +24,7 @@ static const u32 IniVersion = 102; 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. 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. // (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( "Language", Conf.Lang ); string plug = DEFAULT_PLUGINS_DIR; - Entry( "PluginsDir", Conf.PluginsDir, plug ); + Entry( "PluginsDir", Conf.Paths.Plugins, plug ); string bios = DEFAULT_BIOS_DIR; - Entry( "BiosDir", Conf.BiosDir, bios ); + Entry( "BiosDir", Conf.Paths.Bios, bios ); Entry( "CloseGsOnEscape", Conf.closeGSonEsc, true ); SetCurrentSection( "Console" ); @@ -208,14 +208,14 @@ void IniFile::DoConfig( PcsxConfig& Conf ) SetCurrentSection( "Plugins" ); - Entry( "GS", Conf.GS ); - Entry( "SPU2", Conf.SPU2 ); - Entry( "CDVD", Conf.CDVD ); - Entry( "PAD1", Conf.PAD1 ); - Entry( "PAD2", Conf.PAD2 ); - Entry( "DEV9", Conf.DEV9 ); - Entry( "USB", Conf.USB ); - Entry( "FW", Conf.FW ); + Entry( "GS", Conf.Plugins.GS ); + Entry( "SPU2", Conf.Plugins.SPU2 ); + Entry( "CDVD", Conf.Plugins.CDVD ); + Entry( "PAD1", Conf.Plugins.PAD1 ); + Entry( "PAD2", Conf.Plugins.PAD2 ); + Entry( "DEV9", Conf.Plugins.DEV9 ); + Entry( "USB", Conf.Plugins.USB ); + Entry( "FW", Conf.Plugins.FW ); //cpu SetCurrentSection( "Cpu" ); @@ -317,14 +317,14 @@ void SaveConfig() { PcsxConfig tmpConf = Config; - strcpy( tmpConf.GS, winConfig.GS ); - strcpy( tmpConf.SPU2, winConfig.SPU2 ); - strcpy( tmpConf.CDVD, winConfig.CDVD ); - strcpy( tmpConf.PAD1, winConfig.PAD1 ); - strcpy( tmpConf.PAD2, winConfig.PAD2 ); - strcpy( tmpConf.DEV9, winConfig.DEV9 ); - strcpy( tmpConf.USB, winConfig.USB ); - strcpy( tmpConf.FW, winConfig.FW ); + strcpy( tmpConf.Plugins.GS, winConfig.Plugins.GS ); + strcpy( tmpConf.Plugins.SPU2, winConfig.Plugins.SPU2 ); + strcpy( tmpConf.Plugins.CDVD, winConfig.Plugins.CDVD ); + strcpy( tmpConf.Plugins.PAD1, winConfig.Plugins.PAD1 ); + strcpy( tmpConf.Plugins.PAD2, winConfig.Plugins.PAD2 ); + strcpy( tmpConf.Plugins.DEV9, winConfig.Plugins.DEV9 ); + strcpy( tmpConf.Plugins.USB, winConfig.Plugins.USB ); + strcpy( tmpConf.Plugins.FW, winConfig.Plugins.FW ); IniFileSaver().DoConfig( tmpConf ); }