Previous 199869 Revisions Next

r17394 Wednesday 22nd August, 2012 at 14:02:55 UTC by Miodrag Milanović
patch that enables output of <info> elements stored in software lists through -listsoftware [qmc2]
[src/emu]clifront.c softlist.c

trunk/src/emu/clifront.c
r17393r17394
11211121      fprintf( out, "\t\t\t<year>%s</year>\n", xml_normalize_string( swinfo->year ) );
11221122      fprintf( out, "\t\t\t<publisher>%s</publisher>\n", xml_normalize_string( swinfo->publisher ) );
11231123
1124      feature_list *flist = swinfo->other_info;
1125      while ( flist ) {
1126         fprintf( out, "\t\t\t<info name=\"%s\" value=\"%s\"/>\n", flist->name, flist->value );
1127         flist = flist->next;
1128      }
1129
11241130      for ( software_part *part = software_find_part( swinfo, NULL, NULL ); part != NULL; part = software_part_next( part ) )
11251131      {
11261132         fprintf( out, "\t\t\t<part name=\"%s\"", part->name );
trunk/src/emu/softlist.c
r17393r17394
352352}
353353
354354/*-------------------------------------------------
355 add_other_info (same as add_info, but its target
356 is softinfo->other_info)
357 -------------------------------------------------*/
358
359static void add_other_info(software_list *swlist, char *info_name, char *info_value)
360{
361   software_info *info = swlist->softinfo;
362   feature_list *new_entry;
363
364   /* First allocate the new entry */
365   new_entry = (feature_list *)pool_malloc_lib(swlist->pool, sizeof(feature_list) );
366
367   if ( new_entry )
368   {
369      new_entry->next = NULL;
370      new_entry->name = info_name;
371      new_entry->value = info_value ? info_value : info_name;
372
373      /* Add new feature to end of feature list */
374      if ( info->other_info )
375      {
376         feature_list *list = info->other_info;
377         while ( list->next != NULL )
378         {
379            list = list->next;
380         }
381         list->next = new_entry;
382      }
383      else
384      {
385         info->other_info = new_entry;
386      }
387   }
388   else
389   {
390      /* Unable to allocate memory */
391   }
392}
393
394/*-------------------------------------------------
355395    add_software_part
356396-------------------------------------------------*/
357397
r17393r17394
536576            text_dest = (char **) &swlist->softinfo->publisher;
537577         else if (!strcmp(tagname, "info"))
538578         {
539            // the "info" field (containing info about actual developers, etc.) is not currently stored.
540            // full support will be added, but for the moment frontend have to get this info from the xml directly
579            const char *str_info_name = NULL;
580            const char *str_info_value = NULL;
581            for ( ; attributes[0]; attributes += 2 )
582            {
583               if ( !strcmp( attributes[0], "name" ) )
584                  str_info_name = attributes[1];
585               else if ( !strcmp( attributes[0], "value" ) )
586                  str_info_value = attributes[1];
587               else
588                  unknown_attribute(swlist, attributes[0]);
589            }
590
591            if ( str_info_name && swlist->softinfo )
592            {
593               char *name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_info_name ) + 1 ) * sizeof(char) );
594               char *value = NULL;
595
596               if ( !name )
597                  return;
598
599               strcpy( name, str_info_name );
600
601               if ( str_info_value )
602               {
603                  value = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_info_value ) + 1 ) * sizeof(char) );
604
605                  if ( !value )
606                     return;
607
608                  strcpy( value, str_info_value );
609
610                  add_other_info( swlist, name, value );
611               }
612            } else {
613               parse_error(&swlist->state, "%s: Incomplete other_info definition (line %lu)\n",
614                  swlist->file->filename(),XML_GetCurrentLineNumber(swlist->state.parser));
615            }
541616         }
542617         else if (!strcmp(tagname, "sharedfeat"))
543618         {

Previous 199869 Revisions Next


© 1997-2024 The MAME Team