]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/filethread.cpp
Moving towards a better file picker... :-)
[virtualjaguar] / src / gui / filethread.cpp
index 1f5a5aab51223e50e6d11af57d6a4f6b4c8d3214..a6ecd3fbd1dcbd3c435e058d3ee6f986286b52ef 100644 (file)
 #include "settings.h"
 //#include "types.h"
 
+#if 0
 struct RomIdentifier
 {
        const uint32 crc32;
        const char name[128];
        const char file[128];
 };
+#endif
 
 RomIdentifier romList[] = {
        { 0x0509C85E, "Raiden (World)", "" },
@@ -107,7 +109,7 @@ 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), /*listWidget(NULL),*/ abort(false)
 {
 }
 
@@ -121,22 +123,38 @@ FileThread::~FileThread()
        wait();
 }
 
-void FileThread::Go(QListWidget * lw)
+//void FileThread::Go(QListWidget * lw)
+void FileThread::Go(void)
 {
        QMutexLocker locker(&mutex);
-       this->listWidget = lw;
+//     this->listWidget = lw;
        start();
 }
 
+//
+// Here's the thread's actual execution path...
+//
 void FileThread::run(void)
 {
        QDir romDir(vjs.ROMPath);
        QFileInfoList list = romDir.entryInfoList();
 
+/*
+Another thing we'll probably have to do here is check for compressed files and
+decompress/fish around in them to find what we need. :-P
+*/
+
        for(int i=0; i<list.size(); i++)
        {
                if (abort)
+#if 1
+{
+printf("FileThread: Aborting!!!\n");
+#endif
                        return;
+#if 1
+}
+#endif
 
                QFileInfo fileInfo = list.at(i);
                QFile file(romDir.filePath(fileInfo.fileName()));
@@ -153,9 +171,10 @@ void FileThread::run(void)
 
                        if (index != 0xFFFFFFFF)
                        {
-printf("FileThread: Found match [%s]...\n", romList[index].name);
-                               new QListWidgetItem(QIcon(":/res/generic.png"), romList[index].name, listWidget);
-//                             break;
+//printf("FileThread: Found match [%s]...\n", romList[index].name);
+//                             new QListWidgetItem(QIcon(":/res/generic.png"), romList[index].name, listWidget);
+//                             emit FoundAFile(romList[index].crc32);
+                               emit FoundAFile(index);
                        }
                }
 
@@ -164,7 +183,8 @@ printf("FileThread: Found match [%s]...\n", romList[index].name);
 }
 
 //
-// Find a CRC in the ROM list. If it's there, return the index, otherwise return $FFFFFFFF
+// Find a CRC in the ROM list (simple brute force algorithm).
+// If it's there, return the index, otherwise return $FFFFFFFF
 //
 uint32 FileThread::FindCRCIndexInFileList(uint32 crc)
 {