gva-mame

gva-mame — MAME Communication Backend

Synopsis




void                (*GvaMameCallback)                  (const gchar *name,
                                                         const gchar *game_data,
                                                         gpointer user_data);
gchar*              gva_mame_get_version                (GError **error);
guint               gva_mame_get_total_supported        (GError **error);
gchar*              gva_mame_get_config_value           (const gchar *config_key,
                                                         GError **error);
gboolean            gva_mame_has_config_value           (const gchar *config_key);
GHashTable*         gva_mame_get_input_files            (GError **error);
GvaProcess*         gva_mame_list_xml                   (GError **error);
GvaProcess*         gva_mame_verify_roms                (GvaMameCallback callback,
                                                         gpointer user_data,
                                                         GError **error);
GvaProcess*         gva_mame_verify_samples             (GvaMameCallback callback,
                                                         gpointer user_data,
                                                         GError **error);
GvaProcess*         gva_mame_run_game                   (const gchar *name,
                                                         GError **error);
GvaProcess*         gva_mame_record_game                (const gchar *name,
                                                         const gchar *inpname,
                                                         GError **error);
GvaProcess*         gva_mame_playback_game              (const gchar *name,
                                                         const gchar *inpname,
                                                         GError **error);
gchar*              gva_mame_get_save_state_file        (const gchar *name);
void                gva_mame_delete_save_state          (const gchar *name);
#define             gva_mame_supports_auto_save         ()
#define             gva_mame_supports_full_screen       ()
#define             gva_mame_supports_window            ()

Description

These functions define the interface for MAME communication backends. GNOME Video Arcade currently supports backends for xmame and sdlmame.

Details

GvaMameCallback ()

void                (*GvaMameCallback)                  (const gchar *name,
                                                         const gchar *game_data,
                                                         gpointer user_data);

Specifies the type of function for passing results of an asynchronous operation to the user.

name :

a unique identifier, usually the game name

game_data :

data for name

user_data :

user-provided data

gva_mame_get_version ()

gchar*              gva_mame_get_version                (GError **error);

Returns the version of the MAME executable that GNOME Video Arcade is configured to use. If an error occurs, it returns NULL and sets error.

error :

return location for a GError, or NULL

Returns :

the MAME version, or NULL

gva_mame_get_total_supported ()

guint               gva_mame_get_total_supported        (GError **error);

Returns the number of games supported by the MAME executable that GNOME Video Arcade is configured to use. If an error occurs, it returns zero and sets error.

error :

return location for a GError, or NULL

Returns :

number of supported games, or zero

gva_mame_get_config_value ()

gchar*              gva_mame_get_config_value           (const gchar *config_key,
                                                         GError **error);

Runs "MAME -showconfig" and extracts from the output the value of config_key. If an error occurs, or if config_key is not found in MAME's configuration, the function returns NULL and sets error.

config_key :

a configuration key

error :

return location for a GError, or NULL

Returns :

the value of config_key, or NULL

gva_mame_has_config_value ()

gboolean            gva_mame_has_config_value           (const gchar *config_key);

Returns TRUE if the MAME configuration has a configuration value for config_key. The function does not report errors that occur in the course of spawning MAME, so false negatives are possible.

config_key :

a configuration key

Returns :

TRUE if a value for config_key exists, FALSE if no such value exists or if an error occurred

gva_mame_get_input_files ()

GHashTable*         gva_mame_get_input_files            (GError **error);

Returns a GHashTable of input files for playback. The keys of the GHashTable are absolute filenames and the values are the corresponding game name. If an error occurs, it returns NULL and sets error.

error :

return location for a GError, or NULL

Returns :

a GHashTable of input files, or NULL

gva_mame_list_xml ()

GvaProcess*         gva_mame_list_xml                   (GError **error);

Spawns a "MAME -listxml" child process and returns a GvaProcess so the output can be read asynchronously. If an error occurs while spawning, it returns NULL and sets error.

Note

Beware, this command spews many megabytes of XML data!

error :

return location for a GError, or NULL

Returns :

a new GvaProcess, or NULL

gva_mame_verify_roms ()

GvaProcess*         gva_mame_verify_roms                (GvaMameCallback callback,
                                                         gpointer user_data,
                                                         GError **error);

Spawns a "MAME -verifyroms" child process and returns a GvaProcess to track it. As each ROM set is tested, the function asynchronously calls callback(romset, status, user_data). If an error occurs while spawning, it returns NULL and sets error.

callback :

callback function

user_data :

user data to pass to the callback function

error :

return location for a GError, or NULL

Returns :

a new GvaProcess, or NULL

gva_mame_verify_samples ()

GvaProcess*         gva_mame_verify_samples             (GvaMameCallback callback,
                                                         gpointer user_data,
                                                         GError **error);

Spawns a "MAME -verifysamples" child process and returns a GvaProcess to track it. As each sample set is tested, the function asynchronously calls callback(sampleset, status, user_data). If an error occurs while spawning, it returns NULL and sets error.

callback :

callback function

user_data :

user data to pass to the callback function

error :

return location for a GError, or NULL

Returns :

a new GvaProcess, or NULL

gva_mame_run_game ()

GvaProcess*         gva_mame_run_game                   (const gchar *name,
                                                         GError **error);

Spawns a "MAME name" child process (with some additional user preferences) and returns a GvaProcess to track it. If an error occurs while spawning, it returns NULL and sets error.

name :

the name of the game to run

error :

return location for a GError, or NULL

Returns :

a new GvaProcess, or NULL

gva_mame_record_game ()

GvaProcess*         gva_mame_record_game                (const gchar *name,
                                                         const gchar *inpname,
                                                         GError **error);

Spawns a "MAME -record inpname name" child process (with some additional user preferences) and returns a GvaProcess to track it. If an error occurs while spawning, it returns NULL and sets error.

name :

the name of the game to run

inpname :

the name of a file to record keypresses to

error :

return location for a GError, or NULL

Returns :

a new GvaProcess, or NULL

gva_mame_playback_game ()

GvaProcess*         gva_mame_playback_game              (const gchar *name,
                                                         const gchar *inpname,
                                                         GError **error);

Spawns a "MAME -playback inpname name" child process (with some additional user preferences) and returns a GvaProcess to track it. If an error occurs while spawning, it returns NULL and sets error.

name :

the name of the game to play back

inpname :

the name of a file containing keypresses for name

error :

return location for a GError, or NULL

Returns :

a new GvaProcess, or NULL

gva_mame_get_save_state_file ()

gchar*              gva_mame_get_save_state_file        (const gchar *name);

Returns the name of the automatic save state file for name.

name :

the name of a game

Returns :

the name of the save state file

gva_mame_delete_save_state ()

void                gva_mame_delete_save_state          (const gchar *name);

Deletes the automatic save state file for name, if it exists.

name :

the name of a game

gva_mame_supports_auto_save()

#define             gva_mame_supports_auto_save()

Returns TRUE if the MAME executable that GNOME Video Arcade is configured to use supports an "autosave" option.


gva_mame_supports_full_screen()

#define             gva_mame_supports_full_screen()

Returns TRUE if the MAME executable that GNOME Video Arcade is configured to use supports a "fullscreen" option.


gva_mame_supports_window()

#define             gva_mame_supports_window()

Returns TRUE if the MAME executable that GNOME Video Arcade is configured to use supports a "window" option.