本文整理汇总了C++中running_machine::config方法的典型用法代码示例。如果您正苦于以下问题:C++ running_machine::config方法的具体用法?C++ running_machine::config怎么用?C++ running_machine::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类running_machine
的用法示例。
在下文中一共展示了running_machine::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: memcard_create
int memcard_create(running_machine &machine, int index, int overwrite)
{
char name[16];
/* create a name */
memcard_name(index, name);
/* if we can't overwrite, fail if the file already exists */
astring fname(machine.basename(), PATH_SEPARATOR, name);
if (!overwrite)
{
emu_file testfile(machine.options().memcard_directory(), OPEN_FLAG_READ);
if (testfile.open(fname) == FILERR_NONE)
return 1;
}
/* create a new file */
emu_file file(machine.options().memcard_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = file.open(fname);
if (filerr != FILERR_NONE)
return 1;
/* initialize and then save the card */
if (machine.config().m_memcard_handler)
(*machine.config().m_memcard_handler)(machine, file, MEMCARD_CREATE);
/* close the file */
return 0;
}
示例3: 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(filename, machine.root_device()), ".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, FALSE);
file.close();
}
else
{
(*machine.config().m_nvram_handler)(machine, NULL, FALSE);
}
}
nvram_interface_iterator iter(machine.root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next())
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE)
{
nvram->nvram_load(file);
file.close();
}
else
nvram->nvram_reset();
}
}
示例4: memcard_eject
void memcard_eject(running_machine &machine)
{
generic_machine_private *state = machine.generic_machine_data;
char name[16];
/* if no card is preset, just ignore */
if (state->memcard_inserted == -1)
return;
/* create a name */
memcard_name(state->memcard_inserted, name);
/* open the file; if we can't, it's an error */
emu_file file(machine.options().memcard_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = file.open(machine.basename(), PATH_SEPARATOR, name);
if (filerr != FILERR_NONE)
return;
/* initialize and then load the card */
if (machine.config().m_memcard_handler)
(*machine.config().m_memcard_handler)(machine, file, MEMCARD_EJECT);
/* close the file */
state->memcard_inserted = -1;
}
示例5: 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(filename, machine.root_device()), ".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, TRUE);
file.close();
}
}
nvram_interface_iterator iter(machine.root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next())
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE)
{
nvram->nvram_save(file);
file.close();
}
}
}
示例6: memcard_insert
int memcard_insert(running_machine &machine, int index)
{
generic_machine_private *state = machine.generic_machine_data;
char name[16];
/* if a card is already inserted, eject it first */
if (state->memcard_inserted != -1)
memcard_eject(machine);
assert(state->memcard_inserted == -1);
/* create a name */
memcard_name(index, name);
/* open the file; if we can't, it's an error */
emu_file file(machine.options().memcard_directory(), OPEN_FLAG_READ);
file_error filerr = file.open(machine.basename(), PATH_SEPARATOR, name);
if (filerr != FILERR_NONE)
return 1;
/* initialize and then load the card */
if (machine.config().m_memcard_handler)
(*machine.config().m_memcard_handler)(machine, file, MEMCARD_INSERT);
/* close the file */
state->memcard_inserted = index;
return 0;
}
示例7: watchdog_internal_reset
static void watchdog_internal_reset(running_machine &machine)
{
/* set up the watchdog timer; only start off enabled if explicitly configured */
watchdog_enabled = (machine.config().m_watchdog_vblank_count != 0 || machine.config().m_watchdog_time != attotime::zero);
watchdog_reset(machine);
watchdog_enabled = TRUE;
}
示例8: nvram_load
void nvram_load(running_machine &machine)
{
int overrideNVram = 0;
if(netCommon) {
if(nvram_size(machine)>=32*1024*1024) {
overrideNVram=1;
ui_popup_time(3, "The NVRAM for this game is too big, not loading NVRAM.");
}
}
if (machine.config().m_nvram_handler != NULL)
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (!overrideNVram && file.open(nvram_filename(filename, machine.root_device()), ".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, FALSE);
file.close();
}
else
{
(*machine.config().m_nvram_handler)(machine, NULL, FALSE);
}
}
nvram_interface_iterator iter(machine.root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next())
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE)
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ);
if (!overrideNVram && file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE)
{
nvram->nvram_load(file);
file.close();
}
else
{
nvram->nvram_reset();
}
}
else
nvram->nvram_reset();
}
}
示例9: deviter
rom_load_manager::rom_load_manager(running_machine &machine)
: m_machine(machine)
{
/* figure out which BIOS we are using */
device_iterator deviter(machine.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next()) {
if (device->rom_region()) {
std::string specbios;
if (device->owner() == nullptr) {
specbios.assign(machine.options().bios());
} else {
specbios = machine.options().sub_value(std::string(device->owner()->tag()).c_str()+1,"bios");
if (specbios.empty()) {
specbios = device->default_bios_tag();
}
}
determine_bios_rom(device, specbios.c_str());
}
}
/* count the total number of ROMs */
count_roms();
/* reset the disk list */
m_chd_list.clear();
/* process the ROM entries we were passed */
process_region_list();
/* display the results and exit */
display_rom_load_results(FALSE);
}
示例10: 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;
}
/* 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 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)
{
machine.save().save_item(NAME(state->memcard_inserted));
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(memcard_eject), &machine));
}
}
示例11: 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();
}
}
}
}
示例12: watchdog_reset
void watchdog_reset(running_machine &machine)
{
/* if we're not enabled, skip it */
if (!watchdog_enabled)
watchdog_timer->adjust(attotime::never);
/* VBLANK-based watchdog? */
else if (machine.config().m_watchdog_vblank_count != 0)
{
watchdog_counter = machine.config().m_watchdog_vblank_count;
/* register a VBLANK callback for the primary screen */
if (machine.primary_screen != NULL)
machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(on_vblank), &machine));
}
/* timer-based watchdog? */
else if (machine.config().m_watchdog_time != attotime::zero)
watchdog_timer->adjust(machine.config().m_watchdog_time);
/* default to an obscene amount of time (3 seconds) */
else
watchdog_timer->adjust(attotime::from_seconds(3));
}
示例13: nvram_save
void nvram_save(running_machine &machine)
{
static bool first=true;
if(netCommon) {
if(nvram_size(machine)>=32*1024*1024) {
if(first) {
ui_popup_time(3, "The NVRAM for this game is too big, not saving NVRAM.");
first = false;
}
return;
}
}
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(filename, machine.root_device()), ".nv") == FILERR_NONE)
{
(*machine.config().m_nvram_handler)(machine, &file, TRUE);
file.close();
}
}
nvram_interface_iterator iter(machine.root_device());
for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next())
{
astring filename;
emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(nvram_filename(filename, nvram->device())) == FILERR_NONE)
{
nvram->nvram_save(file);
file.close();
}
}
}
示例14: 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));
}
}
示例15: deviter
ui_menu_device_config::ui_menu_device_config(running_machine &machine, render_container *container, device_slot_interface *slot, device_slot_option *option) : ui_menu(machine, container)
{
astring tmp_tag;
tmp_tag.cpy(slot->device().tag()).cat(":").cat(option->name());
m_option = option;
m_owner = slot;
m_mounted = false;
device_iterator deviter(machine.config().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
{
if (strcmp(device->tag(), tmp_tag.cstr()) == 0)
{
m_mounted = true;
break;
}
}
}