[mythtv] [patch] mythgame

Jason York mythtv-dev at yorkspace.com
Tue Oct 5 21:07:00 UTC 2004


Hi,

This is my first patch, so go easy. :)

I've made a minor change to nesrominfo.cpp
Currently, mythgame tries to find the screen shot for NES games based
only on the screenshot column in the database.
My patch will first look for this file, if it fails, it tries to find an
image matching the Game Name found in the database, if that fails, it
attempts to match it to the same name as the ROM.

I have also included a small blurb to add to the mythgame README file.

Thanks for a great program.  Hope this patch helps.

-- Jason York




-------------- next part --------------
--- README.old	2004-09-10 01:59:28.000000000 -0400
+++ README	2004-09-21 18:12:30.586869808 -0400
@@ -48,6 +48,17 @@
 To use the generic PC game stuff, check out the example gamelist.xml file
 in this directory and modify it/add to it as desired.
 
+NES SETTINGS
+-----------------
+
+ROM Screenshots
+Screenshots must be in GIF format and must have an extension of ".gif"
+MythGame will first look to the database for the name of the screenshot. If
+that file is not found, it will then attempt to match an image with the
+the game name from the database.  If that fails, it will then atttempt to 
+find the image with the same name as the ROM file. 
+
+
 Feel free to subscribe to the development mailing list at:
 http://www.mythtv.org/mailman/listinfo/mythtv-dev
 


-------------- next part --------------
--- nesrominfo.cpp.old	2004-09-21 17:43:00.624944920 -0400
+++ nesrominfo.cpp.new	2004-09-21 17:56:43.815800888 -0400
@@ -5,6 +5,8 @@
 
 bool NesRomInfo::FindImage(QString type, QString* result)
 {
+    bool retval = false;
+    
     if (type != "screenshot")
         return false;
     
@@ -12,7 +14,7 @@
     // index that hopefully matches up with the game.
     
     QString thequery; 
-    thequery = QString("SELECT screenshot FROM nestitle WHERE "
+    thequery = QString("SELECT screenshot, description FROM nestitle WHERE "
                        "MATCH(description) AGAINST ('%1');").arg(Gamename());
     
     QSqlDatabase* db = QSqlDatabase::database();
@@ -23,10 +25,27 @@
         query.first();
         QString current = query.value(0).toString();
         *result = gContext->GetSetting("NesScreensLocation") + "/" + current + ".gif";
-        return QFile::exists(*result);
-    }
-    else
-    {
-        return false;
+        retval = QFile::exists(*result);
+        if (!retval)
+        {
+            // Look for file with the same name as the Game
+            current = query.value(1).toString();
+            *result = gContext->GetSetting("NesScreensLocation") + "/" + current + ".gif";
+            retval = QFile::exists(*result);
+        }
+        else if (!retval)
+        {
+            // Now just try to match the game name
+            *result = gContext->GetSetting("NesScreensLocation") + "/" + Gamename() + ".gif";
+            retval = QFile::exists(*result);
+        }
+        else if (!retval)
+        {
+            // Now just try to match the game name
+            *result = gContext->GetSetting("NesScreensLocation") + "/" + Romname() + ".gif";
+            retval = QFile::exists(*result);
+        }
+
     }
+    return retval;
 }




More information about the mythtv-dev mailing list