//
// mainwin.cpp - Qt-based GUI for Virtual Jaguar: Main Application Window
-// by James L. Hammons
+// by James Hammons
// (C) 2009 Underground Software
//
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
//
// Who When What
// --- ---------- -------------------------------------------------------------
#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)
+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);
useCDAct->setCheckable(true);
connect(useCDAct, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
+ frameAdvanceAct = new QAction(QIcon(":/res/generic.png"), tr("&Frame Advance"), this);
+ frameAdvanceAct->setShortcut(QKeySequence(tr("F7")));
+ connect(frameAdvanceAct, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
+
// Misc. connections...
connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString)));
connect(filePickWin, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
fileMenu = menuBar()->addMenu(tr("&Jaguar"));
fileMenu->addAction(powerAct);
fileMenu->addAction(pauseAct);
+ fileMenu->addAction(frameAdvanceAct);
fileMenu->addAction(filePickAct);
fileMenu->addAction(useCDAct);
fileMenu->addAction(configAct);
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)
// 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)
if (showUntunedTankCircuit)
{
+ // Some machines can't handle this, so we give them the option to disable it. :-)
+ if (!plzDontKillMyComputer)
+ {
// Random hash & trash
// We try to simulate an untuned tank circuit here... :-)
for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
= (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
}
}
+ }
}
else
{
if (pauseForFileSelector)
{
pauseForFileSelector = false;
- ToggleRunState();
+
+ // Some nutter might have unpaused while in the file selector, so check for that
+ if (!running)
+ ToggleRunState();
}
}
powerButtonOn = false;
TogglePowerState();
- if (!vjs.hardwareTypeAlpine)
+ if (!vjs.hardwareTypeAlpine && !loadAndGo)
{
QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION " - Now playing: %1")
.arg(filePickWin->GetSelectedPrettyName());
#endif
}
+void MainWin::FrameAdvance(void)
+{
+//printf("Frame Advance...\n");
+ // Execute 1 frame, then exit (only useful in Pause mode)
+ JaguarExecuteNew();
+ videoWidget->updateGL();
+}
+
void MainWin::ResizeMainWindow(void)
{
videoWidget->setFixedSize(zoomLevel * 320, zoomLevel * (vjs.hardwareTypeNTSC ? 240 : 256));