diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-19 01:17:08 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-19 01:17:08 +0000 |
| commit | 48c4a699f1829b7d6d1a6b87fce7ec933f1680e0 (patch) | |
| tree | 6793341276a43b6eb0d4929602eaa0a7df9bd32a | |
| parent | 1d8d16782e43a7697e72f6d8c5b298ca5de06c8c (diff) | |
| download | pcsxr-48c4a699f1829b7d6d1a6b87fce7ec933f1680e0.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@56209 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | win32/gui/WndMain.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/win32/gui/WndMain.c b/win32/gui/WndMain.c index 00fd2409..a0bba1ab 100644 --- a/win32/gui/WndMain.c +++ b/win32/gui/WndMain.c @@ -132,7 +132,7 @@ void strcatz(char *dst, char *src) { int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
char *arg = NULL;
- char cdfile[MAXPATHLEN] = "";
+ char cdfile[MAXPATHLEN] = "", buf[4096];
int loadstatenum = -1;
strcpy(cfgfile, "Software\\Pcsx");
@@ -187,18 +187,23 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine #endif
// Parse command-line
- for (arg = strtok(lpCmdLine, " "); arg != NULL; arg = strtok(NULL, " ")) {
+ strncpy(buf, lpCmdLine, 4096);
+
+ for (arg = strtok(buf, " "); arg != NULL; arg = strtok(NULL, " ")) {
if (strcmp(arg, "-nogui") == 0) {
UseGui = FALSE;
} else if (strcmp(arg, "-runcd") == 0) {
cdfile[0] = '\0';
} else if (strcmp(arg, "-cdfile") == 0) {
- arg = strtok(NULL, "\"");
+ arg = strtok(NULL, " ");
if (arg != NULL) {
- strcpy(cdfile, arg);
- } else {
- arg = strtok(NULL, " ");
- if (arg != NULL) strcpy(cdfile, arg);
+ if (arg[0] == '"') {
+ strncpy(buf, lpCmdLine + (arg - buf), 4096);
+ arg = strtok(buf, "\"");
+ if (arg != NULL) strcpy(cdfile, arg);
+ } else {
+ strcpy(cdfile, arg);
+ }
}
} else if (strcmp(arg, "-psxout") == 0) {
Config.PsxOut = TRUE;
@@ -206,10 +211,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine MessageBox(gApp.hWnd, _(
"Usage: pcsx [options]\n"
"\toptions:\n"
- "\t-runcd\t\tRuns CD-ROM (requires -nogui)\n"
- "\t-cdfile FILE\tRuns a CD image file (requires -nogui)\n"
"\t-nogui\t\tDon't open the GUI\n"
"\t-psxout\t\tEnable PSX output\n"
+ "\t-runcd\t\tRuns CD-ROM (requires -nogui)\n"
+ "\t-cdfile FILE\tRuns a CD image file (requires -nogui)\n"
"\t-help\t\tDisplay this message"),
"PCSX", 0);
|
