[gnome-games] game-boy: Replace GameBoyGame by GenericGame



commit 08d965b4bda56676f48cdb22965bb243c3484821
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Mar 23 09:07:11 2016 +0100

    game-boy: Replace GameBoyGame by GenericGame

 plugins/game-boy/src/Makefile.am          |    1 -
 plugins/game-boy/src/game-boy-game.vala   |   46 -----------------------------
 plugins/game-boy/src/game-boy-plugin.vala |   13 +++++++-
 3 files changed, 12 insertions(+), 48 deletions(-)
---
diff --git a/plugins/game-boy/src/Makefile.am b/plugins/game-boy/src/Makefile.am
index 474e1a3..c7bc3c6 100644
--- a/plugins/game-boy/src/Makefile.am
+++ b/plugins/game-boy/src/Makefile.am
@@ -6,7 +6,6 @@ libgames_game_boy_plugin_la_DEPENDENCIES = \
        $(NULL)
 
 libgames_game_boy_plugin_la_SOURCES = \
-       game-boy-game.vala \
        game-boy-header.vala \
        game-boy-plugin.vala \
        $(NULL)
diff --git a/plugins/game-boy/src/game-boy-plugin.vala b/plugins/game-boy/src/game-boy-plugin.vala
index 16d705c..5f5f0c1 100644
--- a/plugins/game-boy/src/game-boy-plugin.vala
+++ b/plugins/game-boy/src/game-boy-plugin.vala
@@ -1,7 +1,9 @@
 // This file is part of GNOME Games. License: GPLv3
 
 private class Games.GameBoyPlugin : Object, Plugin {
+       private const string FINGERPRINT_PREFIX = "game-boy";
        private const string MIME_TYPE = "application/x-gameboy-rom";
+       private const string MODULE_BASENAME = "libretro-game-boy.so";
 
        public GameSource get_game_source () throws Error {
                var query = new MimeTypeTrackerQuery (MIME_TYPE, game_for_uri);
@@ -13,7 +15,16 @@ private class Games.GameBoyPlugin : Object, Plugin {
        }
 
        private static Game game_for_uri (string uri) throws Error {
-               return new GameBoyGame (uri);
+               var file = File.new_for_uri (uri);
+               var header = new GameBoyHeader (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]