[gnome-games] plugins: Add the msdos plugin



commit 113b31c2f5285af3827a609f57b1de747d0f8129
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed May 24 22:40:05 2017 +0200

    plugins: Add the msdos plugin
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783070

 configure.ac                          |    1 +
 plugins/Makefile.am                   |    4 +++
 plugins/ms-dos/Makefile.am            |    3 ++
 plugins/ms-dos/configure.ac           |   14 +++++++++
 plugins/ms-dos/data/Makefile.am       |    6 ++++
 plugins/ms-dos/data/ms-dos.plugin     |    6 ++++
 plugins/ms-dos/src/Makefile.am        |   49 +++++++++++++++++++++++++++++++++
 plugins/ms-dos/src/ms-dos-plugin.vala |   34 +++++++++++++++++++++++
 src/retro/retro-platform.vala         |    2 +
 9 files changed, 119 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fe04201..1d6b4e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ m4_include([plugins/love/configure.ac])
 m4_include([plugins/mame/configure.ac])
 m4_include([plugins/master-system/configure.ac])
 m4_include([plugins/mega-drive/configure.ac])
+m4_include([plugins/ms-dos/configure.ac])
 m4_include([plugins/neo-geo-pocket/configure.ac])
 m4_include([plugins/nintendo-64/configure.ac])
 m4_include([plugins/nintendo-ds/configure.ac])
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 11650a0..6df3e70 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -60,6 +60,10 @@ if ENABLE_MEGA_DRIVE_PLUGIN
 SUBDIRS += mega-drive
 endif
 
+if ENABLE_MS_DOS_PLUGIN
+SUBDIRS += ms-dos
+endif
+
 if ENABLE_NEO_GEO_POCKET_PLUGIN
 SUBDIRS += neo-geo-pocket
 endif
