]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/app.cpp
Miscellaneous fixes, plus extra whitespace munging for good effect.
[virtualjaguar] / src / gui / app.cpp
index c1093fff4e7e4f35aaf3dc0766d740744396573c..8cf3f1ea36159d02ac15ea9cf61dfd763b0249f5 100644 (file)
@@ -22,6 +22,7 @@
 #include "gamepad.h"
 #include "log.h"
 #include "mainwin.h"
+#include "profile.h"
 #include "settings.h"
 #include "version.h"
 
@@ -48,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);
 
@@ -59,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();
@@ -107,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();
 
@@ -120,7 +123,8 @@ int main(int argc, char * argv[])
        fclose(ctt);
 #endif
 #endif
-       LogDone();                                                                      // Close logfile
+       // Close logfile
+       LogDone();
        return retVal;
 }
 
@@ -133,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.toAscii().data());
+       }
+
        mainWindow->show();
 }
 
@@ -186,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;
                }
@@ -203,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))
@@ -332,3 +344,4 @@ void ParseOptions(int argc, char * argv[])
        char alpineROMPath[MAX_PATH];
        char absROMPath[MAX_PATH];
 #endif
+