]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/mainwin.cpp
Added 2nd controller to config dialog.
[virtualjaguar] / src / gui / mainwin.cpp
index 293b924a280a0249e057e5cf56b138f2957d1ce5..83d0a53855adcd33c3a1812f226be80d39e3c2e3 100644 (file)
@@ -79,7 +79,8 @@
 // use, we can drop it in anywhere and use it as-is.
 
 MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit(true),
-       cartridgeLoaded(false), CDActive(false)//, alpineLoadSuccessful(false)
+       cartridgeLoaded(false), CDActive(false),//, alpineLoadSuccessful(false),
+       pauseForFileSelector(false)
 {
        videoWidget = new GLWidget(this);
        setCentralWidget(videoWidget);
@@ -165,7 +166,7 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit
        filePickAct->setShortcut(QKeySequence(tr("Ctrl+i")));
        connect(filePickAct, SIGNAL(triggered()), this, SLOT(InsertCart()));
 
-       configAct = new QAction(QIcon(":/res/generic.png"), tr("&Configure"), this);
+       configAct = new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this);
        configAct->setStatusTip(tr("Configure options for Virtual Jaguar"));
        configAct->setShortcut(QKeySequence(tr("Ctrl+c")));
        connect(configAct, SIGNAL(triggered()), this, SLOT(Configure()));
@@ -178,14 +179,15 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit
 
        // Misc. connections...
        connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString)));
+       connect(filePickWin, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
 
        // Create menus & toolbars
 
-       fileMenu = menuBar()->addMenu(tr("&File"));
-       fileMenu->addAction(filePickAct);
-       fileMenu->addAction(useCDAct);
+       fileMenu = menuBar()->addMenu(tr("&Jaguar"));
        fileMenu->addAction(powerAct);
        fileMenu->addAction(pauseAct);
+       fileMenu->addAction(filePickAct);
+       fileMenu->addAction(useCDAct);
        fileMenu->addAction(configAct);
        fileMenu->addAction(quitAppAct);
 
@@ -358,7 +360,7 @@ void MainWin::Configure(void)
        // If the "Alpine" ROM is changed, then let's load it...
        if (alpineBefore != alpineAfter)
        {
-               if (!JaguarLoadFile(vjs.alpineROMPath) || !AlpineLoadFile(vjs.alpineROMPath))
+               if (!JaguarLoadFile(vjs.alpineROMPath) && !AlpineLoadFile(vjs.alpineROMPath))
                {
                        // Oh crap, we couldn't get the file! Alert the media!
                        QMessageBox msg;
@@ -534,14 +536,33 @@ void MainWin::ShowAboutWin(void)
 
 void MainWin::InsertCart(void)
 {
+       // If the emulator is running, we pause it here and unpause it later
+       // if we dismiss the file selector without choosing anything
+       if (running)
+       {
+               ToggleRunState();
+               pauseForFileSelector = true;
+       }
+
        filePickWin->show();
 }
 
+void MainWin::Unpause(void)
+{
+       // Here we unpause the emulator if it was paused when we went into the file selector
+       if (pauseForFileSelector)
+       {
+               pauseForFileSelector = false;
+               ToggleRunState();
+       }
+}
+
 void MainWin::LoadSoftware(QString file)
 {
-       running = false;                                                        //  Prevent bad things(TM) from happening...
+       running = false;                                                        // Prevent bad things(TM) from happening...
+       pauseForFileSelector = false;                           // Reset the file selector pause flag
        SET32(jaguarMainRAM, 0, 0x00200000);            // Set top of stack...
-       cartridgeLoaded = (JaguarLoadFile(file.toAscii().data()) ? true : false);
+       cartridgeLoaded = JaguarLoadFile(file.toAscii().data());
 
        char * biosPointer = jaguarBootROM;