Previous 15994 Revisions Next

r8288 Thursday 17th June, 2010 at 20:26:14 UTC by Wilbert Pol
Software list update:
Changed feature into a list of key-value pairs to allow greater flexibility in describing software part features.
[hash]aes.xml softwarelist.dtd
[src/mess]image.c image.h softlist.c softlist.h
[src/mess/devices]aescart.c
[src/mess/machine]nes.c

hash/softwarelist.dtd
r8287r8288
88<!ELEMENT description (#PCDATA)>
99<!ELEMENT year (#PCDATA)>
1010<!ELEMENT publisher (#PCDATA)>
11<!ELEMENT part (dataarea*)>
11<!ELEMENT part (feature*, dataarea*)>
1212<!ATTLIST part name CDATA #REQUIRED>
1313<!ATTLIST part interface CDATA #REQUIRED>
1414<!-- feature is used to store things like pcb-type, mapper type, etc. Specific values depend on the system. -->
15<!ATTLIST part feature CDATA #IMPLIED>
15<!ELEMENT feature EMPTY>
16<!ATTLIST feature name CDATA #REQUIRED>
17<!ATTLIST feature value CDATA #IMPLIED>
1618<!ELEMENT dataarea (rom*)>
1719<!ATTLIST dataarea name CDATA #REQUIRED>
1820<!ATTLIST dataarea size CDATA #REQUIRED>
r8287r8288
2022<!ATTLIST dataarea endian (big|little) "little">
2123<!ELEMENT rom EMPTY>
2224<!ATTLIST rom name CDATA #IMPLIED>
23<!ATTLIST rom size CDATA #REQUIRED>
25<!ATTLIST rom size CDATA #IMPLIED>
2426<!ATTLIST rom crc CDATA #IMPLIED>
2527<!ATTLIST rom md5 CDATA #IMPLIED>
2628<!ATTLIST rom sha1 CDATA #IMPLIED>
hash/aes.xml
r8287r8288
650650      <description>Fatal Fury 2 / Garou Densetsu 2 - arata-naru tatakai</description>
651651      <year>1992</year>
652652      <publisher>SNK</publisher>
653      <part name="cart" interface="aes_cart" feature="fatfury2_prot">
653      <part name="cart" interface="aes_cart">
654         <feature name="crypt" value="fatfury2_prot" />
654655         <dataarea name="maincpu" size="1048576">
655656                <rom name="047-p1.bin" size="524288" crc="be40ea92" sha1="958b891bb8beb6af122d5467257ab20cbc6cf574" offset="000000" />
656657                <rom name="047-p2.bin" size="524288" crc="2a9beac5" sha1="61378f89d64fef4c172825694f83229c2ab1a7af" offset="080000" />
r8287r8288
10581059      <description>The King of Fighters '99 - Millennium Battle</description>
10591060      <year>1999</year>
10601061      <publisher>SNK</publisher>
1061      <part name="cart" interface="aes_cart" feature="kof99_crypt">
1062      <part name="cart" interface="aes_cart">
1063         <feature name="crypt" value="kof99_crypt" />
10621064         <dataarea name="maincpu" size="9437184">
10631065                <rom name="251-sma.kc" size="262144" crc="6c9d0647" sha1="2a0ce62ca6c18007e8fbe1b60475c7874ab79389" offset="0c0000" />
10641066                <rom name="251-p1.bin" size="4194304" crc="006e4532" sha1="47791ab4044ad55988b1d3412d95b65b91a163c8" offset="100000" />
r8287r8288
10951097      <description>Metal Slug 3</description>
10961098      <year>2000</year>
10971099      <publisher>SNK</publisher>
1098      <part name="cart" interface="aes_cart" feature="mslug3_crypt">
1100      <part name="cart" interface="aes_cart">
1101         <feature name="crypt" value="mslug3_crypt" />
10991102         <dataarea name="maincpu" size="5242880">
11001103                <rom name="256-ph1.bin" size="1048576" crc="9c42ca85" sha1="7a8f77a89867b889295ae9b9dfd4ba28f02d234d" offset="000000" />
11011104                <rom name="256-ph2.bin" size="4194304" crc="1f3d8ce8" sha1="08b05a8abfb86ec09a5e758d6273acf1489961f9" offset="100000" />
r8287r8288
11311134      <description>The King of Fighters 2001</description>
11321135      <year>2001</year>
11331136      <publisher>Eolith / SNK</publisher>
1134      <part name="cart" interface="aes_cart" feature="kof2001_crypt">
1137      <part name="cart" interface="aes_cart">
1138         <feature name="crypt" value="kof2001_crypt" />
11351139         <dataarea name="maincpu" size="5242880">
11361140                <rom name="262-pg1.bin" size="1048576" crc="2af7e741" sha1="e41282d73ed6d521da056f1a16573bb61bfa3826" offset="000000" />
11371141                <rom name="262-pg2.bin" size="4194304" crc="91eea062" sha1="82bae42bbeedb9f3aa0c7c0b0a7a69be499cf98f" offset="100000" />
r8287r8288
11691173      <description>Metal Slug 4</description>
11701174      <year>2002</year>
11711175      <publisher>Mega / Playmore</publisher>
1172      <part name="cart" interface="aes_cart" feature="mslug4_crypt">
1176      <part name="cart" interface="aes_cart">
1177         <feature name="crypt" value="mslug4_crypt" />
11731178         <dataarea name="maincpu" size="5242880">
11741179                <rom name="263-ph1.bin" size="1048576" crc="c67f5c8d" sha1="12af74964843f103520d9f0825069ea2f67eeb2f" offset="000000" />
11751180                <rom name="263-ph2.bin" size="4194304" crc="bc3ec89e" sha1="2cb0626bc4fa57e1d25f208e04532b570d87b3fb" offset="100000" />
r8287r8288
12031208      <description>The King of Fighters 2002</description>
12041209      <year>2002</year>
12051210      <publisher>Eolith / Playmore</publisher>
1206      <part name="cart" interface="aes_cart" feature="kof2002_crypt">
1211      <part name="cart" interface="aes_cart">
1212         <feature name="crypt" value="kof2002_crypt" />
12071213         <dataarea name="maincpu" size="5242880">
12081214                <rom name="265-p1.bin" size="1048576" crc="9ede7323" sha1="ad9d45498777fda9fa58e75781f48e09aee705a6" offset="000000" />
12091215                <rom name="265-p2.bin" size="4194304" crc="327266b8" sha1="98f445cc0a94f8744d74bca71cb420277622b034" offset="100000" />
r8287r8288
12401246      <description>Matrimelee / Shin Gouketsuji Ichizoku Toukon</description>
12411247      <year>2002</year>
12421248      <publisher>Noise Factory / Atlus</publisher>
1243      <part name="cart" interface="aes_cart" feature="matrim_crypt">
1249      <part name="cart" interface="aes_cart">
1250         <feature name="crypt" value="matrim_crypt" />
12441251         <dataarea name="maincpu" size="5242880">
12451252                <rom name="266-p1.bin" size="1048576" crc="5d4c2dc7" sha1="8d723b0d28ec344eef26009b361a2b97d300dd51" offset="000000" />
12461253                <rom name="266-p2.bin" size="4194304" crc="a14b1906" sha1="1daa14d73512f760ef569b06f9facb279437d1db" offset="100000" />
r8287r8288
12761283      <description>Metal Slug 5</description>
12771284      <year>2003</year>
12781285      <publisher>SNK Playmore</publisher>
1279      <part name="cart" interface="aes_cart" feature="mslug5_crypt">
1286      <part name="cart" interface="aes_cart">
1287         <feature name="crypt" value="mslug5_crypt" />
12801288         <dataarea name="maincpu" size="8388608">
12811289                <rom name="268-p1cr2.bin" size="4194304" crc="3636690a" sha1="e0da714b4bdc6efffe1250ded02ebddb3ab6d7b3" offset="000000" loadflag="load32_word" />
12821290                <rom name="268-p2cr2.bin" size="4194304" crc="8dfc47a2" sha1="27d618cfbd0107a4d2a836797e967b39d2eb4851" offset="000002" loadflag="load32_word" />
r8287r8288
13121320      <description>SNK vs CAPCOM SVC CHAOS</description>
13131321      <year>2003</year>
13141322      <publisher>SNK Playmore</publisher>
1315      <part name="cart" interface="aes_cart" feature="svc_crypt">
1323      <part name="cart" interface="aes_cart">
1324         <feature name="crypt" value="svc_crypt" />
13161325         <dataarea name="maincpu" size="8388608">
13171326                <rom name="269-p1.bin" size="4194304" crc="38e2005e" sha1="1b902905916a30969282f1399a756e32ff069097" offset="000000" loadflag="load32_word" />
13181327                <rom name="269-p2.bin" size="4194304" crc="6d13797c" sha1="3cb71a95cea6b006b44cac0f547df88aec0007b7" offset="000002" loadflag="load32_word" />
r8287r8288
13471356      <description>Samurai Shodown V / Samurai Spirits Zero</description>
13481357      <year>2003</year>
13491358      <publisher>Yuki Enterprise / SNK Playmore</publisher>
1350      <part name="cart" interface="aes_cart" feature="samsho5_crypt">
1359      <part name="cart" interface="aes_cart">
1360         <feature name="crypt" value="samsho5_crypt" />
13511361         <dataarea name="maincpu" size="8388608">
13521362                <rom name="270-p1c.bin" size="4194304" crc="bf956089" sha1="c538289069bf338b9fa7ecc5c9143763dbb776a8" offset="000000" />
13531363                <rom name="270-p2c.bin" size="4194304" crc="943a6b1d" sha1="12bd02fc197456da6ee86f066086094cef0f4bf9" offset="400000" />
src/mess/devices/aescart.c
r8287r8288
407407static void install_protection(running_device* image)
408408{
409409   neogeo_state *state = (neogeo_state *)image->machine->driver_data;
410   const char *crypt_feature = image_get_feature( image, "crypt" );
410411
411   if(image_get_feature(image) == NULL)
412   if(crypt_feature == NULL)
412413      return;
413414
414   if(strcmp(image_get_feature(image),"fatfury2_prot") == 0)
415   if(strcmp(crypt_feature,"fatfury2_prot") == 0)
415416   {
416417      fatfury2_install_protection(image->machine);
417418      logerror("Installed Fatal Fury 2 protection\n");
418419   }
419   if(strcmp(image_get_feature(image),"kof99_crypt") == 0)
420   if(strcmp(crypt_feature,"kof99_crypt") == 0)
420421   {
421422      kof99_decrypt_68k(image->machine);
422423      state->fixed_layer_bank_type = 1;
r8287r8288
424425      kof99_install_protection(image->machine);
425426      logerror("Decrypted KOF99 code and graphics.\n");
426427   }
427   if(strcmp(image_get_feature(image),"mslug3_crypt") == 0)
428   if(strcmp(crypt_feature,"mslug3_crypt") == 0)
428429   {
429430      state->fixed_layer_bank_type = 1;
430431      kof99_neogeo_gfx_decrypt(image->machine, 0xad);
431432      logerror("Decrypted Metal Slug 3 graphics\n");
432433   }
433   if(strcmp(image_get_feature(image),"matrim_crypt") == 0)
434   if(strcmp(crypt_feature,"matrim_crypt") == 0)
434435   {
435436      matrim_decrypt_68k(image->machine);
436437      neo_pcm2_swap(image->machine, 1);
r8287r8288
439440      kof2000_neogeo_gfx_decrypt(image->machine, 0x6a);
440441      logerror("Decrypted Matrimelee code, sound and graphics\n");
441442   }
442   if(strcmp(image_get_feature(image),"svc_crypt") == 0)
443   if(strcmp(crypt_feature,"svc_crypt") == 0)
443444   {
444445      svc_px_decrypt(image->machine);
445446      neo_pcm2_swap(image->machine, 3);
r8287r8288
449450      install_pvc_protection(image->machine);
450451      logerror("Decrypted SvC code, sound and graphics.\n");
451452   }
452   if(strcmp(image_get_feature(image),"samsho5_crypt") == 0)
453   if(strcmp(crypt_feature,"samsho5_crypt") == 0)
453454   {
454455      samsho5_decrypt_68k(image->machine);
455456      neo_pcm2_swap(image->machine, 4);
r8287r8288
458459      kof2000_neogeo_gfx_decrypt(image->machine, 0x0f);
459460      logerror("Decrypted Samurai Shodown V code, sound and graphics.\n");
460461   }
461   if(strcmp(image_get_feature(image),"kof2001_crypt") == 0)
462   if(strcmp(crypt_feature,"kof2001_crypt") == 0)
462463   {
463464      state->fixed_layer_bank_type = 1;
464465      kof2000_neogeo_gfx_decrypt(image->machine, 0x1e);
465466      neogeo_cmc50_m1_decrypt(image->machine);
466467      logerror("Decrypted KOF2001 code and graphics.\n");
467468   }
468   if(strcmp(image_get_feature(image),"kof2002_crypt") == 0)
469   if(strcmp(crypt_feature,"kof2002_crypt") == 0)
469470   {
470471      kof2002_decrypt_68k(image->machine);
471472      neo_pcm2_swap(image->machine, 0);
r8287r8288
473474      kof2000_neogeo_gfx_decrypt(image->machine, 0xec);
474475      logerror("Decrypted KOF2002 code, sound and graphics.\n");
475476   }
476   if(strcmp(image_get_feature(image),"mslug4_crypt") == 0)
477   if(strcmp(crypt_feature,"mslug4_crypt") == 0)
477478   {
478479      state->fixed_layer_bank_type = 1; /* USA violent content screen is wrong -- not a bug, confirmed on real hardware! */
479480      neogeo_cmc50_m1_decrypt(image->machine);
r8287r8288
481482      neo_pcm2_snk_1999(image->machine, 8);
482483      logerror("Decrypted Metal Slug 4 code, sound and graphics.\n");
483484   }
484   if(strcmp(image_get_feature(image),"mslug5_crypt") == 0)
485   if(strcmp(crypt_feature,"mslug5_crypt") == 0)
485486   {
486487      mslug5_decrypt_68k(image->machine);
487488      neo_pcm2_swap(image->machine, 2);
src/mess/softlist.c
r8287r8288
247247   }
248248}
249249
250/*-------------------------------------------------
251    add_feature
252-------------------------------------------------*/
250253
254static void add_feature(software_list *swlist, char *feature_name, char *feature_value)
255{
256   software_part *part = &swlist->softinfo->partdata[swlist->current_part_entry-1];
257   feature_list *new_entry;
258
259   /* First allocate the new entry */
260   new_entry = (feature_list *)pool_malloc_lib(swlist->pool, sizeof(feature_list) );
261
262   if ( new_entry )
263   {
264      new_entry->next = NULL;
265      new_entry->name = feature_name;
266      new_entry->value = feature_value ? feature_value : feature_name;
267
268      /* Add new feature to end of feature list */
269      if ( part->featurelist )
270      {
271         feature_list *list = part->featurelist;
272         while ( list->next != NULL )
273         {
274            list = list->next;
275         }
276         list->next = new_entry;
277      }
278      else
279      {
280         part->featurelist = new_entry;
281      }
282   }
283   else
284   {
285      /* Unable to allocate memory */
286   }
287}
288
251289/*-------------------------------------------------
252290    add_software_part
253291-------------------------------------------------*/
254292
255static void add_software_part(software_list *swlist, const char *name, const char *interface, const char *feature)
293static void add_software_part(software_list *swlist, const char *name, const char *interface)
256294{
257295   software_part *part = &swlist->softinfo->partdata[swlist->current_part_entry];
258296
259297   part->name = name;
260298   part->interface_ = interface;
261   part->feature = feature;
299   part->featurelist = NULL;
262300   part->romdata = NULL;
263301
264302   swlist->current_part_entry += 1;
r8287r8288
419457         {
420458            const char *str_name = NULL;
421459            const char *str_interface = NULL;
422            const char *str_feature = NULL;
423460
424461            for ( ; attributes[0]; attributes += 2 )
425462            {
r8287r8288
428465
429466               if ( !strcmp( attributes[0], "interface" ) )
430467                  str_interface = attributes[1];
431
432               if ( !strcmp( attributes[0], "feature" ) )
433                  str_feature = attributes[1];
434468            }
435469
436470            if ( str_name && str_interface )
r8287r8288
439473               {
440474                  char *name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_name ) + 1 ) * sizeof(char) );
441475                  char *interface = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_interface ) + 1 ) * sizeof(char) );
442                  char *feature = NULL;
443476
444477                  if ( !name || !interface )
445478                     return;
r8287r8288
447480                  strcpy( name, str_name );
448481                  strcpy( interface, str_interface );
449482
450                  if ( str_feature )
451                  {
452                     feature = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_feature ) + 1 ) * sizeof(char) );
453                     if ( !feature )
454                        return;
455                     strcpy( feature, str_feature );
456                  }
483                  add_software_part( swlist, name, interface );
457484
458                  add_software_part( swlist, name, interface, feature );
459
460485                  /* Allocate initial space to hold the rom information */
461486                  swlist->rom_entries = 3;
462487                  swlist->current_rom_entry = 0;
r8287r8288
512537               /* Missing dataarea name or size */
513538            }
514539         }
540         else if ( !strcmp(tagname, "feature") )
541         {
542            const char *str_feature_name = NULL;
543            const char *str_feature_value = NULL;
544
545            for ( ; attributes[0]; attributes += 2 )
546            {
547               if ( !strcmp( attributes[0], "name" ) )
548                  str_feature_name = attributes[1];
549
550               if ( !strcmp( attributes[0], "value" ) )
551                  str_feature_value = attributes[1];
552            }
553
554            /* Prepare for adding feature to feature list */
555            if ( str_feature_name && swlist->softinfo )
556            {
557               char *name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_feature_name ) + 1 ) * sizeof(char) );
558               char *value = NULL;
559
560               if ( !name )
561                  return;
562
563               strcpy( name, str_feature_name );
564
565               if ( str_feature_value )
566               {
567                  value = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_feature_value ) + 1 ) * sizeof(char) );
568
569                  if ( !value )
570                     return;
571
572                  strcpy( value, str_feature_value );
573               }
574
575               add_feature( swlist, name, value );
576            }
577         }
515578         else
516579            unknown_tag( &swlist->state, tagname );
517580         break;
r8287r8288
639702      case POS_MAIN:
640703         if ( swlist->softinfo )
641704         {
642            add_software_part( swlist, NULL, NULL, NULL );
705            add_software_part( swlist, NULL, NULL );
643706         }
644707         break;
645708
r8287r8288
10651128      (*sw_part)->name = auto_strdup( device->machine, software_part_ptr->name );
10661129      if ( software_part_ptr->interface_ )
10671130         (*sw_part)->interface_ = auto_strdup( device->machine, software_part_ptr->interface_ );
1068      if ( software_part_ptr->feature )
1069         (*sw_part)->feature = auto_strdup( device->machine, software_part_ptr->feature );
10701131
1132      if ( software_part_ptr->featurelist )
1133      {
1134         feature_list *list = software_part_ptr->featurelist;
1135         feature_list *new_list = auto_alloc_clear( device->machine, feature_list );
1136
1137         (*sw_part)->featurelist = new_list;
1138
1139         new_list->name = auto_strdup( device->machine, list->name );
1140         new_list->value = auto_strdup( device->machine, list->value );
1141
1142         list = list->next;
1143
1144         while( list )
1145         {
1146            new_list->next = auto_alloc_clear( device->machine, feature_list );
1147            new_list = new_list->next;
1148            new_list->name = auto_strdup( device->machine, list->name );
1149            new_list->value = auto_strdup( device->machine, list->value );
1150
1151            list = list->next;
1152         }
1153
1154         new_list->next = NULL;
1155      }
1156
10711157      /* Tell the world which part we actually loaded */
10721158      *full_sw_name = auto_alloc_array( device->machine, char, strlen(swlist_name) + strlen(software_info_ptr->shortname) + strlen(software_part_ptr->name) + 3 );
10731159      sprintf( *full_sw_name, "%s:%s:%s", swlist_name, software_info_ptr->shortname, software_part_ptr->name );
src/mess/softlist.h
r8287r8288
1818
1919*********************************************************************/
2020
21/* Replace this with list<string>? */
22typedef struct _feature_list feature_list;
23struct _feature_list
24{
25   feature_list   *next;
26   char         *name;
27   char         *value;
28};
29
2130typedef struct _software_part software_part;
2231struct _software_part
2332{
2433   const char *name;
2534   const char *interface_;
26   const char *feature;
35   feature_list *featurelist;
2736   struct rom_entry *romdata;
2837};
2938
src/mess/image.c
r8287r8288
14521452 image_get_feature
14531453 -------------------------------------------------*/
14541454
1455const char *image_get_feature(running_device *image)
1455const char *image_get_feature(running_device *image, const char *feature_name)
14561456{
14571457   image_slot_data *slot = find_image_slot(image);
1458   
1459   return slot->software_part_ptr->feature;
1458   feature_list *feature;
1459
1460   if ( ! slot->software_part_ptr->featurelist )
1461      return NULL;
1462
1463   for ( feature = slot->software_part_ptr->featurelist; feature; feature = feature->next )
1464   {
1465      if ( ! strcmp( feature->name, feature_name ) )
1466         return feature->value;
1467   }
1468
1469   return NULL;
14601470}
14611471
14621472
src/mess/image.h
r8287r8288
264264
265265UINT8 *image_get_software_region(running_device *image, const char *tag);
266266UINT32 image_get_software_region_length(running_device *image, const char *tag);
267const char *image_get_feature(running_device *image);
267const char *image_get_feature(running_device *image, const char *feature_name);
268268const software_info *image_software_entry(running_device *image);
269269
270270
src/mess/machine/nes.c
r8287r8288
10961096
10971097      state->format = 3;
10981098      state->mapper = 0;      // this allows us to set up memory handlers without duplicating code (for the moment)
1099      state->pcb_id = nes_get_pcb_id(image->machine, image_get_feature(image));
1099      state->pcb_id = nes_get_pcb_id(image->machine, image_get_feature(image, "pcb"));
11001100     
11011101      // setup NMT etc.
11021102      nes_pcb_setup(image->machine, state->pcb_id);
r8287r8288
11371137      state->chr_open_bus = 0;
11381138
11391139#if 1
1140      printf("PCB Feature: %s\n", image_get_feature(image));
1140      printf("PCB Feature: %s\n", image_get_feature(image, "pcb"));
11411141      printf("PRG chunks: %d\n", state->prg_chunks);
11421142      printf("CHR chunks: %d\n", state->chr_chunks);
11431143      printf("VRAM: Present %s, size: %d\n", state->vram_chunks ? "Yes" : "No", vram_size);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team