2 // app.cpp - Qt-based GUI for Virtual Jaguar
5 // (C) 2010 Underground Software
7 // JLH = James L. Hammons <jlhamm@acm.org>
10 // --- ---------- -------------------------------------------------------------
11 // JLH 12/23/2009 Created this file
12 // JLH 01/21/2011 Added SDL initialization
13 // JLH 06/26/2011 Added fix to keep SDL from hijacking main() on win32
19 #include <QApplication>
26 // Apparently on win32, SDL is hijacking main from Qt. So let's do this:
30 // Here's the main application loop--short and simple...
31 int main(int argc, char * argv[])
33 // Normally, this would be read in from the settings module... :-P
34 vjs.hardwareTypeAlpine = false;
38 if ((strcmp(argv[1], "--help") == 0) || (strcmp(argv[1], "-h") == 0)
39 || (strcmp(argv[1], "-?") == 0))
41 printf("Virtual Jaguar 2.0.0 help\n");
43 printf("Command line interface is mostly non-functional ATM, but may return if\n"
44 "there is enough demand for it. :-)\n");
47 if (strcmp(argv[1], "--yarrr") == 0)
50 printf("Shiver me timbers!\n");
54 if ((strcmp(argv[1], "--alpine") == 0) || (strcmp(argv[1], "-a") == 0))
56 printf("Alpine Mode enabled.\n");
57 vjs.hardwareTypeAlpine = true;
61 Q_INIT_RESOURCE(virtualjaguar); // This must the same name as the exe filename
62 //or is it the .qrc filename???
63 // This is so we can pass this stuff using signal/slot mechanism...
64 //ick int id = qRegisterMetaType<uint32>();
66 bool success = (bool)LogInit("virtualjaguar.log"); // Init logfile
67 int retVal = -1; // Default is failure
70 printf("Failed to open virtualjaguar.log for writing!\n");
73 if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0)
75 WriteLog("VJ: Could not initialize the SDL library: %s\n", SDL_GetError());
79 WriteLog("VJ: SDL (joystick, audio) successfully initialized.\n");
80 App app(argc, argv); // Declare an instance of the application
81 retVal = app.exec(); // And run it!
83 // Free SDL components last...!
84 SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO);
88 LogDone(); // Close logfile
92 // Main app constructor--we stick globally accessible stuff here...
94 App::App(int argc, char * argv[]): QApplication(argc, argv)
96 mainWindow = new MainWin();