]> Shamusworld >> Repos - virtualjaguar/commitdiff
Moved CRCs to filedb.h/cpp, various incremetal improvements to GUI
authorShamus Hammons <jlhamm@acm.org>
Sun, 28 Feb 2010 18:13:19 +0000 (18:13 +0000)
committerShamus Hammons <jlhamm@acm.org>
Sun, 28 Feb 2010 18:13:19 +0000 (18:13 +0000)
Makefile
src/filedb.cpp [new file with mode: 0644]
src/filedb.h [new file with mode: 0644]
src/gui/filepicker.cpp
src/gui/filethread.cpp
src/gui/filethread.h
src/gui/imagedelegate.cpp
vj.cfg

index c4a771f55745b5be862cd2ea79f7919118f24d24..31d3d9d8cca45517a27d24737461e8e9869ce0f7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -96,6 +96,7 @@ OBJS = \
        obj/eeprom.o        \
        obj/event.o         \
        obj/file.o          \
+       obj/filedb.o        \
        obj/gpu.o           \
        obj/jagdasm.o       \
        obj/jaguar.o        \
diff --git a/src/filedb.cpp b/src/filedb.cpp
new file mode 100644 (file)
index 0000000..3f8e9f3
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// filedb.cpp - File database
+//
+// by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  02/15/2010  Created this file
+//
+
+#include "filedb.h"
+
+
+#if 0
+struct RomIdentifier
+{
+       const uint32 crc32;
+       const char name[128];
+       const char file[128];
+       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 };
+#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
+
+RomIdentifier romList[] = {
+       { 0x0509C85E, "Raiden (World)", "raiden.jpg", FF_ROM },
+       { 0x08F15576, "Iron Soldier (World) (v1.04)", "iron-soldier.jpg", FF_ROM },
+       { 0x0957A072, "Kasumi Ninja (World)", "kasumi-ninja.jpg", FF_ROM },
+       { 0x0AC83D77, "NBA Jam T.E. (World)", "nba-jam.jpg", FF_ROM },
+       { 0x0EC5369D, "Evolution - Dino Dudes (World)", "dino-dudes.jpg", FF_ROM },
+       { 0x0F6A1C2C, "Ultra Vortek (World)", "ultra-vortek.jpg", FF_ROM },
+       { 0x14915F20, "White Men Can't Jump (World)", "white-men-can't-jump.jpg", FF_ROM },
+       { 0x1660F070, "Power Drive Rally (World)", "power-drive-rally.jpg", FF_ROM },
+       { 0x1E451446, "Trevor McFur in the Crescent Galaxy (World)", "trevor-mcfur.jpg", FF_ROM },
+       { 0x20DBFF9F, "Breakout 2000", "breakout-2000.jpg", FF_ROM },
+       { 0x27594C6A, "Defender 2000 (World)", "defender-2000.jpg", FF_ROM },
+       { 0x2E17D5DA, "Bubsy in Fractured Furry Tales (World)", "bubsy.jpg", FF_ROM },
+       { 0x348E6449, "Double Dragon V - The Shadow Falls (World)", "double-dragon.jpg", FF_ROM },
+       { 0x3615AF6A, "Fever Pitch Soccer (World) (En,Fr,De,Es,It)", "fever-pitch-soccer.jpg", FF_ROM },
+       { 0x38A130ED, "Troy Aikman NFL Football (World)", "troy-aikman-football.jpg", FF_ROM },
+       { 0x3C044941, "Skyhammer (World)", "skyhammer.jpg", FF_ROM },
+       { 0x40E1A1D0, "Air Cars (World)", "air-cars.jpg", FF_ROM },
+       { 0x42A13EC5, "Soccer Kid (World)", "soccer-kid.jpg", FF_ROM },
+       { 0x47EBC158, "Theme Park (World)", "theme-park.jpg", FF_ROM },
+       { 0x4899628F, "Hover Strike (World)", "hover-strike.jpg", FF_ROM },
+       { 0x53DF6440, "Space War 2000 (World)", "", FF_ROM },
+       { 0x55A0669C, "[BIOS] Atari Jaguar Developer CD (World)", "", FF_BIOS },
+       { 0x58272540, "Syndicate (World)", "syndicate.jpg", FF_ROM },
+       { 0x5A101212, "Sensible Soccer - International Edition (World)", "sensible-soccer.jpg", FF_ROM },
+       { 0x5B6BB205, "Ruiner Pinball (World)", "ruiner-pinball.jpg", FF_ROM },
+       { 0x5CFF14AB, "Pinball Fantasies (World)", "pinball-fantasies.jpg", FF_ROM },
+       { 0x5E2CDBC0, "Doom (World)", "doom.jpg", FF_ROM },
+       { 0x61C7EEC0, "Zero 5 (World)", "zero-5.jpg", FF_ROM },
+       { 0x67F9AB3A, "Battle Sphere Gold (World)", "", FF_ROM },
+       { 0x687068D5, "[BIOS] Atari Jaguar CD (World)", "", FF_BIOS },
+       { 0x6B2B95AD, "Tempest 2000 (World)", "tempest-2000.jpg", FF_ROM },
+       { 0x6EB774EB, "Worms (World)", "worms.jpg", FF_ROM },
+       { 0x6F8B2547, "Super Burnout (World)", "super-burnout.jpg", FF_ROM },
+       { 0x817A2273, "Pitfall - The Mayan Adventure (World)", "pitfall.jpg", FF_ROM },
+       { 0x8975F48B, "Zool 2 (World)", "zool-2.jpg", FF_ROM },
+       { 0x8D15DBC6, "[BIOS] Atari Jaguar Stubulator '94 (World)", "", FF_BIOS },
+       { 0x8FEA5AB0, "Dragon - The Bruce Lee Story (World)", "dragon.jpg", FF_ROM },
+       { 0x97EB4651, "I-War (World)", "i-war.jpg", FF_ROM },
+       { 0xA27823D8, "Ultra Vortek (World) (v0.94) (Beta)", "", FF_ROM },
+       { 0xA56D0798, "Protector - Special Edition (World)", "protector-se.jpg", FF_ROM },
+       { 0xA9F8A00E, "Rayman (World)", "rayman.jpg", FF_ROM },
+       { 0xB14C4753, "Fight for Life (World)", "fight-for-life.jpg", FF_ROM },
+       { 0xBCB1A4BF, "Brutal Sports Football (World)", "brutal-sports-football.jpg", FF_ROM },
+       { 0xBDA405C6, "Cannon Fodder (World)", "cannon-fodder.jpg", FF_ROM },
+       { 0xBDE67498, "Cybermorph (World) (Rev 1)", "cybermorph-2mb.jpg", FF_ROM },
+       { 0xC5562581, "Zoop! (World)", "zoop.jpg", FF_ROM },
+       { 0xC654681B, "Total Carnage (World)", "total-carnage.jpg", FF_ROM },
+       { 0xC6C7BA62, "Fight for Life (World) (Alt)", "", FF_ROM | FF_BAD_DUMP },
+       { 0xC9608717, "Val d'Isere Skiing and Snowboarding (World)", "val-d'isere-skiing.jpg", FF_ROM },
+       { 0xCAF33BD6, "Towers II", "towers-2.jpg", FF_ROM },
+       { 0xCD5BF827, "Attack of the Mutant Penguins (World)", "attack-of-the-mutant-pengiuns.jpg", FF_ROM },
+       { 0xD6C19E34, "Iron Soldier 2 (World)", "iron-soldier-2.jpg", FF_ROM },
+       { 0xDA9C4162, "Missile Command 3D (World)", "missile-command-3d.jpg", FF_ROM },
+       { 0xDC187F82, "Alien vs Predator (World)", "alien-vs-predator.jpg", FF_ROM },
+       { 0xDE55DCC7, "Flashback - The Quest for Identity (World) (En,Fr)", "flashback.jpg", FF_ROM },
+       { 0xE28756DE, "Atari Karts (World)", "atari-karts.jpg", FF_ROM },
+       { 0xE60277BB, "[BIOS] Atari Jaguar Stubulator '93 (World)", "", FF_BIOS },
+       { 0xE91BD644, "Wolfenstein 3D (World)", "wolfenstein-3d.jpg", FF_ROM },
+       { 0xEC22F572, "SuperCross 3D (World)", "supercross-3d.jpg", FF_ROM },
+       { 0xECF854E7, "Cybermorph (World) (Rev 2)", "cybermorph.jpg", FF_ROM },
+       { 0xEEE8D61D, "Club Drive (World)", "club-drive.jpg", FF_ROM },
+       { 0xF0360DB3, "Hyper Force (World)", "hyper-force.jpg", FF_ROM },
+       { 0xFA7775AE, "Checkered Flag (World)", "checkered-flag.jpg", FF_ROM },
+       { 0xFAE31DD0, "Flip Out! (World)", "flip-out.jpg", FF_ROM },
+       { 0xFB731AAA, "[BIOS] Atari Jaguar (World)", "", FF_BIOS },
+       { 0xFFFFFFFF, "***END***", "", 0 }
+};
+/*
+memory-track.jpg
+protector.jpg
+*/
diff --git a/src/filedb.h b/src/filedb.h
new file mode 100644 (file)
index 0000000..685f31f
--- /dev/null
@@ -0,0 +1,28 @@
+//
+// filedb.h: File database definition
+//
+
+#ifndef __FILEDB_H__
+#define __FILEDB_H__
+
+#include "types.h"
+
+// 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 };
+
+// Useful structs
+
+struct RomIdentifier
+{
+       const uint32 crc32;
+       const char name[128];
+       const char file[128];
+       const uint32 flags;
+};
+
+// So other stuff can pull this in...
+
+extern RomIdentifier romList[];
+
+#endif // __FILEDB_H__
index a841d885866ae305b992ef2c77bfc6f184de0f35..1129d17ca905e165ec5672e9a39e70ad922a6967 100644 (file)
 
 #include "filepicker.h"
 
