Previous 15994 Revisions Next

r10936 Sunday 27th March, 2011 at 01:06:34 UTC by Fabio Priuli
softlist format: split info (formerly introduced for the compatibility settings) in info and sharedfeat.
the former stays tied to the whole software entry (e.g. you can use it to mention developers, if you
want to), the latter gets inherited by each part (e.g. you can use it to add compatibility checks like
the sample one in gensvp).
while at it, readded the compatibility check to megadriv.c which got lost before (my bad, I forgot to
sync the file in MAME). More details in a forthcoming board post.

Final note: for me, the list format is finalized (at last) with this set of changes
[hash]megadriv.xml softwarelist.dtd
[src/emu]clifront.c softlist.c softlist.h
[src/mame/machine]md_cart.c

hash/softwarelist.dtd
r10935r10936
11<!ELEMENT softwarelist (software+)>
22   <!ATTLIST softwarelist name CDATA #REQUIRED>
33   <!ATTLIST softwarelist description CDATA #IMPLIED>
4   <!ELEMENT software (description, year?, publisher, part*)>
4   <!ELEMENT software (description, year?, publisher, info*, sharedfeat*, part*)>
55      <!ATTLIST software name CDATA #REQUIRED>
66      <!ATTLIST software cloneof CDATA #IMPLIED>
77      <!ATTLIST software supported (yes|partial|no) "yes">
88      <!ELEMENT description (#PCDATA)>
99      <!ELEMENT year (#PCDATA)>
1010      <!ELEMENT publisher (#PCDATA)>
11      <!ELEMENT info EMPTY>
12         <!ATTLIST info name CDATA #REQUIRED>
13         <!ATTLIST info value CDATA #IMPLIED>
14      <!ELEMENT sharedfeat EMPTY>
15         <!ATTLIST sharedfeat name CDATA #REQUIRED>
16         <!ATTLIST sharedfeat value CDATA #IMPLIED>
1117      <!ELEMENT part (feature*, dataarea*, diskarea*, dipswitch*)>
1218         <!ATTLIST part name CDATA #REQUIRED>
1319         <!ATTLIST part interface CDATA #REQUIRED>
hash/megadriv.xml
r10935r10936
2597725977      <description>Virtua Racing (Euro)</description>
2597825978      <year>1994</year>
2597925979      <publisher>Sega</publisher>
25980      <info name="compatibility" value="PAL" />
25981      <info name="addon" value="SVP" />
25980      <sharedfeat name="compatibility" value="PAL" />
25981      <sharedfeat name="addon" value="SVP" />
2598225982      <part name="cart" interface="megadriv_cart">
2598325983         <dataarea name="rom" size="2097152">
2598425984            <rom name="mpr-16420.bin" size="2097152" crc="9624d4ef" sha1="2c3812f8a010571e51269a33a989598787d27c2d" offset="000000" loadflag="load16_word_swap" />
r10935r10936
2599225992      <description>Virtua Racing (Jpn)</description>
2599325993      <year>1994</year>
2599425994      <publisher>Sega</publisher>
25995      <info name="compatibility" value="EUR-JPN" />
25996      <info name="addon" value="SVP" />
25995      <sharedfeat name="compatibility" value="EUR-JPN" />
25996      <sharedfeat name="addon" value="SVP" />
2599725997      <part name="cart" interface="megadriv_cart">
2599825998         <dataarea name="rom" size="2097152">
2599925999            <rom name="mpr-16389.bin" size="2097152" crc="53a293b5" sha1="0ad38a3ab1cc99edac72184f8ae420e13df5cac6" offset="000000" loadflag="load16_word_swap" />
r10935r10936
2600626006      <description>Virtua Racing (USA)</description>
2600726007      <year>1994</year>
2600826008      <publisher>Sega</publisher>
26009      <info name="compatibility" value="NTSC-U" />
26010      <info name="addon" value="SVP" />
26009      <sharedfeat name="compatibility" value="NTSC-U" />
26010      <sharedfeat name="addon" value="SVP" />
2601126011      <part name="cart" interface="megadriv_cart">
2601226012         <dataarea name="rom" size="2097152">
2601326013            <rom name="virtua racing (usa).bin" size="2097152" crc="7e1a324a" sha1="ff969ae53120cc4e7cb1a8a7e47458f2eb8a2165" offset="000000" loadflag="load16_word_swap" />
src/mame/machine/md_cart.c
r10935r10936
18311831   return IMAGE_INIT_PASS;
18321832}
18331833
1834static void megadrive_check_compat_list(device_image_interface &image)
1835{
1836   const char *compatibility = image.get_feature("compatibility");
1837   const char *chips = image.get_feature("addon");
1838   int md_region = megadrive_region_export + (megadrive_region_pal << 1);
18341839
1840   if (chips)
1841   {
1842      if(!strcmp(chips, "SVP") && (image.device().machine->device<cpu_device>("svp") == NULL))
1843      {
1844         mame_printf_warning("This software requires emulation of the SVP CPU to work.\n");
1845         mame_printf_warning("It might not work in the system you are using.\n");
1846      }
1847   }
1848
1849   if (compatibility)
1850   {
1851      if(!strcmp(compatibility, "PAL") && (md_region != 3))
1852      {
1853         mame_printf_warning("This software requires a PAL console to work.\n");
1854         mame_printf_warning("It might not work in the system you are using.\n");
1855      }
1856      if(!strcmp(compatibility, "NTSC-J") && (md_region != 0))
1857      {
1858         mame_printf_warning("This software requires a JPN console to work.\n");
1859         mame_printf_warning("It might not work in the system you are using.\n");
1860      }
1861      if(!strcmp(compatibility, "NTSC-U") && (md_region != 1))
1862      {
1863         mame_printf_warning("This software requires a USA console to work.\n");
1864         mame_printf_warning("It might not work in the system you are using.\n");
1865      }
1866      if(!strcmp(compatibility, "EUR-JPN") && (md_region != 0 && md_region != 3))
1867      {
1868         mame_printf_warning("This software requires a PAL or a JPN console to work.\n");
1869         mame_printf_warning("It might not work in the system you are using.\n");
1870      }
1871   }
1872}
1873
18351874/*************************************
18361875 *  Loading a cart image from softlist
18371876 *************************************/
r10935r10936
18511890   else
18521891      state->md_cart.type = md_get_pcb_id(pcb_name);
18531892
1893   megadrive_check_compat_list(image);
1894
18541895   memcpy(&ROM[VIRGIN_COPY_GEN], &ROM[0x000000], MAX_MD_CART_SIZE);  /* store a copy of data */
18551896
18561897   return IMAGE_INIT_PASS;
src/emu/clifront.c
r10935r10936
826826            "\t<!ELEMENT softwarelist (software+)>\n"
827827            "\t\t<!ATTLIST softwarelist name CDATA #REQUIRED>\n"
828828            "\t\t<!ATTLIST softwarelist description CDATA #IMPLIED>\n"
829            "\t\t<!ELEMENT software (description, year?, publisher, part*)>\n"
829            "\t\t<!ELEMENT software (description, year?, publisher, info*, sharedfeat*, part*)>\n"
830830            "\t\t\t<!ATTLIST software name CDATA #REQUIRED>\n"
831831            "\t\t\t<!ATTLIST software cloneof CDATA #IMPLIED>\n"
832832            "\t\t\t<!ATTLIST software supported (yes|partial|no) \"yes\">\n"
833833            "\t\t\t<!ELEMENT description (#PCDATA)>\n"
834834            "\t\t\t<!ELEMENT year (#PCDATA)>\n"
835835            "\t\t\t<!ELEMENT publisher (#PCDATA)>\n"
836            // we still do not store the info strings internally, so there is no output here
837            // TODO: add parsing info in softlist.c and then add output here!
838            "\t\t\t<!ELEMENT info EMPTY>\n"
839            "\t\t\t\t<!ATTLIST info name CDATA #REQUIRED>\n"
840            "\t\t\t\t<!ATTLIST info value CDATA #IMPLIED>\n"
841            // shared features get stored in the part->feature below and are output there
842            // this means that we don't output any <sharedfeat> and that -lsoft output will
843            // be different from the list in hash/ when the list uses sharedfeat. But this
844            // is by design: sharedfeat is only available to simplify the life to list creators,
845            // to e.g. avoid manually adding the same feature to each disk of a 9 floppies game!
846            "\t\t\t<!ELEMENT sharedfeat EMPTY>\n"
847            "\t\t\t\t<!ATTLIST sharedfeat name CDATA #REQUIRED>\n"
848            "\t\t\t\t<!ATTLIST sharedfeat value CDATA #IMPLIED>\n"
836849            "\t\t\t<!ELEMENT part (feature*, dataarea*, diskarea*, dipswitch*)>\n"
837850            "\t\t\t\t<!ATTLIST part name CDATA #REQUIRED>\n"
838851            "\t\t\t\t<!ATTLIST part interface CDATA #REQUIRED>\n"
r10935r10936
862875            "\t\t\t\t\t\t<!ATTLIST disk sha1 CDATA #IMPLIED>\n"
863876            "\t\t\t\t\t\t<!ATTLIST disk status (baddump|nodump|good) \"good\">\n"
864877            "\t\t\t\t\t\t<!ATTLIST disk writeable (yes|no) \"no\">\n"
865            // we still do not store the dipswitch values in softlist, so there is no output here
878            // we still do not store the dipswitch values internally, so there is no output here
866879            // TODO: add parsing dipsw in softlist.c and then add output here!
867880            "\t\t\t\t<!ELEMENT dipswitch (dipvalue*)>\n"
868881            "\t\t\t\t\t<!ATTLIST dipswitch name CDATA #REQUIRED>\n"
src/emu/softlist.c
r10935r10936
283283
284284/*-------------------------------------------------
285285 add_info (same as add_feature, but its target
286 is softinfo->other_info)
286 is softinfo->shared_info)
287287 -------------------------------------------------*/
288288
289289static void add_info(software_list *swlist, char *feature_name, char *feature_value)
r10935r10936
301301      new_entry->value = feature_value ? feature_value : feature_name;
302302
303303      /* Add new feature to end of feature list */
304      if ( info->other_info )
304      if ( info->shared_info )
305305      {
306         feature_list *list = info->other_info;
306         feature_list *list = info->shared_info;
307307         while ( list->next != NULL )
308308         {
309309            list = list->next;
r10935r10936
312312      }
313313      else
314314      {
315         info->other_info = new_entry;
315         info->shared_info = new_entry;
316316      }
317317   }
318318   else
r10935r10936
445445               elem->partdata = (software_part *)pool_malloc_lib(swlist->pool, swlist->part_entries * sizeof(software_part) );
446446               if ( !elem->partdata )
447447                  return;
448               elem->other_info = (feature_list *)pool_malloc_lib(swlist->pool, sizeof(feature_list) );
449               if ( !elem->other_info )
448               elem->shared_info = (feature_list *)pool_malloc_lib(swlist->pool, sizeof(feature_list) );
449               if ( !elem->shared_info )
450450                  return;
451451               else
452452               {
453                  elem->other_info->next = (feature_list *)pool_malloc_lib(swlist->pool, sizeof(feature_list) );
454                  elem->other_info->next = NULL;
455                  elem->other_info->name = NULL;
456                  elem->other_info->value = NULL;
453                  elem->shared_info->next = (feature_list *)pool_malloc_lib(swlist->pool, sizeof(feature_list) );
454                  elem->shared_info->next = NULL;
455                  elem->shared_info->name = NULL;
456                  elem->shared_info->value = NULL;
457457               }
458458
459459               /* Handle the supported flag */
r10935r10936
498498            text_dest = (char **) &swlist->softinfo->year;
499499         else if (!strcmp(tagname, "publisher"))
500500            text_dest = (char **) &swlist->softinfo->publisher;
501         else if ( !strcmp(tagname, "info") )
501         else if (!strcmp(tagname, "info"))
502502         {
503            // the "info" field (containing info about actual developers, etc.) is not currently stored.
504            // full support will be added, but for the moment frontend have to get this info from the xml directly
505         }
506         else if (!strcmp(tagname, "sharedfeat"))
507         {
503508            const char *str_feature_name = NULL;
504509            const char *str_feature_value = NULL;
505510
r10935r10936
858863         break;
859864
860865      case POS_PART:
861         /* Add other_info inherited from the software_info level, if any */
862         if ( swlist->softinfo && swlist->softinfo->other_info )
866         /* Add shared_info inherited from the software_info level, if any */
867         if ( swlist->softinfo && swlist->softinfo->shared_info )
863868         {
864            feature_list *list = swlist->softinfo->other_info;
869            feature_list *list = swlist->softinfo->shared_info;
865870
866871            while( list->next )
867872            {
src/emu/softlist.h
r10935r10936
3535};
3636
3737
38/* The software info struct holds basic software information. Additional,
39   optional information like local software names, release dates, serial
40   numbers, etc can be maintained and stored in external recources.
41*/
38/* The software info struct holds basic software information. */
4239struct software_info
4340{
4441   const char *shortname;
4542   const char *longname;
4643   const char *parentname;
47   const char *year;         /* Copyright year on title screen, actual release dates can be tracked in external resources */
44   const char *year;         // Copyright year on title screen, actual release dates can be tracked in external resources
4845   const char *publisher;
49   feature_list *other_info;
46   feature_list *other_info;   // Here we store info like developer, serial #, etc. which belong to the software entry as a whole
47   feature_list *shared_info;   // Here we store info like TV standard compatibility, or add-on requirements, etc. which get inherited
48                        // by each part of this software entry (after loading these are stored in partdata->featurelist)
5049   UINT32 supported;
5150   software_part *partdata;
52   struct software_info *next;   /* Used internally */
51   struct software_info *next;   // Used internally
5352};
5453
5554

Previous 15994 Revisions Next


© 1998-2018 The MESS Team