// --- ---------- -------------------------------------------------------------
// JLH 02/01/2010 Created this file
// JLH 07/05/2011 Fixed model to not reset itself with each new row insertion
+// JLH 07/07/2011 Added code to help the built-in keyboard based auto-search
+// of the QListView class
//
// Note that we have to put in convenience functions to the model for adding data
#include "filelistmodel.h"
+#include "filedb.h"
+
FileListModel::FileListModel(QObject * parent/*= 0*/): QAbstractListModel(parent)
{
}
-int FileListModel::rowCount(const QModelIndex & parent/*= QModelIndex()*/) const
+int FileListModel::rowCount(const QModelIndex & /*parent = QModelIndex()*/) const
{
return list.size();
}
return (uint)list.at(index.row()).fileType;
else if (role == FLM_CRC)
return (uint)list.at(index.row()).crc;
+ else if (role == Qt::DisplayRole)
+ {
+ // The QListView uses this role to do keyboard based searching,
+ // so we help it along by giving it what it needs to do the job. :-)
+ unsigned long dbIndex = list.at(index.row()).dbIndex;
+ QString filename = list.at(index.row()).filename;
+ QString nameToMatch;
+
+ // Pull name from file DB, otherwise, use the filename...
+ if (dbIndex != 0xFFFFFFFF)
+ nameToMatch = romList[dbIndex].name;
+ else
+ {
+ int lastSlashPos = filename.lastIndexOf('/');
+ nameToMatch = filename.mid(lastSlashPos + 1);
+ }
+
+ return nameToMatch;
+ }
return QVariant();
}
connect(fileList->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateSelection(const QModelIndex &, const QModelIndex &)));
connect(insertCart, SIGNAL(clicked()), this, SLOT(LoadButtonPressed()));
+
+ connect(fileList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(CatchDoubleClick(const QModelIndex &)));
+
+// connect(fileList, SIGNAL(doubleClicked()), this, SLOT(LoadButtonPressed()));
+// This returns:
+// Object::connect: No such signal QListView::QAbstractItemView::doubleClicked() in src/gui/filepicker.cpp:203
}
void FilePickerWindow::keyPressEvent(QKeyEvent * e)
LoadButtonPressed();
}
+void FilePickerWindow::CatchDoubleClick(const QModelIndex &)
+{
+ LoadButtonPressed();
+}
+
QString FilePickerWindow::GetSelectedPrettyName(void)
{
return prettyFilename;
void AddFileToList3(unsigned long index, QString, QImage *, unsigned long size, bool, unsigned long, unsigned long);
void UpdateSelection(const QModelIndex &, const QModelIndex &);
void LoadButtonPressed(void);
+ void CatchDoubleClick(const QModelIndex &);
signals:
void RequestLoad(QString);
#include "crc32.h"
#include "file.h"
#include "filedb.h"
+#include "memory.h"
#include "settings.h"
#define VERBOSE_LOGGING
crc = crc32_calcCheckSum(buffer, fileSize);
uint32 index = FindCRCIndexInFileList(crc);
+
+ if ((index != 0xFFFFFFFF) && (romList[index].flags & FF_BIOS))
+ HandleBIOSFile(buffer, crc);
+
delete[] buffer;
// Here we filter out files *not* in the DB (if configured that way) and
emit FoundAFile3(index, fileInfo.canonicalFilePath(), img, fileSize, foundUniversalHeader, fileType, crc);
}
+//
+// Handle checking/copying BIOS files into Jaguar core memory
+//
+void FileThread::HandleBIOSFile(uint8 * buffer, uint32 crc)
+{
+/*
+ { 0x55A0669C, "[BIOS] Atari Jaguar Developer CD (World)", FF_BIOS },
+ { 0x687068D5, "[BIOS] Atari Jaguar CD (World)", FF_BIOS },
+ { 0x8D15DBC6, "[BIOS] Atari Jaguar Stubulator '94 (World)", FF_BIOS },
+ { 0xE60277BB, "[BIOS] Atari Jaguar Stubulator '93 (World)", FF_BIOS },
+ { 0xFB731AAA, "[BIOS] Atari Jaguar (World)", FF_BIOS },
+
+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)
+
+enum { BIOS_NORMAL=0x01, BIOS_CD=0x02, BIOS_STUB1=0x04, BIOS_STUB2=0x08, BIOS_DEV_CD=0x10 };
+extern int biosAvailable;
+*/
+ if (crc == 0xFB731AAA && !(biosAvailable & BIOS_NORMAL))
+ {
+ memcpy(jaguarBootROM, buffer, 0x20000);
+ biosAvailable |= BIOS_NORMAL;
+ }
+ else if (crc == 0x687068D5 && !(biosAvailable & BIOS_CD))
+ {
+ memcpy(jaguarCDBootROM, buffer, 0x40000);
+ biosAvailable |= BIOS_CD;
+ }
+ else if (crc == 0x8D15DBC6 && !(biosAvailable & BIOS_STUB1))
+ {
+ memcpy(jaguarDevBootROM1, buffer, 0x20000);
+ biosAvailable |= BIOS_STUB1;
+ }
+ else if (crc == 0xE60277BB && !(biosAvailable & BIOS_STUB2))
+ {
+ memcpy(jaguarDevBootROM2, buffer, 0x20000);
+ biosAvailable |= BIOS_STUB2;
+ }
+ else if (crc == 0x55A0669C && !(biosAvailable & BIOS_DEV_CD))
+ {
+ memcpy(jaguarDevCDBootROM, buffer, 0x40000);
+ biosAvailable |= BIOS_DEV_CD;
+ }
+}
+
//
// Find a CRC in the ROM list (simple brute force algorithm).
// If it's there, return the index, otherwise return $FFFFFFFF
protected:
void run(void);
void HandleFile(QFileInfo);
+ void HandleBIOSFile(uint8 *, uint32);
uint32 FindCRCIndexInFileList(uint32);
private:
// This is crappy. We really should have a properly scaled image ready to go so we
// don't get Qt's default ugly looking fast scaling...
+
#warning "!!! FIX !!! Need to create properly scaled down cart/label images!"
+//We've got the carts, now just need to do the labels...
+
// unsigned long i = index.model()->data(index, Qt::DisplayRole).toUInt();
#if 0
unsigned long i = index.model()->data(index, Qt::DisplayRole).toUInt();
// FIXED:
//
// - Add dbl click/enter to select in cart list, ESC to dimiss [DONE]
+// - Autoscan/autoload all available BIOS from 'software' folder [DONE]
+// - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting with 'R', etc) [DONE]
//
// 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)
+// - Fix inconsistency with trailing slashes in paths (eeproms needs one, software doesn't)
//
-/*
-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...
WriteLog("VJ: Using built in BIOS/CD BIOS...\n");
memcpy(jaguarBootROM, jagBootROM, 0x20000);
memcpy(jaguarCDBootROM, jagCDROM, 0x40000);
- BIOSLoaded = CDBIOSLoaded = true;
+// BIOSLoaded = CDBIOSLoaded = true;
+ biosAvailable |= (BIOS_NORMAL | BIOS_CD);
#else
// What would be nice here would be a way to check if the BIOS was loaded so that we
// could disable the pushbutton on the Misc Options menu... !!! FIX !!! [DONE here, but needs to be fixed in GUI as well!]
- WriteLog("VJ: About to attempt to load BIOSes...\n");
+// WriteLog("VJ: About to attempt to load BIOSes...\n");
//This is short-circuiting the file finding thread... ??? WHY ???
//Not anymore. Was related to a QImage object creation/corruption bug elsewhere.
- BIOSLoaded = (JaguarLoadROM(jaguarBootROM, vjs.jagBootPath) == 0x20000 ? true : false);
- WriteLog("VJ: BIOS is %savailable...\n", (BIOSLoaded ? "" : "not "));
- CDBIOSLoaded = (JaguarLoadROM(jaguarCDBootROM, vjs.CDBootPath) == 0x40000 ? true : false);
- WriteLog("VJ: CD BIOS is %savailable...\n", (CDBIOSLoaded ? "" : "not "));
+// BIOSLoaded = (JaguarLoadROM(jaguarBootROM, vjs.jagBootPath) == 0x20000 ? true : false);
+// WriteLog("VJ: BIOS is %savailable...\n", (BIOSLoaded ? "" : "not "));
+// CDBIOSLoaded = (JaguarLoadROM(jaguarCDBootROM, vjs.CDBootPath) == 0x40000 ? true : false);
+// WriteLog("VJ: CD BIOS is %savailable...\n", (CDBIOSLoaded ? "" : "not "));
#endif
filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
pauseAct->setDisabled(true);
showUntunedTankCircuit = true;
running = true;
- // This is just in case the ROM we were playing was in a narrow or wide field mode
+ // This is just in case the ROM we were playing was in a narrow or wide field mode,
+ // so the untuned tank sim doesn't look wrong. :-)
TOMReset();
}
else
pauseAct->setChecked(false);
pauseAct->setDisabled(false);
memcpy(jagMemSpace + 0x800000, jaguarCDBootROM, 0x40000);
+ setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
+ " - Now playing: Jaguar CD"));
}
//(Err, what's so crappy about this? It seems to do what it's supposed to...)
vjs.renderType = settings.value("renderType", 0).toInt();
strcpy(vjs.jagBootPath, settings.value("JagBootROM", "./bios/[BIOS] Atari Jaguar (USA, Europe).zip").toString().toAscii().data());
strcpy(vjs.CDBootPath, settings.value("CDBootROM", "./bios/jagcd.rom").toString().toAscii().data());
- strcpy(vjs.EEPROMPath, settings.value("EEPROMs", "./eeproms").toString().toAscii().data());
- strcpy(vjs.ROMPath, settings.value("ROMs", "./software").toString().toAscii().data());
+ strcpy(vjs.EEPROMPath, settings.value("EEPROMs", "./eeproms/").toString().toAscii().data());
+ strcpy(vjs.ROMPath, settings.value("ROMs", "./software/").toString().toAscii().data());
WriteLog("MainWin: Paths\n");
WriteLog(" jagBootPath = \"%s\"\n", vjs.jagBootPath);
WriteLog(" CDBootPath = \"%s\"\n", vjs.CDBootPath);
uint8 jaguarDevBootROM2[0x040000]; // 68K CPU Stubulator 2 ROM--uses only half of this!
uint8 jaguarDevCDBootROM[0x040000]; // 68K CPU Dev CD BIOS ROM (256K)
+// This is an ORed value showing which BIOSes having been loaded into memory.
+int biosAvailable = 0;
#if 0
union Word
enum { UNKNOWN, JAGUAR, DSP, GPU, TOM, JERRY, M68K, BLITTER, OP };
extern const char * whoName[9];
+// BIOS identification enum
+
+enum { BIOS_NORMAL=0x01, BIOS_CD=0x02, BIOS_STUB1=0x04, BIOS_STUB2=0x08, BIOS_DEV_CD=0x10 };
+extern int biosAvailable;
+
// Some handy macros to help converting native endian to big endian (jaguar native)
// & vice versa