[gnome-games] Build retro runners with required MIME types



commit 6d2bbe2da9fc4c01a3cec68a6e86401e8e26e6f9
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Aug 9 12:36:28 2016 +0200

    Build retro runners with required MIME types
    
    This allows to look for a valid libretro core from its supported MIME
    types if none was found from retro-plugins.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769678

 plugins/amiga/src/amiga-plugin.vala                |    2 +-
 plugins/atari-2600/src/atari-2600-plugin.vala      |    2 +-
 plugins/atari-7800/src/atari-7800-plugin.vala      |    2 +-
 plugins/doom/src/doom-plugin.vala                  |    2 +-
 plugins/dreamcast/src/dreamcast-plugin.vala        |    2 +-
 .../src/game-boy-advance-plugin.vala               |    2 +-
 plugins/game-boy/src/game-boy-plugin.vala          |    2 +-
 plugins/game-cube/src/game-cube-plugin.vala        |    2 +-
 plugins/mame/src/mame-plugin.vala                  |    7 ++++---
 .../master-system/src/master-system-plugin.vala    |    4 ++--
 plugins/mega-drive/src/mega-drive-plugin.vala      |    2 +-
 .../neo-geo-pocket/src/neo-geo-pocket-plugin.vala  |    2 +-
 plugins/nes/src/nes-plugin.vala                    |    2 +-
 plugins/nintendo-64/src/nintendo-64-plugin.vala    |    2 +-
 plugins/nintendo-ds/src/nintendo-ds-plugin.vala    |    2 +-
 plugins/pc-engine/src/pc-engine-plugin.vala        |    2 +-
 plugins/playstation/src/playstation-plugin.vala    |    7 ++++---
 plugins/sega-saturn/src/sega-saturn-plugin.vala    |    2 +-
 plugins/snes/src/snes-plugin.vala                  |    2 +-
 plugins/wii-ware/src/wii-ware-plugin.vala          |    2 +-
 plugins/wii/src/wii-plugin.vala                    |    2 +-
 21 files changed, 28 insertions(+), 26 deletions(-)
