if (jerry_writes_enabled)
for(int i=0; i<64; i++)
eeprom_ram[i] = jerry_ee_data;
+
EEPROMSave(); // Save it NOW!
//else
// WriteLog("eeprom: not writing because read only\n");
//WriteLog("eeprom: writing 0x%.4x at 0x%.2x\n",jerry_ee_data,jerry_ee_address_data);
if (jerry_writes_enabled)
eeprom_ram[jerry_ee_address_data] = jerry_ee_data;
+
EEPROMSave(); // Save it NOW!
jerry_ee_state = EE_STATE_BUSY;
break;
//WriteLog("eeprom: erasing 0x%.2x\n",jerry_ee_address_data);
if (jerry_writes_enabled)
eeprom_ram[jerry_ee_address_data] = 0xFFFF;
+
jerry_ee_state = EE_STATE_BUSY;
break;
case EE_READ_DATA:
jerry_ee_data <<= 1;
jerry_ee_data |= data;
jerry_ee_data_cnt--;
+
if (!jerry_ee_data_cnt)
{
jerry_ee_state = jerry_ee_rstate;
+
if (jerry_ee_direct_jump)
eeprom_set_di(data);
}
jerry_ee_address_data |= data;
jerry_ee_address_cnt--;
// WriteLog("eeprom:\t%i bits remaining\n",jerry_ee_address_cnt);
+
if (!jerry_ee_address_cnt)
{
jerry_ee_state = jerry_ee_rstate;
//WriteLog("eeprom:\t\tread address 0x%.2x\n",jerry_ee_address_data);
+
if (jerry_ee_direct_jump)
eeprom_set_di(data);
}
case EE_STATE_2_0:
jerry_ee_data_cnt--;
data = (eeprom_ram[jerry_ee_address_data] & (1 << jerry_ee_data_cnt)) >> jerry_ee_data_cnt;
+
if (!jerry_ee_data_cnt)
{
//WriteLog("eeprom: read 0x%.4x at 0x%.2x cpu %i pc=0x%.8x\n",eeprom_ram[jerry_ee_address_data],jerry_ee_address_data,jaguar_cpu_in_exec,s68000readPC());
{
const uint32 crc32;
const char name[128];
-// const char file[128];
+// const uint8 compatibility;
const uint32 flags;
};
-enum FileFlags { FF_ROM=1, FF_ALPINE=2, FF_BIOS=4, FF_REQ_DSP=8, FF_REQ_BIOS=16, FF_NON_WORKING=32, FF_BAD_DUMP=64 };
+enum FileFlags { FF_ROM=1, FF_ALPINE=2, FF_BIOS=4, FF_REQ_DSP=8, FF_REQ_BIOS=16, FF_NON_WORKING=32, FF_BAD_DUMP=64, FF_VERIFIED=128 };
#endif
// Should have another flag for whether or not it requires DSP, BIOS,
// whether it's a .rom, it's a BIOS, etc...
// ... And now we do! :-D
+// How the CRCs work:
+// If the cart has an RSA signature, we do a CRC on the whole file.
+// If the cart has a universal header, we do a CRC on the file minus the UH.
+// This is to ensure that we can detect something properly (like an Alpine ROM)
+// that somebody slapped a universal header on.
+
RomIdentifier romList[] = {
- { 0x0509C85E, "Raiden (World)", FF_ROM },
- { 0x08F15576, "Iron Soldier (World) (v1.04)", FF_ROM },
- { 0x0957A072, "Kasumi Ninja (World)", FF_ROM },
- { 0x0AC83D77, "NBA Jam T.E. (World)", FF_ROM },
- { 0x0EC5369D, "Evolution - Dino Dudes (World)", FF_ROM },
- { 0x0F6A1C2C, "Ultra Vortek (World)", FF_ROM },
- { 0x14915F20, "White Men Can't Jump (World)", FF_ROM },
- { 0x1660F070, "Power Drive Rally (World)", FF_ROM },
- { 0x1E451446, "Trevor McFur in the Crescent Galaxy (World)", FF_ROM },
-// { 0x20DBFF9F, "Breakout 2000", FF_ROM },
- { 0x27594C6A, "Defender 2000 (World)", FF_ROM },
- { 0x2E17D5DA, "Bubsy in Fractured Furry Tales (World)", FF_ROM },
- { 0x348E6449, "Double Dragon V - The Shadow Falls (World)", FF_ROM },
- { 0x3615AF6A, "Fever Pitch Soccer (World) (En,Fr,De,Es,It)", FF_ROM },
- { 0x38A130ED, "Troy Aikman NFL Football (World)", FF_ROM },
- { 0x3C044941, "Skyhammer (World)", FF_ROM },
- { 0x40E1A1D0, "Air Cars (World)", FF_ROM },
- { 0x42A13EC5, "Soccer Kid (World)", FF_ROM },
- { 0x45AA46BA, "Space War 2000 (World)", FF_ROM },
- { 0x47EBC158, "Theme Park (World)", FF_ROM },
- { 0x4899628F, "Hover Strike (World)", FF_ROM },
- { 0x53DF6440, "Space War 2000 (World) (OVERDUMP)", FF_ROM },
+ { 0x0509C85E, "Raiden (World) (alt)", FF_ROM },
+ { 0x08849D0F, "Hyper Force (World)", FF_ALPINE | FF_VERIFIED },
+ { 0x08F15576, "Iron Soldier (World) (v1.04)", FF_ROM | FF_VERIFIED },
+ { 0x0957A072, "Kasumi Ninja (World)", FF_ROM | FF_VERIFIED },
+ { 0x0AC83D77, "NBA Jam T.E. (World)", FF_ROM | FF_VERIFIED },
+ { 0x0EC5369D, "Evolution - Dino Dudes (World)", FF_ROM | FF_VERIFIED },
+ { 0x0F6A1C2C, "Ultra Vortek (World)", FF_ROM | FF_VERIFIED },
+ { 0x14915F20, "White Men Can't Jump (World)", FF_ROM | FF_VERIFIED },
+ { 0x1660F070, "Power Drive Rally (World)", FF_ROM | FF_VERIFIED },
+ { 0x1A20C5C4, "Protector (World)", FF_ROM | FF_VERIFIED | FF_REQ_DSP },
+ { 0x1E451446, "Trevor McFur in the Crescent Galaxy (World)", FF_ROM | FF_VERIFIED },
+ { 0x20936557, "Space War 2000", FF_ALPINE | FF_VERIFIED },
+ { 0x27594C6A, "Defender 2000 (World)", FF_ROM | FF_VERIFIED },
+ { 0x2BAA92A1, "Space War 2000 (World) (OVERDUMP)", FF_ALPINE },
+ { 0x2E17D5DA, "Bubsy in Fractured Furry Tales (World)", FF_ROM | FF_VERIFIED },
+ { 0x31812799, "Raiden (World)", FF_ROM | FF_VERIFIED },
+ { 0x3241AB6A, "Towers II", FF_ALPINE },
+ { 0x348E6449, "Double Dragon V - The Shadow Falls (World)", FF_ROM | FF_VERIFIED },
+ { 0x3615AF6A, "Fever Pitch Soccer (World) (En,Fr,De,Es,It)", FF_ROM | FF_VERIFIED },
+ { 0x38A130ED, "Troy Aikman NFL Football (World)", FF_ROM | FF_VERIFIED },
+ { 0x40E1A1D0, "Air Cars (World)", FF_ROM | FF_VERIFIED },
+ { 0x4471BFA0, "Skyhammer (World)", FF_ALPINE | FF_VERIFIED },
+ { 0x47EBC158, "Theme Park (World)", FF_ROM | FF_VERIFIED },
+ { 0x4899628F, "Hover Strike (World)", FF_ROM | FF_VERIFIED },
{ 0x55A0669C, "[BIOS] Atari Jaguar Developer CD (World)", FF_BIOS },
- { 0x58272540, "Syndicate (World)", FF_ROM },
- { 0x5A101212, "Sensible Soccer - International Edition (World)", FF_ROM },
- { 0x5B6BB205, "Ruiner Pinball (World)", FF_ROM },
- { 0x5CFF14AB, "Pinball Fantasies (World)", FF_ROM },
- { 0x5E2CDBC0, "Doom (World)", FF_ROM },
- { 0x61C7EEC0, "Zero 5 (World)", FF_ROM },
+ { 0x58272540, "Syndicate (World)", FF_ROM | FF_VERIFIED },
+ { 0x5A101212, "Sensible Soccer - International Edition (World)", FF_ROM | FF_VERIFIED },
+ { 0x5B6BB205, "Ruiner Pinball (World)", FF_ROM | FF_VERIFIED },
+ { 0x5CFF14AB, "Pinball Fantasies (World)", FF_ROM | FF_VERIFIED },
+ { 0x5DDF9724, "Protector - Special Edition (World)", FF_ALPINE | FF_VERIFIED },
+ { 0x5E2CDBC0, "Doom (World)", FF_ROM | FF_VERIFIED | FF_REQ_DSP },
+ { 0x5F2C2774, "Battlesphere (World)", FF_ROM | FF_VERIFIED },
+ { 0x61C7EEC0, "Zero 5 (World)", FF_ROM | FF_VERIFIED },
+ { 0x61EE6B62, "Arena Football '95", FF_ALPINE | FF_VERIFIED },
{ 0x67F9AB3A, "Battle Sphere Gold (World)", FF_ROM },
{ 0x687068D5, "[BIOS] Atari Jaguar CD (World)", FF_BIOS },
- { 0x6B2B95AD, "Tempest 2000 (World)", FF_ROM },
- { 0x6EB774EB, "Worms (World)", FF_ROM },
- { 0x6F8B2547, "Super Burnout (World)", FF_ROM },
- { 0x817A2273, "Pitfall - The Mayan Adventure (World)", FF_ROM },
- { 0x8975F48B, "Zool 2 (World)", FF_ROM },
+ { 0x6B2B95AD, "Tempest 2000 (World)", FF_ROM | FF_VERIFIED },
+ { 0x6EB774EB, "Worms (World)", FF_ROM | FF_VERIFIED },
+ { 0x6F8B2547, "Super Burnout (World)", FF_ROM | FF_VERIFIED },
+ { 0x732FFAB6, "Soccer Kid (World)", FF_ROM | FF_VERIFIED },
+ { 0x817A2273, "Pitfall - The Mayan Adventure (World)", FF_ROM | FF_VERIFIED },
+ { 0x83A3FB5D, "Towers II", FF_ROM | FF_VERIFIED },
+ { 0x892BC67C, "Flip Out! (World)", FF_ROM | FF_VERIFIED },
+ { 0x8975F48B, "Zool 2 (World)", FF_ROM | FF_VERIFIED },
+ { 0x89DA21FF, "Phase Zero", FF_ALPINE | FF_VERIFIED },
{ 0x8D15DBC6, "[BIOS] Atari Jaguar Stubulator '94 (World)", FF_BIOS },
- { 0x8FEA5AB0, "Dragon - The Bruce Lee Story (World)", FF_ROM },
- { 0x97EB4651, "I-War (World)", FF_ROM },
+ { 0x8FEA5AB0, "Dragon - The Bruce Lee Story (World)", FF_ROM | FF_VERIFIED },
+ { 0x91095DD3, "Brett Hull Hockey", FF_ROM | FF_VERIFIED },
+ { 0x95143668, "Trevor McFur in the Crescent Galaxy (World) (alt)", FF_ROM | FF_VERIFIED },
+ { 0x97EB4651, "I-War (World)", FF_ROM | FF_VERIFIED },
+ { 0xA0A25A67, "Missile Command VR", FF_ALPINE },
{ 0xA27823D8, "Ultra Vortek (World) (v0.94) (Beta)", FF_ROM },
- { 0xA56D0798, "Protector - Special Edition (World)", FF_ROM },
- { 0xA9F8A00E, "Rayman (World)", FF_ROM },
- { 0xB14C4753, "Fight for Life (World)", FF_ROM },
- { 0xBCB1A4BF, "Brutal Sports Football (World)", FF_ROM },
- { 0xBDA405C6, "Cannon Fodder (World)", FF_ROM },
- { 0xBDE67498, "Cybermorph (World) (Rev 1)", FF_ROM },
- { 0xC5562581, "Zoop! (World)", FF_ROM },
- { 0xC654681B, "Total Carnage (World)", FF_ROM },
- { 0xC6C7BA62, "Fight for Life (World) (Alt)", FF_ROM | FF_BAD_DUMP },
- { 0xC9608717, "Val d'Isere Skiing and Snowboarding (World)", FF_ROM },
- { 0xCAF33BD6, "Towers II", FF_ROM },
- { 0xCD5BF827, "Attack of the Mutant Penguins (World)", FF_ROM | FF_REQ_DSP },
- { 0xD6C19E34, "Iron Soldier 2 (World)", FF_ROM },
- { 0xD8696F23, "Breakout 2000", FF_ALPINE },
- { 0xDA9C4162, "Missile Command 3D (World)", FF_ROM },
- { 0xDC187F82, "Alien vs Predator (World)", FF_ROM },
+ { 0xA7E01FEF, "Mad Bodies (2008)", FF_ROM | FF_NON_WORKING },
+ { 0xA9F8A00E, "Rayman (World)", FF_ROM | FF_VERIFIED },
+ { 0xAEA9D831, "Barkley Shut Up & Jam", FF_ROM | FF_VERIFIED },
+ { 0xB14C4753, "Fight for Life (World)", FF_ROM | FF_VERIFIED },
+ { 0xB5604D40, "Breakout 2000", FF_ROM | FF_VERIFIED },
+ { 0xBA13AE79, "Soccer Kid (World) (alt)", FF_ALPINE },
+ { 0xBCB1A4BF, "Brutal Sports Football (World)", FF_ROM | FF_VERIFIED },
+ { 0xBD18D606, "Space War 2000 (World) (alt)", FF_ALPINE },
+ { 0xBDA405C6, "Cannon Fodder (World)", FF_ROM | FF_VERIFIED },
+ { 0xBDE67498, "Cybermorph (World) (Rev 1)", FF_ROM | FF_VERIFIED },
+ { 0xC2898F6E, "Barkley Shut Up & Jam (alt)", FF_ALPINE },
+ { 0xC36E935E, "Beebris (World)", FF_ALPINE | FF_VERIFIED },
+ { 0xC5562581, "Zoop! (World)", FF_ROM | FF_VERIFIED },
+ { 0xC654681B, "Total Carnage (World)", FF_ROM | FF_VERIFIED },
+ { 0xC6C7BA62, "Fight for Life (World) (alt)", FF_ROM | FF_BAD_DUMP },
+ { 0xC9608717, "Val d'Isere Skiing and Snowboarding (World)", FF_ROM | FF_VERIFIED },
+ { 0xCBFD822A, "Air Cars (World) (alt)", FF_ROM },
+ { 0xCD5BF827, "Attack of the Mutant Penguins (World)", FF_ROM | FF_VERIFIED | FF_REQ_DSP },
+ { 0xD6C19E34, "Iron Soldier 2 (World)", FF_ROM | FF_VERIFIED },
+ { 0xD8696F23, "Breakout 2000 (alt)", FF_ALPINE },
+ { 0xDA9C4162, "Missile Command 3D (World)", FF_ROM | FF_VERIFIED },
+ { 0xDC187F82, "Alien vs Predator (World)", FF_ROM | FF_VERIFIED },
+ { 0xDCCDEF05, "Brett Hull Hockey", FF_ALPINE },
{ 0xDDFF49F5, "Rayman (Prototype)", FF_ALPINE },
- { 0xDE55DCC7, "Flashback - The Quest for Identity (World) (En,Fr)", FF_ROM },
- { 0xE28756DE, "Atari Karts (World)", FF_ROM },
+ { 0xDE55DCC7, "Flashback - The Quest for Identity (World) (En,Fr)", FF_ROM | FF_VERIFIED },
+ { 0xE28756DE, "Atari Karts (World)", FF_ROM | FF_VERIFIED },
{ 0xE60277BB, "[BIOS] Atari Jaguar Stubulator '93 (World)", FF_BIOS },
- { 0xE91BD644, "Wolfenstein 3D (World)", FF_ROM },
- { 0xEC22F572, "SuperCross 3D (World)", FF_ROM },
+ { 0xE91BD644, "Wolfenstein 3D (World)", FF_ROM | FF_VERIFIED },
+ { 0xEA9B3FA7, "Phase Zero", FF_ROM },
+ { 0xEC22F572, "SuperCross 3D (World)", FF_ROM | FF_VERIFIED },
{ 0xECF854E7, "Cybermorph (World) (Rev 2)", FF_ROM },
- { 0xEEE8D61D, "Club Drive (World)", FF_ROM },
- { 0xF0360DB3, "Hyper Force (World)", FF_ROM },
- { 0xFA7775AE, "Checkered Flag (World)", FF_ROM },
- { 0xFAE31DD0, "Flip Out! (World)", FF_ROM },
+ { 0xEEE8D61D, "Club Drive (World)", FF_ROM | FF_VERIFIED },
+ { 0xF4ACBB04, "Tiny Toon Adventures (World)", FF_ROM | FF_VERIFIED },
+ { 0xFA7775AE, "Checkered Flag (World)", FF_ROM | FF_VERIFIED },
+ { 0xFAE31DD0, "Flip Out! (World) (alt)", FF_ROM },
{ 0xFB731AAA, "[BIOS] Atari Jaguar (World)", FF_BIOS },
+// is this really a BIOS???
+// No, it's really a cart, complete with RSA header. So need to fix so it can load.
+ { 0xFDF37F47, "Memory Track Cartridge (World)", FF_ROM | FF_VERIFIED },
{ 0xFFFFFFFF, "***END***", 0 }
};
// Useful enumerations
-enum FileFlags { FF_ROM=1, FF_ALPINE=2, FF_BIOS=4, FF_REQ_DSP=8, FF_REQ_BIOS=16, FF_NON_WORKING=32, FF_BAD_DUMP=64 };
+enum FileFlags { FF_ROM=0x01, FF_ALPINE=0x02, FF_BIOS=0x04, FF_REQ_DSP=0x08, FF_REQ_BIOS=0x10, FF_NON_WORKING=0x20, FF_BAD_DUMP=0x40, FF_VERIFIED=0x80 };
// Useful structs
{
const uint32 crc32;
const char name[128];
-// const char file[128];
+// const uint8 compatibility;
const uint32 flags;
};
return list.at(index.row()).filename;
else if (role == FLM_FILESIZE)
return (uint)list.at(index.row()).fileSize;
+ else if (role == FLM_UNIVERSALHDR)
+ return (uint)list.at(index.row()).hasUniversalHeader;
+ else if (role == FLM_FILETYPE)
+ return (uint)list.at(index.row()).fileType;
+ else if (role == FLM_CRC)
+ return (uint)list.at(index.row()).crc;
return QVariant();
#endif
reset();
}
+void FileListModel::AddData(unsigned long index, QString str, QImage img, unsigned long size, bool univHdr, uint32_t type, uint32_t fileCrc)
+{
+ // Assuming that both QString and QImage have copy constructors, this should work.
+ FileListData data;
+
+ data.dbIndex = index;
+ data.fileSize = size;
+ data.filename = str;
+ data.label = img;
+ data.hasUniversalHeader = univHdr;
+ data.fileType = type;
+ data.crc = fileCrc;
+
+ list.push_back(data);
+ reset();
+}
+
+void FileListModel::ClearData(void)
+{
+ if (list.size() == 0)
+ return;
+
+ beginResetModel();
+ list.clear();
+ endResetModel();
+}
+
//FileListData FileListModel::GetData(const QModelIndex & index) const
//{
// return list.at(index.row());
#include <QtGui>
#include <vector>
+#include <stdint.h>
struct FileListData
{
unsigned long fileSize;
QString filename;
QImage label;
+ bool hasUniversalHeader;
+ uint32_t fileType;
+ uint32_t crc;
};
//hm.
-#define FLM_INDEX (Qt::UserRole + 1)
-#define FLM_FILESIZE (Qt::UserRole + 2)
-#define FLM_FILENAME (Qt::UserRole + 3)
-#define FLM_LABEL (Qt::UserRole + 4)
+#define FLM_INDEX (Qt::UserRole + 1)
+#define FLM_FILESIZE (Qt::UserRole + 2)
+#define FLM_FILENAME (Qt::UserRole + 3)
+#define FLM_LABEL (Qt::UserRole + 4)
+#define FLM_UNIVERSALHDR (Qt::UserRole + 5)
+#define FLM_FILETYPE (Qt::UserRole + 6)
+#define FLM_CRC (Qt::UserRole + 7)
class FileListModel: public QAbstractListModel
{
// void AddData(QIcon pix);
// void AddData(unsigned long);
void AddData(unsigned long, QString, QImage, unsigned long);
+ void AddData(unsigned long, QString, QImage, unsigned long, bool, uint32_t, uint32_t);
+ void ClearData(void);
// FileListData GetData(const QModelIndex & index) const;
private:
-// std::vector<QIcon> pixList;
-// std::vector<unsigned long> dbIndex;
std::vector<FileListData> list;
-// std::vector<unsigned long> size;
};
#endif // __FILELISTMODEL_H__
#include "filepicker.h"
+#include "file.h"
#include "filedb.h"
#include "filelistmodel.h"
#include "filethread.h"
labels->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
dataLayout->addWidget(labels);
data = new QLabel(QString(tr(
- "4MB Cartridge<br>"
- "FEDCBA98<br>"
- "DOES NOT WORK<br>"
- "Universal Header detected; Requires DSP"
+ "?MB Cartridge<br>"
+ "????????<br>"
+ "???<br>"
+ "???"
)));
data->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
dataLayout->addWidget(data);
fileThread = new FileThread(this);
// connect(fileThread, SIGNAL(FoundAFile(unsigned long)), this, SLOT(AddFileToList(unsigned long)));
- connect(fileThread, SIGNAL(FoundAFile2(unsigned long, QString, QImage *, unsigned long)), this, SLOT(AddFileToList2(unsigned long, QString, QImage *, unsigned long)));
- fileThread->Go();
+// connect(fileThread, SIGNAL(FoundAFile2(unsigned long, QString, QImage *, unsigned long)), this, SLOT(AddFileToList2(unsigned long, QString, QImage *, unsigned long)));
+ connect(fileThread, SIGNAL(FoundAFile3(unsigned long, QString, QImage *,
+ unsigned long, bool, unsigned long, unsigned long)), this,
+ SLOT(AddFileToList3(unsigned long, QString, QImage *, unsigned long,
+ bool, unsigned long, unsigned long)));
+
+// Let's defer this to the main window, so we can have some control over when this is done.
+// fileThread->Go();
/*
New sizes: 373x172 (label), 420x340 (cart)
*/
return prettyFilename;
}
+void FilePickerWindow::ScanSoftwareFolder(bool allow/*= false*/)
+{
+ // "allow" is whether or not to allow scanning for unknown software.
+ model->ClearData();
+ fileThread->Go(allow);
+}
+
//
// This slot gets called by the FileThread's run() function when it finds a
// match in the filesystem to a ROM on our CRC list.
void FilePickerWindow::AddFileToList2(unsigned long index, QString str, QImage * img, unsigned long size)
{
-printf("FilePickerWindow(2): Found match [%s]...\n", romList[index].name);
+if (index != 0xFFFFFFFF)
+ printf("FilePickerWindow(2): Found match [%s]...\n", romList[index].name);
+
if (img)
{
model->AddData(index, str, *img, size);
model->AddData(index, str, QImage(), size);
}
+void FilePickerWindow::AddFileToList3(unsigned long index, QString str, QImage * img, unsigned long size, bool haveUniversalHeader, unsigned long fileType, unsigned long crc)
+{
+if (index != 0xFFFFFFFF)
+ printf("FilePickerWindow(3): Found match [%s]...\n", romList[index].name);
+
+ if (img)
+ {
+ model->AddData(index, str, *img, size, haveUniversalHeader, fileType, crc);
+//It would be better to pass the pointer into the model though...
+ delete img;
+ }
+ else
+ model->AddData(index, str, QImage(), size, haveUniversalHeader, fileType, crc);
+}
+
void FilePickerWindow::LoadButtonPressed(void)
{
// TODO: Get the text of the current selection, call the MainWin slot for loading
unsigned long i = current.model()->data(current, FLM_INDEX).toUInt();
QImage label = current.model()->data(current, FLM_LABEL).value<QImage>();
unsigned long fileSize = current.model()->data(current, FLM_FILESIZE).toUInt();
+ bool haveUniversalHeader = current.model()->data(current, FLM_UNIVERSALHDR).toBool();
+ unsigned long fileType = current.model()->data(current, FLM_FILETYPE).toUInt();
+ uint32 crc = (uint32)current.model()->data(current, FLM_CRC).toUInt();
// printf("FPW: %s\n", s.toAscii().data());
+ bool haveUnknown = (i == 0xFFFFFFFF ? true : false);
#endif
+ // Disallow loading completely unknown files, but allow all others.
+ insertCart->setEnabled(haveUnknown && (fileType == JST_NONE) ? false : true);
//hm.
//currentFile = s;
// We should try to be intelligent with our updates here, and only redraw when
// we're going from a selection with a label to a selection without. Now, we
// redraw regardless.
-#if 0
- QImage cart(":/res/cart-blank.png");
- QPainter painter(&cart);
-// painter.drawPixmap(23, 87, QPixmap::fromImage(QImage(":/res/label-blank.png")));
- painter.drawPixmap(27, 89, QPixmap::fromImage(QImage(":/res/label-blank.png")));
- painter.end();
-#else
QImage cart;
- if (romList[i].flags & FF_ROM)
+// We now have to sources of data for the passed in files:
+// - The file DB
+// - The file type detection
+// This means we have to be mindful of what's passed back by that stuff.
+// We can assume that if it wasn't found in the DB, then the fileType
+// should be valid.
+// The DB takes precedence over the fileType.
+ if ((!haveUnknown && (romList[i].flags & FF_ROM))
+ || (haveUnknown && (fileType == JST_ROM)))
{
cart = QImage(":/res/cart-blank.png");
QPainter painter(&cart);
painter.drawPixmap(27, 89, QPixmap::fromImage(QImage(":/res/label-blank.png")));
painter.end();
}
- else if (romList[i].flags & FF_ALPINE)
+ else if ((!haveUnknown && (romList[i].flags & FF_ALPINE))
+ || (haveUnknown && (fileType == JST_ALPINE)))
{
cart = QImage(":/res/alpine-file.png");
}
+ else if (haveUnknown && (fileType == JST_ABS_TYPE1 || fileType == JST_ABS_TYPE2 || fileType == JST_JAGSERVER))
+ {
+ cart = QImage(":/res/homebrew-file.png");
+ }
else
cart = QImage(":/res/unknown-file.png");
-#endif
+
cartImage->setPixmap(QPixmap::fromImage(cart));
}
//1048576
//2097152
//4194304
- prettyFilename = romList[i].name;
- title->setText(QString("<h2>%1</h2>").arg(romList[i].name));
+ if (!haveUnknown)
+ prettyFilename = romList[i].name;
+ else
+ {
+ int lastSlashPos = currentFile.lastIndexOf('/');
+ prettyFilename = "\"" + currentFile.mid(lastSlashPos + 1) + "\"";
+ }
+
+ title->setText(QString("<h2>%1</h2>").arg(prettyFilename));
+
//Kludge for now, we'll have to fix this later...
// So let's fix it now!
- QString fileType;
+ QString fileTypeString, crcString, notes, compatibility;
- if (romList[i].flags & FF_ROM)
- fileType = QString(tr("%1MB Cartridge")).arg(fileSize / 1048576);
- else if (romList[i].flags & FF_ALPINE)
- fileType = QString(tr("%1MB Alpine ROM")).arg(fileSize / 1048576);
+#if 0
+ if (!haveUnknown)
+ {
+ if (romList[i].flags & FF_ROM)
+ fileTypeString = QString(tr("%1MB Cartridge")).arg(fileSize / 1048576);
+ else if (romList[i].flags & FF_ALPINE)
+ fileTypeString = QString(tr("%1MB Alpine ROM")).arg(fileSize / 1048576);
+ else
+ fileTypeString = QString(tr("*** UNKNOWN *** (%1 bytes)")).arg(fileSize);
+ }
+#else
+ if ((!haveUnknown && (romList[i].flags & FF_ROM)) || (haveUnknown && (fileType == JST_ROM)))
+ fileTypeString = QString(tr("%1MB Cartridge")).arg(fileSize / 1048576);
+ else if ((!haveUnknown && (romList[i].flags & FF_ALPINE)) || (haveUnknown && (fileType == JST_ALPINE)))
+ fileTypeString = QString(tr("%1MB Alpine ROM")).arg(fileSize / 1048576);
+ else if (haveUnknown && (fileType == JST_ABS_TYPE1 || fileType == JST_ABS_TYPE2))
+ fileTypeString = QString(tr("ABS/COF Executable (%1 bytes)")).arg(fileSize);
+ else if (haveUnknown && (fileType == JST_JAGSERVER))
+ fileTypeString = QString(tr("Jaguar Server Executable (%1 bytes)")).arg(fileSize);
+ else
+ fileTypeString = QString(tr("*** UNKNOWN *** (%1 bytes)")).arg(fileSize);
+#endif
+
+// crcString = QString("%1").arg(romList[i].crc32, 8, 16, QChar('0')).toUpper();
+ crcString = QString("%1").arg(crc, 8, 16, QChar('0')).toUpper();
+
+ if (!haveUnknown && (romList[i].flags & FF_NON_WORKING))
+ compatibility = "DOES NOT WORK";
else
- fileType = QString(tr("*** UNKNOWN *** (%1 bytes)")).arg(fileSize);
-// QString fileType = QString(romList[i].flags & FF_ROM ? "%1MB Cartridge" : "%1*** UNKNOWN ***")
-// .arg(fileSize / 1048576);
- QString crcString = QString("%1").arg(romList[i].crc32, 8, 16, QChar('0')).toUpper();
- QString notes =
-/* (romList[i].flags & FF_ROM ? "Jaguar ROM " : "")*/
- QString(romList[i].flags & FF_BAD_DUMP ? "<b>BAD DUMP</b>" : "");
- data->setText(QString("%1<br>%2<br>%3<br>%4").arg(fileType).arg(crcString).arg("???%").arg(notes));
+ compatibility = "Unknown";
+
+ // This is going to need some formatting love before long...
+ if (!haveUnknown && (romList[i].flags & FF_BAD_DUMP))
+ notes = "<b>BAD DUMP</b>";
+
+ if (haveUniversalHeader)
+ notes += " Universal Header detected";
+
+ if (!haveUnknown && (romList[i].flags & FF_REQ_DSP))
+ notes += " Requires DSP";
+
+ if (!haveUnknown && (romList[i].flags & FF_VERIFIED))
+ notes += " <i>(Verified)</i>";
+
+ data->setText(QString("%1<br>%2<br>%3<br>%4")
+ .arg(fileTypeString).arg(crcString).arg(compatibility).arg(notes));
}
/*
public:
FilePickerWindow(QWidget * parent = 0);
QString GetSelectedPrettyName(void);
+ void ScanSoftwareFolder(bool allow = false);
public slots:
void AddFileToList(unsigned long index);
void AddFileToList2(unsigned long index, QString, QImage *, unsigned long size);
+ void AddFileToList3(unsigned long index, QString, QImage *, unsigned long size, bool, unsigned long, unsigned long);
void UpdateSelection(const QModelIndex &, const QModelIndex &);
void LoadButtonPressed(void);
wait();
}
-void FileThread::Go(void)
+void FileThread::Go(bool allowUnknown/*= false*/)
{
+ allowUnknownSoftware = allowUnknown;
QMutexLocker locker(&mutex);
start();
}
uint32 index = FindCRCIndexInFileList(crc);
delete[] buffer;
- if ((index == 0xFFFFFFFF) || (romList[index].flags & FF_BIOS))
- return; // CRC wasn't found, so bail...
+ // Here we filter out files *not* in the DB (if configured that way) and
+ // BIOS files.
+ if (index == 0xFFFFFFFF)
+ {
+ // If we allow unknown software, we pass the (-1) index on, otherwise...
+ if (!allowUnknownSoftware)
+ return; // CRC wasn't found, so bail...
+ }
+ else if (romList[index].flags & FF_BIOS)
+ return;
//Here's a little problem. When we create the image here and pass it off to FilePicker,
//we can clobber this image before we have a chance to copy it out in the FilePicker function
//printf("FileThread: Attempted to load image. Size: %u x %u...\n", img.width(), img.height());
}
- emit FoundAFile2(index, fileInfo.canonicalFilePath(), img, fileSize);
+// emit FoundAFile2(index, fileInfo.canonicalFilePath(), img, fileSize);
+ emit FoundAFile3(index, fileInfo.canonicalFilePath(), img, fileSize, foundUniversalHeader, fileType, crc);
}
//
public:
FileThread(QObject * parent = 0);
~FileThread();
- void Go(void);
+ void Go(bool allowUnknown = false);
signals:
void FoundAFile(unsigned long index);
void FoundAFile2(unsigned long index, QString filename, QImage * label, unsigned long);
+ void FoundAFile3(unsigned long index, QString filename, QImage * label, unsigned long, bool, unsigned long, unsigned long);
protected:
void run(void);
QMutex mutex;
QWaitCondition condition;
bool abort;
+ bool allowUnknownSoftware;
};
#endif // __FILETHREAD_H__
layout4->addLayout(layout3);
// Checkboxes...
- useBIOS = new QCheckBox(tr("Enable Jaguar BIOS"));
- useDSP = new QCheckBox(tr("Enable DSP"));
+ useBIOS = new QCheckBox(tr("Enable Jaguar BIOS"));
+ useDSP = new QCheckBox(tr("Enable DSP"));
+ useUnknownSoftware = new QCheckBox(tr("Allow unknown software in file chooser"));
layout4->addWidget(useBIOS);
layout4->addWidget(useDSP);
+ layout4->addWidget(useUnknownSoftware);
setLayout(layout4);
}
QCheckBox * useBIOS;
QCheckBox * useDSP;
+ QCheckBox * useUnknownSoftware;
};
#endif // __GENERALTAB_H__
QString filename = index.model()->data(index, FLM_FILENAME).toString();
QImage label = index.model()->data(index, FLM_LABEL).value<QImage>();
#endif
+ QString nameToDraw;
+ if (i == 0xFFFFFFFF) // Not found...
+ {
+ int lastSlashPos = filename.lastIndexOf('/');
+ nameToDraw = "\"" + filename.mid(lastSlashPos + 1) + "\"";
+ }
+ else
+ nameToDraw = romList[i].name;
#if 0
if (role == Qt::DecorationRole)
return list.at(index.row()).label;
// painter->setPen(Qt::white);
painter->setPen(QColor(255, 128, 0, 255));
// painter->drawText(QRect(option.rect.x()+20, option.rect.y()+73, 196, 70), Qt::TextWordWrap | Qt::AlignHCenter, QString(romList[i].name));
- painter->drawText(QRect(option.rect.x()+10, option.rect.y()+36, 196/2, 70/2), Qt::TextWordWrap | Qt::AlignHCenter, QString(romList[i].name));
+ painter->drawText(QRect(option.rect.x()+10, option.rect.y()+36, 196/2, 70/2),
+ Qt::TextWordWrap | Qt::AlignHCenter, nameToDraw);
}
else
{
// ImageDelegate(QObject * parent = 0);
ImageDelegate();
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const;
+ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
+ QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
// public slots:
// void setPixelSize(int size);
#include "settings.h"
#include "filepicker.h"
#include "configdialog.h"
+#include "generaltab.h"
#include "version.h"
#include "jaguar.h"
videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- ReadSettings();
setUnifiedTitleAndToolBarOnMac(true);
// Create actions
// Create status bar
statusBar()->showMessage(tr("Ready"));
+ ReadSettings();
+
// Set toolbar buttons/menus based on settings read in (sync the UI)...
blurAct->setChecked(vjs.glFilter);
x1Act->setChecked(zoomLevel == 1);
CDBIOSLoaded = (JaguarLoadROM(jaguarCDBootROM, vjs.CDBootPath) == 0x40000 ? true : false);
WriteLog("VJ: CD BIOS is %savailable...\n", (CDBIOSLoaded ? "" : "not "));
#endif
+
+ filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
}
void MainWin::closeEvent(QCloseEvent * event)
{
// Call the configuration dialog and update settings
ConfigDialog dlg(this);
+ //ick.
+ dlg.generalTab->useUnknownSoftware->setChecked(allowUnknownSoftware);
if (dlg.exec() == false)
return;
+ QString before = vjs.ROMPath;
dlg.UpdateVJSettings();
+ QString after = vjs.ROMPath;
+
+ bool allowOld = allowUnknownSoftware;
+ //ick.
+ allowUnknownSoftware = dlg.generalTab->useUnknownSoftware->isChecked();
+
+ // We rescan the "software" folder if the user either changed the path or
+ // checked/unchecked the "Allow unknown files" option in the config dialog.
+ if ((before != after) || (allowOld != allowUnknownSoftware))
+ filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
+
+ // Just in case we crash before a clean exit...
+ WriteSettings();
}
//
filePickWin->move(pos);
zoomLevel = settings.value("zoom", 1).toInt();
+ allowUnknownSoftware = settings.value("showUnknownSoftware", false).toBool();
vjs.useJoystick = settings.value("useJoystick", false).toBool();
vjs.joyport = settings.value("joyport", 0).toInt();
settings.setValue("cartLoadPos", filePickWin->pos());
settings.setValue("zoom", zoomLevel);
+ settings.setValue("showUnknownSoftware", allowUnknownSoftware);
settings.setValue("useJoystick", vjs.useJoystick);
settings.setValue("joyport", vjs.joyport);
bool powerButtonOn;
bool showUntunedTankCircuit;
bool cartridgeLoaded;
+ bool allowUnknownSoftware;
QMenu * fileMenu;
QMenu * helpMenu;