[gnome-video-arcade] Drop support for xmame.



commit b351bf3140eb1055829b9811057482ce0b2b473c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jul 27 13:26:35 2015 -0400

    Drop support for xmame.
    
    xmame is long dead; the SDL port is the canonical MAME now.
    
    Remove both the xmame backend and all the multi-backend scaffolding.

 README                                         |   25 +---
 configure.ac                                   |   15 +--
 docs/gnome-video-arcade.1                      |    7 +-
 docs/reference/Makefile.am                     |    3 +-
 docs/reference/gnome-video-arcade-docs.sgml    |    1 -
 docs/reference/gnome-video-arcade-sections.txt |    8 +-
 gnome-video-arcade.doap                        |    8 +-
 po/POTFILES.in                                 |    4 +-
 src/Makefile.am                                |   11 +--
 src/gva-mame-common.h                          |   41 ------
 src/gva-mame-sdlmame.c                         |   97 -------------
 src/gva-mame-xmame.c                           |   97 -------------
 src/{gva-mame-common.c => gva-mame.c}          |  171 ++++++++++++-----------
 src/gva-mame.h                                 |   22 +---
 src/gva-preferences.c                          |    1 -
 src/gva-process.c                              |    4 +-
 src/gva-util.c                                 |   19 +---
 17 files changed, 114 insertions(+), 420 deletions(-)
---
diff --git a/README b/README
index 5442273..926940a 100644
--- a/README
+++ b/README
@@ -19,17 +19,11 @@ Dependencies
 GNOME Video Arcade has a few external dependencies which need to be
 installed prior to compiling the source code:
 
-   - mame or xmame
+   - mame
 
-       These may be available as pre-compiled packages from your
+       This may be available as a pre-compiled package from your
        GNU/Linux distribution.  If not, you can download and compile
