[gnome-games] mega-drive: Support 32x games



commit 8b3027fa431d714fe3b4490f0b20b4cebbbc04b0
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Aug 3 11:15:47 2016 +0200

    mega-drive: Support 32x games
    
    The 32X MIME type have been discriminated from the Mega Drive one, hence
    we need to explicitly look for 32X games.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769473

 plugins/mega-drive/src/mega-drive-plugin.vala |   31 ++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/plugins/mega-drive/src/mega-drive-plugin.vala b/plugins/mega-drive/src/mega-drive-plugin.vala
index 865cc98..7443223 100644
--- a/plugins/mega-drive/src/mega-drive-plugin.vala
+++ b/plugins/mega-drive/src/mega-drive-plugin.vala
@@ -1,16 +1,22 @@
 // This file is part of GNOME Games. License: GPLv3
 
 private class Games.MegaDrivePlugin : Object, Plugin {
-       private const string FINGERPRINT_PREFIX = "mega-drive";
-       private const string MIME_TYPE = "application/x-genesis-rom";
+       private const string MEGA_DRIVE_PREFIX = "mega-drive";
+       private const string MEGA_DRIVE_MIME_TYPE = "application/x-genesis-rom";
+
+       private const string 32X_PREFIX = "mega-drive-32x";
+       private const string 32X_MIME_TYPE = "application/x-genesis-32x-rom";
+
        private const string MODULE_BASENAME = "libretro-mega-drive.so";
        private const bool SUPPORTS_SNAPSHOTTING = true;
 
        public GameSource get_game_source () throws Error {
-               var query = new MimeTypeTrackerQuery (MIME_TYPE, game_for_uri);
+               var mega_drive_query = new MimeTypeTrackerQuery (MEGA_DRIVE_MIME_TYPE, game_for_uri);
+               var 32x_query = new MimeTypeTrackerQuery (32X_MIME_TYPE, game_for_uri);
                var connection = Tracker.Sparql.Connection.@get ();
                var source = new TrackerGameSource (connection);
-               source.add_query (query);
+               source.add_query (mega_drive_query);
+               source.add_query (32x_query);
 
                return source;
        }
@@ -20,10 +26,23 @@ private class Games.MegaDrivePlugin : Object, Plugin {
                var header = new MegaDriveHeader (file);
                header.check_validity ();
 
-               var uid = new FingerprintUid (uri, FINGERPRINT_PREFIX);
+               string prefix;
+               string mime_type;
+               if (header.is_mega_drive ()) {
+                       prefix = MEGA_DRIVE_PREFIX;
+                       mime_type = MEGA_DRIVE_MIME_TYPE;
+               }
+               else if (header.is_32x ()) {
+                       prefix = 32X_PREFIX;
+                       mime_type = 32X_MIME_TYPE;
+               }
+               else
+                       assert_not_reached ();
+
+               var uid = new FingerprintUid (uri, prefix);
                var title = new FilenameTitle (uri);
                var icon = new DummyIcon ();
-               var media = new GriloMedia (title, MIME_TYPE);
+               var media = new GriloMedia (title, mime_type);
                var cover = new GriloCover (media, uid);
                var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]