diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-14 02:14:09 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-14 02:14:09 +0000 |
| commit | c4a77870fcb7793bd5a7611b9994a5b15a335a3c (patch) | |
| tree | d76aa96f73aa3688ec03bf0ae0b9f643f5c82d21 /win32 | |
| parent | beafede6f7fa361e990ab06fe48a91680dd4c76d (diff) | |
| download | pcsxr-c4a77870fcb7793bd5a7611b9994a5b15a335a3c.tar.gz | |
win32: added commandline support.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@56094 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/gui/Win32.h | 1 | ||||
| -rw-r--r-- | win32/gui/WndMain.c | 68 | ||||
| -rw-r--r-- | win32/resource.h | 1 |
3 files changed, 69 insertions, 1 deletions
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
|
