r7244 Tuesday 2nd February, 2010 at 20:58:19 UTC by Miodrag Milanović
Fixed regular image loading.
[src/mess]image.c image.h mess.c

src/mess/mess.c
r7243r7244
6363         {
6464            int result = INIT_FAIL;
6565           
66            /* mark init state */
67            set_init_phase(image);
68           
6669            /* try to load this image */
6770            result = image_load(image, image_name);
6871
r7243r7244
7376               const char *image_err = image_error(image);
7477
7578               /* unload all images */
76               image_unload_all(machine);
77
79               image_unload_all(machine);               
7880               /* FIXME: image_name is always empty in this message because of the image_unload_all() call */
7981               fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s\n",
8082                  info.name,
src/mess/image.c
r7243r7244
8585
8686    /* pointer */
8787    void *ptr;
88   
89   int not_init_phase;
8890};
8991
9092
r7243r7244
196198
197199        slot = &machine->images_data->slots[indx];
198200
201      slot->not_init_phase = 1;
202     
199203        /* create a memory pool, and allocated strings */
200204        slot->mempool = pool_alloc_lib(memory_error);
201205        slot->name = astring_alloc();
r7243r7244
770774    int is_create, int create_format, option_resolution *create_args)
771775{
772776    running_machine *machine = image->machine;
777    image_error_t err;
773778    UINT32 open_plan[4];
774779    int i;
775780    image_slot_data *slot = find_image_slot(image);
r7243r7244
848853    {
849854        slot->create_format = create_format;
850855        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      }
851862    }
852863
853864    /* success! */
r7243r7244
908919    slot->is_loading = 0;
909920    slot->create_format = 0;
910921    slot->create_args = NULL;
922   slot->not_init_phase = 1;
911923    return err;
912924}
913925
r7243r7244
17741786    return slot->pcb;
17751787}
17761788
1777
1778
17791789/*-------------------------------------------------
17801790    image_extrainfo
17811791-------------------------------------------------*/
r7243r7244
19231933{
19241934    return machine->images_data->slots[absolute_index].dev;
19251935}
1936
1937void set_init_phase(running_device *device)
1938{
1939    image_slot_data *slot = find_image_slot(device);
1940   slot->not_init_phase = 0;
1941}
src/mess/image.h
r7243r7244
260260int image_feof(running_device *image);
261261
262262void *image_ptr(running_device *image);
263void set_init_phase(running_device *device);
263264
264
265265UINT8 *image_get_software_region(running_device *image, const char *tag);
266266UINT32 image_get_software_region_length(running_device *image, const char *tag);
267267const software_entry *image_software_entry(running_device *image);

Previous 509077 RevisionsNext 50


© 1998-2010 The MESS Team