---
diff --git a/plugins/amiga/src/amiga-plugin.vala b/plugins/amiga/src/amiga-plugin.vala
index 047aa46..be2da2b 100644
--- a/plugins/amiga/src/amiga-plugin.vala
+++ b/plugins/amiga/src/amiga-plugin.vala
@@ -21,7 +21,7 @@ private class Games.AmigaPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/atari-2600/src/atari-2600-plugin.vala b/plugins/atari-2600/src/atari-2600-plugin.vala
index 8d1833e..4bea6b4 100644
--- a/plugins/atari-2600/src/atari-2600-plugin.vala
+++ b/plugins/atari-2600/src/atari-2600-plugin.vala
@@ -21,7 +21,7 @@ private class Games.Atari2600 : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/atari-7800/src/atari-7800-plugin.vala b/plugins/atari-7800/src/atari-7800-plugin.vala
index b9fff2f..6872ea8 100644
--- a/plugins/atari-7800/src/atari-7800-plugin.vala
+++ b/plugins/atari-7800/src/atari-7800-plugin.vala
@@ -21,7 +21,7 @@ private class Games.Atari7800 : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/doom/src/doom-plugin.vala b/plugins/doom/src/doom-plugin.vala
index 15811c5..eb2fd11 100644
--- a/plugins/doom/src/doom-plugin.vala
+++ b/plugins/doom/src/doom-plugin.vala
@@ -20,7 +20,7 @@ private class Games.DoomPlugin : Object, Plugin {
                var title = new FilenameTitle (uri);
                var icon = new DummyIcon ();
                var cover = new DummyCover ();
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index c27b334..1bc35ae 100644
--- a/plugins/dreamcast/src/dreamcast-plugin.vala
+++ b/plugins/dreamcast/src/dreamcast-plugin.vala
@@ -24,7 +24,7 @@ private class Games.DreamcastPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/game-boy-advance/src/game-boy-advance-plugin.vala 
b/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
index 05a6eb0..38502c8 100644
--- a/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
+++ b/plugins/game-boy-advance/src/game-boy-advance-plugin.vala
@@ -21,7 +21,7 @@ private class Games.GameBoyAdvancePlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/game-boy/src/game-boy-plugin.vala b/plugins/game-boy/src/game-boy-plugin.vala
index dd9172f..270f488 100644
--- a/plugins/game-boy/src/game-boy-plugin.vala
+++ b/plugins/game-boy/src/game-boy-plugin.vala
@@ -25,7 +25,7 @@ private class Games.GameBoyPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/game-cube/src/game-cube-plugin.vala b/plugins/game-cube/src/game-cube-plugin.vala
index aeabbe4..1a55b70 100644
--- a/plugins/game-cube/src/game-cube-plugin.vala
+++ b/plugins/game-cube/src/game-cube-plugin.vala
@@ -24,7 +24,7 @@ private class Games.GameCubePlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/mame/src/mame-plugin.vala b/plugins/mame/src/mame-plugin.vala
index 529582e..0a8d147 100644
--- a/plugins/mame/src/mame-plugin.vala
+++ b/plugins/mame/src/mame-plugin.vala
@@ -1,12 +1,13 @@
 // This file is part of GNOME Games. License: GPLv3
 
 private class Games.MamePlugin : Object, Plugin {
+       private const string SEARCHED_MIME_TYPE = "application/zip";
+       private const string SPECIFIC_MIME_TYPE = "application/x-mame-rom";
        private const string MODULE_BASENAME = "libretro-mame.so";
-       private const string MIME_TYPE = "application/zip";
        private const bool SUPPORTS_SNAPSHOTTING = false;
 
        public GameSource get_game_source () throws Error {
-               var query = new MimeTypeTrackerQuery (MIME_TYPE, game_for_uri);
+               var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, game_for_uri);
                var connection = Tracker.Sparql.Connection.@get ();
                var source = new TrackerGameSource (connection);
                source.add_query (query);
@@ -35,7 +36,7 @@ private class Games.MamePlugin : Object, Plugin {
 
                var icon = new DummyIcon ();
                var cover = new DummyCover ();
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { SEARCHED_MIME_TYPE, 
SPECIFIC_MIME_TYPE }, MODULE_BASENAME, SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/master-system/src/master-system-plugin.vala 
b/plugins/master-system/src/master-system-plugin.vala
index 700d28d..2dd57f6 100644
--- a/plugins/master-system/src/master-system-plugin.vala
+++ b/plugins/master-system/src/master-system-plugin.vala
@@ -49,7 +49,7 @@ private class Games.MasterSystemPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, mime_type);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { mime_type }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
@@ -60,7 +60,7 @@ private class Games.MasterSystemPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, SG_1000_MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { SG_1000_MIME_TYPE }, 
MODULE_BASENAME, SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/mega-drive/src/mega-drive-plugin.vala b/plugins/mega-drive/src/mega-drive-plugin.vala
index f6f952f..682545a 100644
--- a/plugins/mega-drive/src/mega-drive-plugin.vala
+++ b/plugins/mega-drive/src/mega-drive-plugin.vala
@@ -51,7 +51,7 @@ private class Games.MegaDrivePlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, mime_type);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { mime_type }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala 
b/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
index 7989e15..a331f4d 100644
--- a/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
+++ b/plugins/neo-geo-pocket/src/neo-geo-pocket-plugin.vala
@@ -21,7 +21,7 @@ private class Games.NeoGeoPocketPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/nes/src/nes-plugin.vala b/plugins/nes/src/nes-plugin.vala
index a0b0ad4..281cc14 100644
--- a/plugins/nes/src/nes-plugin.vala
+++ b/plugins/nes/src/nes-plugin.vala
@@ -21,7 +21,7 @@ private class Games.NesPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/nintendo-64/src/nintendo-64-plugin.vala b/plugins/nintendo-64/src/nintendo-64-plugin.vala
index 8dbef9d..9bd39ef 100644
--- a/plugins/nintendo-64/src/nintendo-64-plugin.vala
+++ b/plugins/nintendo-64/src/nintendo-64-plugin.vala
@@ -21,7 +21,7 @@ private class Games.Nintendo64Plugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index 19b07d0..8518996 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -21,7 +21,7 @@ private class Games.NintendoDsPlugin : Object, Plugin {
                var icon = new NintendoDsIcon (uri);
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/pc-engine/src/pc-engine-plugin.vala b/plugins/pc-engine/src/pc-engine-plugin.vala
index 5c1ecf7..61a1ad4 100644
--- a/plugins/pc-engine/src/pc-engine-plugin.vala
+++ b/plugins/pc-engine/src/pc-engine-plugin.vala
@@ -21,7 +21,7 @@ private class Games.PcEnginePlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/playstation/src/playstation-plugin.vala b/plugins/playstation/src/playstation-plugin.vala
index a3be700..d13be8b 100644
--- a/plugins/playstation/src/playstation-plugin.vala
+++ b/plugins/playstation/src/playstation-plugin.vala
@@ -1,12 +1,13 @@
 // This file is part of GNOME Games. License: GPLv3
 
 private class Games.PlayStation : Object, Plugin {
-       private const string MIME_TYPE = "application/x-cue";
+       private const string SEARCHED_MIME_TYPE = "application/x-cue";
+       private const string SPECIFIC_MIME_TYPE = "application/x-playstation-rom";
        private const string MODULE_BASENAME = "libretro-playstation.so";
        private const bool SUPPORTS_SNAPSHOTTING = true;
 
        public GameSource get_game_source () throws Error {
-               var query = new MimeTypeTrackerQuery (MIME_TYPE, game_for_uri);
+               var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, game_for_uri);
                var connection = Tracker.Sparql.Connection.@get ();
                var source = new TrackerGameSource (connection);
                source.add_query (query);
@@ -26,7 +27,7 @@ private class Games.PlayStation : Object, Plugin {
                var title = new FilenameTitle (uri);
                var icon = new DummyIcon ();
                var cover = new DummyCover ();
-               var runner = new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { SEARCHED_MIME_TYPE, 
SPECIFIC_MIME_TYPE }, MODULE_BASENAME, SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index 18bfbd4..6bc1982 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -28,7 +28,7 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, SPECIFIC_MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { SEARCHED_MIME_TYPE, 
SPECIFIC_MIME_TYPE }, MODULE_BASENAME, SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/snes/src/snes-plugin.vala b/plugins/snes/src/snes-plugin.vala
index 66fd07e..a16ef7c 100644
--- a/plugins/snes/src/snes-plugin.vala
+++ b/plugins/snes/src/snes-plugin.vala
@@ -21,7 +21,7 @@ private class Games.SnesPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/wii-ware/src/wii-ware-plugin.vala b/plugins/wii-ware/src/wii-ware-plugin.vala
index dd41fdd..20f7d99 100644
--- a/plugins/wii-ware/src/wii-ware-plugin.vala
+++ b/plugins/wii-ware/src/wii-ware-plugin.vala
@@ -21,7 +21,7 @@ private class Games.WiiWarePlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }
diff --git a/plugins/wii/src/wii-plugin.vala b/plugins/wii/src/wii-plugin.vala
index c7fb75f..2531f5d 100644
--- a/plugins/wii/src/wii-plugin.vala
+++ b/plugins/wii/src/wii-plugin.vala
@@ -24,7 +24,7 @@ private class Games.WiiPlugin : Object, Plugin {
                var icon = new DummyIcon ();
                var media = new GriloMedia (title, MIME_TYPE);
                var cover = new GriloCover (media, uid);
-               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid, SUPPORTS_SNAPSHOTTING);
+               var runner = new RetroRunner.with_mime_types (uri, uid, { MIME_TYPE }, MODULE_BASENAME, 
SUPPORTS_SNAPSHOTTING);
 
                return new GenericGame (title, icon, cover, runner);
        }


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