From 6bbf8a69b977644a55a4abdea71dfa9e3bb6c087 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Tue, 5 Jul 2011 05:16:55 +0000 Subject: [PATCH] Hooked up CD BIOS loading/running. --- src/gui/filelistmodel.cpp | 3 +++ src/gui/mainwin.cpp | 52 ++++++++++++++++++++++++++++++++++++--- src/gui/mainwin.h | 3 +++ src/memory.cpp | 5 +++- src/memory.h | 3 +++ 5 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/gui/filelistmodel.cpp b/src/gui/filelistmodel.cpp index 8308c5c..626b296 100644 --- a/src/gui/filelistmodel.cpp +++ b/src/gui/filelistmodel.cpp @@ -131,6 +131,9 @@ void FileListModel::AddData(unsigned long index, QString str, QImage img, unsign data.crc = fileCrc; list.push_back(data); +//This is probably not the best way to do this, it prevents the user from using the +//list while it populates. +#warning "!!! AddData calls reset() for every addition, this is bad !!!" reset(); } diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index c700976..88e55f8 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -16,8 +16,19 @@ // // STILL TO BE DONE: // +// - Autoscan/autoload all available BIOS from 'software' folder +// - Controller configuration +// - Remove SDL dependencies (sound, mainly) from Jaguar core lib +// - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting with 'R', etc) +// - Add dbl click/enter to select in cart list, ESC to dimiss // +/* +For BIOS autoscan, infrastructure is already there in filethread.cpp; just need to figure out +if we want to scan every time, or stuff filenames found into the config file, or what. +Should filethread emit signal that's intercepted here? Maybe... +*/ + // Uncomment this for debugging... //#define DEBUG //#define DEBUGFOO // Various tool debugging... @@ -47,6 +58,7 @@ // Uncomment this to use built-in BIOS/CD-ROM BIOS // You'll need a copy of jagboot.h & jagcd.h for this to work...! +// Creating those is left as an exercise for the reader. ;-) //#define USE_BUILT_IN_BIOS #ifdef USE_BUILT_IN_BIOS @@ -67,7 +79,7 @@ // use, we can drop it in anywhere and use it as-is. MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit(true), - cartridgeLoaded(false) + cartridgeLoaded(false), CDActive(false) { videoWidget = new GLWidget(this); setCentralWidget(videoWidget); @@ -152,6 +164,12 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit configAct->setShortcut(QKeySequence(tr("Ctrl+c"))); connect(configAct, SIGNAL(triggered()), this, SLOT(Configure())); + useCDAct = new QAction(QIcon(":/res/generic.png"), tr("&Use CD Unit"), this); + useCDAct->setStatusTip(tr("Use Jaguar Virtual CD unit")); +// useCDAct->setShortcut(QKeySequence(tr("Ctrl+c"))); + useCDAct->setCheckable(true); + connect(useCDAct, SIGNAL(triggered()), this, SLOT(ToggleCDUsage())); + // Misc. connections... connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString))); @@ -159,6 +177,7 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(filePickAct); + fileMenu->addAction(useCDAct); fileMenu->addAction(powerAct); fileMenu->addAction(pauseAct); fileMenu->addAction(configAct); @@ -171,6 +190,7 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit toolbar->addAction(powerAct); toolbar->addAction(pauseAct); toolbar->addAction(filePickAct); + toolbar->addAction(useCDAct); toolbar->addSeparator(); toolbar->addAction(x1Act); toolbar->addAction(x2Act); @@ -461,9 +481,19 @@ void MainWin::TogglePowerState(void) } else { - showUntunedTankCircuit = (cartridgeLoaded ? false : true); - pauseAct->setChecked(false); - pauseAct->setDisabled(!cartridgeLoaded); + if (!CDActive) + { + showUntunedTankCircuit = (cartridgeLoaded ? false : true); + pauseAct->setChecked(false); + pauseAct->setDisabled(!cartridgeLoaded); + } + else + { + showUntunedTankCircuit = false; + pauseAct->setChecked(false); + pauseAct->setDisabled(false); + memcpy(jagMemSpace + 0x800000, jaguarCDBootROM, 0x40000); + } //(Err, what's so crappy about this? It seems to do what it's supposed to...) //This is crappy!!! !!! FIX !!! @@ -568,6 +598,20 @@ void MainWin::LoadSoftware(QString file) setWindowTitle(newTitle); } +void MainWin::ToggleCDUsage(void) +{ + CDActive = !CDActive; + + if (CDActive) + { + powerAct->setDisabled(false); + } + else + { + powerAct->setDisabled(true); + } +} + void MainWin::ResizeMainWindow(void) { videoWidget->setFixedSize(zoomLevel * 320, zoomLevel * (vjs.hardwareTypeNTSC ? 240 : 256)); diff --git a/src/gui/mainwin.h b/src/gui/mainwin.h index 9149c55..5576668 100644 --- a/src/gui/mainwin.h +++ b/src/gui/mainwin.h @@ -44,6 +44,7 @@ class MainWin: public QMainWindow void ShowAboutWin(void); void InsertCart(void); void LoadSoftware(QString); + void ToggleCDUsage(void); private: void HandleKeys(QKeyEvent *, bool); @@ -62,6 +63,7 @@ class MainWin: public QMainWindow bool showUntunedTankCircuit; bool cartridgeLoaded; bool allowUnknownSoftware; + bool CDActive; QMenu * fileMenu; QMenu * helpMenu; @@ -82,6 +84,7 @@ class MainWin: public QMainWindow QAction * aboutAct; QAction * filePickAct; QAction * configAct; + QAction * useCDAct; }; #endif // __MAINWIN_H__ diff --git a/src/memory.cpp b/src/memory.cpp index 0343f61..f37168b 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -37,6 +37,9 @@ uint8 * dspRAM = &jagMemSpace[0xF1B000]; uint8 jaguarBootROM[0x040000]; // 68K CPU BIOS ROM--uses only half of this! uint8 jaguarCDBootROM[0x040000]; // 68K CPU CD BIOS ROM (256K) +uint8 jaguarDevBootROM1[0x040000]; // 68K CPU Stubulator 1 ROM--uses only half of this! +uint8 jaguarDevBootROM2[0x040000]; // 68K CPU Stubulator 2 ROM--uses only half of this! +uint8 jaguarDevCDBootROM[0x040000]; // 68K CPU Dev CD BIOS ROM (256K) #if 0 @@ -148,7 +151,7 @@ uint32 butch, dscntrl, ds_data, i2cntrl, sbcntrl, subdata, subdatb, sb_time, fif //this isn't endian safe... #define BSWAP64(x) ((htonl(x & 0xFFFFFFFF) << 32) | htonl(x >> 32)) // Actually, we use ESAFExx() macros instead of this, and we use GCC to check the endianness... -// Acutally, considering that "byteswap.h" doesn't exist elsewhere, the above +// Actually, considering that "byteswap.h" doesn't exist elsewhere, the above // is probably our best bet here. Just need to rename them to ESAFExx(). uint16 & memcon1 = *((uint16 *)&jagMemSpace[0xF00000]); diff --git a/src/memory.h b/src/memory.h index 900325e..75a9e18 100644 --- a/src/memory.h +++ b/src/memory.h @@ -15,6 +15,9 @@ extern uint8 * jaguarMainRAM; extern uint8 * jaguarMainROM; extern uint8 jaguarBootROM[]; extern uint8 jaguarCDBootROM[]; +extern uint8 jaguarDevBootROM1[]; +extern uint8 jaguarDevBootROM2[]; +extern uint8 jaguarDevCDBootROM[]; extern uint8 * gpuRAM; extern uint8 * dspRAM; -- 2.37.2