+#include "filedb.h"
 #include "filelistmodel.h"
 #include "filethread.h"
 #include "imagedelegate.h"
-#include "settings.h"
-#include "types.h"
+//#include "settings.h"
+//#include "types.h"
 
 /*
 Our strategy here is like so:
@@ -67,7 +68,6 @@ FilePickerWindow::FilePickerWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt:
 void FilePickerWindow::AddFileToList(unsigned long index)
 {
 printf("FilePickerWindow: Found match [%s]...\n", romList[index].name);
-//printf("--> Found CRC: %08X...\n", romList2[index].crc32);
        // NOTE: The model *ignores* what you send it, so this is crap. !!! FIX !!!
 //     model->AddData(QIcon(":/res/generic.png"));
        model->AddData(index);
index 11c11ad6958810ffc2648ef902b64dd4f6c93e0e..d4cccc2ea3fbf3a11692a8d5da470ecec96a0726 100644 (file)
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
 // JLH  01/28/2010  Created this file
+// JLH  02/16/2010  Moved RomIdentifier stuff to its own file
 //
 
 #include "filethread.h"
 
 #include <QtGui>
 #include "crc32.h"
+#include "filedb.h"
 #include "settings.h"
-//#include "types.h"
 
-#if 0
-struct RomIdentifier
-{
-       const uint32 crc32;
-       const char name[128];
-       const char file[128];
-       const uint32 flags;
-};
-#endif
-
-// Should have another flag for whether or not it requires DSP, BIOS,
-// whether it's a .rom, it's a BIOS, etc...
-
-RomIdentifier romList[] = {
-       { 0x0509C85E, "Raiden (World)", "raiden.jpg", 0 },
-       { 0x08F15576, "Iron Soldier (World) (v1.04)", "iron-soldier.jpg", 0 },
-       { 0x0957A072, "Kasumi Ninja (World)", "kasumi-ninja.jpg", 0 },
-       { 0x0AC83D77, "NBA Jam T.E. (World)", "nba-jam.jpg", 0 },
-       { 0x0EC5369D, "Evolution - Dino Dudes (World)", "dino-dudes.jpg", 0 },
-       { 0x0F6A1C2C, "Ultra Vortek (World)", "ultra-vortek.jpg", 0 },
-       { 0x14915F20, "White Men Can't Jump (World)", "white-men-can't-jump.jpg", 0 },
-       { 0x1660F070, "Power Drive Rally (World)", "power-drive-rally.jpg", 0 },
-       { 0x1E451446, "Trevor McFur in the Crescent Galaxy (World)", "trevor-mcfur.jpg", 0 },
-       { 0x27594C6A, "Defender 2000 (World)", "defender-2000.jpg", 0 },
-       { 0x2E17D5DA, "Bubsy in Fractured Furry Tales (World)", "bubsy.jpg", 0 },
-       { 0x348E6449, "Double Dragon V - The Shadow Falls (World)", "double-dragon.jpg", 0 },
-       { 0x3615AF6A, "Fever Pitch Soccer (World) (En,Fr,De,Es,It)", "fever-pitch-soccer.jpg", 0 },
-       { 0x38A130ED, "Troy Aikman NFL Football (World)", "troy-aikman-football.jpg", 0 },
-       { 0x3C044941, "Skyhammer (World)", "skyhammer.jpg", 0 },
-       { 0x42A13EC5, "Soccer Kid (World)", "soccer-kid.jpg", 0 },
-       { 0x47EBC158, "Theme Park (World)", "theme-park.jpg", 0 },
-       { 0x4899628F, "Hover Strike (World)", "hover-strike.jpg", 0 },
-       { 0x53DF6440, "Space War 2000 (World)", "", 0 },
-       { 0x55A0669C, "[BIOS] Atari Jaguar Developer CD (World)", "", 0 },
-       { 0x58272540, "Syndicate (World)", "syndicate.jpg", 0 },
-       { 0x5A101212, "Sensible Soccer - International Edition (World)", "sensible-soccer.jpg", 0 },
-       { 0x5B6BB205, "Ruiner Pinball (World)", "ruiner-pinball.jpg", 0 },
-       { 0x5CFF14AB, "Pinball Fantasies (World)", "pinball-fantasies.jpg", 0 },
-       { 0x5E2CDBC0, "Doom (World)", "doom.jpg", 0 },
-       { 0x61C7EEC0, "Zero 5 (World)", "zero-5.jpg", 0 },
-       { 0x67F9AB3A, "Battle Sphere Gold (World)", "", 0 },
-       { 0x687068D5, "[BIOS] Atari Jaguar CD (World)", "", 0 },
-       { 0x6B2B95AD, "Tempest 2000 (World)", "tempest-2000.jpg", 0 },
-       { 0x6EB774EB, "Worms (World)", "worms.jpg", 0 },
-       { 0x6F8B2547, "Super Burnout (World)", "super-burnout.jpg", 0 },
-       { 0x817A2273, "Pitfall - The Mayan Adventure (World)", "pitfall.jpg", 0 },
-       { 0x8975F48B, "Zool 2 (World)", "zool-2.jpg", 0 },
-       { 0x8D15DBC6, "[BIOS] Atari Jaguar Stubulator '94 (World)", "", 0 },
-       { 0x8FEA5AB0, "Dragon - The Bruce Lee Story (World)", "dragon.jpg", 0 },
-       { 0x97EB4651, "I-War (World)", "i-war.jpg", 0 },
-       { 0xA27823D8, "Ultra Vortek (World) (v0.94) (Beta)", "", 0 },
-       { 0xA56D0798, "Protector - Special Edition (World)", "protector-se.jpg", 0 },
-       { 0xA9F8A00E, "Rayman (World)", "rayman.jpg", 0 },
-       { 0xB14C4753, "Fight for Life (World)", "fight-for-life.jpg", 0 },
-       { 0xBCB1A4BF, "Brutal Sports Football (World)", "brutal-sports-football.jpg", 0 },
-       { 0xBDA405C6, "Cannon Fodder (World)", "cannon-fodder.jpg", 0 },
-       { 0xBDE67498, "Cybermorph (World) (Rev 1)", "cybermorph-2mb.jpg", 0 },
-       { 0xC5562581, "Zoop! (World)", "zoop.jpg", 0 },
-       { 0xC654681B, "Total Carnage (World)", "total-carnage.jpg", 0 },
-       { 0xC6C7BA62, "Fight for Life (World) (Alt) [BOGUS DUMP]", "", 0 },
-       { 0xC9608717, "Val d'Isere Skiing and Snowboarding (World)", "val-d'isere-skiing.jpg", 0 },
-       { 0xCBFD822A, "Air Cars (World)", "air-cars.jpg", 0 },
-       { 0xCD5BF827, "Attack of the Mutant Penguins (World)", "attack-of-the-mutant-pengiuns.jpg", 0 },
-       { 0xD6C19E34, "Iron Soldier 2 (World)", "iron-soldier-2.jpg", 0 },
-       { 0xDA9C4162, "Missile Command 3D (World)", "missile-command-3d.jpg", 0 },
-       { 0xDC187F82, "Alien vs Predator (World)", "alien-vs-predator.jpg", 0 },
-       { 0xDE55DCC7, "Flashback - The Quest for Identity (World) (En,Fr)", "flashback.jpg", 0 },
-       { 0xE28756DE, "Atari Karts (World)", "atari-karts.jpg", 0 },
-       { 0xE60277BB, "[BIOS] Atari Jaguar Stubulator '93 (World)", "", 0 },
-       { 0xE91BD644, "Wolfenstein 3D (World)", "wolfenstein-3d.jpg", 0 },
-       { 0xEC22F572, "SuperCross 3D (World)", "supercross-3d.jpg", 0 },
-       { 0xECF854E7, "Cybermorph (World) (Rev 2)", "cybermorph.jpg", 0 },
-       { 0xEEE8D61D, "Club Drive (World)", "club-drive.jpg", 0 },
-       { 0xF0360DB3, "Hyper Force (World)", "hyper-force.jpg", 0 },
-       { 0xFA7775AE, "Checkered Flag (World)", "checkered-flag.jpg", 0 },
-       { 0xFAE31DD0, "Flip Out! (World)", "flip-out.jpg", 0 },
-       { 0xFB731AAA, "[BIOS] Atari Jaguar (World)", "", 0 },
-       { 0xFFFFFFFF, "***END***", "", 0 }
-};
-/*
-breakout-2000.jpg
-memory-track.jpg
-protector.jpg
-towers-2.jpg
-*/
-
-/*
-Our strategy here is like so:
-Look at the files in the directory pointed to by ROMPath.
-For each file in the directory, take the CRC32 of it and compare it to the CRC
-in the romList[]. If there's a match, put it in a list and note it's index value
-in romList for future reference.
-
-When constructing the list, use the index to pull up an image of the cart and
-put that in the list. User picks from a graphical image of the cart.
-
-Ideally, the label will go into the archive along with the ROM image, but that's
-for the future...
-Maybe box art, screenshots will go as well...
-*/
-
-FileThread::FileThread(QObject * parent/*= 0*/): QThread(parent), /*listWidget(NULL),*/ abort(false)
+FileThread::FileThread(QObject * parent/*= 0*/): QThread(parent), abort(false)
 {
 }
 
