src/mess/mess.c
| r7243 | r7244 | |
| 63 | 63 | { |
| 64 | 64 | int result = INIT_FAIL; |
| 65 | 65 | |
| 66 | /* mark init state */ |
| 67 | set_init_phase(image); |
| 68 | |
| 66 | 69 | /* try to load this image */ |
| 67 | 70 | result = image_load(image, image_name); |
| 68 | 71 | |
| r7243 | r7244 | |
| 73 | 76 | const char *image_err = image_error(image); |
| 74 | 77 | |
| 75 | 78 | /* unload all images */ |
| 76 | | image_unload_all(machine); |
| 77 | | |
| 79 | image_unload_all(machine); |
| 78 | 80 | /* FIXME: image_name is always empty in this message because of the image_unload_all() call */ |
| 79 | 81 | fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s\n", |
| 80 | 82 | info.name, |
src/mess/image.c
| r7243 | r7244 | |
| 85 | 85 | |
| 86 | 86 | /* pointer */ |
| 87 | 87 | void *ptr; |
| 88 | |
| 89 | int not_init_phase; |
| 88 | 90 | }; |
| 89 | 91 | |
| 90 | 92 | |
| r7243 | r7244 | |
| 196 | 198 | |
| 197 | 199 | slot = &machine->images_data->slots[indx]; |
| 198 | 200 | |
| 201 | slot->not_init_phase = 1; |
| 202 | |
| 199 | 203 | /* create a memory pool, and allocated strings */ |
| 200 | 204 | slot->mempool = pool_alloc_lib(memory_error); |
| 201 | 205 | slot->name = astring_alloc(); |
| r7243 | r7244 | |
| 770 | 774 | int is_create, int create_format, option_resolution *create_args) |
| 771 | 775 | { |
| 772 | 776 | running_machine *machine = image->machine; |
| 777 | image_error_t err; |
| 773 | 778 | UINT32 open_plan[4]; |
| 774 | 779 | int i; |
| 775 | 780 | image_slot_data *slot = find_image_slot(image); |
| r7243 | r7244 | |
| 848 | 853 | { |
| 849 | 854 | slot->create_format = create_format; |
| 850 | 855 | slot->create_args = create_args; |
| 856 | |
| 857 | if (slot->not_init_phase) { |
| 858 | err = (image_error_t)image_finish_load(image); |
| 859 | if (err) |
| 860 | goto done; |
| 861 | } |
| 851 | 862 | } |
| 852 | 863 | |
| 853 | 864 | /* success! */ |
| r7243 | r7244 | |
| 908 | 919 | slot->is_loading = 0; |
| 909 | 920 | slot->create_format = 0; |
| 910 | 921 | slot->create_args = NULL; |
| 922 | slot->not_init_phase = 1; |
| 911 | 923 | return err; |
| 912 | 924 | } |
| 913 | 925 | |
| r7243 | r7244 | |
| 1774 | 1786 | return slot->pcb; |
| 1775 | 1787 | } |
| 1776 | 1788 | |
| 1777 | | |
| 1778 | | |
| 1779 | 1789 | /*------------------------------------------------- |
| 1780 | 1790 | image_extrainfo |
| 1781 | 1791 | -------------------------------------------------*/ |
| r7243 | r7244 | |
| 1923 | 1933 | { |
| 1924 | 1934 | return machine->images_data->slots[absolute_index].dev; |
| 1925 | 1935 | } |
| 1936 | |
| 1937 | void set_init_phase(running_device *device) |
| 1938 | { |
| 1939 | image_slot_data *slot = find_image_slot(device); |
| 1940 | slot->not_init_phase = 0; |
| 1941 | } |