[gnome-games/wip/exalm/platform-preferences: 16/26] plugins: Use RetroPlatform



commit 5fb5fd0e8b6f7c87a8277a60234ccb5d7709160a
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Sep 25 23:07:29 2018 +0500

    plugins: Use RetroPlatform

 plugins/dreamcast/src/dreamcast-plugin.vala           |  4 ++--
 plugins/game-cube/src/game-cube-plugin.vala           |  4 ++--
 plugins/mame/src/mame-game-uri-adapter.vala           |  4 ++--
 plugins/mame/src/mame-plugin.vala                     | 12 +++++++-----
 plugins/nintendo-ds/src/nintendo-ds-plugin.vala       |  4 ++--
 plugins/playstation/src/playstation-game-factory.vala |  4 ++--
 plugins/playstation/src/playstation-plugin.vala       | 10 ++++++----
 plugins/sega-cd/src/sega-cd-plugin.vala               | 12 +++++++-----
 plugins/sega-saturn/src/sega-saturn-plugin.vala       |  5 +++--
 plugins/turbografx-cd/src/turbografx-cd-plugin.vala   |  5 +++--
 plugins/virtual-boy/src/virtual-boy-plugin.vala       |  4 ++--
 plugins/wii/src/wii-plugin.vala                       |  4 ++--
 12 files changed, 40 insertions(+), 32 deletions(-)
