hash/softwarelist.dtd
| r9977 | r9978 | |
| 8 | 8 | <!ELEMENT description (#PCDATA)> |
| 9 | 9 | <!ELEMENT year (#PCDATA)> |
| 10 | 10 | <!ELEMENT publisher (#PCDATA)> |
| 11 | | <!ELEMENT part (feature*, dataarea*, dipswitch*)> |
| 11 | <!ELEMENT part (feature*, dataarea*, diskarea*, dipswitch*)> |
| 12 | 12 | <!ATTLIST part name CDATA #REQUIRED> |
| 13 | 13 | <!ATTLIST part interface CDATA #REQUIRED> |
| 14 | 14 | <!-- feature is used to store things like pcb-type, mapper type, etc. Specific values depend on the system. --> |
| r9977 | r9978 | |
| 30 | 30 | <!ATTLIST rom value CDATA #IMPLIED> |
| 31 | 31 | <!ATTLIST rom status (baddump|nodump|good) "good"> |
| 32 | 32 | <!ATTLIST rom loadflag (load16_byte|load16_word|load16_word_swap|load32_byte|load32_word|load32_word_swap|load32_dword|load64_word|load64_word_swap|reload|fill|continue) #IMPLIED> |
| 33 | <!ELEMENT diskarea (disk*)> |
| 34 | <!ATTLIST diskarea name CDATA #REQUIRED> |
| 35 | <!ELEMENT disk EMPTY> |
| 36 | <!ATTLIST disk name CDATA #IMPLIED> |
| 37 | <!ATTLIST disk md5 CDATA #IMPLIED> |
| 38 | <!ATTLIST disk sha1 CDATA #IMPLIED> |
| 39 | <!ATTLIST disk status (baddump|nodump|good) "good"> |
| 33 | 40 | <!ELEMENT dipswitch (dipvalue*)> |
| 34 | 41 | <!ATTLIST dipswitch name CDATA #REQUIRED> |
| 35 | 42 | <!ATTLIST dipswitch tag CDATA #REQUIRED> |
src/emu/romload.c
| r9977 | r9978 | |
| 949 | 949 | up the parent and loading by checksum |
| 950 | 950 | -------------------------------------------------*/ |
| 951 | 951 | |
| 952 | | chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd) |
| 952 | chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd,const char *locationtag) |
| 953 | 953 | { |
| 954 | | return open_disk_image_options(mame_options(), gamedrv, romp, image_file, image_chd); |
| 954 | return open_disk_image_options(mame_options(), gamedrv, romp, image_file, image_chd, locationtag); |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | |
| r9977 | r9978 | |
| 961 | 961 | checksum |
| 962 | 962 | -------------------------------------------------*/ |
| 963 | 963 | |
| 964 | | chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd) |
| 964 | chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd,const char *locationtag) |
| 965 | 965 | { |
| 966 | 966 | const game_driver *drv, *searchdrv; |
| 967 | 967 | const rom_entry *region, *rom; |
| r9977 | r9978 | |
| 986 | 986 | filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, fname, OPEN_FLAG_READ, image_file); |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | if (filerr != FILERR_NONE && locationtag!=NULL) |
| 990 | { |
| 991 | astring fname(locationtag, PATH_SEPARATOR, ROM_GETNAME(romp), ".chd"); |
| 992 | filerr = mame_fopen_options(options, SEARCHPATH_IMAGE, fname, OPEN_FLAG_READ, image_file); |
| 993 | } |
| 994 | |
| 989 | 995 | /* did the file open succeed? */ |
| 990 | 996 | if (filerr == FILERR_NONE) |
| 991 | 997 | { |
| r9977 | r9978 | |
| 1101 | 1107 | for a region |
| 1102 | 1108 | -------------------------------------------------*/ |
| 1103 | 1109 | |
| 1104 | | static void process_disk_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp) |
| 1110 | static void process_disk_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp, const char *locationtag) |
| 1105 | 1111 | { |
| 1106 | 1112 | /* loop until we hit the end of this region */ |
| 1107 | 1113 | for ( ; !ROMENTRY_ISREGIONEND(romp); romp++) |
| r9977 | r9978 | |
| 1122 | 1128 | |
| 1123 | 1129 | /* first open the source drive */ |
| 1124 | 1130 | LOG(("Opening disk image: %s\n", filename.cstr())); |
| 1125 | | err = open_disk_image(romdata->machine->gamedrv, romp, &chd.origfile, &chd.origchd); |
| 1131 | err = open_disk_image(romdata->machine->gamedrv, romp, &chd.origfile, &chd.origchd, locationtag); |
| 1126 | 1132 | if (err != CHDERR_NONE) |
| 1127 | 1133 | { |
| 1128 | 1134 | if (err == CHDERR_FILE_NOT_FOUND) |
| r9977 | r9978 | |
| 1283 | 1289 | if (ROMREGION_ISROMDATA(region)) |
| 1284 | 1290 | process_rom_entries(romdata, locationtag, region + 1); |
| 1285 | 1291 | else if (ROMREGION_ISDISKDATA(region)) |
| 1286 | | process_disk_entries(romdata, locationtag, region + 1); |
| 1292 | process_disk_entries(romdata, core_strdup(regiontag.cstr()), region + 1, locationtag); |
| 1287 | 1293 | } |
| 1288 | 1294 | |
| 1289 | 1295 | /* now go back and post-process all the regions */ |
| r9977 | r9978 | |
| 1346 | 1352 | process_rom_entries(romdata, ROMREGION_ISLOADBYNAME(region) ? ROMREGION_GETTAG(region) : NULL, region + 1); |
| 1347 | 1353 | } |
| 1348 | 1354 | else if (ROMREGION_ISDISKDATA(region)) |
| 1349 | | process_disk_entries(romdata, ROMREGION_GETTAG(region), region + 1); |
| 1355 | process_disk_entries(romdata, ROMREGION_GETTAG(region), region + 1, NULL); |
| 1350 | 1356 | } |
| 1351 | 1357 | |
| 1352 | 1358 | /* now go back and post-process all the regions */ |
src/emu/imagedev/chd_cd.c
| r9977 | r9978 | |
| 79 | 79 | dev_cdrom_t *cdrom = get_safe_token(&image.device()); |
| 80 | 80 | chd_error err = (chd_error)0; |
| 81 | 81 | chd_file *chd = NULL; |
| 82 | astring tempstring; |
| 82 | 83 | |
| 83 | | err = chd_open_file( image.image_core_file(), CHD_OPEN_READ, NULL, &chd ); /* CDs are never writeable */ |
| 84 | | if ( err ) |
| 85 | | goto error; |
| 84 | if (image.software_entry() == NULL) |
| 85 | { |
| 86 | err = chd_open_file( image.image_core_file(), CHD_OPEN_READ, NULL, &chd ); /* CDs are never writeable */ |
| 87 | if ( err ) |
| 88 | goto error; |
| 89 | } else { |
| 90 | chd = get_disk_handle(image.device().machine, image.device().subtag(tempstring,"cdrom")); |
| 91 | } |
| 86 | 92 | |
| 87 | 93 | /* open the CHD file */ |
| 88 | 94 | cdrom->cdrom_handle = cdrom_open( chd ); |
| r9977 | r9978 | |
| 141 | 147 | -------------------------------------------------*/ |
| 142 | 148 | static DEVICE_IMAGE_SOFTLIST_LOAD(cdrom) |
| 143 | 149 | { |
| 144 | | return image.load_software(swlist, swname, start_entry); |
| 150 | load_software_part_region( &image.device(), swlist, swname, start_entry ); |
| 151 | return TRUE; |
| 145 | 152 | } |
| 146 | 153 | |
| 147 | 154 | /*------------------------------------------------- |
src/emu/romload.h
| r9977 | r9978 | |
| 313 | 313 | /* ----- disk handling ----- */ |
| 314 | 314 | |
| 315 | 315 | /* open a disk image, searching up the parent and loading by checksum */ |
| 316 | | chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd); |
| 316 | chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd,const char *locationtag); |
| 317 | 317 | |
| 318 | 318 | /* open a disk image, searching up the parent and loading by checksum */ |
| 319 | | chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd); |
| 319 | chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd,const char *locationtag); |
| 320 | 320 | |
| 321 | 321 | /* return a pointer to the CHD file associated with the given region */ |
| 322 | 322 | chd_file *get_disk_handle(running_machine *machine, const char *region); |
src/emu/softlist.c
| r9977 | r9978 | |
| 530 | 530 | /* Missing dataarea name or size */ |
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | else if (!strcmp(tagname, "diskarea")) |
| 534 | { |
| 535 | const char *str_name = NULL; |
| 536 | |
| 537 | for ( ; attributes[0]; attributes += 2 ) |
| 538 | { |
| 539 | if ( !strcmp( attributes[0], "name" ) ) |
| 540 | str_name = attributes[1]; |
| 541 | } |
| 542 | if ( str_name ) |
| 543 | { |
| 544 | if ( swlist->softinfo ) |
| 545 | { |
| 546 | char *s = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_name ) + 1 ) * sizeof(char) ); |
| 547 | |
| 548 | if ( !s ) |
| 549 | return; |
| 550 | |
| 551 | strcpy( s, str_name ); |
| 552 | |
| 553 | /* ROM_REGION( length, "name", flags ) */ |
| 554 | add_rom_entry( swlist, s, NULL, 0, 1, ROMENTRYTYPE_REGION | ROMREGION_DATATYPEDISK); |
| 555 | } |
| 556 | } |
| 557 | else |
| 558 | { |
| 559 | /* Missing dataarea name or size */ |
| 560 | } |
| 561 | } |
| 533 | 562 | else if ( !strcmp(tagname, "feature") ) |
| 534 | 563 | { |
| 535 | 564 | const char *str_feature_name = NULL; |
| r9977 | r9978 | |
| 663 | 692 | } |
| 664 | 693 | } |
| 665 | 694 | else |
| 695 | if (!strcmp(tagname, "disk")) |
| 696 | { |
| 697 | const char *str_name = NULL; |
| 698 | const char *str_sha1 = NULL; |
| 699 | const char *str_status = NULL; |
| 700 | |
| 701 | for ( ; attributes[0]; attributes += 2 ) |
| 702 | { |
| 703 | if ( !strcmp( attributes[0], "name" ) ) |
| 704 | str_name = attributes[1]; |
| 705 | if ( !strcmp( attributes[0], "sha1" ) ) |
| 706 | str_sha1 = attributes[1]; |
| 707 | if ( !strcmp( attributes[0], "status" ) ) |
| 708 | str_status = attributes[1]; |
| 709 | } |
| 710 | if ( swlist->softinfo ) |
| 711 | { |
| 712 | if ( str_name && str_sha1 ) |
| 713 | { |
| 714 | char *s_name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_name ) + 1 ) * sizeof(char) ); |
| 715 | char *hashdata = (char *)pool_malloc_lib( swlist->pool, sizeof(char) * ( strlen(str_sha1) + 7 + 4 ) ); |
| 716 | int baddump = ( str_status && !strcmp(str_status, "baddump") ) ? 1 : 0; |
| 717 | int nodump = ( str_status && !strcmp(str_status, "nodump" ) ) ? 1 : 0; |
| 718 | |
| 719 | if ( !s_name || !hashdata ) |
| 720 | return; |
| 721 | |
| 722 | strcpy( s_name, str_name ); |
| 723 | sprintf( hashdata, "s:%s#%s", str_sha1, ( nodump ? NO_DUMP : ( baddump ? BAD_DUMP : "" ) ) ); |
| 724 | |
| 725 | add_rom_entry( swlist, s_name, hashdata, 0, 0, ROMENTRYTYPE_ROM | DISK_READONLY ); |
| 726 | } |
| 727 | } |
| 728 | } |
| 729 | else |
| 666 | 730 | unknown_tag(&swlist->state, tagname); |
| 667 | 731 | break; |
| 668 | 732 | } |