]> Shamusworld >> Repos - virtualjaguar/commitdiff
Preliminary support for passing in filenames from the command line.
authorShamus Hammons <jlhamm@acm.org>
Sun, 8 Apr 2012 17:38:38 +0000 (17:38 +0000)
committerShamus Hammons <jlhamm@acm.org>
Sun, 8 Apr 2012 17:38:38 +0000 (17:38 +0000)
src/gui/about.h
src/gui/app.cpp
src/gui/app.h
src/gui/configdialog.h
src/gui/filelistmodel.h
src/gui/glwidget.h
src/gui/help.h
src/gui/keygrabber.h
src/gui/mainwin.cpp
src/gui/mainwin.h

index e8e5771ad674e8d8513021dd66676eaa13796f71..9c5f086bdace2a2b7fd37fc6cd1e4d321ba4f0e3 100644 (file)
@@ -1,7 +1,7 @@
 //
 // about.h: Credits where credits are due ;-)
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
 
index 6abfe15cddce199d28d6f4f2ec2ce1000c6e849b..7a905a9c76c9940870b0658328eb5126291c089e 100644 (file)
@@ -30,6 +30,8 @@
 //hm. :-/
 // This is stuff we pass into the mainWindow...
 bool noUntunedTankPlease = false;
+bool loadAndGo = false;
+QString filename;
 
 // Here's the main application loop--short and simple...
 int main(int argc, char * argv[])
@@ -69,6 +71,13 @@ int main(int argc, char * argv[])
                {
                        noUntunedTankPlease = true;
                }
+
+               // Check for filename
+               if (argv[1][0] != '-')
+               {
+                       loadAndGo = true;
+                       filename = argv[1];
+               }
        }
 
        Q_INIT_RESOURCE(virtualjaguar); // This must the same name as the exe filename
@@ -106,7 +115,7 @@ int main(int argc, char * argv[])
 
 App::App(int argc, char * argv[]): QApplication(argc, argv)
 {
-       mainWindow = new MainWin();
+       mainWindow = new MainWin(filename);
        mainWindow->plzDontKillMyComputer = noUntunedTankPlease;
        mainWindow->show();
 }
index 9de170a7736900a177fea4351729369f3a6361cc..85462ff40d9d3c76ed406be64501078050b85d24 100644 (file)
@@ -1,7 +1,7 @@
 //
 // app.h: Header file
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2009 Underground Software
 //
 
@@ -25,7 +25,11 @@ class App: public QApplication
 
        // Globally accessible stuff goes here...
        // Although... Globally accessible stuff should go into settings.cpp...
+       // Unless it's stuff related to the GUI, then it should go here. :-P
+       // And we make these class variables so we don't have to muck around with
+       // chasing down instances of the object...
 //     public:
+//             static QString filenameToRun;
 };
 
 #endif // __APP_H__
index ee121c266c0dbbfec4796342fddda339ea84b270..532c47ffafb968fea7a57a5f898becfc71b2fdd2 100644 (file)
@@ -1,7 +1,7 @@
 //
 // configdialog.h - Configuration dialog
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
 
index a3ab66077b710fb66f72b4ca65f9d83198566bd3..10f2e2a72a25489c0919a2c67fb592e0229579ec 100644 (file)
@@ -1,7 +1,7 @@
 //
 // filelistmodel.h: Class definition
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
 
index 7c8f9955e4f55e487eb811c34be52762b0830972..39ed1815438b39755c045ea33c3e50a2fde9f283 100644 (file)
@@ -1,6 +1,6 @@
 // Implementation of OpenGL widget using Qt
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 
 #ifndef __GLWIDGET_H__
index 23aa947168383c860dfffc8b4a4bdf1114eb0aad..59690838275ea8a368fd713a76bda443e41cbf4c 100644 (file)
@@ -1,7 +1,7 @@
 //
 // help.h: Built-in help system
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2011 Underground Software
 //
 
index 6ea19d2e76b516f2052212b39c11fd71f0c6d019..aae59616fe1401441939e0c0f98a1a01b6fea216 100644 (file)
@@ -1,7 +1,7 @@
 //
 // keygrabber.h - Widget to grab a key and dismiss itself
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2011 Underground Software
 //
 
index ba0b21ebe09bc94f7e5db84ba6cc2a1ebe760a3b..ea4f8d46156b273f93cc936f04562bcfa36ffdb8 100644 (file)
@@ -34,6 +34,7 @@
 #include "mainwin.h"
 
 #include "SDL.h"
+#include "app.h"
 #include "glwidget.h"
 #include "about.h"
 #include "help.h"
 // We'll make the VJ core modular so that it doesn't matter what GUI is in
 // use, we can drop it in anywhere and use it as-is.
 
-MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(true),
-       cartridgeLoaded(false), CDActive(false),//, alpineLoadSuccessful(false),
-       pauseForFileSelector(false), plzDontKillMyComputer(false)
+MainWin::MainWin(QString filenameToRun): running(true), powerButtonOn(false),
+       showUntunedTankCircuit(true), cartridgeLoaded(false), CDActive(false),
+       //, alpineLoadSuccessful(false),
+       pauseForFileSelector(false), loadAndGo(false), plzDontKillMyComputer(false)
 {
        videoWidget = new GLWidget(this);
        setCentralWidget(videoWidget);
@@ -259,7 +261,15 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
        WriteLog("VJ: Initializing jaguar subsystem...\n");
        JaguarInit();
 
-       filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
+       if (!filenameToRun.isEmpty())
+       {
+               loadAndGo = true;
+               // Attempt to load/run the file the user passed in...
+               LoadSoftware(filenameToRun);
+               memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Use the stock BIOS
+               // Prevent the scanner from running...
+               return;
+       }
 
        // Load up the default ROM if in Alpine mode:
        if (vjs.hardwareTypeAlpine)
@@ -279,9 +289,13 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
                // Attempt to load/run the ABS file...
                LoadSoftware(vjs.absROMPath);
                memcpy(jagMemSpace + 0xE00000, jaguarDevBootROM2, 0x20000);     // Use the stub BIOS
+               // Prevent the scanner from running...
+               return;
        }
        else
                memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Otherwise, use the stock BIOS
+
+       filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
 }
 
 void MainWin::closeEvent(QCloseEvent * event)
@@ -622,7 +636,7 @@ void MainWin::LoadSoftware(QString file)
        powerButtonOn = false;
        TogglePowerState();
 
-       if (!vjs.hardwareTypeAlpine)
+       if (!vjs.hardwareTypeAlpine && !loadAndGo)
        {
                QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION " - Now playing: %1")
                        .arg(filePickWin->GetSelectedPrettyName());
index 37902b2f8929e4b173df5cac086f3bb30b7394cb..d9d0447bad4dcc0d35d4770e195cb4c7e625712f 100644 (file)
@@ -1,7 +1,7 @@
 //
 // mainwin.h: Header file
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
 
@@ -23,7 +23,7 @@ class MainWin: public QMainWindow
        Q_OBJECT
 
        public:
-               MainWin();
+               MainWin(QString);
 
        protected:
                void closeEvent(QCloseEvent *);
@@ -71,6 +71,7 @@ class MainWin: public QMainWindow
                bool CDActive;
 //             bool alpineLoadSuccessful;
                bool pauseForFileSelector;
+               bool loadAndGo;
        public:
                bool plzDontKillMyComputer;
        private: