示例#1
0
文件: image.c 项目: broftkd/mess-cvs
static void image_exit(running_machine *machine)
{
	int i, j, indx;

	/* unload all devices */
	image_unload_all(FALSE);
	image_unload_all(TRUE);

	indx = 0;

	if (Machine->devices)
	{
		for (i = 0; Machine->devices[i].type < IO_COUNT; i++)
		{
			for (j = 0; j < Machine->devices[i].count; j++)
			{
				/* call the exit handler if appropriate */
				if (Machine->devices[i].exit)
					Machine->devices[i].exit(&images[indx + j]);

				tagpool_exit(&images[indx + j].tagpool);
			}
			indx += Machine->devices[i].count;
		}
	}
}
示例#2
0
文件: image.c 项目: bdidier/MAME-OS-X
void image_postdevice_init(running_machine &machine)
{
	device_image_interface *image = NULL;

	/* make sure that any required devices have been allocated */
    for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image))
    {
			int result = image->finish_load();
			/* did the image load fail? */
			if (result)
			{
				/* retrieve image error message */
				astring image_err = astring(image->error());

				/* unload all images */
				image_unload_all(machine);

				fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load failed: %s",
					image->device().name(),
					image_err.cstr());
			}
	}

	/* add a callback for when we shut down */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(image_unload_all), &machine));
}
示例#3
0
文件: image.c 项目: Ilgrim/MAMEHub
void image_device_init(running_machine &machine)
{
	const char *image_name;

	/* make sure that any required devices have been allocated */
	image_interface_iterator iter(machine.root_device());
	for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
	{
		/* is an image specified for this image */
		image_name = machine.options().device_option(*image);

		if ((image_name != NULL) && (image_name[0] != '\0'))
		{
			/* mark init state */
			image->set_init_phase();

			/* try to load this image */
			bool result = image->load(image_name);

			/* did the image load fail? */
			if (result)
			{
				/* retrieve image error message */
				astring image_err = astring(image->error());
				astring image_basename(image_name);

				/* unload all images */
				image_unload_all(machine);

				fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s",
					image->device().name(),
					image_basename.cstr(),
					image_err.cstr());
			}
		}
	}

	for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
	{
		/* is an image specified for this image */
		image_name = image->filename();

		if (!((image_name != NULL) && (image_name[0] != '\0')))
		{
			/* no image... must this device be loaded? */
			if (image->must_be_loaded())
			{
				fatalerror_exitcode(machine, MAMERR_DEVICE, "Driver requires that device \"%s\" must have an image to load", image->instance_name());
			}
		}
	}
}
示例#4
0
文件: image.c 项目: johkelly/MAME_hi
void image_device_init(running_machine *machine)
{
	const char *image_name;
	device_image_interface *image = NULL;

	/* make sure that any required devices have been allocated */
    for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
	{
		/* is an image specified for this image */
		image_name = image_get_device_option(image);

		if ((image_name != NULL) && (image_name[0] != '\0'))
		{
			/* mark init state */
			image->set_init_phase();

			/* try to load this image */
			bool result = image->load(image_name);

			/* did the image load fail? */
			if (result)
			{
				/* retrieve image error message */
				astring image_err = astring(image->error());
				const char *image_basename_str = image->basename();
				/* unload all images */
				image_unload_all(*machine);

				fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s",
					image->image_config().devconfig().name(),
					image_basename_str,
					image_err.cstr());
			}
		}
		else
		{
			/* no image... must this device be loaded? */
			if (image->image_config().must_be_loaded())
			{
				fatalerror_exitcode(machine, MAMERR_DEVICE, "Driver requires that device \"%s\" must have an image to load", image->image_config().instance_name());
			}
		}

		image->call_get_devices();
	}
}