Previous 15994 Revisions Next

r7376 Tuesday 16th February, 2010 at 15:18:20 UTC by Miodrag Milanović
Placed print_game_categories into core info.c since it can be used on any driver, not just MESS one.
[src/emu]info.c
[src/mess]infomess.c infomess.h

src/emu/info.c
r7375r7376
818818   fprintf(out, "/>\n");
819819}
820820
821/*-------------------------------------------------
822    print_game_categories - print the Categories
823    settings for a system
824-------------------------------------------------*/
821825
826void print_game_categories(FILE *out, const game_driver *game, const ioport_list &portlist)
827{
828   const input_port_config *port;
829   const input_field_config *field;
830
831   /* iterate looking for Categories */
832   for (port = portlist.first(); port != NULL; port = port->next)
833      for (field = port->fieldlist; field != NULL; field = field->next)
834         if (field->type == IPT_CATEGORY)
835         {
836            const input_setting_config *setting;
837
838            /* output the category name information */
839            fprintf(out, "\t\t<category name=\"%s\">\n", xml_normalize_string(input_field_name(field)));
840
841            /* loop over item settings */
842            for (setting = field->settinglist; setting != NULL; setting = setting->next)
843            {
844               fprintf(out, "\t\t\t<item name=\"%s\"", xml_normalize_string(setting->name));
845               if (setting->value == field->defvalue)
846                  fprintf(out, " default=\"yes\"");
847               fprintf(out, "/>\n");
848            }
849
850            /* terminate the category entry */
851            fprintf(out, "\t\t</category>\n");
852         }
853}
854
822855/*-------------------------------------------------
823856    print_game_info - print the XML information
824857    for one particular game driver
r7375r7376
890923   print_game_input(out, game, portlist);
891924   print_game_switches(out, game, portlist);
892925   print_game_configs(out, game, portlist);
893#ifdef MESS
894926   print_game_categories(out, game, portlist);
895#endif /* MESS */
896927   print_game_adjusters(out, game, portlist);
897928   print_game_driver(out, game, config);
898929#ifdef MESS
r7375r7376
926957#ifdef MESS
927958      "\t<!ELEMENT " XML_TOP " (description, year?, manufacturer, biosset*, rom*, disk*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, category*, adjuster*, driver?, device*, ramoption*)>\n"
928959#else
929      "\t<!ELEMENT " XML_TOP " (description, year?, manufacturer, biosset*, rom*, disk*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, adjuster*, driver?)>\n"
960      "\t<!ELEMENT " XML_TOP " (description, year?, manufacturer, biosset*, rom*, disk*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, category*, adjuster*, driver?)>\n"
930961#endif
931962      "\t\t<!ATTLIST " XML_TOP " name CDATA #REQUIRED>\n"
932963      "\t\t<!ATTLIST " XML_TOP " sourcefile CDATA #IMPLIED>\n"
r7375r7376
10151046      "\t\t\t\t<!ATTLIST confsetting name CDATA #REQUIRED>\n"
10161047      "\t\t\t\t<!ATTLIST confsetting value CDATA #REQUIRED>\n"
10171048      "\t\t\t\t<!ATTLIST confsetting default (yes|no) \"no\">\n"
1018#ifdef MESS
10191049      "\t\t<!ELEMENT category (item*)>\n"
10201050      "\t\t\t<!ATTLIST category name CDATA #REQUIRED>\n"
10211051      "\t\t\t<!ELEMENT item EMPTY>\n"
10221052      "\t\t\t\t<!ATTLIST item name CDATA #REQUIRED>\n"
10231053      "\t\t\t\t<!ATTLIST item default (yes|no) \"no\">\n"
1024#endif
10251054      "\t\t<!ELEMENT adjuster EMPTY>\n"
10261055      "\t\t\t<!ATTLIST adjuster name CDATA #REQUIRED>\n"
10271056      "\t\t\t<!ATTLIST adjuster default CDATA #REQUIRED>\n"
src/mess/infomess.c
r7375r7376
2424 *************************************/
2525
2626/*-------------------------------------------------
27    print_game_categories - print the Categories
28    settings for a system
29-------------------------------------------------*/
30
31void print_game_categories(FILE *out, const game_driver *game, const ioport_list &portlist)
32{
33   const input_port_config *port;
34   const input_field_config *field;
35
36   /* iterate looking for Categories */
37   for (port = portlist.first(); port != NULL; port = port->next)
38      for (field = port->fieldlist; field != NULL; field = field->next)
39         if (field->type == IPT_CATEGORY)
40         {
41            const input_setting_config *setting;
42
43            /* output the category name information */
44            fprintf(out, "\t\t<category name=\"%s\">\n", xml_normalize_string(input_field_name(field)));
45
46            /* loop over item settings */
47            for (setting = field->settinglist; setting != NULL; setting = setting->next)
48            {
49               fprintf(out, "\t\t\t<item name=\"%s\"", xml_normalize_string(setting->name));
50               if (setting->value == field->defvalue)
51                  fprintf(out, " default=\"yes\"");
52               fprintf(out, "/>\n");
53            }
54
55            /* terminate the category entry */
56            fprintf(out, "\t\t</category>\n");
57         }
58}
59
60/*-------------------------------------------------
6127    print_game_device - prints out all info on
6228    MESS-specific devices
6329-------------------------------------------------*/
src/mess/infomess.h
r7375r7376
1010#define INFOMESS_H
1111
1212/* code used by print_mame_xml() */
13void print_game_categories(FILE *out, const game_driver *game, const ioport_list &portlist);
1413void print_game_device(FILE *out, const game_driver *game, const machine_config *config);
1514void print_game_ramoptions(FILE *out, const game_driver *game, const machine_config *config);
1615

Previous 15994 Revisions Next


© 1998-2018 The MESS Team