diff --git a/plugins/ms-dos/Makefile.am b/plugins/ms-dos/Makefile.am
new file mode 100644
index 0000000..5d55ad0
--- /dev/null
+++ b/plugins/ms-dos/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = data src
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/ms-dos/configure.ac b/plugins/ms-dos/configure.ac
new file mode 100644
index 0000000..28f7805
--- /dev/null
+++ b/plugins/ms-dos/configure.ac
@@ -0,0 +1,14 @@
+PKG_CHECK_MODULES(MS_DOS_PLUGIN, [
+       gio-2.0
+       glib-2.0 >= $GLIB_MIN_VERSION
+       gtk+-3.0
+       retro-gtk-0.10
+], [enable_ms_dos_plugin=yes], [enable_ms_dos_plugin=no])
+
+AM_CONDITIONAL(ENABLE_MS_DOS_PLUGIN, test x$enable_ms_dos_plugin != xno)
+
+AC_CONFIG_FILES([
+       plugins/ms-dos/Makefile
+       plugins/ms-dos/data/Makefile
+       plugins/ms-dos/src/Makefile
+])
diff --git a/plugins/ms-dos/data/Makefile.am b/plugins/ms-dos/data/Makefile.am
new file mode 100644
index 0000000..9fb67c4
--- /dev/null
+++ b/plugins/ms-dos/data/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = $(plugin_DATA)
+
+plugindir = $(libdir)/gnome-games/plugins
+dist_plugin_DATA = ms-dos.plugin
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/ms-dos/data/ms-dos.plugin b/plugins/ms-dos/data/ms-dos.plugin
new file mode 100644
index 0000000..220f2df
--- /dev/null
+++ b/plugins/ms-dos/data/ms-dos.plugin
@@ -0,0 +1,6 @@
+[Plugin]
+Module=libgames-ms-dos-plugin
+Name=MS-DOS Plugin
+Description=Provides support for MS-DOS games.
+Authors=Adrien Plazas <kekun plazas laposte net>
+Copyright=Copyright © 2017 Adrien Plazas
diff --git a/plugins/ms-dos/src/Makefile.am b/plugins/ms-dos/src/Makefile.am
new file mode 100644
index 0000000..4b77879
--- /dev/null
+++ b/plugins/ms-dos/src/Makefile.am
@@ -0,0 +1,49 @@
+plugindir = $(libdir)/gnome-games/plugins
+plugin_LTLIBRARIES = libgames-ms-dos-plugin.la
+
+libgames_ms_dos_plugin_la_DEPENDENCIES = \
+       $(top_builddir)/src/gnome-games.vapi \
+       $(NULL)
+
+libgames_ms_dos_plugin_la_SOURCES = \
+       ms-dos-plugin.vala \
+       $(NULL)
+
+libgames_ms_dos_plugin_la_VALAFLAGS = \
+       --target-glib=@GLIB_MIN_VERSION@ \
+       --pkg gnome-games \
+       --vapidir $(top_builddir)/src \
+       $(NULL)
+
+libgames_ms_dos_plugin_la_CFLAGS = \
+       $(MS_DOS_PLUGIN_CFLAGS) \
+       $(GNOME_GAMES_CFLAGS) \
+       -DG_LOG_DOMAIN=\"GamesMsDos\" \
+       -DLOCALEDIR=\"$(localedir)\" \
+       $(NULL)
+
+libgames_ms_dos_plugin_la_CPPFLAGS = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/src \
+       $(NULL)
+
+libgames_ms_dos_plugin_la_LIBADD = \
+       $(MS_DOS_PLUGIN_LIBS) \
+       $(GNOME_GAMES_LIBS) \
+       $(NULL)
+
+libgames_ms_dos_plugin_la_LDFLAGS = \
+       -no-undefined \
+       -module \
+       -avoid-version \
+       $(NULL)
+
+EXTRA_DIST = \
+       $(plugin_DATA) \
+       $(NULL)
+
+MAINTAINERCLEANFILES = \
+       $(BUILT_SOURCES) \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/ms-dos/src/ms-dos-plugin.vala b/plugins/ms-dos/src/ms-dos-plugin.vala
new file mode 100644
index 0000000..61de819
--- /dev/null
+++ b/plugins/ms-dos/src/ms-dos-plugin.vala
@@ -0,0 +1,34 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+private class Games.Nintendo64Plugin : Object, Plugin {
+       private const string FINGERPRINT_PREFIX = "ms-dos";
+       private const string MIME_TYPE = "application/x-ms-dos-executable";
+       private const string PLATFORM = "MSDOS";
+
+       public UriGameFactory[] get_uri_game_factories () {
+               var game_uri_adapter = new GenericGameUriAdapter (game_for_uri);
+               var factory = new GenericUriGameFactory (game_uri_adapter);
+               factory.add_mime_type (MIME_TYPE);
+
+               return { factory };
+       }
+
+       private static Game game_for_uri (Uri uri) throws Error {
+               var uid = new FingerprintUid (uri, FINGERPRINT_PREFIX);
+               var title = new FilenameTitle (uri);
+               var icon = new DummyIcon ();
+               var media = new GriloMedia (title, MIME_TYPE);
+               var cover = new CompositeCover ({
+                       new LocalCover (uri),
+                       new GriloCover (media, uid)});
+               var core_source = new RetroCoreSource (PLATFORM, { MIME_TYPE });
+               var runner = new RetroRunner (core_source, uri, uid, title);
+
+               return new GenericGame (title, icon, cover, runner);
+       }
+}
+
+[ModuleInit]
+public Type register_games_plugin (TypeModule module) {
+       return typeof(Games.Nintendo64Plugin);
+}
diff --git a/src/retro/retro-platform.vala b/src/retro/retro-platform.vala
index 63f7279..226e84a 100644
--- a/src/retro/retro-platform.vala
+++ b/src/retro/retro-platform.vala
@@ -31,6 +31,8 @@ namespace Games.RetroPlatform {
                case "MAME":
                        /* translators: the "Multiple Arcade Machine Emulator" */
                        return _("MAME");
+               case "MSDOS":
+                       return _("MS-DOS");
                case "NeoGeoPocket":
                        return _("Neo Geo Pocket");
                case "NintendoEntertainmentSystem":


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