+ 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();
+
+ // Free SDL components last...!
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO);
+ SDL_Quit();
+ }
+
+#ifdef __GCCWIN32__
+#if 0
+ fclose(ctt);
+#endif
+#endif
+ // Close logfile
+ LogDone();
+ return retVal;
+}
+
+//
+// Main app constructor--we stick globally accessible stuff here... (?)
+//
+App::App(int & argc, char * argv[]): QApplication(argc, argv)
+{
+ bool loadAndGo = !filename.isEmpty();
+
+ mainWindow = new MainWin(loadAndGo);
+ mainWindow->plzDontKillMyComputer = noUntunedTankPlease;
+ // 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();
+}
+
+
+//
+// Here we parse out stuff that needs to be looked at *before* we construct the
+// App object.
+//
+bool ParseCommandLine(int argc, char * argv[])
+{
+ for(int i=1; i<argc; i++)
+ {
+ if ((strcmp(argv[i], "--help") == 0) || (strcmp(argv[i], "-h") == 0)
+ || (strcmp(argv[i], "-?") == 0))
+ {
+ printf(
+ "Virtual Jaguar " VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ")\n"
+ "Based upon Virtual Jaguar core v1.0.0 by David Raingeard.\n"
+ "Written by James Hammons (Linux/WIN32), Niels Wagenaar (Linux/WIN32),\n"
+ "Carwin Jones (BeOS), and Adam Green (MacOS)\n"
+ "Contact: http://sdlemu.ngemu.com/ | sdlemu@ngemu.com\n"
+ "\n"
+ "Usage:\n"
+ " virtualjaguar [<filename>] [switches]\n"
+ "\n"
+ " Option Description\n"
+ " ---------------- -----------------------------------\n"
+ " <filename> Name of file to autoload\n"
+ " --alpine -a Put Virtual Jaguar into Alpine mode\n"
+ " --pal -p PAL mode\n"
+ " --ntsc -n NTSC mode\n"
+ " --bios -b Boot using Jagaur BIOS\n"
+ " --no-bios Do not use Jaguar BIOS\n"
+ " --gpu -g Enable GPU\n"
+ " --no-gpu Disable GPU\n"
+ " --dsp -d Enable DSP\n"
+ " --no-dsp Disable DSP\n"
+ " --fullscreen -f Start in full screen mode\n"
+ " --blur -B Enable GL bilinear filter\n"
+ " --no-blur Disable GL bilinear filtering\n"
+ " --log -l Create and use log file\n"
+ " --no-log Do not use log file\n"
+ " --help -h Show this message\n"
+ " --please-dont-kill-my-computer\n"
+ " -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. Using Alpine mode will enable log file.\n"
+ "\n");
+ return false;
+ }
+
+ if (strcmp(argv[i], "--yarrr") == 0)