src/mess/image.c
| r6930 | r6931 | |
| 23 | 23 | #include "ui.h" |
| 24 | 24 | #include "device.h" |
| 25 | 25 | #include "zippath.h" |
| 26 | #include "softlist.h" |
| 26 | 27 | |
| 27 | 28 | |
| 28 | 29 | |
| r6930 | r6931 | |
| 64 | 65 | unsigned int created : 1; |
| 65 | 66 | unsigned int is_loading : 1; |
| 66 | 67 | |
| 68 | /* Software list and software entry information */ |
| 69 | const software_list *software_list; |
| 70 | const software_entry *software_entry; |
| 71 | |
| 67 | 72 | /* info read from the hash file */ |
| 68 | 73 | char *longname; |
| 69 | 74 | char *manufacturer; |
| r6930 | r6931 | |
| 242 | 247 | slot->unload = (device_image_unload_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_UNLOAD); |
| 243 | 248 | slot->verify = (device_image_verify_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_VERIFY); |
| 244 | 249 | |
| 250 | /* sodftware list and entry */ |
| 251 | slot->software_list = software_list_get_by_name( device_get_info_string(slot->dev, DEVINFO_STR_SOFTWARE_LIST) ); |
| 252 | slot->software_entry = NULL; |
| 253 | |
| 245 | 254 | /* creation option guide */ |
| 246 | 255 | slot->create_option_guide = (const option_guide *) device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE); |
| 247 | 256 | |
| r6930 | r6931 | |
| 693 | 702 | |
| 694 | 703 | static int is_loaded(image_slot_data *image) |
| 695 | 704 | { |
| 696 | | return (image->file != NULL) || (image->ptr != NULL); |
| 705 | return (image->file != NULL) || (image->ptr != NULL) || (image->software_entry != NULL); |
| 697 | 706 | } |
| 698 | 707 | |
| 699 | 708 | |
| r6930 | r6931 | |
| 838 | 847 | if ((attotime_compare(timer_get_time(machine), attotime_zero) > 0) && slot->info.reset_on_load) |
| 839 | 848 | mame_schedule_hard_reset(machine); |
| 840 | 849 | |
| 850 | /* Check if there's a software list defined for this device and use that if we're not creating an image */ |
| 851 | /* This piece below is commented out until load_region_list or something better is available in src/emu/romload */ |
| 852 | #if 0 |
| 853 | if ( !is_create && slot->software_list ) |
| 854 | { |
| 855 | slot->software_entry = software_get_by_name( slot->software_list, path ); |
| 856 | |
| 857 | if ( slot->software_entry ) |
| 858 | { |
| 859 | load_region_list(slot->dev, slot->software_list->name, slot->software_entry->name, slot->software_entry->rom_info ); |
| 860 | |
| 861 | /* call device load or create */ |
| 862 | if (image->token != NULL) |
| 863 | { |
| 864 | err = image_finish_load(image); |
| 865 | if (err) |
| 866 | goto done; |
| 867 | } |
| 868 | |
| 869 | goto done; |
| 870 | } |
| 871 | } |
| 872 | #endif |
| 873 | |
| 841 | 874 | /* determine open plan */ |
| 842 | 875 | determine_open_plan(slot, is_create, open_plan); |
| 843 | 876 | |
| r6930 | r6931 | |
| 1410 | 1443 | |
| 1411 | 1444 | |
| 1412 | 1445 | /*------------------------------------------------- |
| 1446 | image_software_entry |
| 1447 | -------------------------------------------------*/ |
| 1448 | |
| 1449 | const software_entry *image_software_entry(const device_config *image) |
| 1450 | { |
| 1451 | image_slot_data *slot = find_image_slot(image); |
| 1452 | |
| 1453 | return slot->software_entry; |
| 1454 | } |
| 1455 | |
| 1456 | |
| 1457 | |
| 1458 | /*------------------------------------------------- |
| 1459 | image_get_software_region |
| 1460 | -------------------------------------------------*/ |
| 1461 | |
| 1462 | UINT8 *image_get_software_region(const device_config *image, const char *tag) |
| 1463 | { |
| 1464 | char full_tag[256]; |
| 1465 | |
| 1466 | sprintf( full_tag, "%s:%s:%s", image->tag, image_software_entry(image)->name, tag ); |
| 1467 | return memory_region( image->machine, full_tag ); |
| 1468 | } |
| 1469 | |
| 1470 | |
| 1471 | /*------------------------------------------------- |
| 1413 | 1472 | image_is_writable |
| 1414 | 1473 | -------------------------------------------------*/ |
| 1415 | 1474 | |
src/mess/image.h
| r6930 | r6931 | |
| 15 | 15 | #include "utils.h" |
| 16 | 16 | #include "opresolv.h" |
| 17 | 17 | #include "osdmess.h" |
| 18 | #include "softlist.h" |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | /*************************************************************************** |
| r6930 | r6931 | |
| 144 | 145 | DEVINFO_STR_IMAGE_CREATE_OPTNAME, |
| 145 | 146 | DEVINFO_STR_IMAGE_CREATE_OPTDESC = DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_CREATE_OPTMAX, |
| 146 | 147 | DEVINFO_STR_IMAGE_CREATE_OPTEXTS = DEVINFO_STR_IMAGE_CREATE_OPTDESC + DEVINFO_CREATE_OPTMAX, |
| 148 | DEVINFO_STR_SOFTWARE_LIST, |
| 147 | 149 | DEVINFO_STR_IMAGE_LAST = DEVINFO_STR_IMAGE_FIRST + 0x0fff |
| 148 | 150 | }; |
| 149 | 151 | |
| r6930 | r6931 | |
| 264 | 266 | void *image_ptr(const device_config *image); |
| 265 | 267 | |
| 266 | 268 | |
| 269 | UINT8 *image_get_software_region(const device_config *image, const char *tag); |
| 270 | const software_entry *image_software_entry(const device_config *image); |
| 267 | 271 | |
| 272 | |
| 273 | |
| 268 | 274 | /**************************************************************************** |
| 269 | 275 | Memory allocators |
| 270 | 276 | |