//
// 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
// --- ---------- -------------------------------------------------------------
#include "crc32.h"
#include "file.h"
#include "filedb.h"
+//#include "memory.h"
#include "settings.h"
#define VERBOSE_LOGGING
//
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;
}
// 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);
uint32 index = FindCRCIndexInFileList(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,