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()); } } } }
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)); }
static void display_rom_load_results(rom_load_data *romdata) { int region; /* final status display */ display_loading_rom_message(NULL, romdata); /* if we had errors, they are fatal */ if (romdata->errors != 0) { /* clean up any regions */ for (region = 0; region < MAX_MEMORY_REGIONS; region++) free_memory_region(Machine, region); /* create the error message and exit fatally */ strcat(romdata->errorbuf, "ERROR: required files are missing, the game cannot be run."); fatalerror_exitcode(MAMERR_MISSING_FILES, "%s", romdata->errorbuf); } /* if we had warnings, output them, but continue */ if (romdata->warnings) { strcat(romdata->errorbuf, "WARNING: the game might not run correctly."); mame_printf_warning("%s\n", romdata->errorbuf); } }
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(); } }
image_manager::image_manager(running_machine &machine) : m_machine(machine) { // make sure that any required devices have been allocated for (device_image_interface &image : image_interface_iterator(machine.root_device())) { // ignore things not user loadable if (!image.user_loadable()) continue; // is an image specified for this image const char *image_name_ptr = machine.options().value(image.instance_name()); if ((image_name_ptr != nullptr) && (image_name_ptr[0] != '\0')) { image_init_result result = image_init_result::FAIL; std::string image_name(image_name_ptr); // mark init state image.set_init_phase(); // try as a softlist if (software_name_parse(image_name)) result = image.load_software(image_name); // failing that, try as an image if (result != image_init_result::PASS) result = image.load(image_name); // failing that, try creating it (if appropriate) if (result != image_init_result::PASS && image.support_command_line_image_creation()) result = image.create(image_name); // did the image load fail? if (result != image_init_result::PASS) { // retrieve image error message std::string image_err = std::string(image.error()); // unload all images unload_all(); fatalerror_exitcode(machine, EMU_ERR_DEVICE, "Device %s load (%s) failed: %s", image.device().name(), image_name.c_str(), image_err.c_str()); } } } machine.configuration().config_register("image_directories", config_saveload_delegate(FUNC(image_manager::config_load), this), config_saveload_delegate(FUNC(image_manager::config_save), this)); }
void rom_load_manager::display_rom_load_results(bool from_list) { /* final status display */ display_loading_rom_message(nullptr, from_list); /* if we had errors, they are fatal */ if (m_errors != 0) { /* create the error message and exit fatally */ osd_printf_error("%s", m_errorstring.c_str()); fatalerror_exitcode(machine(), MAMERR_MISSING_FILES, "Required files are missing, the machine cannot be run."); } /* if we had warnings, output them, but continue */ if ((m_warnings) || (m_knownbad)) { m_errorstring.append("WARNING: the machine might not run correctly."); osd_printf_warning("%s\n", m_errorstring.c_str()); } }
static void display_rom_load_results(romload_private *romdata, bool from_list) { /* final status display */ display_loading_rom_message(romdata, NULL, from_list); /* if we had errors, they are fatal */ if (romdata->errors != 0) { /* create the error message and exit fatally */ mame_printf_error("%s", romdata->errorstring.cstr()); fatalerror_exitcode(romdata->machine(), MAMERR_MISSING_FILES, "Required files are missing, the %s cannot be run.",emulator_info::get_gamenoun()); } /* if we had warnings, output them, but continue */ if ((romdata-> warnings) || (romdata->knownbad)) { romdata->errorstring.cat("WARNING: the "); romdata->errorstring.cat(emulator_info::get_gamenoun()); romdata->errorstring.cat(" might not run correctly."); mame_printf_warning("%s\n", romdata->errorstring.cstr()); } }
image_manager::image_manager(running_machine &machine) : m_machine(machine) { /* make sure that any required devices have been allocated */ for (device_image_interface &image : image_interface_iterator(machine.root_device())) { /* is an image specified for this image */ const char *image_name = machine.options().value(image.instance_name()); if (!image.user_loadable()) continue; if ((image_name != nullptr) && (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 */ std::string image_err = std::string(image.error()); std::string image_basename(image_name); /* unload all images */ unload_all(); fatalerror_exitcode(machine, EMU_ERR_DEVICE, "Device %s load (%s) failed: %s", image.device().name(), image_basename.c_str(), image_err.c_str()); } } } machine.configuration().config_register("image_directories", config_saveload_delegate(FUNC(image_manager::config_load), this), config_saveload_delegate(FUNC(image_manager::config_save), this)); }
void image_manager::postdevice_init() { /* make sure that any required devices have been allocated */ for (device_image_interface &image : image_interface_iterator(machine().root_device())) { int result = image.finish_load(); /* did the image load fail? */ if (result) { /* retrieve image error message */ std::string image_err = std::string(image.error()); /* unload all images */ unload_all(); fatalerror_exitcode(machine(), EMU_ERR_DEVICE, "Device %s load failed: %s", image.device().name(), image_err.c_str()); } } /* add a callback for when we shut down */ machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(image_manager::unload_all), this)); }