X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Ffilethread.cpp;h=db9c44febab4aa2135af0194469c52696020e68c;hb=868fd551420e8b88e0bcf363c121e6e84a71b09a;hp=90bee21229cad767e9dd6403bed875d528e43ed5;hpb=742efd9b7deca399ca92f1c548e97836d626c86a;p=virtualjaguar diff --git a/src/gui/filethread.cpp b/src/gui/filethread.cpp index 90bee21..db9c44f 100644 --- a/src/gui/filethread.cpp +++ b/src/gui/filethread.cpp @@ -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(); } @@ -136,10 +138,22 @@ 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; - 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 @@ -165,7 +179,56 @@ 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); +} + +// +// 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; + } } //