X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fapp.cpp;h=d6875160132d9b9219fff8201f5550e15a2b0010;hb=refs%2Ftags%2F2.0.2;hp=bb0f9243bf7e7f5471d2d446e26d4a69cf4913a4;hpb=4c951d1b043c8ee14603ffdc6704962280df40d6;p=virtualjaguar diff --git a/src/gui/app.cpp b/src/gui/app.cpp index bb0f924..d687516 100644 --- a/src/gui/app.cpp +++ b/src/gui/app.cpp @@ -10,6 +10,7 @@ // --- ---------- ------------------------------------------------------------- // 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 // #include "app.h" @@ -18,23 +19,43 @@ #include #include "log.h" #include "mainwin.h" +#include "settings.h" #include "types.h" -// Apparently on other archs, SDL is hijacking main, so let's do this: +#ifdef __GCCWIN32__ +// Apparently on win32, SDL is hijacking main from Qt. So let's do this: #undef main +#endif // Here's the main application loop--short and simple... int main(int argc, char * argv[]) { + // Normally, this would be read in from the settings module... :-P + vjs.hardwareTypeAlpine = false; + if (argc > 1) { - if (strcmp(argv[1], "--help") == 0) + if ((strcmp(argv[1], "--help") == 0) || (strcmp(argv[1], "-h") == 0) + || (strcmp(argv[1], "-?") == 0)) { printf("Virtual Jaguar 2.0.0 help\n"); printf("\n"); - printf("This is an experimental branch of Virtual Jaguar, how did you get it?\n"); + printf("Command line interface is mostly non-functional ATM, but may return if\n" + "there is enough demand for it. :-)\n"); + return 0; + } + if (strcmp(argv[1], "--yarrr") == 0) + { + printf("\n"); + printf("Shiver me timbers!\n"); + printf("\n"); return 0; } + if ((strcmp(argv[1], "--alpine") == 0) || (strcmp(argv[1], "-a") == 0)) + { + printf("Alpine Mode enabled.\n"); + vjs.hardwareTypeAlpine = true; + } } Q_INIT_RESOURCE(virtualjaguar); // This must the same name as the exe filename @@ -42,9 +63,12 @@ int main(int argc, char * argv[]) // This is so we can pass this stuff using signal/slot mechanism... //ick int id = qRegisterMetaType(); - LogInit("virtualjaguar.log"); // Init logfile + bool success = (bool)LogInit("virtualjaguar.log"); // Init logfile int retVal = -1; // Default is failure + if (!success) + printf("Failed to open virtualjaguar.log for writing!\n"); + // Set up SDL library if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0) { @@ -55,6 +79,10 @@ int main(int argc, char * argv[]) WriteLog("VJ: SDL (joystick, audio) successfully initialized.\n"); App app(argc, argv); // Declare an instance of the application retVal = app.exec(); // And run it! + + // Free SDL components last...! + SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO); + SDL_Quit(); } LogDone(); // Close logfile