本文整理汇总了C++中running_machine::devicelist方法的典型用法代码示例。如果您正苦于以下问题:C++ running_machine::devicelist方法的具体用法?C++ running_machine::devicelist怎么用?C++ running_machine::devicelist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类running_machine
的用法示例。
在下文中一共展示了running_machine::devicelist方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nvram_save
void nvram_save(running_machine &machine)
{
if (machine.config().m_nvram_handler != NULL)
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(nvram_filename(machine,filename), ".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, TRUE);
file.close();
}
}
device_nvram_interface *nvram = NULL;
if (machine.devicelist().first(nvram))
{
for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram))
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(nvram_filename(nvram->device(),filename)) == FILERR_NONE)
{
nvram->nvram_save(file);
file.close();
}
}
}
}
示例2: image_dirs_load
static void image_dirs_load(running_machine &machine, int config_type, xml_data_node *parentnode)
{
xml_data_node *node;
const char *dev_instance;
const char *working_directory;
device_image_interface *image = NULL;
if ((config_type == CONFIG_TYPE_GAME) && (parentnode != NULL))
{
for (node = xml_get_sibling(parentnode->child, "device"); node; node = xml_get_sibling(node->next, "device"))
{
dev_instance = xml_get_attribute_string(node, "instance", NULL);
if ((dev_instance != NULL) && (dev_instance[0] != '\0'))
{
for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image))
{
if (!strcmp(dev_instance, image->instance_name())) {
working_directory = xml_get_attribute_string(node, "directory", NULL);
if (working_directory != NULL)
image->set_working_directory(working_directory);
}
}
}
}
}
}
示例3: image_postdevice_init
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));
}
示例4: image_unload_all
void image_unload_all(running_machine &machine)
{
device_image_interface *image = NULL;
// extract the options
image_options_extract(machine);
for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image))
{
// unload this image
image->unload();
}
}
示例5: image_device_init
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.devicelist().first(image); gotone; gotone = image->next(image))
{
/* 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());
}
}
else
{
/* 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());
}
}
image->call_get_devices();
}
}
示例6: generic_machine_init
void generic_machine_init(running_machine &machine)
{
generic_machine_private *state;
int counternum;
/* allocate our state */
machine.generic_machine_data = auto_alloc_clear(machine, generic_machine_private);
state = machine.generic_machine_data;
/* reset coin counters */
for (counternum = 0; counternum < COIN_COUNTERS; counternum++)
{
state->lastcoin[counternum] = 0;
state->coinlockedout[counternum] = 0;
}
// map devices to the interrupt state
memset(state->interrupt_device, 0, sizeof(state->interrupt_device));
device_execute_interface *exec = NULL;
int index = 0;
for (bool gotone = machine.devicelist().first(exec); gotone && index < ARRAY_LENGTH(state->interrupt_device); gotone = exec->next(exec))
state->interrupt_device[index++] = &exec->device();
/* register coin save state */
machine.save().save_item(NAME(state->coin_count));
machine.save().save_item(NAME(state->coinlockedout));
machine.save().save_item(NAME(state->lastcoin));
/* reset memory card info */
state->memcard_inserted = -1;
/* register a reset callback and save state for interrupt enable */
machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(interrupt_reset), &machine));
machine.save().save_item(NAME(state->interrupt_enable));
/* register for configuration */
config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine));
/* for memory cards, request save state and an exit callback */
if (machine.config().m_memcard_handler != NULL)
{
state_save_register_global(machine, state->memcard_inserted);
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(memcard_eject), &machine));
}
}
示例7: image_dirs_save
static void image_dirs_save(running_machine &machine, int config_type, xml_data_node *parentnode)
{
xml_data_node *node;
const char *dev_instance;
device_image_interface *image = NULL;
/* only care about game-specific data */
if (config_type == CONFIG_TYPE_GAME)
{
for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image))
{
dev_instance = image->instance_name();
node = xml_add_child(parentnode, "device", NULL);
if (node != NULL)
{
xml_set_attribute(node, "instance", dev_instance);
xml_set_attribute(node, "directory", image->working_directory());
}
}
}
}
示例8: nvram_load
void nvram_load(running_machine &machine)
{
if (machine.config().m_nvram_handler != NULL)
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(machine,filename),".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, FALSE);
file.close();
}
else
{
(*machine.config().m_nvram_handler)(machine, NULL, FALSE);
}
}
device_nvram_interface *nvram = NULL;
if (machine.devicelist().first(nvram))
{
for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram))
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(nvram->device(),filename)) == FILERR_NONE)
{
nvram->nvram_load(file);
file.close();
}
else
{
nvram->nvram_reset();
}
}
}
}
示例9: image_options_extract
static void image_options_extract(running_machine &machine)
{
/* only extract the device options if we've added them
no need to assert in case they are missing */
{
int index = 0;
device_image_interface *image = NULL;
for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image))
{
const char *filename = image->filename();
/* and set the option */
astring error;
machine.options().set_value(image->instance_name(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error);
index++;
}
}
/* write the config, if appropriate */
if (machine.options().write_config())
write_config(machine.options(), NULL, &machine.system());
}