From b098f73f55d274968760ca63433d5ce24d6e27c8 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 16 Feb 2010 15:17:37 +0000 Subject: [PATCH] info.c: Moved print_game_categories into info.c, since it can be used by any driver anyway. [Miodrag Milanovic] --- src/emu/info.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/emu/info.c b/src/emu/info.c index 9ca96862085..b9dbf9d63b7 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -818,6 +818,39 @@ static void print_game_driver(FILE *out, const game_driver *game, const machine_ fprintf(out, "/>\n"); } +/*------------------------------------------------- + print_game_categories - print the Categories + settings for a system +-------------------------------------------------*/ + +void print_game_categories(FILE *out, const game_driver *game, const ioport_list &portlist) +{ + const input_port_config *port; + const input_field_config *field; + + /* iterate looking for Categories */ + for (port = portlist.first(); port != NULL; port = port->next) + for (field = port->fieldlist; field != NULL; field = field->next) + if (field->type == IPT_CATEGORY) + { + const input_setting_config *setting; + + /* output the category name information */ + fprintf(out, "\t\t\n", xml_normalize_string(input_field_name(field))); + + /* loop over item settings */ + for (setting = field->settinglist; setting != NULL; setting = setting->next) + { + fprintf(out, "\t\t\tname)); + if (setting->value == field->defvalue) + fprintf(out, " default=\"yes\""); + fprintf(out, "/>\n"); + } + + /* terminate the category entry */ + fprintf(out, "\t\t\n"); + } +} /*------------------------------------------------- print_game_info - print the XML information @@ -890,9 +923,7 @@ static void print_game_info(FILE *out, const game_driver *game) print_game_input(out, game, portlist); print_game_switches(out, game, portlist); print_game_configs(out, game, portlist); -#ifdef MESS print_game_categories(out, game, portlist); -#endif /* MESS */ print_game_adjusters(out, game, portlist); print_game_driver(out, game, config); #ifdef MESS @@ -926,7 +957,7 @@ void print_mame_xml(FILE *out, const game_driver *const games[], const char *gam #ifdef MESS "\t\n" #else - "\t\n" + "\t\n" #endif "\t\t\n" "\t\t\n" @@ -1015,13 +1046,11 @@ void print_mame_xml(FILE *out, const game_driver *const games[], const char *gam "\t\t\t\t\n" "\t\t\t\t\n" "\t\t\t\t\n" -#ifdef MESS "\t\t\n" "\t\t\t\n" "\t\t\t\n" "\t\t\t\t\n" "\t\t\t\t\n" -#endif "\t\t\n" "\t\t\t\n" "\t\t\t\n"