-       the source code yourself.
-
-       I recommend mame (formerly sdlmame) over xmame.  The mame project
-       is still actively developed, xmame has been defunct for years.
-
-          mame:     http://mamedev.org/
-          xmame:    (formerly http://x.mame.net/, since taken down)
+       the source code yourself at https://github.com/mamedev/mame.
 
    - intltool
 
@@ -125,20 +119,11 @@ The standard installation procedure looks like this:
    To start: Applications -> Games -> Video Arcade
 
 If the configure script cannot find the MAME program, you can
-specify the MAME program location by defining a MAME or XMAME
-environment variable, like this:
+specify the MAME program location by defining an environment
+variable, like this:
 
    $ MAME=/path/to/program/mame ./configure
 
-   or
-
-   $ XMAME=/path/to/program/xmame ./configure
-
-The choice of environment variable determines which MAME driver
-is compiled, so use the MAME environment variable if you have the
-official mame software installed, or the XMAME environment variable
-if you have xmame installed.
-
 You can use the --with-category-file configure option to specify
 the location of a catver.ini file as mentioned above.  Usage looks
 something like this:
diff --git a/configure.ac b/configure.ac
index 25fcfc4..6f066f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,27 +117,18 @@ AC_ARG_VAR([MAME], [MAME command])
 AC_PATH_PROGS([MAME], [mame sdlmame],, [$PATH:/usr/local/games:/usr/games])
 if test "x$MAME" != "x"; then
         MAME_PROGRAM=$MAME
-        MAME_BACKEND='gva-mame-sdlmame.$(OBJEXT)'
-else
-        AC_ARG_VAR([XMAME], [XMAME command])
-        AC_PATH_PROG([XMAME], [xmame],, [$PATH:/usr/local/games:/usr/games])
-        if test "x$XMAME" != "x"; then
-                MAME_PROGRAM=$XMAME
-                MAME_BACKEND='gva-mame-xmame.$(OBJEXT)'
-        fi
 fi
 if test "x$MAME" = "x"; then
         AC_MSG_ERROR([
 
         Unable to find a MAME program.
 
-        Please install either sdlmame or xmame, or specify the
-        MAME command with a MAME or XMAME environment variable.
+        Please install MAME, or specify the path to the
+        executable binary with a MAME environment variable.
 
-        e.g. XMAME=/path/to/program/xmame.x11 ./configure
+        e.g. MAME=/path/to/program/mame ./configure
 ])
 fi
-AC_SUBST([MAME_BACKEND])
 AC_DEFINE_UNQUOTED(MAME_PROGRAM, "$MAME_PROGRAM", [Location of the MAME program])
 
 # Localization
diff --git a/docs/gnome-video-arcade.1 b/docs/gnome-video-arcade.1
index 71e6736..b6583e2 100644
--- a/docs/gnome-video-arcade.1
+++ b/docs/gnome-video-arcade.1
@@ -9,11 +9,8 @@ gnome-video-arcade \- A MAME front-end for GNOME
 [\fIOPTION\fR...]
 .SH DESCRIPTION
 .B gnome-video-arcade
-is a MAME front-end for the GNOME Desktop Environment.  It supports both the
-.B xmame
-and
-.B sdlmame
-ports of the original MAME program written by Nicola Salmoria.
+is a MAME front-end for desktop environments compliant with the various
+freedesktop.org specifications.
 .P
 This program is targeted towards non-technical arcade enthusiasts who just
 want to easily play classic arcade games on their desktop.  Though it may
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index a39238f..00510d4 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -93,7 +93,7 @@ GTKDOC_LIBS=                                                  \
        $(top_builddir)/src/gva-history.o                       \
        $(top_builddir)/src/gva-input-file.o                    \
        $(top_builddir)/src/gva-main.o                          \
-       $(top_builddir)/src/gva-mame-common.o                   \
+       $(top_builddir)/src/gva-mame.o                          \
        $(top_builddir)/src/gva-mame-process.o                  \
        $(top_builddir)/src/gva-mute-button.o                   \
        $(top_builddir)/src/gva-nplayers.o                      \
@@ -107,7 +107,6 @@ GTKDOC_LIBS=                                                        \
        $(top_builddir)/src/gva-ui.o                            \
        $(top_builddir)/src/gva-util.o                          \
        $(top_builddir)/src/gva-wnck.o                          \
-       $(top_builddir)/src/@MAME_BACKEND@                      \
        $(GLIB_LIBS)                                            \
        $(GTK_LIBS)                                             \
        $(SOUP_LIBS)                                            \
diff --git a/docs/reference/gnome-video-arcade-docs.sgml b/docs/reference/gnome-video-arcade-docs.sgml
index 1287614..8e54e22 100644
--- a/docs/reference/gnome-video-arcade-docs.sgml
+++ b/docs/reference/gnome-video-arcade-docs.sgml
@@ -28,7 +28,6 @@
     <xi:include href="xml/gva-error.xml"/>
     <xi:include href="xml/gva-favorites.xml"/>
     <xi:include href="xml/gva-history.xml"/>
-    <xi:include href="xml/gva-mame-common.xml"/>
     <xi:include href="xml/gva-mame.xml"/>
     <xi:include href="xml/gva-nplayers.xml"/>
     <xi:include href="xml/gva-time.xml"/>
diff --git a/docs/reference/gnome-video-arcade-sections.txt b/docs/reference/gnome-video-arcade-sections.txt
index fa30228..0ea24dc 100644
--- a/docs/reference/gnome-video-arcade-sections.txt
+++ b/docs/reference/gnome-video-arcade-sections.txt
@@ -193,7 +193,7 @@ gva_main_window_destroy_cb
 
 <SECTION>
 <FILE>gva-mame</FILE>
-gva_mame_get_path_sep
+gva_mame_command
 gva_mame_get_version
 gva_mame_get_version_int
 gva_mame_get_total_supported
@@ -216,18 +216,12 @@ gva_mame_get_input_directory
 gva_mame_get_snapshot_directory
 gva_mame_get_state_directory
 gva_mame_supports_auto_save
-gva_mame_supports_full_screen
 gva_mame_supports_maximize
 gva_mame_supports_sound
 gva_mame_supports_window
 </SECTION>
 
 <SECTION>
-<FILE>gva-mame-common</FILE>
-gva_mame_command
-</SECTION>
-
-<SECTION>
 <FILE>gva-mame-process</FILE>
 <TITLE>GvaMameProcess</TITLE>
 GvaMameProcess
diff --git a/gnome-video-arcade.doap b/gnome-video-arcade.doap
index 86cd5da..436e8e9 100644
--- a/gnome-video-arcade.doap
+++ b/gnome-video-arcade.doap
@@ -5,11 +5,9 @@
          xmlns="http://usefulinc.com/ns/doap#";>
 
   <name xml:lang="en">GNOME Video Arcade</name>
-  <shortdesc xml:lang="en">Simple MAME frontend for the GNOME Desktop</shortdesc>
-  <description>GNOME Video Arcade is a simple MAME frontend, which
-supports both the xmame and sdlmame ports of MAME for GNU/Linux and other
-UNIX-like operating systems, and can utilize third-party data files like
-arcade history and game categories.
+  <shortdesc xml:lang="en">Simple MAME frontend for free desktops</shortdesc>
+  <description>GNOME Video Arcade is a MAME front-end for desktop environments
+compliant with the various freedesktop.org specifications.
 
 GNOME Video Arcade recognizes that the frontend is not the point; the
 games are. As such, its chief design goal is to help you quickly find a
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a7730f5..6bfe506 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,10 +9,8 @@ src/gva-column-manager.c
 src/gva-columns.c
 src/gva-input-file.c
 src/gva-main.c
-src/gva-mame-common.c
+src/gva-mame.c
 src/gva-mame-process.c
-src/gva-mame-sdlmame.c
-src/gva-mame-xmame.c
 src/gva-mute-button.c
 src/gva-nplayers.c
 src/gva-play-back.c
diff --git a/src/Makefile.am b/src/Makefile.am
index b6182ec..dfa7d40 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,10 +42,9 @@ gnome_video_arcade_SOURCES = \
        gva-input-file.h                \
        gva-main.c                      \
        gva-main.h                      \
-       gva-mame-common.c               \
-       gva-mame-common.h               \
        gva-mame-process.c              \
        gva-mame-process.h              \
+       gva-mame.c                      \
        gva-mame.h                      \
        gva-mute-button.c               \
        gva-mute-button.h               \
@@ -73,16 +72,8 @@ gnome_video_arcade_SOURCES = \
        gva-wnck.h                      \
        main.c
 
-EXTRA_gnome_video_arcade_SOURCES = \
-       gva-mame-sdlmame.c              \
-       gva-mame-xmame.c
-
 gnome_video_arcade_LDADD = \
        @GLIB_LIBS@ @GTK_LIBS@ \
-       @MAME_BACKEND@ \
        @SOUP_LIBS@ @SQLITE_LIBS@ @WNCK_LIBS@
 
-gnome_video_arcade_DEPENDENCIES = \
-       @MAME_BACKEND@
-
 -include $(top_srcdir)/git.mk
diff --git a/src/gva-mame-common.c b/src/gva-mame.c
similarity index 91%
rename from src/gva-mame-common.c
rename to src/gva-mame.c
index e0f2b83..fe189cc 100644
--- a/src/gva-mame-common.c
+++ b/src/gva-mame.c
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "gva-mame-common.h"
+#include "gva-mame.h"
 
 #include <errno.h>
 #include <stdlib.h>
@@ -34,10 +34,6 @@
 #include "gva-preferences.h"
 #include "gva-ui.h"
 
-/*****************************************************************************
- * Private utilities for MAME backends
- *****************************************************************************/
-
 /**
  * gva_mame_command:
  * @arguments: command line arguments
@@ -103,9 +99,54 @@ fail:
         return status;
 }
 
-/*****************************************************************************
- * Partial implementation of public MAME interface
- *****************************************************************************/
+/**
+ * gva_mame_get_version:
+ * @error: return location for a #GError, or %NULL
+ *
+ * Returns the version of the MAME executable that
+ * <emphasis>GNOME Video Arcade</emphasis> is configured to use.  If an
+ * error occurs, it returns %NULL and sets @error.
+ *
+ * Returns: the MAME version, or %NULL
+ **/
+gchar *
+gva_mame_get_version (GError **error)
+{
+        gchar *version = NULL;
+        gchar **lines;
+        gchar *cp;
+
+        /* Execute the command "${mame} -help". */
+        if (gva_mame_command ("-help", &lines, NULL, error) != 0)
+                return NULL;
+
+        /* Output is as follows:
+         *
+         * M.A.M.E. v0.xxx (Mmm dd yyyy) - Multiple Arcade Machine Emulator
+         * Copyright (x) 1997-2007 by Nicola Salmoria and the MAME Team
+         * ...
+         */
+
+        if (lines == NULL || lines[0] == NULL)
+                goto exit;
+
+        cp = strstr (lines[0], " - Multiple Arcade Machine Emulator");
+        if (cp != NULL)
+        {
+                *cp = '\0';
+                version = g_strdup (lines[0]);
+        }
+
+exit:
+        if (version == NULL)
+                g_set_error (
+                        error, GVA_ERROR, GVA_ERROR_MAME,
+                        _("Could not determine emulator version"));
+
+        g_strfreev (lines);
+
+        return version;
+}
 
 /**
  * gva_mame_get_version_int:
@@ -155,6 +196,42 @@ gva_mame_get_version_int (void)
 }
 
 /**
+ * gva_mame_get_total_supported:
+ * @error: return location for a #GError, or %NULL
+ *
+ * Returns the number of games supported by the MAME executable that
+ * <emphasis>GNOME Video Arcade</emphasis> is configured to use.  If an
+ * error occurs, it returns zero and sets @error.
+ *
+ * Returns: number of supported games, or zero
+ **/
+guint
+gva_mame_get_total_supported (GError **error)
+{
+        gchar **lines;
+        guint num_lines;
+
+        /* Execute the command "${mame} -listfull". */
+        if (gva_mame_command ("-listfull", &lines, NULL, error) != 0)
+                return 0;
+
+        /* Output is as follows:
+         *
+         * Name:     Description:
+         * puckman   "PuckMan (Japan set 1, Probably Bootleg)"
+         * puckmana  "PuckMan (Japan set 2)"
+         * puckmanf  "PuckMan (Japan set 1 with speedup hack)"
+         * ...
+         */
+
+        num_lines = (lines != NULL) ? g_strv_length (lines) : 0;
+        g_strfreev (lines);
+
+        /* Count the lines, excluding the header. */
+        return (num_lines > 1) ? num_lines - 1 : 0;
+}
+
+/**
  * gva_mame_get_config_value:
  * @config_key: a configuration key
  * @error: return location for a #GError, or %NULL
@@ -298,7 +375,7 @@ gva_mame_get_search_paths (const gchar *config_key,
         if (config_value == NULL)
                 return NULL;
 
-        return g_strsplit (config_value, gva_mame_get_path_sep (), -1);
+        return g_strsplit (config_value, ";", -1);
 }
 
 /**
@@ -620,19 +697,7 @@ gva_mame_run_game (const gchar *name,
                         g_string_append (arguments, "-noautosave ");
         }
 
-        /* Support for the -fullscreen and -window options appears to be
-         * mutually exclusive.  The latest xmame supports -fullscreen but
-         * not -window, while the latest sdlmame supports -window but not
-         * -fullscreen.  We'll use whichever is available. */
-
-        if (gva_mame_supports_full_screen ())
-        {
-                if (gva_preferences_get_full_screen ())
-                        g_string_append (arguments, "-fullscreen ");
-                else
-                        g_string_append (arguments, "-nofullscreen ");
-        }
-        else if (gva_mame_supports_window ())
+        if (gva_mame_supports_window ())
         {
                 if (gva_preferences_get_full_screen ())
                         g_string_append (arguments, "-nowindow ");
@@ -712,19 +777,7 @@ gva_mame_record_game (const gchar *name,
         if (gva_mame_supports_auto_save ())
                 g_string_append (arguments, "-noautosave ");
 
-        /* Support for the -fullscreen and -window options appears to be
-         * mutually exclusive.  The latest xmame supports -fullscreen but
-         * not -window, while the latest sdlmame supports -window but not
-         * -fullscreen.  We'll use whichever is available. */
-
-        if (gva_mame_supports_full_screen ())
-        {
-                if (gva_preferences_get_full_screen ())
-                        g_string_append (arguments, "-fullscreen ");
-                else
-                        g_string_append (arguments, "-nofullscreen ");
-        }
-        else if (gva_mame_supports_window ())
+        if (gva_mame_supports_window ())
         {
                 if (gva_preferences_get_full_screen ())
                         g_string_append (arguments, "-nowindow ");
@@ -786,19 +839,7 @@ gva_mame_playback_game (const gchar *name,
         if (gva_mame_supports_auto_save ())
                 g_string_append (arguments, "-noautosave ");
 
-        /* Support for the -fullscreen and -window options appears to be
-         * mutually exclusive.  The latest xmame supports -fullscreen but
-         * not -window, while the latest sdlmame supports -window but not
-         * -fullscreen.  We'll use whichever is available. */
-
-        if (gva_mame_supports_full_screen ())
-        {
-                if (gva_preferences_get_full_screen ())
-                        g_string_append (arguments, "-fullscreen ");
-                else
-                        g_string_append (arguments, "-nofullscreen ");
-        }
-        else if (gva_mame_supports_window ())
+        if (gva_mame_supports_window ())
         {
                 if (gva_preferences_get_full_screen ())
                         g_string_append (arguments, "-nowindow ");
@@ -976,37 +1017,3 @@ gva_mame_get_state_directory (GError **error)
         return directory;
 }
 
-/*****************************************************************************
- * Documentation for the rest of the public MAME interface
- *****************************************************************************/
-
-/**
- * gva_mame_get_path_sep:
- *
- * Returns the search path delimiter string.
- * XMAME uses UNIX-style ':' whereas SDLMAME uses Window-style ';'.
- *
- * Returns: search path delimiter string
- **/
-
-/**
- * gva_mame_get_version:
- * @error: return location for a #GError, or %NULL
- *
- * Returns the version of the MAME executable that
- * <emphasis>GNOME Video Arcade</emphasis> is configured to use.  If an
- * error occurs, it returns %NULL and sets @error.
- *
- * Returns: the MAME version, or %NULL
- **/
-
-/**
- * gva_mame_get_total_supported:
- * @error: return location for a #GError, or %NULL
- *
- * Returns the number of games supported by the MAME executable that
- * <emphasis>GNOME Video Arcade</emphasis> is configured to use.  If an
- * error occurs, it returns zero and sets @error.
- *
- * Returns: number of supported games, or zero
- **/
diff --git a/src/gva-mame.h b/src/gva-mame.h
index c264f0b..2a3c53f 100644
--- a/src/gva-mame.h
+++ b/src/gva-mame.h
@@ -20,10 +20,7 @@
  * SECTION: gva-mame
  * @short_description: MAME Communication Backend
  *
- * These functions define the interface for MAME communication backends.
- * <emphasis>GNOME Video Arcade</emphasis> currently supports backends for
- * <ulink url="http://x.mame.net/";>xmame</ulink> and
- * <ulink url="http://rbelmont.mameworld.info/?page_id=163";>sdlmame</ulink>.
+ * These functions define the interface for communication with MAME.
  **/
 
 #ifndef GVA_MAME_H
@@ -34,7 +31,10 @@
 
 G_BEGIN_DECLS
 
-const gchar *   gva_mame_get_path_sep           (void);
+gint            gva_mame_command                (const gchar *arguments,
+                                                 gchar ***stdout_lines,
+                                                 gchar ***stderr_lines,
+                                                 GError **error);
 gchar *         gva_mame_get_version            (GError **error);
 guint           gva_mame_get_version_int        (void);
 guint           gva_mame_get_total_supported    (GError **error);
@@ -83,18 +83,6 @@ const gchar *   gva_mame_get_state_directory    (GError **error);
         (gva_mame_has_config_value ("autosave"))
 
 /**
- * gva_mame_supports_full_screen:
- *
- * Returns %TRUE if the MAME executable that
- * <emphasis>GNOME Video Arcade</emphasis> is configured to use
- * supports a "fullscreen" option.
- *
- * Returns: %TRUE if MAME supports the "fullscreen" option
- **/
-#define gva_mame_supports_full_screen() \
-        (gva_mame_has_config_value ("fullscreen"))
-
-/**
  * gva_mame_supports_maximize:
  *
  * Returns %TRUE if the MAME executable that
diff --git a/src/gva-preferences.c b/src/gva-preferences.c
index 3b11d4b..88f3053 100644
--- a/src/gva-preferences.c
+++ b/src/gva-preferences.c
@@ -54,7 +54,6 @@ gva_preferences_init (void)
 
         gtk_action_set_sensitive (
                 GVA_ACTION_FULL_SCREEN,
-                gva_mame_supports_full_screen () ||
                 gva_mame_supports_window ());
 
         g_settings_bind (
diff --git a/src/gva-process.c b/src/gva-process.c
index 7f3333e..ac8edf9 100644
--- a/src/gva-process.c
+++ b/src/gva-process.c
@@ -1011,8 +1011,8 @@ gva_process_kill (GvaProcess *process)
 
         g_return_if_fail (GVA_IS_PROCESS (process));
 
-        /* XXX Using SIGKILL here because xmame appears to ignore SIGINT
-         *     and SIGTERM.  A friendlier approach for an arbitrary process
+        /* XXX Using SIGKILL because mame appears to ignore SIGINT and
+         *     SIGTERM.  A friendlier approach for an arbitrary process
          *     might be to use SIGTERM first.  Then, if it hasn't exited
          *     after a reasonable duration, SIGKILL. */
 
diff --git a/src/gva-util.c b/src/gva-util.c
index 0d252e6..5b86561 100644
--- a/src/gva-util.c
+++ b/src/gva-util.c
@@ -50,29 +50,12 @@ log_handler (const gchar *log_domain,
 static gboolean
 inpname_exists (const gchar *inppath, const gchar *inpname)
 {
-        gchar *inpfile;
         gchar *filename;
         gboolean exists;
 
-        /* Last version of xmame creates input files named "game.inp",
-         * but sdlmame names them "game".  Not sure when the extension
-         * was dropped (tested versions 0.120 - 0.123).  In any case,
-         * we need to check for both. */
-
-        inpfile = g_strdup_printf ("%s", inpname);
-        filename = g_build_filename (inppath, inpfile, NULL);
-        exists = g_file_test (filename, G_FILE_TEST_EXISTS);
-        g_free (filename);
-        g_free (inpfile);
-
-        if (exists)
-                return TRUE;
-
-        inpfile = g_strdup_printf ("%s.inp", inpname);
-        filename = g_build_filename (inppath, inpfile, NULL);
+        filename = g_build_filename (inppath, inpname, NULL);
         exists = g_file_test (filename, G_FILE_TEST_EXISTS);
         g_free (filename);
-        g_free (inpfile);
 
         return exists;
 }


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