X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fapp.cpp;h=9414dd4c6674ded2126adbacff1df1ef948e966c;hb=32f569e1bd09f5d7f07005d119f6408805106381;hp=10bc5af8a5ee224056809e82adc3ced67372b56b;hpb=29525b808574d009a74c9af2a84fa32649bbd4d6;p=virtualjaguar diff --git a/src/gui/app.cpp b/src/gui/app.cpp index 10bc5af..9414dd4 100644 --- a/src/gui/app.cpp +++ b/src/gui/app.cpp @@ -7,7 +7,7 @@ // JLH = James Hammons // // Who When What -// --- ---------- ------------------------------------------------------------- +// --- ---------- ----------------------------------------------------------- // JLH 12/23/2009 Created this file // JLH 01/21/2011 Added SDL initialization // JLH 06/26/2011 Added fix to keep SDL from hijacking main() on win32 @@ -22,8 +22,8 @@ #include "gamepad.h" #include "log.h" #include "mainwin.h" +#include "profile.h" #include "settings.h" -#include "types.h" #include "version.h" @@ -49,8 +49,9 @@ QString filename; // Here's the main application loop--short and simple... int main(int argc, char * argv[]) { - // Win32 console redirection, because MS and their band of super geniuses decided - // that nobody would ever launch an app from the command line. :-P + // Win32 console redirection, because MS and their band of super geniuses + // decided that nobody would ever launch an app from the command line. :-P + // [Unfortunately, this doesn't seem to work on Vista/7. :-(] #ifdef __GCCWIN32__ BOOL (WINAPI * AttachConsole)(DWORD dwProcessId); @@ -60,11 +61,11 @@ int main(int argc, char * argv[]) if (AttachConsole != NULL && AttachConsole(((DWORD)-1))) { if (_fileno(stdout) == -1) - freopen("CONOUT$","wb",stdout); + freopen("CONOUT$", "wb", stdout); if (_fileno(stderr) == -1) - freopen("CONOUT$","wb",stderr); + freopen("CONOUT$", "wb", stderr); if (_fileno(stdin) == -1) - freopen("CONIN$","rb",stdin); + freopen("CONIN$", "rb", stdin); // Fix C++ std::ios::sync_with_stdio(); @@ -108,6 +109,7 @@ int main(int argc, char * argv[]) WriteLog("VJ: SDL (joystick, audio) successfully initialized.\n"); App app(argc, argv); // Declare an instance of the application Gamepad::AllocateJoysticks(); + AutoConnectProfiles(); retVal = app.exec(); // And run it! Gamepad::DeallocateJoysticks(); @@ -121,7 +123,8 @@ int main(int argc, char * argv[]) fclose(ctt); #endif #endif - LogDone(); // Close logfile + // Close logfile + LogDone(); return retVal; } @@ -134,12 +137,18 @@ App::App(int & argc, char * argv[]): QApplication(argc, argv) mainWindow = new MainWin(loadAndGo); mainWindow->plzDontKillMyComputer = noUntunedTankPlease; - ParseOptions(argc, argv); // Override defaults with command line (if any) + // Override defaults with command line (if any) + ParseOptions(argc, argv); mainWindow->SyncUI(); if (loadAndGo) + { mainWindow->LoadFile(filename); + if (!mainWindow->cartridgeLoaded) + printf("Could not load file \"%s\"!\n", filename.toUtf8().data()); + } + mainWindow->show(); } @@ -187,7 +196,7 @@ bool ParseCommandLine(int argc, char * argv[]) " -z Run Virtual Jaguar without \"snow\"\n" "\n" "Invoking Virtual Jagaur with no filename will cause it to boot up\n" - "with the VJ GUI.\n" + "with the VJ GUI. Using Alpine mode will enable log file.\n" "\n"); return false; } @@ -204,6 +213,8 @@ bool ParseCommandLine(int argc, char * argv[]) { printf("Alpine Mode enabled.\n"); vjs.hardwareTypeAlpine = true; + // We also enable logging as well :-) + useLogfile = true; } if ((strcmp(argv[i], "--please-dont-kill-my-computer") == 0) || (strcmp(argv[i], "-z") == 0)) @@ -333,3 +344,4 @@ void ParseOptions(int argc, char * argv[]) char alpineROMPath[MAX_PATH]; char absROMPath[MAX_PATH]; #endif +