[gnome-games] mega-drive: Replace MegaDriveGame by GenericGame



commit 0bfc32b2c1b3b1e6c7dde126f68eeb88412640f8
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Mar 25 07:00:54 2016 +0100

    mega-drive: Replace MegaDriveGame by GenericGame

 plugins/mega-drive/src/Makefile.am            |    1 -
 plugins/mega-drive/src/mega-drive-game.vala   |   46 -------------------------
 plugins/mega-drive/src/mega-drive-plugin.vala |   13 ++++++-
 3 files changed, 12 insertions(+), 48 deletions(-)
---
diff --git a/plugins/mega-drive/src/Makefile.am b/plugins/mega-drive/src/Makefile.am
index 5ad01a4..f754ef2 100644
--- a/plugins/mega-drive/src/Makefile.am
+++ b/plugins/mega-drive/src/Makefile.am
@@ -6,7 +6,6 @@ libgames_mega_drive_plugin_la_DEPENDENCIES = \
        $(NULL)
 
 libgames_mega_drive_plugin_la_SOURCES = \
-       mega-drive-game.vala \
        mega-drive-header.vala \
        mega-drive-plugin.vala \
        $(NULL)
diff --git a/plugins/mega-drive/src/mega-drive-plugin.vala b/plugins/mega-drive/src/mega-drive-plugin.vala
index 1209ba2..bc6da12 100644
--- a/plugins/mega-drive/src/mega-drive-plugin.vala
+++ b/plugins/mega-drive/src/mega-drive-plugin.vala
@@ -1,7 +1,9 @@
 // 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 MODULE_BASENAME = "libretro-pc-engine.so";
 
        public GameSource get_game_source () throws Error {
                var query = new MimeTypeTrackerQuery (MIME_TYPE, game_for_uri);
@@ -13,7 +15,16 @@ private class Games.MegaDrivePlugin : Object, Plugin {
        }
 
        private static Game game_for_uri (string uri) throws Error {
-               return new MegaDriveGame (uri);
+               var file = File.new_for_uri (uri);
+               var header = new MegaDriveHeader (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]