[gnome-games/wip/exalm/platform-preferences: 27/46] plugins: Use RetroPlatform



commit b17c5239bbb032579d225bead651c8c1a6c372ec
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/ms-dos/src/ms-dos-plugin.vala                 |  4 ++--
 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 ++--
 13 files changed, 42 insertions(+), 34 deletions(-)
---
diff --git a/plugins/dreamcast/src/dreamcast-plugin.vala b/plugins/dreamcast/src/dreamcast-plugin.vala
index 1909984a..ad84d3f4 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 160397fe..62fbe0a4 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 b03e0223..d1bab433 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/ms-dos/src/ms-dos-plugin.vala b/plugins/ms-dos/src/ms-dos-plugin.vala
index 9f7c08e9..71bcab8d 100644
--- a/plugins/ms-dos/src/ms-dos-plugin.vala
+++ b/plugins/ms-dos/src/ms-dos-plugin.vala
@@ -6,10 +6,10 @@ private class Games.MsDosPlugin : Object, Plugin {
        private const string PLATFORM_ID = "MSDOS";
        private const string PLATFORM_NAME = _("MS-DOS");
 
-       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/nintendo-ds/src/nintendo-ds-plugin.vala b/plugins/nintendo-ds/src/nintendo-ds-plugin.vala
index aebbef56..16af6169 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 7df8018d..49fc7df5 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 8eec7c17..497e1429 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 e740283c..f5c705d9 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 dfa97800..1f81173a 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 d7895270..55f26cd7 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 600af436..034a5882 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]