]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/app.cpp
Added appropriate audio thread pausing to the GUI layer.
[virtualjaguar] / src / gui / app.cpp
index 10df86c646bd811afacaad00532b4afcac63c7d5..3961d31aaef3c92b7aba18b2790623fa79e7c11f 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <SDL.h>
 #include <QApplication>
+#include "gamepad.h"
 #include "log.h"
 #include "mainwin.h"
 #include "settings.h"
@@ -45,6 +46,17 @@ 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
+       // And, of course, this doesn't work, but causes weird problems. Yay Microsoft. :-/
+#ifdef __GCCWIN32__
+#if 0
+       FILE * ctt = fopen("CON", "w");
+       freopen("CON", "w", stdout);
+       freopen("CON", "w", stderr);
+#endif
+#endif
+
        // Normally, this would be read in from the settings module... :-P
        vjs.hardwareTypeAlpine = false;
        // This is stuff we pass into the mainWindow...
@@ -52,7 +64,14 @@ int main(int argc, char * argv[])
 
        // Check for options that must be in place be constructing the App object
        if (!ParseCommandLine(argc, argv))
+       {
+#ifdef __GCCWIN32__
+#if 0
+               fclose(ctt);
+#endif
+#endif
                return 0;
+       }
 
        Q_INIT_RESOURCE(virtualjaguar); // This must the same name as the exe filename
 //or is it the .qrc filename???
@@ -79,13 +98,20 @@ 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();
                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
        LogDone();                                                                      // Close logfile
        return retVal;
 }
@@ -93,7 +119,7 @@ int main(int argc, char * argv[])
 //
 // Main app constructor--we stick globally accessible stuff here... (?)
 //
-App::App(int argc, char * argv[]): QApplication(argc, argv)
+App::App(int argc, char * argv[]): QApplication(argc, argv)
 {
        bool loadAndGo = !filename.isEmpty();
 
@@ -123,8 +149,8 @@ bool ParseCommandLine(int argc, char * argv[])
                        printf(
                                "Virtual Jaguar " VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ")\n"
                                "Based upon Virtual Jaguar core v1.0.0 by David Raingeard.\n"
-                               "Written by Niels Wagenaar (Linux/WIN32), Carwin Jones (BeOS),\n"
-                               "James Hammons (Linux/WIN32) and Adam Green (MacOS)\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"
@@ -169,7 +195,7 @@ bool ParseCommandLine(int argc, char * argv[])
                        vjs.hardwareTypeAlpine = true;
                }
 
-               if (strcmp(argv[i], "--please-dont-kill-my-computer") == 0)
+               if ((strcmp(argv[i], "--please-dont-kill-my-computer") == 0) || (strcmp(argv[i], "-z") == 0))
                {
                        noUntunedTankPlease = true;
                }
@@ -199,6 +225,8 @@ bool ParseCommandLine(int argc, char * argv[])
 //
 // This is to override settings loaded from the config file.
 // Note that settings set here will become the new defaults!
+// (Not any more: Settings are only saved if the config dialog was OKed, or
+// the toolbar buttons were pressed.)
 //
 void ParseOptions(int argc, char * argv[])
 {