X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Ffilethread.cpp;h=306af9fd4ff3596d46e69935d07e4737eb0bd37e;hb=26044acf8a4fe70772bd6e69afb8b8d20b5a6af5;hp=90bee21229cad767e9dd6403bed875d528e43ed5;hpb=742efd9b7deca399ca92f1c548e97836d626c86a;p=virtualjaguar diff --git a/src/gui/filethread.cpp b/src/gui/filethread.cpp index 90bee21..306af9f 100644 --- a/src/gui/filethread.cpp +++ b/src/gui/filethread.cpp @@ -1,10 +1,10 @@ // // filethread.cpp - File discovery thread // -// by James L. Hammons +// by James Hammons // (C) 2010 Underground Software // -// JLH = James L. Hammons +// JLH = James Hammons // // Who When What // --- ---------- ------------------------------------------------------------- @@ -21,6 +21,7 @@ #include "crc32.h" #include "file.h" #include "filedb.h" +//#include "memory.h" #include "settings.h" #define VERBOSE_LOGGING @@ -39,8 +40,9 @@ FileThread::~FileThread() wait(); } -void FileThread::Go(void) +void FileThread::Go(bool allowUnknown/*= false*/) { + allowUnknownSoftware = allowUnknown; QMutexLocker locker(&mutex); start(); } @@ -90,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; @@ -123,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,8 +143,16 @@ void FileThread::HandleFile(QFileInfo fileInfo) 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 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 ((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, //we can clobber this image before we have a chance to copy it out in the FilePicker function @@ -165,7 +178,8 @@ void FileThread::HandleFile(QFileInfo fileInfo) //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); } //