Previous 15994 Revisions Next

r7780 Sunday 11th April, 2010 at 10:17:29 UTC by Wilbert Pol
Fixed support for the 'reload' loadflag in software lists.
[src/mess]climess.c softlist.c

src/mess/climess.c
r7779r7780
252252                                 {
253253                                    fprintf( out, "\t\t\t\t<dataarea name=\"%s\" size=\"%x\">\n", ROMREGION_GETTAG(region), ROMREGION_GETLENGTH(region) );
254254
255                                    for ( const rom_entry *rom = rom_first_file( region ); rom; rom = rom_next_file( rom ) )
255                                    for ( const rom_entry *rom = rom_first_file( region ); !ROMENTRY_ISREGIONEND(rom); rom++ )
256256                                    {
257257                                       if ( ROMENTRY_ISFILE(rom) )
258258                                       {
r7779r7780
279279
280280                                          fprintf( out, "/>\n" );
281281                                       }
282                                       else if ( ROMENTRY_ISRELOAD(rom) )
283                                       {
284                                          fprintf( out, "\t\t\t\t\t<rom size=\"%d\" offset=\"%x\" loadflag=\"reload\" />\n", ROM_GETLENGTH(rom), ROM_GETOFFSET(rom) );
285                                       }
282286                                    }
283287
284288                                    fprintf( out, "\t\t\t\t</datearea>\n" );
src/mess/softlist.c
r7779r7780
525525               if ( !strcmp( attributes[0], "loadflag" ) )
526526                  str_loadflag = attributes[1];
527527            }
528            if ( str_name && str_size && str_crc && str_sha1 && str_offset )
528            if ( swlist->softinfo )
529529            {
530               if ( swlist->softinfo )
530               if ( str_size && str_offset )
531531               {
532532                  UINT32 length = strtol( str_size, NULL, 10 );
533533                  UINT32 offset = strtol( str_offset, NULL, 16 );
534                  char *s_name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_name ) + 1 ) * sizeof(char) );
535                  char *hashdata = (char *)pool_malloc_lib( swlist->pool, sizeof(char) * ( strlen(str_crc) + strlen(str_sha1) + 7 ) );
536                  int baddump = ( str_status && !strcmp(str_status,"baddump") ) ? 1 : 0;
537                  int nodump = ( str_status && !strcmp(str_status,"nodump" ) ) ? 1 : 0;
538534
539                  if ( !s_name || !hashdata )
540                     return;
535                  if ( str_loadflag && !strcmp(str_loadflag,"reload") )
536                  {
537                     /* Handle 'reload' loadflag */
538                     add_rom_entry( swlist, NULL, NULL, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS );
539                  }
540                  else
541                  {
542                     if ( str_name && str_crc && str_sha1 )
543                     {
544                        char *s_name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_name ) + 1 ) * sizeof(char) );
545                        char *hashdata = (char *)pool_malloc_lib( swlist->pool, sizeof(char) * ( strlen(str_crc) + strlen(str_sha1) + 7 ) );
546                        int baddump = ( str_status && !strcmp(str_status,"baddump") ) ? 1 : 0;
547                        int nodump = ( str_status && !strcmp(str_status,"nodump" ) ) ? 1 : 0;
541548
542                  strcpy( s_name, str_name );
543                  sprintf( hashdata, "c:%s#s:%s#%s", str_crc, str_sha1, ( nodump ? NO_DUMP : ( baddump ? BAD_DUMP : 0 ) ) );
549                        if ( !s_name || !hashdata )
550                           return;
544551
545                  /* ROM_LOAD( name, offset, length, hash ) */
546                  add_rom_entry( swlist, s_name, hashdata, offset, length, ROMENTRYTYPE_ROM );
552                        strcpy( s_name, str_name );
553                        sprintf( hashdata, "c:%s#s:%s#%s", str_crc, str_sha1, ( nodump ? NO_DUMP : ( baddump ? BAD_DUMP : 0 ) ) );
554
555                        /* ROM_LOAD( name, offset, length, hash ) */
556                        add_rom_entry( swlist, s_name, hashdata, offset, length, ROMENTRYTYPE_ROM );
557                     }
558                  }
547559               }
548560            }
549561            else

Previous 15994 Revisions Next


© 1998-2018 The MESS Team