[gnome-games] playstation: Make PlayStationPlugin use PlayStationGameFactory



commit 89bdf78f01210ddfff22fb6a497669aabfd7b42b
Author: Ricard Gascons <gascons1995 gmail com>
Date:   Fri Aug 19 20:35:41 2016 +0200

    playstation: Make PlayStationPlugin use PlayStationGameFactory
    
    Make PlayStationPlugin use PlayStationGameFactory which groups sources
    from the same game under a unique title.
    
    This is the last in a series of commits to add multi-source support.
    
    Fixes #326

 plugins/playstation/src/Makefile.am             |    1 +
 plugins/playstation/src/playstation-plugin.vala |   23 +----------------------
 2 files changed, 2 insertions(+), 22 deletions(-)
---
diff --git a/plugins/playstation/src/Makefile.am b/plugins/playstation/src/Makefile.am
index fe442e8..a345974 100644
--- a/plugins/playstation/src/Makefile.am
+++ b/plugins/playstation/src/Makefile.am
@@ -29,6 +29,7 @@ libgames_playstation_plugin_la_DEPENDENCIES = \
 libgames_playstation_plugin_la_SOURCES = \
        $(BUILT_SOURCES) \
        playstation-error.vala \
+       playstation-game-factory.vala \
        playstation-header.vala \
        playstation-plugin.vala \
        playstation-uid.vala \
diff --git a/plugins/playstation/src/playstation-plugin.vala b/plugins/playstation/src/playstation-plugin.vala
index 50feebe..feab056 100644
--- a/plugins/playstation/src/playstation-plugin.vala
+++ b/plugins/playstation/src/playstation-plugin.vala
@@ -2,13 +2,9 @@
 
 private class Games.PlayStation : Object, Plugin {
        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 game_uri_adapter = new GenericSyncGameUriAdapter (game_for_uri);
-               var factory = new GenericUriGameFactory (game_uri_adapter);
+               var factory = new PlayStationGameFactory ();
                var query = new MimeTypeTrackerQuery (SEARCHED_MIME_TYPE, factory);
                var connection = Tracker.Sparql.Connection.@get ();
                var source = new TrackerGameSource (connection);
@@ -16,23 +12,6 @@ private class Games.PlayStation : Object, Plugin {
 
                return source;
        }
-
-       private static Game game_for_uri (string uri) throws Error {
-               var cue_file = File.new_for_uri (uri);
-               var cue_sheet = new CueSheet (cue_file);
-               var cue_track_node = cue_sheet.get_track (0);
-               var bin_file = cue_track_node.file.file;
-               var header = new PlayStationHeader (bin_file);
-               header.check_validity ();
-
-               var uid = new PlayStationUid (header);
-               var title = new FilenameTitle (uri);
-               var icon = new DummyIcon ();
-               var cover = new LocalCover (uri);
-               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);
-       }
 }
 
 [ModuleInit]


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