---
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index 77ca8b28..55caba10 100644
--- a/plugins/dreamcast/src/dreamcast-plugin.vala
+++ b/plugins/dreamcast/src/dreamcast-plugin.vala
@@ -5,10 +5,10 @@ private class Games.DreamcastPlugin : Object, Plugin {
        private const string PLATFORM_ID = "Dreamcast";
        private const string PLATFORM_NAME = _("Dreamcast");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE });
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/game-cube/src/game-cube-plugin.vala b/plugins/game-cube/src/game-cube-plugin.vala
index a560e03e..71e3bd6f 100644
--- a/plugins/game-cube/src/game-cube-plugin.vala
+++ b/plugins/game-cube/src/game-cube-plugin.vala
@@ -5,10 +5,10 @@ private class Games.GameCubePlugin : Object, Plugin {
        private const string PLATFORM_ID = "GameCube";
        private const string PLATFORM_NAME = _("Nintendo GameCube");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE });
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/mame/src/mame-game-uri-adapter.vala b/plugins/mame/src/mame-game-uri-adapter.vala
index 278a356c..18232c0d 100644
--- a/plugins/mame/src/mame-game-uri-adapter.vala
+++ b/plugins/mame/src/mame-game-uri-adapter.vala
@@ -4,9 +4,9 @@ private class Games.MameGameUriAdapter : GameUriAdapter, Object {
        private const string SEARCHED_MIME_TYPE = "application/zip";
        private const string SPECIFIC_MIME_TYPE = "application/x-mame-rom";
 
-       private Platform platform;
+       private RetroPlatform platform;
 
-       public MameGameUriAdapter (Platform platform) {
+       public MameGameUriAdapter (RetroPlatform platform) {
                this.platform = platform;
        }
 
diff --git a/plugins/mame/src/mame-plugin.vala b/plugins/mame/src/mame-plugin.vala
index 099fc5bb..2e4e77a9 100644
--- a/plugins/mame/src/mame-plugin.vala
+++ b/plugins/mame/src/mame-plugin.vala
@@ -1,14 +1,16 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 private class Games.MamePlugin : Object, Plugin {
-       private const string MIME_TYPE = "application/zip";
+       private const string SEARCHED_MIME_TYPE = "application/zip";
+       private const string SPECIFIC_MIME_TYPE = "application/x-mame-rom";
        private const string PLATFORM_ID = "MAME";
        private const string PLATFORM_NAME = _("Arcade");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               string[] mime_types = { SEARCHED_MIME_TYPE, SPECIFIC_MIME_TYPE };
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, mime_types);
        }
 
        public Platform[] get_platforms () {
@@ -16,13 +18,13 @@ private class Games.MamePlugin : Object, Plugin {
        }
 
        public string[] get_mime_types () {
-               return { MIME_TYPE };
+               return { SEARCHED_MIME_TYPE };
        }
 
        public UriGameFactory[] get_uri_game_factories () {
                var game_uri_adapter = new MameGameUriAdapter (platform);
                var factory = new GenericUriGameFactory (game_uri_adapter);
-               factory.add_mime_type (MIME_TYPE);
+               factory.add_mime_type (SEARCHED_MIME_TYPE);
 
                return { factory };
        }
diff --git a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index 18c38e57..5183d7f6 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
@@ -6,10 +6,10 @@ private class Games.NintendoDsPlugin : Object, Plugin {
        private const string PLATFORM_ID = "NintendoDS";
        private const string PLATFORM_NAME = _("Nintendo DS");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE });
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/playstation/src/playstation-game-factory.vala 
b/plugins/playstation/src/playstation-game-factory.vala
index 31d41037..c977feba 100644
--- a/plugins/playstation/src/playstation-game-factory.vala
+++ b/plugins/playstation/src/playstation-game-factory.vala
@@ -12,9 +12,9 @@ public class Games.PlayStationGameFactory : Object, UriGameFactory {
        private HashTable<Uri, Game> game_for_uri;
        private HashTable<string, Game> game_for_disc_set_id;
        private GenericSet<Game> games;
-       private Platform platform;
+       private RetroPlatform platform;
 
-       public PlayStationGameFactory (Platform platform) {
+       public PlayStationGameFactory (RetroPlatform platform) {
                media_for_disc_id = new HashTable<string, Media> (str_hash, str_equal);
                game_for_uri = new HashTable<Uri, Game> (Uri.hash, Uri.equal);
                game_for_disc_set_id = new HashTable<string, Game> (GLib.str_hash, GLib.str_equal);
diff --git a/plugins/playstation/src/playstation-plugin.vala b/plugins/playstation/src/playstation-plugin.vala
index fcd1ee0a..967b4bef 100644
--- a/plugins/playstation/src/playstation-plugin.vala
+++ b/plugins/playstation/src/playstation-plugin.vala
@@ -1,14 +1,16 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 private class Games.PlayStation : Object, Plugin {
-       private const string MIME_TYPE = "application/x-cue";
+       private const string CUE_MIME_TYPE = "application/x-cue";
+       private const string PHONY_MIME_TYPE = "application/x-playstation-rom";
        private const string PLATFORM_ID = "PlayStation";
        private const string PLATFORM_NAME = _("PlayStation");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               string[] mime_types = { CUE_MIME_TYPE, PHONY_MIME_TYPE };
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, mime_types);
        }
 
        public Platform[] get_platforms () {
@@ -16,7 +18,7 @@ private class Games.PlayStation : Object, Plugin {
        }
 
        public string[] get_mime_types () {
-               return { MIME_TYPE };
+               return { CUE_MIME_TYPE };
        }
 
        public UriGameFactory[] get_uri_game_factories () {
diff --git a/plugins/sega-cd/src/sega-cd-plugin.vala b/plugins/sega-cd/src/sega-cd-plugin.vala
index be379a2c..b25a5567 100644
--- a/plugins/sega-cd/src/sega-cd-plugin.vala
+++ b/plugins/sega-cd/src/sega-cd-plugin.vala
@@ -13,12 +13,14 @@ private class Games.SegaCDPlugin : Object, Plugin {
        /* translators: known as "Mega-CD 32X" in most of the world */
        private const string SEGA_CD_32X_PLATFORM_NAME = _("Sega CD 32X");
 
-       private static Platform platform_sega_cd;
-       private static Platform platform_sega_cd_32x;
+       private static RetroPlatform platform_sega_cd;
+       private static RetroPlatform platform_sega_cd_32x;
 
        static construct {
-               platform_sega_cd = new GenericPlatform (SEGA_CD_PLATFORM_ID, SEGA_CD_PLATFORM_NAME);
-               platform_sega_cd_32x = new GenericPlatform (SEGA_CD_32X_PLATFORM_ID, 
SEGA_CD_32X_PLATFORM_NAME);
+               string[] mime_types = { CUE_MIME_TYPE, SEGA_CD_MIME_TYPE };
+               string[] mime_types_32x = { CUE_MIME_TYPE, SEGA_CD_MIME_TYPE, 32X_MIME_TYPE };
+               platform_sega_cd = new RetroPlatform (SEGA_CD_PLATFORM_ID, SEGA_CD_PLATFORM_NAME, mime_types);
+               platform_sega_cd_32x = new RetroPlatform (SEGA_CD_32X_PLATFORM_ID, SEGA_CD_32X_PLATFORM_NAME, 
mime_types_32x);
        }
 
        public Platform[] get_platforms () {
@@ -62,7 +64,7 @@ private class Games.SegaCDPlugin : Object, Plugin {
                header.check_validity ();
 
                string[] mime_types;
-               Platform platform;
+               RetroPlatform platform;
                if (header.is_sega_cd ()) {
                        mime_types = { CUE_MIME_TYPE, SEGA_CD_MIME_TYPE };
                        platform = platform_sega_cd;
diff --git a/plugins/sega-saturn/src/sega-saturn-plugin.vala b/plugins/sega-saturn/src/sega-saturn-plugin.vala
index f60867f2..4f1217b7 100644
--- a/plugins/sega-saturn/src/sega-saturn-plugin.vala
+++ b/plugins/sega-saturn/src/sega-saturn-plugin.vala
@@ -6,10 +6,11 @@ private class Games.SegaSaturnPlugin : Object, Plugin {
        private const string PLATFORM_ID = "SegaSaturn";
        private const string PLATFORM_NAME = _("Sega Saturn");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               string[] mime_types = { CUE_MIME_TYPE, SEGA_SATURN_MIME_TYPE };
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, mime_types);
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/turbografx-cd/src/turbografx-cd-plugin.vala 
b/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
index 1015adfa..c571cb54 100644
--- a/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
+++ b/plugins/turbografx-cd/src/turbografx-cd-plugin.vala
@@ -9,10 +9,11 @@ private class Games.TurboGrafxCDPlugin : Object, Plugin {
        /* translators: known as "CD-ROMĀ²" in eastern Asia and France */
        private const string PLATFORM_NAME = _("TurboGrafx-CD");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               string[] mime_types = { CUE_MIME_TYPE, PHONY_MIME_TYPE };
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, mime_types);
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/virtual-boy/src/virtual-boy-plugin.vala b/plugins/virtual-boy/src/virtual-boy-plugin.vala
index b926c54b..e614e0f0 100644
--- a/plugins/virtual-boy/src/virtual-boy-plugin.vala
+++ b/plugins/virtual-boy/src/virtual-boy-plugin.vala
@@ -6,10 +6,10 @@ private class Games.VirtualBoyPlugin : Object, Plugin {
        private const string PLATFORM_ID = "VirtualBoy";
        private const string PLATFORM_NAME = _("Virtual Boy");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE });
        }
 
        public Platform[] get_platforms () {
diff --git a/plugins/wii/src/wii-plugin.vala b/plugins/wii/src/wii-plugin.vala
index 1eecf092..96f94f37 100644
--- a/plugins/wii/src/wii-plugin.vala
+++ b/plugins/wii/src/wii-plugin.vala
@@ -5,10 +5,10 @@ private class Games.WiiPlugin : Object, Plugin {
        private const string PLATFORM_ID = "Wii";
        private const string PLATFORM_NAME = _("Wii");
 
-       private static Platform platform;
+       private static RetroPlatform platform;
 
        static construct {
-               platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
+               platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, { MIME_TYPE });
        }
 
        public Platform[] get_platforms () {


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