mirror of https://github.com/PCSX2/pcsx2.git
Added a functional -cfg command line option (the help has listed it forever, but it never did anything). Absolute paths via the command line or .ini file are supported now. That means you can specify "c:\mystuff\someplugin.dll" now without getting an error. Additionally, filenames with spaces are also supported. Pcsx2 now uses the working directory at startup to load the ini file, allowing it to be run from VStudio's debug environment more easily. Expanded the console log depth to 2048. Plus many code cleanups and some extra error checking when handling strings and pathnames.
git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@294 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
parent
97dd495e85
commit
d274c25b2b
|
@ -132,10 +132,10 @@ typedef struct _TESTRUNARGS
|
|||
int efile;
|
||||
int snapdone;
|
||||
|
||||
char* ptitle;
|
||||
char* pimagename;
|
||||
char* plogname;
|
||||
char* pgsdll, *pcdvddll, *pspudll;
|
||||
const char* ptitle;
|
||||
const char* pimagename;
|
||||
const char* plogname;
|
||||
const char* pgsdll, *pcdvddll, *pspudll;
|
||||
|
||||
} TESTRUNARGS;
|
||||
|
||||
|
@ -221,7 +221,6 @@ extern TESTRUNARGS g_TestRun;
|
|||
#include "Vif.h"
|
||||
#include "SPR.h"
|
||||
#include "Sif.h"
|
||||
#include "Plugins.h"
|
||||
#include "PS2Edefs.h"
|
||||
#include "Misc.h"
|
||||
#include "Counters.h"
|
||||
|
|
21
pcsx2/Misc.c
21
pcsx2/Misc.c
|
@ -296,7 +296,7 @@ int CheckCdrom() {
|
|||
int GetPS2ElfName(char *name){
|
||||
FILE *fp;
|
||||
int f;
|
||||
char buffer[256];//if a file is longer...it should be shorter :D
|
||||
char buffer[g_MaxPath];//if a file is longer...it should be shorter :D
|
||||
char *pos;
|
||||
static struct TocEntry tocEntry;
|
||||
int i;
|
||||
|
@ -310,7 +310,7 @@ int GetPS2ElfName(char *name){
|
|||
}
|
||||
|
||||
f=CDVDFS_open("SYSTEM.CNF;1", 1);
|
||||
CDVDFS_read(f, buffer, 256);
|
||||
CDVDFS_read(f, buffer, g_MaxPath);
|
||||
CDVDFS_close(f);
|
||||
|
||||
buffer[tocEntry.fileSize]='\0';
|
||||
|
@ -355,7 +355,7 @@ int GetPS2ElfName(char *name){
|
|||
for (i=2; i<10; i++) buffer[i] = fgetc(fp); buffer[i] = 0;
|
||||
addr = strtoul(buffer, (char**)NULL, 0);
|
||||
fseek(fp, 3, SEEK_CUR);
|
||||
for (i=0; i<256; i++) {
|
||||
for (i=0; i<g_MaxPath; i++) {
|
||||
buffer[i] = fgetc(fp);
|
||||
if (buffer[i] == '\n' || buffer[i] == 0) break;
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ const char Pcsx2Header[32] = STATE_VERSION " PCSX2 v" PCSX2_VERSION;
|
|||
|
||||
extern void gsWaitGS();
|
||||
|
||||
int SaveState(char *file) {
|
||||
int SaveState(const char *file) {
|
||||
|
||||
gzFile f;
|
||||
freezeData fP;
|
||||
|
@ -605,7 +605,7 @@ int SaveState(char *file) {
|
|||
extern u32 dumplog;
|
||||
u32 s_vucount=0;
|
||||
|
||||
int LoadState(char *file) {
|
||||
int LoadState(const char *file) {
|
||||
|
||||
gzFile f;
|
||||
freezeData fP;
|
||||
|
@ -743,7 +743,7 @@ int LoadState(char *file) {
|
|||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
|
||||
int SaveGSState(char *file)
|
||||
int SaveGSState(const char *file)
|
||||
{
|
||||
if( g_SaveGSStream ) return -1;
|
||||
|
||||
|
@ -760,7 +760,7 @@ int SaveGSState(char *file)
|
|||
}
|
||||
|
||||
extern uptr pDsp;
|
||||
int LoadGSState(char *file)
|
||||
int LoadGSState(const char *file)
|
||||
{
|
||||
int ret;
|
||||
char strfile[255];
|
||||
|
@ -808,7 +808,7 @@ int LoadGSState(char *file)
|
|||
|
||||
#endif
|
||||
|
||||
int CheckState(char *file) {
|
||||
int CheckState(const char *file) {
|
||||
gzFile f;
|
||||
char header[32];
|
||||
|
||||
|
@ -877,8 +877,6 @@ extern void iDumpRegisters(u32 startpc, u32 temp);
|
|||
extern void recExecuteVU0Block(void);
|
||||
extern void recExecuteVU1Block(void);
|
||||
extern void DummyExecuteVU1Block(void);
|
||||
extern int LoadConfig();
|
||||
extern void SaveConfig();
|
||||
extern char strgametitle[256];
|
||||
|
||||
char* mystrlwr( char* string )
|
||||
|
@ -960,7 +958,8 @@ void ProcessFKeys(int fkey, int shift)
|
|||
SysPrintf("VU Skip - Frame Limit Mode Changed\n");
|
||||
break;
|
||||
}
|
||||
SaveConfig();
|
||||
// [Air]: Do we really want to save runtime changes to frameskipping?
|
||||
//SaveConfig();
|
||||
#endif
|
||||
break;
|
||||
// note: VK_F5-VK_F7 are reserved for GS
|
||||
|
|
48
pcsx2/Misc.h
48
pcsx2/Misc.h
|
@ -40,6 +40,16 @@
|
|||
#define X86_32CODE(x) x
|
||||
#endif
|
||||
|
||||
// --->> Path Utilities [PathUtil.c]
|
||||
|
||||
#define g_MaxPath 512
|
||||
extern int g_Error_PathTooLong;
|
||||
|
||||
int isPathRooted( const char* path );
|
||||
void CombinePaths( char* dest, const char* srcPath, const char* srcFile );
|
||||
|
||||
// <<--- END Path Utilities [PathUtil.c]
|
||||
|
||||
#define PCSX2_GSMULTITHREAD 1 // uses multithreaded gs
|
||||
#define PCSX2_DUALCORE 2 // speed up for dual cores
|
||||
#define PCSX2_FRAMELIMIT 4 // limits frames to normal speeds
|
||||
|
@ -88,20 +98,20 @@
|
|||
#define CHECK_VU1REC (Config.Options&PCSX2_VU1REC)
|
||||
|
||||
typedef struct {
|
||||
char Bios[256];
|
||||
char GS[256];
|
||||
char PAD1[256];
|
||||
char PAD2[256];
|
||||
char SPU2[256];
|
||||
char CDVD[256];
|
||||
char DEV9[256];
|
||||
char USB[256];
|
||||
char FW[256];
|
||||
char Mcd1[256];
|
||||
char Mcd2[256];
|
||||
char PluginsDir[256];
|
||||
char BiosDir[256];
|
||||
char Lang[256];
|
||||
char Bios[g_MaxPath];
|
||||
char GS[g_MaxPath];
|
||||
char PAD1[g_MaxPath];
|
||||
char PAD2[g_MaxPath];
|
||||
char SPU2[g_MaxPath];
|
||||
char CDVD[g_MaxPath];
|
||||
char DEV9[g_MaxPath];
|
||||
char USB[g_MaxPath];
|
||||
char FW[g_MaxPath];
|
||||
char Mcd1[g_MaxPath];
|
||||
char Mcd2[g_MaxPath];
|
||||
char PluginsDir[g_MaxPath];
|
||||
char BiosDir[g_MaxPath];
|
||||
char Lang[g_MaxPath];
|
||||
u32 Options; // PCSX2_X options
|
||||
int PsxOut;
|
||||
int PsxType;
|
||||
|
@ -135,12 +145,12 @@ int GetPS2ElfName(char*);
|
|||
|
||||
extern char *LabelAuthors;
|
||||
extern char *LabelGreets;
|
||||
int SaveState(char *file);
|
||||
int LoadState(char *file);
|
||||
int CheckState(char *file);
|
||||
int SaveState(const char *file);
|
||||
int LoadState(const char *file);
|
||||
int CheckState(const char *file);
|
||||
|
||||
int SaveGSState(char *file);
|
||||
int LoadGSState(char *file);
|
||||
int SaveGSState(const char *file);
|
||||
int LoadGSState(const char *file);
|
||||
|
||||
char *ParseLang(char *id);
|
||||
void ProcessFKeys(int fkey, int shift); // processes fkey related commands value 1-12
|
||||
|
|
|
@ -537,8 +537,8 @@ typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
|
|||
#ifdef _WIN32
|
||||
typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info);
|
||||
#endif
|
||||
typedef void (CALLBACK* _GSmakeSnapshot)(char *path);
|
||||
typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int);
|
||||
typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
|
||||
typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
|
||||
typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _GSconfigure)();
|
||||
typedef s32 (CALLBACK* _GStest)();
|
||||
|
|
|
@ -483,24 +483,34 @@ void ShutdownPlugins() {
|
|||
}
|
||||
|
||||
int LoadPlugins() {
|
||||
char Plugin[256];
|
||||
char Plugin[g_MaxPath];
|
||||
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.GS);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.GS );
|
||||
if (LoadGSplugin(Plugin) == -1) return -1;
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.PAD1);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.PAD1 );
|
||||
if (LoadPAD1plugin(Plugin) == -1) return -1;
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.PAD2);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.PAD2);
|
||||
if (LoadPAD2plugin(Plugin) == -1) return -1;
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.SPU2);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.SPU2);
|
||||
if (LoadSPU2plugin(Plugin) == -1) return -1;
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.CDVD);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.CDVD);
|
||||
if (LoadCDVDplugin(Plugin) == -1) return -1;
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.DEV9);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.DEV9);
|
||||
if (LoadDEV9plugin(Plugin) == -1) return -1;
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.USB);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.USB);
|
||||
if (LoadUSBplugin(Plugin) == -1) return -1;
|
||||
sprintf(Plugin, "%s%s", Config.PluginsDir, Config.FW);
|
||||
|
||||
CombinePaths( Plugin, Config.PluginsDir, Config.FW);
|
||||
if (LoadFWplugin(Plugin) == -1) return -1;
|
||||
|
||||
if( g_Error_PathTooLong ) return -1;
|
||||
if (InitPlugins() == -1) return -1;
|
||||
|
||||
loadp=1;
|
||||
|
|
|
@ -573,7 +573,7 @@ int sioFreeze(gzFile f, int Mode) {
|
|||
*******************************************************************
|
||||
*******************************************************************/
|
||||
FILE *LoadMcd(int mcd) {
|
||||
char str[256];
|
||||
char str[g_MaxPath];
|
||||
FILE *f;
|
||||
|
||||
if (mcd == 1) {
|
||||
|
|
|
@ -26,8 +26,8 @@ void SysMessage(const char *fmt, ...); // Message used to print msg to users
|
|||
void SysUpdate(); // Called on VBlank (to update i.e. pads)
|
||||
void SysRunGui(); // Returns to the Gui
|
||||
void SysClose(); // Close mem and plugins
|
||||
void *SysLoadLibrary(char *lib); // Loads Library
|
||||
void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library
|
||||
void *SysLoadLibrary(const char *lib); // Loads Library
|
||||
void *SysLoadSym(void *lib, const char *sym); // Loads Symbol from Library
|
||||
char *SysLibError(); // Gets previous error loading sysbols
|
||||
void SysCloseLibrary(void *lib); // Closes Library
|
||||
void *SysMmap(uptr base, u32 size);
|
||||
|
|
|
@ -78,7 +78,7 @@ BOOL OnConfigureDialog(HWND hW) {
|
|||
if (type & PS2E_LT_GS) {
|
||||
version = PS2E_GetLibVersion2(PS2E_LT_GS);
|
||||
if ( ((version >> 16)&0xff) == PS2E_GS_VERSION) {
|
||||
ComboAddPlugin(hWC_GS, Config.GS);
|
||||
ComboAddPlugin(hWC_GS, winConfig.GS);
|
||||
} else SysPrintf("Plugin %s: Version %x != %x\n", FindData.cFileName, 0xff&(version >> 16), PS2E_GS_VERSION);
|
||||
}
|
||||
if (type & PS2E_LT_PAD) {
|
||||
|
@ -88,39 +88,39 @@ BOOL OnConfigureDialog(HWND hW) {
|
|||
version = PS2E_GetLibVersion2(PS2E_LT_PAD);
|
||||
if (((version >> 16)&0xff) == PS2E_PAD_VERSION && query) {
|
||||
if (query() & 0x1)
|
||||
ComboAddPlugin(hWC_PAD1, Config.PAD1);
|
||||
ComboAddPlugin(hWC_PAD1, winConfig.PAD1);
|
||||
if (query() & 0x2)
|
||||
ComboAddPlugin(hWC_PAD2, Config.PAD2);
|
||||
ComboAddPlugin(hWC_PAD2, winConfig.PAD2);
|
||||
} else SysPrintf("Plugin %s: Version %x != %x\n", FindData.cFileName, (version >> 16)&0xff, PS2E_PAD_VERSION);
|
||||
}
|
||||
if (type & PS2E_LT_SPU2) {
|
||||
version = PS2E_GetLibVersion2(PS2E_LT_SPU2);
|
||||
if ( ((version >> 16)&0xff) == PS2E_SPU2_VERSION) {
|
||||
ComboAddPlugin(hWC_SPU2, Config.SPU2);
|
||||
ComboAddPlugin(hWC_SPU2, winConfig.SPU2);
|
||||
} else SysPrintf("Plugin %s: Version %x != %x\n", FindData.cFileName, (version >> 16)&0xff, PS2E_SPU2_VERSION);
|
||||
}
|
||||
if (type & PS2E_LT_CDVD) {
|
||||
version = PS2E_GetLibVersion2(PS2E_LT_CDVD);
|
||||
if (((version >> 16)&0xff) == PS2E_CDVD_VERSION) {
|
||||
ComboAddPlugin(hWC_CDVD, Config.CDVD);
|
||||
ComboAddPlugin(hWC_CDVD, winConfig.CDVD);
|
||||
} else SysPrintf("Plugin %s: Version %x != %x\n", FindData.cFileName, (version >> 16)&0xff, PS2E_CDVD_VERSION);
|
||||
}
|
||||
if (type & PS2E_LT_DEV9) {
|
||||
version = PS2E_GetLibVersion2(PS2E_LT_DEV9);
|
||||
if (((version >> 16)&0xff) == PS2E_DEV9_VERSION) {
|
||||
ComboAddPlugin(hWC_DEV9, Config.DEV9);
|
||||
ComboAddPlugin(hWC_DEV9, winConfig.DEV9);
|
||||
} else SysPrintf("Plugin %s: Version %x != %x\n", FindData.cFileName, (version >> 16)&0xff, PS2E_DEV9_VERSION);
|
||||
}
|
||||
if (type & PS2E_LT_USB) {
|
||||
version = PS2E_GetLibVersion2(PS2E_LT_USB);
|
||||
if (((version >> 16)&0xff) == PS2E_USB_VERSION) {
|
||||
ComboAddPlugin(hWC_USB, Config.USB);
|
||||
ComboAddPlugin(hWC_USB, winConfig.USB);
|
||||
} else SysPrintf("Plugin %s: Version %x != %x\n", FindData.cFileName, (version >> 16)&0xff, PS2E_USB_VERSION);
|
||||
}
|
||||
if (type & PS2E_LT_FW) {
|
||||
version = PS2E_GetLibVersion2(PS2E_LT_FW);
|
||||
if (((version >> 16)&0xff) == PS2E_FW_VERSION) {
|
||||
ComboAddPlugin(hWC_FW, Config.FW);
|
||||
ComboAddPlugin(hWC_FW, winConfig.FW);
|
||||
} else SysPrintf("Plugin %s: Version %x != %x\n", FindData.cFileName, (version >> 16)&0xff, PS2E_FW_VERSION);
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,6 @@ BOOL OnConfigureDialog(HWND hW) {
|
|||
if (Find==INVALID_HANDLE_VALUE) break;
|
||||
if (!strcmp(FindData.cFileName, ".")) continue;
|
||||
if (!strcmp(FindData.cFileName, "..")) continue;
|
||||
// if (FindData.nFileSizeLow < 1024 * 512) continue;
|
||||
if (FindData.nFileSizeLow > 1024 * 4096) continue; //2002-09-22 (Florin)
|
||||
if (!IsBIOS(FindData.cFileName, description)) continue;//2002-09-22 (Florin)
|
||||
lp = (char *)malloc(strlen(FindData.cFileName)+8);
|
||||
|
@ -226,15 +225,15 @@ char *GetComboSel(HWND hW, int id) {
|
|||
}
|
||||
|
||||
void OnOK(HWND hW) {
|
||||
CheckComboSel(Config.Bios, IDC_LISTBIOS);
|
||||
CheckComboSel(Config.GS, IDC_LISTGS);
|
||||
CheckComboSel(Config.PAD1, IDC_LISTPAD1);
|
||||
CheckComboSel(Config.PAD2, IDC_LISTPAD2);
|
||||
CheckComboSel(Config.SPU2, IDC_LISTSPU2);
|
||||
CheckComboSel(Config.CDVD, IDC_LISTCDVD);
|
||||
CheckComboSel(Config.DEV9, IDC_LISTDEV9);
|
||||
CheckComboSel(Config.USB, IDC_LISTUSB);
|
||||
CheckComboSel(Config.FW, IDC_LISTFW);
|
||||
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);
|
||||
CleanUpCombos(hW);
|
||||
|
||||
EndDialog(hW, TRUE);
|
||||
|
@ -244,134 +243,145 @@ void OnOK(HWND hW) {
|
|||
}
|
||||
|
||||
|
||||
#define ConfPlugin(src, confs, name) \
|
||||
void *drv; \
|
||||
src conf; \
|
||||
char * pDLL = GetComboSel(hW, confs); \
|
||||
char file[256]; \
|
||||
if(pDLL==NULL) return; \
|
||||
strcpy(file, Config.PluginsDir); \
|
||||
strcat(file, pDLL); \
|
||||
drv = SysLoadLibrary(file); \
|
||||
if (drv == NULL) return; \
|
||||
conf = (src) SysLoadSym(drv, name); \
|
||||
if (SysLibError() == NULL) conf(); \
|
||||
static void ConfPlugin( HWND hW, int confs, const char* name )
|
||||
{
|
||||
void *drv;
|
||||
void (*conf)();
|
||||
char * pDLL = GetComboSel(hW, confs);
|
||||
char file[g_MaxPath];
|
||||
|
||||
if(pDLL==NULL) return;
|
||||
CombinePaths( file, Config.PluginsDir, pDLL );
|
||||
|
||||
drv = SysLoadLibrary(file);
|
||||
if (drv == NULL) return;
|
||||
|
||||
conf = (void (*)()) SysLoadSym(drv, name);
|
||||
if (SysLibError() == NULL) conf();
|
||||
SysCloseLibrary(drv);
|
||||
}
|
||||
|
||||
void ConfigureGS(HWND hW) {
|
||||
ConfPlugin(_GSconfigure, IDC_LISTGS, "GSconfigure");
|
||||
ConfPlugin(hW, IDC_LISTGS, "GSconfigure");
|
||||
}
|
||||
|
||||
void ConfigurePAD1(HWND hW) {
|
||||
ConfPlugin(_PADconfigure, IDC_LISTPAD1, "PADconfigure");
|
||||
ConfPlugin(hW, IDC_LISTPAD1, "PADconfigure");
|
||||
}
|
||||
|
||||
void ConfigurePAD2(HWND hW) {
|
||||
ConfPlugin(_PADconfigure, IDC_LISTPAD2, "PADconfigure");
|
||||
ConfPlugin(hW, IDC_LISTPAD2, "PADconfigure");
|
||||
}
|
||||
|
||||
void ConfigureSPU2(HWND hW) {
|
||||
ConfPlugin(_SPU2configure, IDC_LISTSPU2, "SPU2configure");
|
||||
ConfPlugin(hW, IDC_LISTSPU2, "SPU2configure");
|
||||
}
|
||||
|
||||
void ConfigureCDVD(HWND hW) {
|
||||
ConfPlugin(_CDVDconfigure, IDC_LISTCDVD, "CDVDconfigure");
|
||||
ConfPlugin(hW, IDC_LISTCDVD, "CDVDconfigure");
|
||||
}
|
||||
|
||||
void ConfigureDEV9(HWND hW) {
|
||||
ConfPlugin(_DEV9configure, IDC_LISTDEV9, "DEV9configure");
|
||||
ConfPlugin(hW, IDC_LISTDEV9, "DEV9configure");
|
||||
}
|
||||
|
||||
void ConfigureUSB(HWND hW) {
|
||||
ConfPlugin(_USBconfigure, IDC_LISTUSB, "USBconfigure");
|
||||
ConfPlugin(hW, IDC_LISTUSB, "USBconfigure");
|
||||
}
|
||||
void ConfigureFW(HWND hW) {
|
||||
ConfPlugin(_FWconfigure, IDC_LISTFW, "FWconfigure");
|
||||
ConfPlugin(hW, IDC_LISTFW, "FWconfigure");
|
||||
}
|
||||
|
||||
void AboutGS(HWND hW) {
|
||||
ConfPlugin(_GSabout, IDC_LISTGS, "GSabout");
|
||||
ConfPlugin(hW, IDC_LISTGS, "GSabout");
|
||||
}
|
||||
|
||||
void AboutPAD1(HWND hW) {
|
||||
ConfPlugin(_PADabout, IDC_LISTPAD1, "PADabout");
|
||||
ConfPlugin(hW, IDC_LISTPAD1, "PADabout");
|
||||
}
|
||||
|
||||
void AboutPAD2(HWND hW) {
|
||||
ConfPlugin(_PADabout, IDC_LISTPAD2, "PADabout");
|
||||
ConfPlugin(hW, IDC_LISTPAD2, "PADabout");
|
||||
}
|
||||
|
||||
void AboutSPU2(HWND hW) {
|
||||
ConfPlugin(_SPU2about, IDC_LISTSPU2, "SPU2about");
|
||||
ConfPlugin(hW, IDC_LISTSPU2, "SPU2about");
|
||||
}
|
||||
|
||||
void AboutCDVD(HWND hW) {
|
||||
ConfPlugin(_CDVDabout, IDC_LISTCDVD, "CDVDabout");
|
||||
ConfPlugin(hW, IDC_LISTCDVD, "CDVDabout");
|
||||
}
|
||||
|
||||
void AboutDEV9(HWND hW) {
|
||||
ConfPlugin(_DEV9about, IDC_LISTDEV9, "DEV9about");
|
||||
ConfPlugin(hW, IDC_LISTDEV9, "DEV9about");
|
||||
}
|
||||
|
||||
void AboutUSB(HWND hW) {
|
||||
ConfPlugin(_USBabout, IDC_LISTUSB, "USBabout");
|
||||
ConfPlugin(hW, IDC_LISTUSB, "USBabout");
|
||||
}
|
||||
void AboutFW(HWND hW) {
|
||||
ConfPlugin(_FWabout, IDC_LISTFW, "FWabout");
|
||||
ConfPlugin(hW, IDC_LISTFW, "FWabout");
|
||||
}
|
||||
|
||||
static void TestPlugin( HWND hW, int confs, const char* name )
|
||||
{
|
||||
void *drv;
|
||||
int (*conf)();
|
||||
int ret = 0;
|
||||
char * pDLL = GetComboSel(hW, confs);
|
||||
char file[256];
|
||||
|
||||
if (pDLL== NULL) return;
|
||||
CombinePaths( file, Config.PluginsDir, pDLL );
|
||||
|
||||
drv = SysLoadLibrary(file);
|
||||
if (drv == NULL) return;
|
||||
|
||||
conf = (int (*)()) SysLoadSym(drv, name);
|
||||
if (SysLibError() == NULL) ret = conf();
|
||||
SysCloseLibrary(drv);
|
||||
|
||||
if (ret == 0)
|
||||
SysMessage(_("This plugin reports that should work correctly"));
|
||||
else
|
||||
SysMessage(_("This plugin reports that should not work correctly"));
|
||||
}
|
||||
#define TestPlugin(src, confs, name) \
|
||||
void *drv; \
|
||||
src conf; \
|
||||
int ret = 0; \
|
||||
char * pDLL = GetComboSel(hW, confs); \
|
||||
char file[256]; \
|
||||
if (pDLL== NULL) return; \
|
||||
strcpy(file, Config.PluginsDir); \
|
||||
strcat(file, pDLL); \
|
||||
drv = SysLoadLibrary(file); \
|
||||
if (drv == NULL) return; \
|
||||
conf = (src) SysLoadSym(drv, name); \
|
||||
if (SysLibError() == NULL) ret = conf(); \
|
||||
SysCloseLibrary(drv); \
|
||||
if (ret == 0) \
|
||||
SysMessage(_("This plugin reports that should work correctly")); \
|
||||
else SysMessage(_("This plugin reports that should not work correctly"));
|
||||
|
||||
void TestGS(HWND hW) {
|
||||
TestPlugin(_GStest, IDC_LISTGS, "GStest");
|
||||
TestPlugin(hW, IDC_LISTGS, "GStest");
|
||||
}
|
||||
|
||||
void TestPAD1(HWND hW) {
|
||||
TestPlugin(_PADtest, IDC_LISTPAD1, "PADtest");
|
||||
TestPlugin(hW, IDC_LISTPAD1, "PADtest");
|
||||
}
|
||||
|
||||
void TestPAD2(HWND hW) {
|
||||
TestPlugin(_PADtest, IDC_LISTPAD2, "PADtest");
|
||||
TestPlugin(hW, IDC_LISTPAD2, "PADtest");
|
||||
}
|
||||
|
||||
void TestSPU2(HWND hW) {
|
||||
TestPlugin(_SPU2test, IDC_LISTSPU2, "SPU2test");
|
||||
TestPlugin(hW, IDC_LISTSPU2, "SPU2test");
|
||||
}
|
||||
|
||||
void TestCDVD(HWND hW) {
|
||||
TestPlugin(_CDVDtest, IDC_LISTCDVD, "CDVDtest");
|
||||
TestPlugin(hW, IDC_LISTCDVD, "CDVDtest");
|
||||
}
|
||||
|
||||
void TestDEV9(HWND hW) {
|
||||
TestPlugin(_DEV9test, IDC_LISTDEV9, "DEV9test");
|
||||
TestPlugin(hW, IDC_LISTDEV9, "DEV9test");
|
||||
}
|
||||
|
||||
void TestUSB(HWND hW) {
|
||||
TestPlugin(_USBtest, IDC_LISTUSB, "USBtest");
|
||||
TestPlugin(hW, IDC_LISTUSB, "USBtest");
|
||||
}
|
||||
void TestFW(HWND hW) {
|
||||
TestPlugin(_FWtest, IDC_LISTFW, "FWtest");
|
||||
TestPlugin(hW, IDC_LISTFW, "FWtest");
|
||||
}
|
||||
|
||||
int SelectPath(HWND hW, char *Title, char *Path) {
|
||||
LPITEMIDLIST pidl;
|
||||
BROWSEINFO bi;
|
||||
char Buffer[256];
|
||||
char Buffer[g_MaxPath];
|
||||
|
||||
bi.hwndOwner = hW;
|
||||
bi.pidlRoot = NULL;
|
||||
|
@ -392,7 +402,7 @@ int SelectPath(HWND hW, char *Title, char *Path) {
|
|||
}
|
||||
|
||||
void SetPluginsDir(HWND hW) {
|
||||
char Path[256];
|
||||
char Path[g_MaxPath];
|
||||
|
||||
if (SelectPath(hW, _("Select Plugins Directory"), Path) == -1) return;
|
||||
strcpy(Config.PluginsDir, Path);
|
||||
|
@ -401,7 +411,7 @@ void SetPluginsDir(HWND hW) {
|
|||
}
|
||||
|
||||
void SetBiosDir(HWND hW) {
|
||||
char Path[256];
|
||||
char Path[g_MaxPath];
|
||||
|
||||
if (SelectPath(hW, _("Select Bios Directory"), Path) == -1) return;
|
||||
strcpy(Config.BiosDir, Path);
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/* 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
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
// This global set true by path methods when they encounter long paths.
|
||||
// If it flags true it means the app isn't stable and should be terminated.
|
||||
// (someday this should be replaced with proper C++ exception handling)
|
||||
int g_Error_PathTooLong = FALSE;
|
||||
|
||||
static const char PathSeparator = '\\';
|
||||
|
||||
int isPathRooted( const char* path )
|
||||
{
|
||||
// if the first character is a backslash or period, or the second character
|
||||
// a colon, it's a safe bet we're rooted.
|
||||
|
||||
if( path[0] == 0 ) return FALSE;
|
||||
#ifdef WIN32
|
||||
return (path[0] == '/') || (path[0] == '\\') || (path[1] == ':');
|
||||
#else
|
||||
return (path[0] == PathSeparator);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Concatenates two pathnames together, inserting delimiters (backslash on win32)
|
||||
// as needed! Assumes the 'dest' is allocated to at least g_MaxPath length.
|
||||
void CombinePaths( char* dest, const char* srcPath, const char* srcFile )
|
||||
{
|
||||
int pathlen, guesslen;
|
||||
char tmp[g_MaxPath];
|
||||
|
||||
if( g_Error_PathTooLong )
|
||||
{
|
||||
// This means a previous call has already failed and given the user
|
||||
// a message. Pcsx2 will exit as soon as it finds out, so skip
|
||||
// this operation (avoids the redundant message below)
|
||||
// [TODO] : Proper exception handling would resolve this hack!
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( srcFile == NULL || srcFile[0] == 0 )
|
||||
{
|
||||
// No source filename? Return the path unmodified.
|
||||
if( srcPath != NULL ) strcpy( dest, srcPath );
|
||||
return;
|
||||
}
|
||||
|
||||
if( isPathRooted( srcFile ) || srcPath == NULL || srcPath[0] == 0 )
|
||||
{
|
||||
// No source path? Or source filename is rooted?
|
||||
// Return the filename unmodified.
|
||||
strcpy( dest, srcFile );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// strip off the srcPath's trialing backslashes (if any)
|
||||
// Note: The win32 build works better if I check for both forward and backslashes.
|
||||
// This might be a problem on Linux builds or maybe it doesn't matter?
|
||||
strcpy( tmp, srcPath );
|
||||
pathlen = strlen( tmp );
|
||||
while( pathlen > 0 && ((tmp[pathlen-1] == '\\') || (tmp[pathlen-1] == '/')) )
|
||||
{
|
||||
--pathlen;
|
||||
tmp[pathlen] = 0;
|
||||
}
|
||||
|
||||
// Concatenate strings:
|
||||
guesslen = pathlen + strlen(srcFile) + 2;
|
||||
|
||||
if( guesslen >= g_MaxPath )
|
||||
{
|
||||
SysMessage(
|
||||
"Pcsx2 path names are too long. Please move or reinstall Pcsx2 to\n"
|
||||
"a location on your hard drive that has a shorter total path."
|
||||
);
|
||||
|
||||
g_Error_PathTooLong = TRUE;
|
||||
// [TODO]: Here would be a nice place for future C++ exception handling!
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
sprintf_s( dest, g_MaxPath, "%s%c%s", tmp, PathSeparator, srcFile );
|
||||
#else
|
||||
sprintf( dest, "%s%c%s", srcPath, PathSeparator, srcFile );
|
||||
#endif
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="windows-1253"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="pcsx2"
|
||||
ProjectGUID="{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
|
||||
RootNamespace="pcsx2"
|
||||
|
@ -705,6 +705,10 @@
|
|||
RelativePath="..\..\Patch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PathUtils.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\System.h"
|
||||
>
|
||||
|
@ -778,6 +782,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
RuntimeLibrary="0"
|
||||
AssemblerOutput="4"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
|
@ -1437,4 +1442,4 @@
|
|||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
</VisualStudioProject>
|
||||
|
|
|
@ -19,16 +19,28 @@
|
|||
#ifndef __WIN32_H__
|
||||
#define __WIN32_H__
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
// --->> Ini Configuration [ini.c]
|
||||
|
||||
extern char g_WorkingFolder[g_MaxPath];
|
||||
extern const char* g_CustomConfigFile;
|
||||
|
||||
int LoadConfig();
|
||||
void SaveConfig();
|
||||
|
||||
// <<--- END Ini Configuration [ini.c]
|
||||
|
||||
|
||||
extern int needReset;
|
||||
|
||||
AppData gApp;
|
||||
HWND hStatusWnd;
|
||||
PcsxConfig winConfig; // local storage of the configuration options.
|
||||
|
||||
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
void CreateMainWindow(int nCmdShow);
|
||||
void RunGui();
|
||||
int LoadConfig();
|
||||
void SaveConfig();
|
||||
|
||||
BOOL Open_File_Proc(char *filename);
|
||||
BOOL Pcsx2Configure(HWND hWnd);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <direct.h>
|
||||
|
||||
#include <ntsecapi.h>
|
||||
|
||||
|
@ -50,26 +51,33 @@
|
|||
#include "Patch.h"
|
||||
#include "cheats/cheats.h"
|
||||
|
||||
#include "../Paths.h"
|
||||
#include "Paths.h"
|
||||
|
||||
#define COMPILEDATE __DATE__
|
||||
|
||||
static int efile;
|
||||
char filename[256];
|
||||
static char filename[g_MaxPath];
|
||||
static int AccBreak = 0;
|
||||
static unsigned int langsMax;
|
||||
|
||||
// This instance is not modified by command line overrides so
|
||||
// that command line plugins and stuff won't be saved into the
|
||||
// user's conf file accidentally.
|
||||
PcsxConfig winConfig; // local storage of the configuration options.
|
||||
|
||||
extern int g_SaveGSStream;
|
||||
|
||||
static int AccBreak = 0;
|
||||
int needReset = 1;
|
||||
unsigned int langsMax;
|
||||
int RunExe = 0;
|
||||
|
||||
typedef struct {
|
||||
char lang[256];
|
||||
} _langs;
|
||||
_langs *langs = NULL;
|
||||
|
||||
int UseGui = 1;
|
||||
int nDisableSC = 0; // screensaver
|
||||
int firstRun=1;
|
||||
int RunExe = 0;
|
||||
static int UseGui = 1;
|
||||
static int nDisableSC = 0; // screensaver
|
||||
|
||||
void OpenConsole() {
|
||||
COORD csize;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||
|
@ -79,7 +87,7 @@ void OpenConsole() {
|
|||
AllocConsole();
|
||||
SetConsoleTitle(_("Ps2 Output"));
|
||||
csize.X = 100;
|
||||
csize.Y = 1024;
|
||||
csize.Y = 2048;
|
||||
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), csize);
|
||||
|
||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbiInfo);
|
||||
|
@ -125,10 +133,8 @@ void RunExecute(int run) {
|
|||
}
|
||||
|
||||
if (needReset == 1) {
|
||||
if(RunExe == 0)cpuExecuteBios();
|
||||
//if (efile == 2)
|
||||
if(!efile)efile=GetPS2ElfName(filename);
|
||||
//if (efile)
|
||||
if(RunExe == 0) cpuExecuteBios();
|
||||
if(!efile) efile=GetPS2ElfName(filename);
|
||||
loadElfFile(filename);
|
||||
|
||||
RunExe = 0;
|
||||
|
@ -185,8 +191,9 @@ void States_Load(int num) {
|
|||
sprintf (Text, "sstates\\%8.8X.%3.3d", ElfCRC, num);
|
||||
ret = LoadState(Text);
|
||||
if (ret == 0)
|
||||
sprintf (Text, _("*PCSX2*: Loaded State %d"), num+1);
|
||||
else sprintf (Text, _("*PCSX2*: Error Loading State %d"), num+1);
|
||||
sprintf (Text, _("*PCSX2*: Loaded State %d"), num+1);
|
||||
else
|
||||
sprintf (Text, _("*PCSX2*: Error Loading State %d"), num+1);
|
||||
StatusSet(Text);
|
||||
|
||||
Cpu->Execute();
|
||||
|
@ -200,8 +207,9 @@ void States_Save(int num) {
|
|||
sprintf (Text, "sstates\\%8.8X.%3.3d", ElfCRC, num);
|
||||
ret = SaveState(Text);
|
||||
if (ret == 0)
|
||||
sprintf(Text, _("*PCSX2*: Saving State %d"), num+1);
|
||||
else sprintf(Text, _("*PCSX2*: Error Saving State %d"), num+1);
|
||||
sprintf(Text, _("*PCSX2*: Saving State %d"), num+1);
|
||||
else
|
||||
sprintf(Text, _("*PCSX2*: Error Saving State %d"), num+1);
|
||||
StatusSet(Text);
|
||||
|
||||
RunExecute(1);
|
||||
|
@ -258,7 +266,7 @@ void OnStates_Save3() { States_Save(2); }
|
|||
void OnStates_Save4() { States_Save(3); }
|
||||
void OnStates_Save5() { States_Save(4); }
|
||||
|
||||
char* g_pRunGSState = NULL;
|
||||
const char* g_pRunGSState = NULL;
|
||||
|
||||
void OnStates_SaveOther() {
|
||||
OPENFILENAME ofn;
|
||||
|
@ -301,123 +309,207 @@ void OnStates_SaveOther() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
TESTRUNARGS g_TestRun;
|
||||
|
||||
static int ParseCommandLine(char* pcmd)
|
||||
{
|
||||
const char* pdelim = " \t\r\n";
|
||||
char* token = strtok(pcmd, pdelim);
|
||||
#define CmdSwitchIs( text ) ( stricmp( command, text ) == 0 )
|
||||
|
||||
g_TestRun.efile = 0;
|
||||
static const char* phelpmsg =
|
||||
"pcsx2 [options] [file]\n\n"
|
||||
"-cfg [file] {configuration file}\n"
|
||||
"-efile [efile] {0 - reset, 1 - runcd (default), 2 - loadelf}\n"
|
||||
"-help {display this help file}\n"
|
||||
"-nogui {Don't use gui when launching}\n"
|
||||
"-loadgs [file] {Loads a gsstate}\n"
|
||||
"\n"
|
||||
|
||||
while(token != NULL) {
|
||||
|
||||
if( _stricmp(token, "-help") == 0) {
|
||||
const char* phelpmsg =
|
||||
"pcsx2 [options] [file]\n\n"
|
||||
"-cfg [file] {configuration file}\n"
|
||||
"-efile [efile] {0 - reset, 1 - runcd (default), 2 - loadelf}\n"
|
||||
"-help {display this help file}\n"
|
||||
"-nogui {Don't use gui when launching}\n"
|
||||
"-loadgs [file} {Loads a gsstate}\n"
|
||||
"\n"
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
"Testing Options: \n"
|
||||
"\t-frame [frame] {game will run up to this frame before exiting}\n"
|
||||
"\t-image [name] {path and base name of image (do not include the .ext)}\n"
|
||||
"\t-jpg {save images to jpg format}\n"
|
||||
"\t-log [name] {log path to save log file in}\n"
|
||||
"\t-logopt [hex] {log options in hex (see debug.h) }\n"
|
||||
"\t-numimages [num] {after hitting frame, this many images will be captures every 20 frames}\n"
|
||||
"\t-test {Triggers testing mode (only for dev builds)}\n"
|
||||
"\n"
|
||||
"Testing Options: \n"
|
||||
"\t-frame [frame] {game will run up to this frame before exiting}\n"
|
||||
"\t-image [name] {path and base name of image (do not include the .ext)}\n"
|
||||
"\t-jpg {save images to jpg format}\n"
|
||||
"\t-log [name] {log path to save log file in}\n"
|
||||
"\t-logopt [hex] {log options in hex (see debug.h) }\n"
|
||||
"\t-numimages [num] {after hitting frame, this many images will be captures every 20 frames}\n"
|
||||
"\t-test {Triggers testing mode (only for dev builds)}\n"
|
||||
"\n"
|
||||
#endif
|
||||
|
||||
"Load Plugins:\n"
|
||||
"\t-cdvd [dllpath] {specify the dll load path of the CDVD plugin}\n"
|
||||
"\t-gs [dllpath] {specify the dll load path of the GS plugin}\n"
|
||||
"-pad [tsxcal] {specify to hold down on the triangle, square, circle, x, start, select buttons}\n"
|
||||
"\t-spu [dllpath] {specify the dll load path of the SPU2 plugin}\n"
|
||||
"\n";
|
||||
"Load Plugins:\n"
|
||||
"\t-cdvd [dllpath] {specify the dll load path of the CDVD plugin}\n"
|
||||
"\t-gs [dllpath] {specify the dll load path of the GS plugin}\n"
|
||||
"\t-spu [dllpath] {specify the dll load path of the SPU2 plugin}\n"
|
||||
"\n";
|
||||
|
||||
printf("%s", phelpmsg);
|
||||
MessageBox(NULL,phelpmsg,"Help", MB_OK);
|
||||
/// This code is courtesy of http://alter.org.ua/en/docs/win/args/
|
||||
static PTCHAR* _CommandLineToArgv( PTCHAR CmdLine, int* _argc )
|
||||
{
|
||||
PTCHAR* argv;
|
||||
PTCHAR _argv;
|
||||
ULONG len;
|
||||
ULONG argc;
|
||||
TCHAR a;
|
||||
ULONG i, j;
|
||||
|
||||
BOOLEAN in_QM;
|
||||
BOOLEAN in_TEXT;
|
||||
BOOLEAN in_SPACE;
|
||||
|
||||
len = _tcslen( CmdLine );
|
||||
i = ((len+2)/2)*sizeof(PVOID) + sizeof(PVOID);
|
||||
|
||||
argv = (PTCHAR*)GlobalAlloc(GMEM_FIXED,
|
||||
i + (len+2)*sizeof(a));
|
||||
|
||||
_argv = (PTCHAR)(((PUCHAR)argv)+i);
|
||||
|
||||
argc = 0;
|
||||
argv[argc] = _argv;
|
||||
in_QM = FALSE;
|
||||
in_TEXT = FALSE;
|
||||
in_SPACE = TRUE;
|
||||
i = 0;
|
||||
j = 0;
|
||||
|
||||
while( a = CmdLine[i] ) {
|
||||
if(in_QM) {
|
||||
if(a == '\"') {
|
||||
in_QM = FALSE;
|
||||
} else {
|
||||
_argv[j] = a;
|
||||
j++;
|
||||
}
|
||||
} else {
|
||||
switch(a) {
|
||||
case '\"':
|
||||
in_QM = TRUE;
|
||||
in_TEXT = TRUE;
|
||||
if(in_SPACE) {
|
||||
argv[argc] = _argv+j;
|
||||
argc++;
|
||||
}
|
||||
in_SPACE = FALSE;
|
||||
break;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\r':
|
||||
if(in_TEXT) {
|
||||
_argv[j] = '\0';
|
||||
j++;
|
||||
}
|
||||
in_TEXT = FALSE;
|
||||
in_SPACE = TRUE;
|
||||
break;
|
||||
default:
|
||||
in_TEXT = TRUE;
|
||||
if(in_SPACE) {
|
||||
argv[argc] = _argv+j;
|
||||
argc++;
|
||||
}
|
||||
_argv[j] = a;
|
||||
j++;
|
||||
in_SPACE = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
_argv[j] = '\0';
|
||||
argv[argc] = NULL;
|
||||
|
||||
(*_argc) = argc;
|
||||
return argv;
|
||||
}
|
||||
|
||||
// returns 1 if the user requested help (show help and exit)
|
||||
// returns zero on success.
|
||||
// returns -1 on failure (bad command line argument)
|
||||
static int ParseCommandLine( int tokenCount, const TCHAR** tokens )
|
||||
{
|
||||
int tidx = 0;
|
||||
g_TestRun.efile = 0;
|
||||
|
||||
while( tidx < tokenCount )
|
||||
{
|
||||
const TCHAR* command = tokens[tidx++];
|
||||
|
||||
if( command[0] != '-' )
|
||||
{
|
||||
g_TestRun.ptitle = command;
|
||||
printf("opening file %s\n", command);
|
||||
continue;
|
||||
}
|
||||
|
||||
// jump past the '-' switch char, and skip if this is a dud switch:
|
||||
command++;
|
||||
if( command[0] == 0 ) continue;
|
||||
|
||||
if( CmdSwitchIs( "help" ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if( _stricmp(token, "-nogui") == 0 ) {
|
||||
else if( CmdSwitchIs( "nogui" ) ) {
|
||||
UseGui = 0;
|
||||
}
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
else if( _stricmp(token, "-image") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
g_TestRun.pimagename = token;
|
||||
}
|
||||
else if( _stricmp(token, "-log") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
g_TestRun.plogname = token;
|
||||
}
|
||||
else if( _stricmp(token, "-logopt") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
if( token != NULL ) {
|
||||
if( token[0] == '0' && token[1] == 'x' ) token += 2;
|
||||
sscanf(token, "%x", &varLog);
|
||||
}
|
||||
}
|
||||
else if( _stricmp(token, "-frame") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
if( token != NULL ) {
|
||||
g_TestRun.frame = atoi(token);
|
||||
}
|
||||
}
|
||||
else if( _stricmp(token, "-numimages") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
if( token != NULL ) {
|
||||
g_TestRun.numimages = atoi(token);
|
||||
}
|
||||
}
|
||||
else if( _stricmp(token, "-jpg") == 0 ) {
|
||||
else if( CmdSwitchIs( "jpg" ) ) {
|
||||
g_TestRun.jpgcapture = 1;
|
||||
}
|
||||
#endif
|
||||
else if( _stricmp(token, "-pad") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
printf("-pad ignored\n");
|
||||
}
|
||||
else if( _stricmp(token, "-efile") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
if( token != NULL ) {
|
||||
g_TestRun.efile = atoi(token);
|
||||
else
|
||||
{
|
||||
const TCHAR* param;
|
||||
if( tidx >= tokenCount ) break;
|
||||
|
||||
// None of the parameter-less toggles flagged.
|
||||
// Check for switches that require one or more parameters here:
|
||||
|
||||
param = tokens[tidx++];
|
||||
|
||||
if( CmdSwitchIs( "cfg" ) ) {
|
||||
g_CustomConfigFile = param;
|
||||
}
|
||||
}
|
||||
else if( _stricmp(token, "-gs") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
g_TestRun.pgsdll = token;
|
||||
}
|
||||
else if( _stricmp(token, "-cdvd") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
g_TestRun.pcdvddll = token;
|
||||
}
|
||||
else if( _stricmp(token, "-spu") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
g_TestRun.pspudll = token;
|
||||
}
|
||||
else if( _stricmp(token, "-loadgs") == 0 ) {
|
||||
token = strtok(NULL, pdelim);
|
||||
g_pRunGSState = token;
|
||||
}
|
||||
else {
|
||||
g_TestRun.ptitle = token;
|
||||
printf("opening file %s\n", token);
|
||||
}
|
||||
|
||||
if( token == NULL ) {
|
||||
printf("invalid args\n");
|
||||
return -1;
|
||||
}
|
||||
else if( CmdSwitchIs( "efile" ) ) {
|
||||
g_TestRun.efile = atoi( param );
|
||||
}
|
||||
else if( CmdSwitchIs( "loadgs" ) ) {
|
||||
g_pRunGSState = param;
|
||||
}
|
||||
|
||||
token = strtok(NULL, pdelim);
|
||||
// Options to configure plugins:
|
||||
|
||||
else if( CmdSwitchIs( "gs" ) ) {
|
||||
g_TestRun.pgsdll = param;
|
||||
}
|
||||
else if( CmdSwitchIs( "cdvd" ) ) {
|
||||
g_TestRun.pcdvddll = param;
|
||||
}
|
||||
else if( CmdSwitchIs( "spu" ) ) {
|
||||
g_TestRun.pspudll = param;
|
||||
}
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
else if( CmdSwitchIs( "image" ) ) {
|
||||
g_TestRun.pimagename = param;
|
||||
}
|
||||
else if( CmdSwitchIs( "log" ) ) {
|
||||
g_TestRun.plogname = param;
|
||||
}
|
||||
else if( CmdSwitchIs( "logopt" ) ) {
|
||||
if( param[0] == '0' && param[1] == 'x' ) param += 2;
|
||||
sscanf(param, "%x", &varLog);
|
||||
}
|
||||
else if( CmdSwitchIs( "frame" ) ) {
|
||||
g_TestRun.frame = atoi( param );
|
||||
}
|
||||
else if( CmdSwitchIs( "numimages" ) ) {
|
||||
g_TestRun.numimages = atoi( param );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -466,22 +558,55 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
if (LoadConfig() == -1) {
|
||||
memset(&Config, 0, sizeof(Config));
|
||||
//strcpy(Config.Bios, "HLE");
|
||||
strcpy(Config.BiosDir, "Bios\\");
|
||||
strcpy(Config.PluginsDir, "Plugins\\");
|
||||
Config.Patch = 1;
|
||||
Config.Options = PCSX2_EEREC|PCSX2_VU0REC|PCSX2_VU1REC|PCSX2_COP2REC;
|
||||
Config.sseMXCSR = DEFAULT_sseMXCSR;
|
||||
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
|
||||
memset(&g_TestRun, 0, sizeof(g_TestRun));
|
||||
|
||||
_getcwd( g_WorkingFolder, g_MaxPath );
|
||||
|
||||
SysMessage(_("Pcsx2 needs to be configured"));
|
||||
Pcsx2Configure(NULL);
|
||||
{
|
||||
int argc;
|
||||
TCHAR** argv;
|
||||
|
||||
return 0;
|
||||
argv = _CommandLineToArgv( lpCmdLine, &argc );
|
||||
if( argv == NULL )
|
||||
{
|
||||
SysMessage( "A fatal error occured while attempting to parse the command line.\n" );
|
||||
return 2;
|
||||
}
|
||||
|
||||
switch( ParseCommandLine( argc, argv ) )
|
||||
{
|
||||
case 1: // display help and exit:
|
||||
printf( "%s", phelpmsg );
|
||||
MessageBox( NULL, phelpmsg, "Pcsx2 Help", MB_OK);
|
||||
|
||||
case -1: // exit...
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch( LoadConfig( &winConfig ) )
|
||||
{
|
||||
case 0: break; // everything worked!
|
||||
case 1:
|
||||
// configure some defaults, notify the user, and the quit.
|
||||
memset(&Config, 0, sizeof(Config));
|
||||
//strcpy(Config.Bios, "HLE");
|
||||
strcpy(Config.BiosDir, "Bios\\");
|
||||
strcpy(Config.PluginsDir, "Plugins\\");
|
||||
Config.Patch = 1;
|
||||
Config.Options = PCSX2_EEREC|PCSX2_VU0REC|PCSX2_VU1REC|PCSX2_COP2REC;
|
||||
Config.sseMXCSR = DEFAULT_sseMXCSR;
|
||||
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
|
||||
|
||||
SysMessage(_("Pcsx2 needs to be configured"));
|
||||
Pcsx2Configure(NULL);
|
||||
|
||||
case -1: // Error occured. Quit.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( g_Error_PathTooLong ) return 3;
|
||||
}
|
||||
|
||||
if (Config.Lang[0] == 0) {
|
||||
strcpy(Config.Lang, "en_US");
|
||||
}
|
||||
|
@ -497,22 +622,36 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
CloseLanguages();
|
||||
langsMax = i;
|
||||
|
||||
if (Config.PsxOut) OpenConsole();
|
||||
if( winConfig.PsxOut )
|
||||
{
|
||||
OpenConsole();
|
||||
|
||||
memset(&g_TestRun, 0, sizeof(g_TestRun));
|
||||
|
||||
if( lpCmdLine == NULL || *lpCmdLine == 0 )
|
||||
SysPrintf("-help to see arguments\n");
|
||||
else if( ParseCommandLine(lpCmdLine) == -1 ) {
|
||||
return 2;
|
||||
if( lpCmdLine == NULL || *lpCmdLine == 0 )
|
||||
SysPrintf("-help to see arguments\n");
|
||||
}
|
||||
|
||||
// Load the command line overrides for plugins:
|
||||
|
||||
memcpy( &Config, &winConfig, sizeof( PcsxConfig ) );
|
||||
|
||||
if( g_TestRun.pgsdll )
|
||||
_snprintf(Config.GS, sizeof(Config.GS), "%s", g_TestRun.pgsdll);
|
||||
{
|
||||
_tcscpy_s( Config.GS, g_MaxPath, g_TestRun.pgsdll );
|
||||
SysPrintf( "* GS plugin override: \n\t%s\n\n", Config.GS );
|
||||
}
|
||||
if( g_TestRun.pcdvddll )
|
||||
_snprintf(Config.CDVD, sizeof(Config.CDVD), "%s", g_TestRun.pcdvddll);
|
||||
{
|
||||
_tcscpy_s( Config.CDVD, g_MaxPath, g_TestRun.pcdvddll );
|
||||
SysPrintf( "* CDVD plugin override: \n\t%s\n\n", Config.CDVD );
|
||||
}
|
||||
if( g_TestRun.pspudll )
|
||||
_snprintf(Config.SPU2, sizeof(Config.SPU2), "%s", g_TestRun.pspudll);
|
||||
{
|
||||
_tcscpy_s( Config.SPU2, g_MaxPath, g_TestRun.pspudll );
|
||||
SysPrintf( "* SPU2 plugin override: \n\t%s\n\n", Config.SPU2 );
|
||||
}
|
||||
|
||||
// [TODO] : Add the other plugins here...
|
||||
|
||||
|
||||
if (SysInit() == -1) return 1;
|
||||
|
||||
|
@ -527,9 +666,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
SysClose();
|
||||
return 0; // success!
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
if( g_pRunGSState ) {
|
||||
LoadGSState(g_pRunGSState);
|
||||
SysClose();
|
||||
|
@ -537,9 +674,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
}
|
||||
#endif
|
||||
|
||||
CreateMainWindow(nCmdShow);
|
||||
CreateMainWindow( nCmdShow );
|
||||
|
||||
if( Config.PsxOut ) {
|
||||
if( Config.PsxOut )
|
||||
{
|
||||
// output the help commands
|
||||
SysPrintf("\tF1 - save state\n");
|
||||
SysPrintf("\t(Shift +) F2 - cycle states\n");
|
||||
|
@ -684,7 +822,7 @@ BOOL APIENTRY LogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
|||
Log = 1;
|
||||
else Log = 0;
|
||||
|
||||
SaveConfig();
|
||||
SaveConfig( &winConfig );
|
||||
|
||||
EndDialog(hDlg, TRUE);
|
||||
}
|
||||
|
@ -762,53 +900,52 @@ BOOL APIENTRY GameFixes(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#define HacksInit() \
|
||||
{ \
|
||||
if(Config.Hacks & 0x1) CheckDlgButton(hDlg, IDC_SYNCHACK, TRUE); \
|
||||
if(Config.Hacks & 0x2) CheckDlgButton(hDlg, IDC_VU_OVERFLOWHACK, TRUE); \
|
||||
if(Config.Hacks & 0x4) CheckDlgButton(hDlg, IDC_SOUNDHACK, TRUE); \
|
||||
if(Config.Hacks & 0x8) CheckDlgButton(hDlg, IDC_DENORMALS, TRUE); \
|
||||
if(Config.Hacks & 0x10) CheckDlgButton(hDlg, IDC_SYNCHACK2, TRUE); \
|
||||
if(Config.Hacks & 0x20) CheckDlgButton(hDlg, IDC_SYNCHACK3, TRUE); \
|
||||
if(Config.Hacks & 0x40) CheckDlgButton(hDlg, IDC_VU_OVERFLOWHACK, 2); \
|
||||
if(Config.Hacks & 0x80) CheckDlgButton(hDlg, IDC_FASTBRANCHES, TRUE); \
|
||||
if(Config.Hacks & 0x100) CheckDlgButton(hDlg, IDC_VU_FLAGS, TRUE); \
|
||||
if(Config.Hacks & 0x200) CheckDlgButton(hDlg, IDC_FPU_FLAGS, TRUE); \
|
||||
if(Config.Hacks & 0x400) CheckDlgButton(hDlg, IDC_ESCHACK, TRUE); \
|
||||
if(Config.Hacks & 0x800) CheckDlgButton(hDlg, IDC_FPU_OVERFLOWHACK, TRUE); \
|
||||
if(Config.Hacks & 0x1000) CheckDlgButton(hDlg, IDC_FPU_OVERFLOWHACK, 2); \
|
||||
static void HacksInit( HWND hDlg )
|
||||
{
|
||||
if(Config.Hacks & 0x1) CheckDlgButton(hDlg, IDC_SYNCHACK, TRUE);
|
||||
if(Config.Hacks & 0x2) CheckDlgButton(hDlg, IDC_VU_OVERFLOWHACK, TRUE);
|
||||
if(Config.Hacks & 0x4) CheckDlgButton(hDlg, IDC_SOUNDHACK, TRUE);
|
||||
if(Config.Hacks & 0x8) CheckDlgButton(hDlg, IDC_DENORMALS, TRUE);
|
||||
if(Config.Hacks & 0x10) CheckDlgButton(hDlg, IDC_SYNCHACK2, TRUE);
|
||||
if(Config.Hacks & 0x20) CheckDlgButton(hDlg, IDC_SYNCHACK3, TRUE);
|
||||
if(Config.Hacks & 0x40) CheckDlgButton(hDlg, IDC_VU_OVERFLOWHACK, 2);
|
||||
if(Config.Hacks & 0x80) CheckDlgButton(hDlg, IDC_FASTBRANCHES, TRUE);
|
||||
if(Config.Hacks & 0x100) CheckDlgButton(hDlg, IDC_VU_FLAGS, TRUE);
|
||||
if(Config.Hacks & 0x200) CheckDlgButton(hDlg, IDC_FPU_FLAGS, TRUE);
|
||||
if(Config.Hacks & 0x400) CheckDlgButton(hDlg, IDC_ESCHACK, TRUE);
|
||||
if(Config.Hacks & 0x800) CheckDlgButton(hDlg, IDC_FPU_OVERFLOWHACK, TRUE);
|
||||
if(Config.Hacks & 0x1000) CheckDlgButton(hDlg, IDC_FPU_OVERFLOWHACK, 2);
|
||||
}
|
||||
|
||||
#define HacksChecked() \
|
||||
{ \
|
||||
Config.Hacks = 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK) ? 0x1 : 0; \
|
||||
/* 0x40 == greyed checkbox (extra overflow checking); 0x2 == checked (disable overflow checking) */ \
|
||||
Config.Hacks |= ( IsDlgButtonChecked(hDlg, IDC_VU_OVERFLOWHACK) == 2 ) ? 0x40 : (IsDlgButtonChecked(hDlg, IDC_VU_OVERFLOWHACK) ? 0x2 : 0); \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SOUNDHACK) ? 0x4 : 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_DENORMALS) ? 0x8 : 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK2) ? 0x10 : 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK3) ? 0x20 : 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_FASTBRANCHES) ? 0x80 : 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_VU_FLAGS) ? 0x100 : 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_FPU_FLAGS) ? 0x200 : 0; \
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_ESCHACK) ? 0x400 : 0; \
|
||||
/* 0x1000 == greyed checkbox (extra overflow checking); 0x800 == checked (disable overflow checking)*/ \
|
||||
Config.Hacks |= ( IsDlgButtonChecked(hDlg, IDC_FPU_OVERFLOWHACK) == 2 ) ? 0x1000 : (IsDlgButtonChecked(hDlg, IDC_FPU_OVERFLOWHACK) ? 0x800 : 0); \
|
||||
static void HacksChecked( HWND hDlg )
|
||||
{
|
||||
Config.Hacks = 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK) ? 0x1 : 0;
|
||||
/* 0x40 == greyed checkbox (extra overflow checking); 0x2 == checked (disable overflow checking) */
|
||||
Config.Hacks |= ( IsDlgButtonChecked(hDlg, IDC_VU_OVERFLOWHACK) == 2 ) ? 0x40 : (IsDlgButtonChecked(hDlg, IDC_VU_OVERFLOWHACK) ? 0x2 : 0);
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SOUNDHACK) ? 0x4 : 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_DENORMALS) ? 0x8 : 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK2) ? 0x10 : 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK3) ? 0x20 : 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_FASTBRANCHES) ? 0x80 : 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_VU_FLAGS) ? 0x100 : 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_FPU_FLAGS) ? 0x200 : 0;
|
||||
Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_ESCHACK) ? 0x400 : 0;
|
||||
/* 0x1000 == greyed checkbox (extra overflow checking); 0x800 == checked (disable overflow checking)*/
|
||||
Config.Hacks |= ( IsDlgButtonChecked(hDlg, IDC_FPU_OVERFLOWHACK) == 2 ) ? 0x1000 : (IsDlgButtonChecked(hDlg, IDC_FPU_OVERFLOWHACK) ? 0x800 : 0);
|
||||
}
|
||||
|
||||
BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
//char str[256];
|
||||
|
||||
BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
HacksInit();
|
||||
HacksInit( hDlg );
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
HacksChecked();
|
||||
HacksChecked( hDlg );
|
||||
SaveConfig();
|
||||
EndDialog(hDlg, TRUE);
|
||||
break;
|
||||
|
@ -830,8 +967,8 @@ BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
|||
//CheckDlgButton(hDlg, IDC_SOUNDHACK, TRUE);
|
||||
//CheckDlgButton(hDlg, IDC_ESCHACK, TRUE);
|
||||
|
||||
HacksChecked();
|
||||
HacksInit();
|
||||
HacksChecked( hDlg );
|
||||
HacksInit( hDlg );
|
||||
break;
|
||||
|
||||
case IDBUTTON2:
|
||||
|
@ -847,8 +984,8 @@ BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
|||
CheckDlgButton(hDlg, IDC_SOUNDHACK, FALSE);
|
||||
//CheckDlgButton(hDlg, IDC_ESCHACK, TRUE);
|
||||
|
||||
HacksChecked();
|
||||
HacksInit();
|
||||
HacksChecked( hDlg );
|
||||
HacksInit( hDlg );
|
||||
break;
|
||||
|
||||
default: return TRUE;
|
||||
|
@ -1713,11 +1850,11 @@ void SysRunGui() {
|
|||
static char *err = N_("Error Loading Symbol");
|
||||
static int errval;
|
||||
|
||||
void *SysLoadLibrary(char *lib) {
|
||||
void *SysLoadLibrary(const char *lib) {
|
||||
return LoadLibrary(lib);
|
||||
}
|
||||
|
||||
void *SysLoadSym(void *lib, char *sym) {
|
||||
void *SysLoadSym(void *lib, const char *sym) {
|
||||
void *tmp = GetProcAddress((HINSTANCE)lib, sym);
|
||||
if (tmp == NULL) errval = 1;
|
||||
else errval = 0;
|
||||
|
|
|
@ -22,73 +22,106 @@
|
|||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "win32.h"
|
||||
#include "Paths.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
//extern u32 g_sseMXCSR;
|
||||
//extern u32 g_sseVUMXCSR;
|
||||
const char* g_CustomConfigFile;
|
||||
char g_WorkingFolder[g_MaxPath]; // Working folder at application startup
|
||||
|
||||
int LoadConfig() {
|
||||
FILE *fp;
|
||||
// Returns TRUE if the user has invoked the -cfg command line option.
|
||||
BOOLEAN hasCustomConfig()
|
||||
{
|
||||
return (g_CustomConfigFile != NULL) && (g_CustomConfigFile[0] != 0);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
char text[256];
|
||||
extern int _nl_msg_cat_cntr;
|
||||
#endif
|
||||
PcsxConfig *Conf = &Config;
|
||||
char *szTemp;
|
||||
char szIniFile[256], szValue[256];
|
||||
|
||||
GetModuleFileName(GetModuleHandle((LPCSTR)gApp.hInstance), szIniFile, 256);
|
||||
szTemp = strrchr(szIniFile, '\\');
|
||||
|
||||
if(!szTemp) return -1;
|
||||
strcpy(szTemp, "\\inis\\pcsx2.ini");
|
||||
fp=fopen("inis\\pcsx2.ini","rt");//check if pcsx2.ini really exists
|
||||
if (!fp)
|
||||
// Returns the FULL (absolute) path and filename of the configuration file.
|
||||
void GetConfigFilename( char* dest )
|
||||
{
|
||||
if( hasCustomConfig() )
|
||||
{
|
||||
// Load a user-specified configuration.
|
||||
// If the configuration isn't found, fail outright (see below)
|
||||
|
||||
CombinePaths( dest, ".", g_CustomConfigFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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:
|
||||
|
||||
CombinePaths( dest, g_WorkingFolder, CONFIG_DIR "\\pcsx2.ini" );
|
||||
}
|
||||
}
|
||||
|
||||
int LoadConfig()
|
||||
{
|
||||
FILE *fp;
|
||||
PcsxConfig* Conf = &winConfig;
|
||||
|
||||
char szIniFile[g_MaxPath], szValue[g_MaxPath];
|
||||
|
||||
GetConfigFilename( szIniFile );
|
||||
|
||||
if( g_Error_PathTooLong ) return -1;
|
||||
|
||||
fp = fopen( szIniFile, "rt" );
|
||||
if( fp == NULL)
|
||||
{
|
||||
if( hasCustomConfig() )
|
||||
{
|
||||
// using custom config, so fail outright:
|
||||
SysMessage( "User-specified configuration file not found:\n %s\nPCSX2 will now exit." );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// standard mode operation. Create the directory.
|
||||
// Conf File will be created and saved later.
|
||||
CreateDirectory("inis",NULL);
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
fclose(fp);
|
||||
//interface
|
||||
GetPrivateProfileString("Interface", "Bios", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Interface", "Bios", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->Bios, szValue);
|
||||
GetPrivateProfileString("Interface", "Lang", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Interface", "Lang", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->Lang, szValue);
|
||||
GetPrivateProfileString("Interface", "Ps2Out", NULL, szValue, 20, szIniFile);
|
||||
Conf->PsxOut = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Interface", "ThPriority", NULL, szValue, 20, szIniFile);
|
||||
Conf->ThPriority = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Interface", "PluginsDir", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Interface", "PluginsDir", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->PluginsDir, szValue);
|
||||
GetPrivateProfileString("Interface", "BiosDir", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Interface", "BiosDir", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->BiosDir, szValue);
|
||||
GetPrivateProfileString("Interface", "Mcd1", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Interface", "Mcd1", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->Mcd1, szValue);
|
||||
GetPrivateProfileString("Interface", "Mcd2", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Interface", "Mcd2", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->Mcd2, szValue);
|
||||
Config.CustomFps = GetPrivateProfileInt("Interface", "CustomFps", 0, szIniFile);
|
||||
Config.CustomFrameSkip = GetPrivateProfileInt("Interface", "CustomFrameskip", 0, szIniFile);
|
||||
Config.CustomConsecutiveFrames = GetPrivateProfileInt("Interface", "CustomConsecutiveFrames", 0, szIniFile);
|
||||
Config.CustomConsecutiveSkip = GetPrivateProfileInt("Interface", "CustomConsecutiveSkip", 0, szIniFile);
|
||||
//plugins
|
||||
GetPrivateProfileString("Plugins", "GS", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "GS", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->GS, szValue);
|
||||
GetPrivateProfileString("Plugins", "SPU2", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "SPU2", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->SPU2, szValue);
|
||||
GetPrivateProfileString("Plugins", "CDVD", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "CDVD", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->CDVD, szValue);
|
||||
GetPrivateProfileString("Plugins", "PAD1", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "PAD1", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->PAD1, szValue);
|
||||
GetPrivateProfileString("Plugins", "PAD2", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "PAD2", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->PAD2, szValue);
|
||||
GetPrivateProfileString("Plugins", "DEV9", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "DEV9", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->DEV9, szValue);
|
||||
GetPrivateProfileString("Plugins", "USB", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "USB", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->USB, szValue);
|
||||
GetPrivateProfileString("Plugins", "FW", NULL, szValue, 256, szIniFile);
|
||||
GetPrivateProfileString("Plugins", "FW", NULL, szValue, g_MaxPath, szIniFile);
|
||||
strcpy(Conf->FW, szValue);
|
||||
//cpu
|
||||
GetPrivateProfileString("Cpu Options", "Options", NULL, szValue, 20, szIniFile);
|
||||
|
@ -119,14 +152,13 @@ int LoadConfig() {
|
|||
GetPrivateProfileString("Misc", "GameFixes", NULL, szValue, 20, szIniFile);
|
||||
Conf->GameFixes = strtoul(szValue, NULL, 0);
|
||||
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
sprintf(text, "LANGUAGE=%s", Conf->Lang);
|
||||
#ifdef _WIN32
|
||||
gettext_putenv(text);
|
||||
#else
|
||||
putenv(text);
|
||||
#endif
|
||||
{
|
||||
char text[256];
|
||||
extern int _nl_msg_cat_cntr;
|
||||
sprintf_s(text, 256, "LANGUAGE=%s", Conf->Lang);
|
||||
gettext_putenv(text);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -134,17 +166,20 @@ int LoadConfig() {
|
|||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
void SaveConfig() {
|
||||
|
||||
PcsxConfig *Conf = &Config;
|
||||
char *szTemp;
|
||||
char szIniFile[256], szValue[256];
|
||||
void SaveConfig()
|
||||
{
|
||||
const PcsxConfig* Conf = &Config;
|
||||
char szIniFile[g_MaxPath], szValue[g_MaxPath];
|
||||
|
||||
GetModuleFileName(GetModuleHandle((LPCSTR)gApp.hInstance), szIniFile, 256);
|
||||
szTemp = strrchr(szIniFile, '\\');
|
||||
//GetModuleFileName(GetModuleHandle((LPCSTR)gApp.hInstance), szIniFile, 256);
|
||||
//szTemp = strrchr(szIniFile, '\\');
|
||||
|
||||
GetConfigFilename( szIniFile );
|
||||
|
||||
// This should never be true anyway since long pathnames would have in theory
|
||||
// been caught earlier by LoadConfig -- but no harm in being safe.
|
||||
if( g_Error_PathTooLong ) return;
|
||||
|
||||
if(!szTemp) return;
|
||||
strcpy(szTemp, "\\inis\\pcsx2.ini");
|
||||
//interface
|
||||
sprintf(szValue,"%s",Conf->Bios);
|
||||
WritePrivateProfileString("Interface","Bios",szValue,szIniFile);
|
||||
|
@ -170,23 +205,28 @@ void SaveConfig() {
|
|||
WritePrivateProfileString("Interface", "CustomConsecutiveFrames", szValue, szIniFile);
|
||||
sprintf(szValue,"%d",Conf->CustomConsecutiveSkip);
|
||||
WritePrivateProfileString("Interface", "CustomConsecutiveSkip", szValue, szIniFile);
|
||||
//plugins
|
||||
sprintf(szValue,"%s",Conf->GS);
|
||||
|
||||
// Plugins are saved from the winConfig struct.
|
||||
// It contains the user config settings and not the
|
||||
// runtime cmdline overrides.
|
||||
|
||||
sprintf(szValue,"%s",winConfig.GS);
|
||||
WritePrivateProfileString("Plugins","GS",szValue,szIniFile);
|
||||
sprintf(szValue,"%s",Conf->SPU2);
|
||||
sprintf(szValue,"%s",winConfig.SPU2);
|
||||
WritePrivateProfileString("Plugins","SPU2",szValue,szIniFile);
|
||||
sprintf(szValue,"%s",Conf->CDVD);
|
||||
sprintf(szValue,"%s",winConfig.CDVD);
|
||||
WritePrivateProfileString("Plugins","CDVD",szValue,szIniFile);
|
||||
sprintf(szValue,"%s",Conf->PAD1);
|
||||
sprintf(szValue,"%s",winConfig.PAD1);
|
||||
WritePrivateProfileString("Plugins","PAD1",szValue,szIniFile);
|
||||
sprintf(szValue,"%s",Conf->PAD2);
|
||||
sprintf(szValue,"%s",winConfig.PAD2);
|
||||
WritePrivateProfileString("Plugins","PAD2",szValue,szIniFile);
|
||||
sprintf(szValue,"%s",Conf->DEV9);
|
||||
sprintf(szValue,"%s",winConfig.DEV9);
|
||||
WritePrivateProfileString("Plugins","DEV9",szValue,szIniFile);
|
||||
sprintf(szValue,"%s",Conf->USB);
|
||||
sprintf(szValue,"%s",winConfig.USB);
|
||||
WritePrivateProfileString("Plugins","USB",szValue,szIniFile);
|
||||
sprintf(szValue,"%s",Conf->FW);
|
||||
sprintf(szValue,"%s",winConfig.FW);
|
||||
WritePrivateProfileString("Plugins","FW",szValue,szIniFile);
|
||||
|
||||
//cpu
|
||||
sprintf(szValue,"%u", Conf->Options);
|
||||
WritePrivateProfileString("Cpu Options","Options",szValue,szIniFile);
|
||||
|
@ -194,6 +234,7 @@ void SaveConfig() {
|
|||
WritePrivateProfileString("Cpu Options","sseMXCSR",szValue,szIniFile);
|
||||
sprintf(szValue,"%u",Conf->sseVUMXCSR);
|
||||
WritePrivateProfileString("Cpu Options","sseVUMXCSR",szValue,szIniFile);
|
||||
|
||||
//Misc
|
||||
sprintf(szValue,"%u",Conf->Patch);
|
||||
WritePrivateProfileString("Misc","Patch",szValue,szIniFile);
|
||||
|
|
|
@ -2692,7 +2692,6 @@ void recompileNextInstruction(int delayslot)
|
|||
extern tIPU_BP g_BP;
|
||||
|
||||
extern u32 psxdump;
|
||||
extern u32 psxNextCounter, psxNextsCounter;
|
||||
extern void iDumpPsxRegisters(u32 startpc, u32 temp);
|
||||
extern Counter counters[6];
|
||||
extern int rdram_devices; // put 8 for TOOL and 2 for PS2 and PSX
|
||||
|
|
Loading…
Reference in New Issue