[gnome-games] master-system: Replace MasterSystemGame by GenericGame



commit b4c8bd8a79c672dbd266b7facd3145616d3de408
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Mar 25 06:59:20 2016 +0100

    master-system: Replace MasterSystemGame by GenericGame

 plugins/master-system/src/Makefile.am              |    1 -
 plugins/master-system/src/master-system-game.vala  |   46 --------------------
 .../master-system/src/master-system-plugin.vala    |   13 +++++-
 3 files changed, 12 insertions(+), 48 deletions(-)
---
diff --git a/plugins/master-system/src/Makefile.am b/plugins/master-system/src/Makefile.am
index e5f8d15..d4c6b18 100644
--- a/plugins/master-system/src/Makefile.am
+++ b/plugins/master-system/src/Makefile.am
@@ -6,7 +6,6 @@ libgames_master_system_plugin_la_DEPENDENCIES = \
        $(NULL)
 
 libgames_master_system_plugin_la_SOURCES = \
-       master-system-game.vala \
        master-system-header.vala \
        master-system-plugin.vala \
        $(NULL)
diff --git a/plugins/master-system/src/master-system-plugin.vala 
b/plugins/master-system/src/master-system-plugin.vala
index 31c9b32..f65154e 100644
--- a/plugins/master-system/src/master-system-plugin.vala
+++ b/plugins/master-system/src/master-system-plugin.vala
@@ -1,7 +1,9 @@
 // This file is part of GNOME Games. License: GPLv3
 
 private class Games.MasterSystemPlugin : Object, Plugin {
+       private const string FINGERPRINT_PREFIX = "master-system";
        private const string MIME_TYPE = "application/x-sms-rom";
+       private const string MODULE_BASENAME = "libretro-master-system.so";
 
        public GameSource get_game_source () throws Error {
                var query = new MimeTypeTrackerQuery (MIME_TYPE, game_for_uri);
@@ -13,7 +15,16 @@ private class Games.MasterSystemPlugin : Object, Plugin {
        }
 
        private static Game game_for_uri (string uri) throws Error {
-               return new MasterSystemGame (uri);
+               var file = File.new_for_uri (uri);
+               var header = new MasterSystemHeader (file);
+               header.check_validity ();
+
+               var uid = new FingerprintUid (uri, FINGERPRINT_PREFIX);
+               var title = new FilenameTitle (uri);
+               var cover = new DummyCover ();
+               var runner =  new RetroRunner (MODULE_BASENAME, uri, uid);
+
+               return new GenericGame (title, cover, runner);
        }
 }
 


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