src/mess/softlist.c
| r8094 | r8095 | |
| 520 | 520 | const char *str_crc = NULL; |
| 521 | 521 | const char *str_sha1 = NULL; |
| 522 | 522 | const char *str_offset = NULL; |
| 523 | const char *str_value = NULL; |
| 523 | 524 | const char *str_status = NULL; |
| 524 | 525 | const char *str_loadflag = NULL; |
| 525 | 526 | |
| r8094 | r8095 | |
| 535 | 536 | str_sha1 = attributes[1]; |
| 536 | 537 | if ( !strcmp( attributes[0], "offset" ) ) |
| 537 | 538 | str_offset = attributes[1]; |
| 539 | if ( !strcmp( attributes[0], "value" ) ) |
| 540 | str_value = attributes[1]; |
| 538 | 541 | if ( !strcmp( attributes[0], "status" ) ) |
| 539 | 542 | str_status = attributes[1]; |
| 540 | 543 | if ( !strcmp( attributes[0], "loadflag" ) ) |
| r8094 | r8095 | |
| 547 | 550 | UINT32 length = strtol( str_size, NULL, 10 ); |
| 548 | 551 | UINT32 offset = strtol( str_offset, NULL, 16 ); |
| 549 | 552 | |
| 550 | | if ( str_loadflag && !strcmp(str_loadflag,"reload") ) |
| 553 | if ( str_loadflag && !strcmp(str_loadflag, "reload") ) |
| 551 | 554 | { |
| 552 | 555 | /* Handle 'reload' loadflag */ |
| 553 | 556 | add_rom_entry( swlist, NULL, NULL, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS ); |
| 554 | 557 | } |
| 558 | else if ( str_loadflag && !strcmp(str_loadflag, "continue") ) |
| 559 | { |
| 560 | /* Handle 'continue' loadflag */ |
| 561 | add_rom_entry( swlist, NULL, NULL, offset, length, ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS ); |
| 562 | } |
| 563 | else if ( str_loadflag && !strcmp(str_loadflag, "fill") ) |
| 564 | { |
| 565 | /* Handle 'fill' loadflag */ |
| 566 | add_rom_entry( swlist, NULL, (const char*)atoi(str_value), offset, length, ROMENTRYTYPE_FILL ); |
| 567 | } |
| 555 | 568 | else |
| 556 | 569 | { |
| 557 | 570 | if ( str_name && str_crc && str_sha1 ) |
| 558 | 571 | { |
| 559 | 572 | char *s_name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_name ) + 1 ) * sizeof(char) ); |
| 560 | 573 | char *hashdata = (char *)pool_malloc_lib( swlist->pool, sizeof(char) * ( strlen(str_crc) + strlen(str_sha1) + 7 + 4 ) ); |
| 561 | | int baddump = ( str_status && !strcmp(str_status,"baddump") ) ? 1 : 0; |
| 562 | | int nodump = ( str_status && !strcmp(str_status,"nodump" ) ) ? 1 : 0; |
| 574 | int baddump = ( str_status && !strcmp(str_status, "baddump") ) ? 1 : 0; |
| 575 | int nodump = ( str_status && !strcmp(str_status, "nodump" ) ) ? 1 : 0; |
| 563 | 576 | int romflags = 0; |
| 564 | 577 | |
| 565 | 578 | if ( !s_name || !hashdata ) |
| r8094 | r8095 | |
| 569 | 582 | sprintf( hashdata, "c:%s#s:%s#%s", str_crc, str_sha1, ( nodump ? NO_DUMP : ( baddump ? BAD_DUMP : "" ) ) ); |
| 570 | 583 | |
| 571 | 584 | /* Handle loadflag attribute */ |
| 572 | | if ( str_loadflag && !strcmp(str_loadflag,"load16_word_swap") ) |
| 585 | if ( str_loadflag && !strcmp(str_loadflag, "load16_word_swap") ) |
| 573 | 586 | romflags = ROM_GROUPWORD | ROM_REVERSE; |
| 574 | | else if ( str_loadflag && !strcmp(str_loadflag,"load16_byte") ) |
| 587 | else if ( str_loadflag && !strcmp(str_loadflag, "load16_byte") ) |
| 575 | 588 | romflags = ROM_SKIP(1); |
| 589 | else if ( str_loadflag && !strcmp(str_loadflag, "load32_word_swap") ) |
| 590 | romflags = ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2); |
| 576 | 591 | |
| 577 | 592 | /* ROM_LOAD( name, offset, length, hash ) */ |
| 578 | 593 | add_rom_entry( swlist, s_name, hashdata, offset, length, ROMENTRYTYPE_ROM | romflags ); |