]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/filethread.cpp
Preparation for 2.1.0 release.
[virtualjaguar] / src / gui / filethread.cpp
index db9c44febab4aa2135af0194469c52696020e68c..306af9fd4ff3596d46e69935d07e4737eb0bd37e 100644 (file)
@@ -1,10 +1,10 @@
 //
 // filethread.cpp - File discovery thread
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2010 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
@@ -21,7 +21,7 @@
 #include "crc32.h"
 #include "file.h"
 #include "filedb.h"
-#include "memory.h"
+//#include "memory.h"
 #include "settings.h"
 
 #define VERBOSE_LOGGING
@@ -92,6 +92,9 @@ printf("FileThread: Aborting!!!\n");
 //
 void FileThread::HandleFile(QFileInfo fileInfo)
 {
+       // Really, need to come up with some kind of cacheing scheme here, so we don't
+       // fish through these files every time we run VJ :-P
+#warning "!!! Need to come up with some kind of cacheing scheme here !!!"
        bool haveZIPFile = (fileInfo.suffix().compare("zip", Qt::CaseInsensitive) == 0
                ? true : false);
        uint32_t fileSize = 0;
@@ -125,7 +128,7 @@ void FileThread::HandleFile(QFileInfo fileInfo)
        }
 
        // Try to divine the file type by size & header
-       int fileType = ParseFileType(buffer[0], buffer[1], fileSize);
+       int fileType = ParseFileType(buffer, fileSize);
 
        // Check for Alpine ROM w/Universal Header
        bool foundUniversalHeader = HasUniversalHeader(buffer, fileSize);
@@ -138,21 +141,17 @@ void FileThread::HandleFile(QFileInfo fileInfo)
                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
-       // BIOS files.
-       if (index == 0xFFFFFFFF)
+       // Here we filter out files that are *not* in the DB and of unknown type,
+       // and BIOS files. If desired, this can be overriden with a config option.
+       if ((index == 0xFFFFFFFF) && (fileType == JST_NONE))
        {
                // 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)
+       else if ((index != 0xFFFFFFFF) && romList[index].flags & FF_BIOS)
                return;
 
 //Here's a little problem. When we create the image here and pass it off to FilePicker,
@@ -183,54 +182,6 @@ void FileThread::HandleFile(QFileInfo fileInfo)
        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