diff options
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | win32/gui/Win32.h | 1 | ||||
| -rw-r--r-- | win32/gui/WndMain.c | 68 | ||||
| -rw-r--r-- | win32/resource.h | 1 |
4 files changed, 72 insertions, 1 deletions
@@ -4,6 +4,9 @@ August 14, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> * plugins/dfxvideo/hq2x.h: Likewise.
* plugins/dfxvideo/hq3x.h: Likewise.
* win32/plugins/dfxvideo/draw.c: Likewise.
+ * win32/gui/WndMain.c: Added support for command line.
+ * win32/gui/Win32.h: Likewise.
+ * win32/gui/resource.h: Likewise.
August 13, 2010 Wei Mingzhi <whistler_wmz@users.sf.net>
diff --git a/win32/gui/Win32.h b/win32/gui/Win32.h index bfe51543..01a95d39 100644 --- a/win32/gui/Win32.h +++ b/win32/gui/Win32.h @@ -34,6 +34,7 @@ extern int ConfPlug; extern int CancelQuit;
extern char cfgfile[256];
extern int Running;
+extern boolean UseGui;
extern char PcsxDir[256];
void strcatz(char *dst, char *src);
diff --git a/win32/gui/WndMain.c b/win32/gui/WndMain.c index cee6a11f..9a3a1896 100644 --- a/win32/gui/WndMain.c +++ b/win32/gui/WndMain.c @@ -50,6 +50,7 @@ int StatesC = 0; int CancelQuit = 0;
char cfgfile[256];
int Running = 0;
+boolean UseGui = TRUE;
char PcsxDir[256];
static HDC hDC;
@@ -130,6 +131,10 @@ void strcatz(char *dst, char *src) { }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
+ char *arg = NULL;
+ char cdfile[MAXPATHLEN] = "";
+ int loadstatenum = -1;
+
strcpy(cfgfile, "Software\\Pcsx");
gApp.hInstance = hInstance;
@@ -181,10 +186,43 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine }
#endif
+ // Parse command-line
+ for (arg = strtok(lpCmdLine, " "); 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, " ");
+ if (arg != NULL) {
+ strcpy(cdfile, arg);
+ }
+ } else if (strcmp(arg, "-psxout") == 0) {
+ Config.PsxOut = TRUE;
+ } else if (strcmp(arg, "-help") == 0) {
+ MessageBox(gApp.hWnd, _(
+ "Usage: pcsx [options]\n"
+ "\toptions:\n"
+ "\t-runcd\t\tRuns CD-ROM\n"
+ "\t-cdfile FILE\tRuns a CD image file\n"
+ "\t-nogui\t\tDon't open the GUI\n"
+ "\t-psxout\t\tEnable PSX output\n"
+ "\t-help\tDisplay this message"),
+ "PCSX", 0);
+
+ return 0;
+ }
+ }
+
if (SysInit() == -1) return 1;
CreateMainWindow(nCmdShow);
+ if (!UseGui) {
+ SetIsoFile(cdfile);
+ PostMessage(gApp.hWnd, WM_COMMAND, ID_FILE_RUN_NOGUI, 0);
+ }
+
RunGui();
return 0;
@@ -194,7 +232,7 @@ void RunGui() { MSG msg;
for (;;) {
- if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
+ if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -208,6 +246,8 @@ void RestoreWindow() { ShowCursor(TRUE);
SetCursor(LoadCursor(gApp.hInstance, IDC_ARROW));
ShowCursor(TRUE);
+
+ if (!UseGui) PostMessage(gApp.hWnd, WM_COMMAND, ID_FILE_EXIT, 0);
}
void ResetMenuSlots() { @@ -512,6 +552,32 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { case ID_FILE_STATES_SAVE_SLOT9: States_Save(8); return TRUE;
case ID_FILE_STATES_SAVE_OTHER: OnStates_SaveOther(); return TRUE;
+ case ID_FILE_RUN_NOGUI:
+ SetMenu(hWnd, NULL);
+ LoadPlugins();
+ if (OpenPlugins(hWnd) == -1) {
+ ClosePlugins();
+ RestoreWindow();
+ return TRUE;
+ }
+ SysReset();
+ if (CheckCdrom() == -1) {
+ fprintf(stderr, _("The CD does not appear to be a valid Playstation CD"));
+ ClosePlugins();
+ RestoreWindow();
+ return TRUE;
+ }
+ if (LoadCdrom() == -1) {
+ fprintf(stderr, _("Could not load CD-ROM!"));
+ ClosePlugins();
+ RestoreWindow();
+ return TRUE;
+ }
+ ShowCursor(FALSE);
+ Running = 1;
+ psxCpu->Execute();
+ return TRUE;
+
case ID_EMULATOR_RUN:
SetMenu(hWnd, NULL);
OpenPlugins(hWnd);
diff --git a/win32/resource.h b/win32/resource.h index 263e598c..98bc1fcb 100644 --- a/win32/resource.h +++ b/win32/resource.h @@ -299,6 +299,7 @@ #define ID_HELP_ABOUT 40002
#define ID_FILE_RUN_CD 40003
#define ID_FILE_RUN_EXE 40004
+#define ID_FILE_RUN_NOGUI 40016
#define ID_EMULATOR_PAUSE 40005
#define ID_EMULATOR_RESET 40006
#define ID_FILE_RUN_ISO 40007
|