@@ -133,20 +33,34 @@ FileThread::~FileThread()
        wait();
 }
 
-//void FileThread::Go(QListWidget * lw)
 void FileThread::Go(void)
 {
        QMutexLocker locker(&mutex);
-//     this->listWidget = lw;
        start();
 }
 
+/*
+Our strategy here is like so:
+Look at the files in the directory pointed to by ROMPath.
+For each file in the directory, take the CRC32 of it and compare it to the CRC
+in the romList[]. If there's a match, put it in a list and note it's index value
+in romList for future reference.
+
+When constructing the list, use the index to pull up an image of the cart and
+put that in the list. User picks from a graphical image of the cart.
+
+Ideally, the label will go into the archive along with the ROM image, but that's
+for the future...
+Maybe box art, screenshots will go as well...
+*/
+
 //
 // Here's the thread's actual execution path...
 //
 void FileThread::run(void)
 {
        QDir romDir(vjs.ROMPath);
+//     QDir romDir("../virtualjaguar/roms/rarities/");
        QFileInfoList list = romDir.entryInfoList();
 
 /*
@@ -175,17 +89,11 @@ printf("FileThread: Aborting!!!\n");
                        file.read((char *)buffer, fileInfo.size());
                        uint32 crc = crc32_calcCheckSum(buffer, fileInfo.size());
                        file.close();
-//printf("FilePickerWindow: File crc == %08X...\n", crc);
 
                        uint32 index = FindCRCIndexInFileList(crc);
 
-                       if (index != 0xFFFFFFFF)
-                       {
-//printf("FileThread: Found match [%s]...\n", romList[index].name);
-//                             new QListWidgetItem(QIcon(":/res/generic.png"), romList[index].name, listWidget);
-//                             emit FoundAFile(romList[index].crc32);
+                       if (index != 0xFFFFFFFF && !(romList[index].flags & FF_BIOS))
                                emit FoundAFile(index);
-                       }
                }
 
                delete[] buffer;
index 24f0c9d2c05d19049eb4046760d637f3d5b2821e..0065f51fb6f542db026dee8d594d6824f4e78032 100644 (file)
@@ -8,9 +8,6 @@
 #include <QtCore>
 #include "types.h"
 
-// Forward declarations
-//class QListWidget;
-
 class FileThread: public QThread
 {
        Q_OBJECT
@@ -18,7 +15,6 @@ class FileThread: public QThread
        public:
                FileThread(QObject * parent = 0);
                ~FileThread();
-//             void Go(QListWidget * lw);
                void Go(void);
 
        signals:
@@ -29,22 +25,9 @@ class FileThread: public QThread
                uint32 FindCRCIndexInFileList(uint32);
 
        private:
-//             QListWidget * listWidget;
                QMutex mutex;
                QWaitCondition condition;
                bool abort;
 };
 
-enum FileFlags { FF_ROM=1, FF_ALPINE=2, FF_BIOS=4, FF_REQ_DSP=8, FF_REQ_BIOS=16, FF_NON_WORKING=32 };
-
-struct RomIdentifier
-{
-       const uint32 crc32;
-       const char name[128];
-       const char file[128];
-       const uint32 flags;
-};
-
-extern RomIdentifier romList[];
-
 #endif // __FILETHREAD_H__
index b5dc508d8316f966584dbb344f6b866aa3ca5342..827bc007df39ff8715733b55fbf32435554d14dc 100644 (file)
@@ -15,8 +15,8 @@
 // class utilized in FilePicker.
 
 #include "imagedelegate.h"
-#warning "Move ROM database to its own file... !!! FIX !!!"
-#include "filethread.h"
+
+#include "filedb.h"
 
 
 ImageDelegate::ImageDelegate(QObject * parent): QAbstractItemDelegate(parent), pixelSize(12)
diff --git a/vj.cfg b/vj.cfg
index 68deaf21161385b2b420613ae930f653365358ab..ac70b4edd155ce15575d8c954bc534660b4ecd31 100644 (file)
--- a/vj.cfg
+++ b/vj.cfg
@@ -11,7 +11,7 @@ useJaguarBIOS = 0
 JagBootROM = ./bios/jagboot.rom
 CDBootROM = ./bios/jagcd.rom
 EEPROMs = ./eeproms
-ROMs = ./roms
+ROMs = ./software
 
 # OpenGL options: 1 - use OpenGL rendering, 0 - use old style rendering