sound_stream *stream_create(device_t *device, int inputs, int outputs, int sample_rate, void *param, stream_update_func callback) { running_machine *machine = device->machine; streams_private *strdata = machine->streams_data; int inputnum, outputnum; sound_stream *stream; char statetag[30]; /* allocate memory */ stream = auto_alloc_clear(device->machine, sound_stream); VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream)); /* fill in the data */ stream->device = device; stream->index = strdata->stream_index++; stream->sample_rate = sample_rate; stream->inputs = inputs; stream->outputs = outputs; stream->callback = callback; stream->param = param; /* create a unique tag for saving */ sprintf(statetag, "%d", stream->index); state_save_register_item(machine, "stream", statetag, 0, stream->sample_rate); /* allocate space for the inputs */ if (inputs > 0) { stream->input = auto_alloc_array_clear(device->machine, stream_input, inputs); stream->input_array = auto_alloc_array_clear(device->machine, stream_sample_t *, inputs); }
void timer_init(running_machine *machine) { timer_private *global; int i; /* allocate global data */ global = machine->timer_data = auto_alloc_clear(machine, timer_private); /* we need to wait until the first call to timer_cyclestorun before using real CPU times */ global->exec.basetime = attotime_zero; global->exec.nextfire = attotime_never; global->exec.curquantum = DEFAULT_MINIMUM_QUANTUM; global->callback_timer = NULL; global->callback_timer_modified = FALSE; /* register with the save state system */ state_save_register_item(machine, "timer", NULL, 0, global->exec.basetime.seconds); state_save_register_item(machine, "timer", NULL, 0, global->exec.basetime.attoseconds); state_save_register_postload(machine, timer_postload, NULL); /* initialize the lists */ global->activelist = NULL; global->freelist = &global->timers[0]; for (i = 0; i < MAX_TIMERS-1; i++) global->timers[i].next = &global->timers[i+1]; global->timers[MAX_TIMERS-1].next = NULL; global->freelist_tail = &global->timers[MAX_TIMERS-1]; /* reset the quanta */ global->quantum_list[0].requested = DEFAULT_MINIMUM_QUANTUM; global->quantum_list[0].actual = DEFAULT_MINIMUM_QUANTUM; global->quantum_list[0].expire = attotime_never; global->quantum_current = &global->quantum_list[0]; global->quantum_minimum = ATTOSECONDS_IN_NSEC(1) / 1000; }
void ui_menu_slot_devices::handle() { /* process the menu */ const ui_menu_event *menu_event = process(0); if (menu_event != NULL && menu_event->itemref != NULL) { if ((FPTR)menu_event->itemref == 1 && menu_event->iptkey == IPT_UI_SELECT) { machine().options().add_slot_options(false); machine().schedule_hard_reset(); } else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) { device_slot_interface *slot = (device_slot_interface *)menu_event->itemref; const char *val = (menu_event->iptkey == IPT_UI_LEFT) ? slot_get_prev(slot) : slot_get_next(slot); set_slot_device(slot, val); reset(UI_MENU_RESET_REMEMBER_REF); } else if (menu_event->iptkey == IPT_UI_SELECT) { device_slot_interface *slot = (device_slot_interface *)menu_event->itemref; device_slot_option *option = slot_get_current_option(slot); if (option) ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_device_config(machine(), container, slot, option))); } } }
poly_manager *poly_alloc(running_machine &machine, int max_polys, size_t extra_data_size, UINT8 flags) { poly_manager *poly; /* allocate the manager itself */ poly = auto_alloc_clear(machine, poly_manager); poly->flags = flags; /* allocate polygons */ poly->polygon_size = sizeof(polygon_info); poly->polygon_count = MAX(max_polys, 1); poly->polygon_next = 0; poly->polygon = (polygon_info **)allocate_array(machine, &poly->polygon_size, poly->polygon_count); /* allocate extra data */ poly->extra_size = extra_data_size; poly->extra_count = poly->polygon_count; poly->extra_next = 1; poly->extra = allocate_array(machine, &poly->extra_size, poly->extra_count); /* allocate triangle work units */ poly->unit_size = (flags & POLYFLAG_ALLOW_QUADS) ? sizeof(quad_work_unit) : sizeof(tri_work_unit); poly->unit_count = MIN(poly->polygon_count * UNITS_PER_POLY, 65535); poly->unit_next = 0; poly->unit = (work_unit **)allocate_array(machine, &poly->unit_size, poly->unit_count); /* create the work queue */ if (!(flags & POLYFLAG_NO_WORK_QUEUE)) poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ); /* request a pre-save callback for synchronization */ machine.save().register_presave(save_prepost_delegate(FUNC(poly_state_presave), poly)); return poly; }
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)); } }
void ui_menu_input_groups::handle() { /* process the menu */ const ui_menu_event *menu_event = process(0); if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_general(machine(), container, int((long long)(menu_event->itemref)-1)))); }
void rom_init(running_machine &machine) { rom_load_data *romdata; /* allocate private data */ machine.romload_data = romdata = auto_alloc_clear(machine, romload_private); /* make sure we get called back on the way out */ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(rom_exit), &machine)); /* reset the romdata struct */ romdata->m_machine = &machine; /* figure out which BIOS we are using */ determine_bios_rom(romdata); /* count the total number of ROMs */ count_roms(romdata); /* reset the disk list */ romdata->chd_list.reset(); /* process the ROM entries we were passed */ process_region_list(romdata); /* display the results and exit */ display_rom_load_results(romdata); }
void ui_menu_video_targets::handle() { /* process the menu */ const ui_menu_event *menu_event = process(0); if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_options(machine(), container, static_cast<render_target *>(menu_event->itemref)))); }
void k037122_device::device_start() { static const gfx_layout k037122_char_layout = { 8, 8, K037122_NUM_TILES, 8, { 0,1,2,3,4,5,6,7 }, { 1*16, 0*16, 3*16, 2*16, 5*16, 4*16, 7*16, 6*16 }, { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128 }, 8*128 }; m_char_ram = auto_alloc_array_clear(machine(), UINT32, 0x200000 / 4); m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x20000 / 4); m_reg = auto_alloc_array_clear(machine(), UINT32, 0x400 / 4); m_layer[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer0),this), TILEMAP_SCAN_ROWS, 8, 8, 256, 64); m_layer[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer1),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); m_layer[0]->set_transparent_pen(0); m_layer[1]->set_transparent_pen(0); machine().gfx[m_gfx_index] = auto_alloc_clear(machine(), gfx_element(machine(), k037122_char_layout, (UINT8*)m_char_ram, machine().total_colors() / 16, 0)); save_pointer(NAME(m_reg), 0x400 / 4); save_pointer(NAME(m_char_ram), 0x200000 / 4); save_pointer(NAME(m_tile_ram), 0x20000 / 4); }
void ui_menu_select_game::inkey_select(const ui_menu_event *menu_event) { const game_driver *driver = (const game_driver *)menu_event->itemref; // special case for configure inputs if ((FPTR)driver == 1) ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container))); // anything else is a driver else { // audit the game first to see if we're going to work driver_enumerator enumerator(machine().options(), *driver); enumerator.next(); media_auditor auditor(enumerator); media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST); // if everything looks good, schedule the new driver if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { machine().manager().schedule_new_driver(*driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } // otherwise, display an error else { reset(UI_MENU_RESET_REMEMBER_REF); m_error = true; } } }
// force file manager menu void ui_menu_file_manager::force_file_manager(running_machine &machine, render_container *container, const char *warnings) { // reset the menu stack ui_menu::stack_reset(machine); // add the quit entry followed by the game select entry ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container)); quit->set_special_main_menu(true); ui_menu::stack_push(quit); ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_file_manager(machine, container, warnings))); // force the menus on machine.ui().show_menu(); // make sure MAME is paused machine.pause(); }
void ui_menu_select_game::inkey_cancel(const ui_menu_event *menu_event) { // escape pressed with non-empty text clears the text if (m_search[0] != 0) { // since we have already been popped, we must recreate ourself from scratch ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_select_game(machine(), container, NULL))); } }
void ui_menu_select_game::force_game_select(running_machine &machine, render_container *container) { char *gamename = (char *)machine.options().system_name(); // reset the menu stack ui_menu::stack_reset(machine); // add the quit entry followed by the game select entry ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container)); quit->set_special_main_menu(true); ui_menu::stack_push(quit); ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_select_game(machine, container, gamename))); // force the menus on machine.ui().show_menu(); // make sure MAME is paused machine.pause(); }
void ui_input_init(running_machine &machine) { /* create the private data */ machine.ui_input_data = auto_alloc_clear(machine, ui_input_private); machine.ui_input_data->current_mouse_x = -1; machine.ui_input_data->current_mouse_y = -1; /* add a frame callback to poll inputs */ machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(ui_input_frame_update), &machine)); }
void sgi_mc_init(running_machine &machine) { pMC = auto_alloc_clear(machine, MC_t); // if Indigo2, ID appropriately if (!strcmp(machine.system().name, "ip244415")) { pMC->nSysID = 0x11; // rev. B MC, EISA bus present } sgi_mc_timer_init(machine); }
int generic_sound_init(running_machine &machine) { generic_audio_private *state; state = machine.generic_audio_data = auto_alloc_clear(machine, generic_audio_private); /* register globals with the save state system */ state_save_register_global_array(machine, state->latched_value); state_save_register_global_array(machine, state->latch_read); return 0; }
void state_save_register_memory(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount, const char *file, int line) { state_private *global = machine->state_data; state_entry **entryptr, *next; astring totalname; assert(valsize == 1 || valsize == 2 || valsize == 4 || valsize == 8); /* check for invalid timing */ if (!global->reg_allowed) { logerror("Attempt to register save state entry after state registration is closed!\nFile: %s, line %d, module %s tag %s name %s\n", file, line, module, tag, name); if (machine->gamedrv->flags & GAME_SUPPORTS_SAVE) fatalerror(_("Attempt to register save state entry after state registration is closed!\nFile: %s, line %d, module %s tag %s name %s\n"), file, line, module, tag, name); global->illegal_regs++; return; } /* create the full name */ if (tag != NULL) totalname.printf("%s/%s/%X/%s", module, tag, index, name); else totalname.printf("%s/%X/%s", module, index, name); /* look for duplicates and an entry to insert in front of */ for (entryptr = &global->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) { /* stop if the next guy's string is greater than ours */ int cmpval = (*entryptr)->name.cmp(totalname); if (cmpval > 0) break; /* error if we are equal */ if (cmpval == 0) fatalerror(_("Duplicate save state registration entry (%s)"), totalname.cstr()); } /* didn't find one; allocate a new one */ next = *entryptr; *entryptr = auto_alloc_clear(machine, state_entry); /* fill in the rest */ (*entryptr)->next = next; (*entryptr)->machine = machine; (*entryptr)->data = val; (*entryptr)->name = totalname; (*entryptr)->typesize = valsize; (*entryptr)->typecount = valcount; }
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)); } }
void sound_init(running_machine *machine) { sound_private *global; const char *filename; machine->sound_data = global = auto_alloc_clear(machine, sound_private); /* handle -nosound */ global->nosound_mode = !options_get_bool(machine->options(), OPTION_SOUND); if (global->nosound_mode) machine->sample_rate = 11025; /* count the speakers */ VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config))); /* allocate memory for mix buffers */ global->leftmix = auto_alloc_array(machine, INT32, machine->sample_rate); global->rightmix = auto_alloc_array(machine, INT32, machine->sample_rate); global->finalmix = auto_alloc_array(machine, INT16, machine->sample_rate); /* allocate a global timer for sound timing */ global->update_timer = timer_alloc(machine, sound_update, NULL); timer_adjust_periodic(global->update_timer, STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME); /* finally, do all the routing */ VPRINTF(("route_sound\n")); route_sound(machine); /* open the output WAV file if specified */ filename = options_get_string(machine->options(), OPTION_WAVWRITE); if (filename[0] != 0) global->wavfile = wav_open(filename, machine->sample_rate, 2); /* enable sound by default */ global->enabled = TRUE; global->muted = FALSE; sound_set_attenuation(machine, options_get_int(machine->options(), OPTION_VOLUME)); /* register callbacks */ config_register(machine, "mixer", sound_load, sound_save); machine->add_notifier(MACHINE_NOTIFY_PAUSE, sound_pause); machine->add_notifier(MACHINE_NOTIFY_RESUME, sound_resume); machine->add_notifier(MACHINE_NOTIFY_RESET, sound_reset); machine->add_notifier(MACHINE_NOTIFY_EXIT, sound_exit); }
void streams_init(running_machine *machine) { streams_private *strdata; /* allocate memory for our private data */ strdata = auto_alloc_clear(machine, streams_private); /* reset globals */ strdata->stream_tailptr = &strdata->stream_head; strdata->update_attoseconds = STREAMS_UPDATE_ATTOTIME.attoseconds; /* set the global pointer */ machine->streams_data = strdata; /* register global states */ state_save_register_global(machine, strdata->last_update.seconds); state_save_register_global(machine, strdata->last_update.attoseconds); }
UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *container, UINT32 state) { UINT32 result; /* if this is the first call, push the sliders menu */ if (state) ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_sliders(machine, container, true))); /* handle standard menus */ result = ui_menu::ui_handler(machine, container, state); /* if we are cancelled, pop the sliders menu */ if (result == UI_HANDLER_CANCEL) ui_menu::stack_pop(machine); ui_menu_sliders *uim = dynamic_cast<ui_menu_sliders *>(menu_stack); return uim && uim->menuless_mode ? 0 : UI_HANDLER_CANCEL; }
void rom_init(running_machine &machine) { romload_private *romdata; /* allocate private data */ machine.romload_data = romdata = auto_alloc_clear(machine, romload_private); /* make sure we get called back on the way out */ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(rom_exit), &machine)); /* reset the romdata struct */ romdata->m_machine = &machine; /* figure out which BIOS we are using */ device_iterator deviter(romdata->machine().config().root_device()); for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) { if (device->rom_region()) { const char *specbios; astring temp; if (strcmp(device->tag(),":")==0) { specbios = romdata->machine().options().bios(); } else { specbios = romdata->machine().options().sub_value(temp,device->owner()->tag()+1,"bios"); if (strlen(specbios) == 0) { specbios = device->default_bios_tag().cstr(); } } determine_bios_rom(romdata, device, specbios); } } /* count the total number of ROMs */ count_roms(romdata); /* reset the disk list */ romdata->chd_list.reset(); /* process the ROM entries we were passed */ process_region_list(romdata); /* display the results and exit */ display_rom_load_results(romdata, FALSE); }
UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container, UINT32 state) { // if we have no menus stacked up, start with the main menu if (menu_stack == nullptr) stack_push(auto_alloc_clear(machine, ui_menu_main(machine, container))); // update the menu state if (menu_stack != nullptr) menu_stack->do_handle(); // clear up anything pending to be released clear_free_list(machine); // if the menus are to be hidden, return a cancel here if (machine.ui().is_menu_active() && ((ui_input_pressed(machine, IPT_UI_CONFIGURE) && !stack_has_special_main_menu()) || menu_stack == nullptr)) return UI_HANDLER_CANCEL; return 0; }
void debug_console_register_command(running_machine &machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine &machine, int ref, int params, const char **param)) { debug_command *cmd; assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); assert_always((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running"); cmd = auto_alloc_clear(machine, debug_command); /* fill in the command */ strcpy(cmd->command, command); cmd->flags = flags; cmd->ref = ref; cmd->minparams = minparams; cmd->maxparams = maxparams; cmd->handler = handler; /* link it */ cmd->next = commandlist; commandlist = cmd; }
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)); /* register for configuration */ config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine)); }
void state_init(running_machine *machine) { bool test_bool; INT8 test_INT8; UINT8 test_UINT8; INT16 test_INT16; UINT16 test_UINT16; INT32 test_INT32; UINT32 test_UINT32; INT64 test_INT64; UINT64 test_UINT64; float test_float; double test_double; test_enum_type test_enum; #ifdef __GNUC__ test_class_type test_class; #endif assert_always(IS_VALID_SAVE_TYPE(test_bool), "bool is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_INT8), "INT8 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_UINT8), "UINT8 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_INT16), "INT16 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_UINT16), "UINT16 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_INT32), "INT32 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_UINT32), "UINT32 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_INT64), "INT64 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_UINT64), "UINT64 is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_float), "float is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_double), "double is not a valid type for save"); assert_always(IS_VALID_SAVE_TYPE(test_enum), "enums are not a valid type for save"); #ifdef __GNUC__ assert_always(!IS_VALID_SAVE_TYPE(test_class), "classes are a valid type for save"); #endif machine->state_data = auto_alloc_clear(machine, state_private); }
static driver_data_t *alloc(running_machine &machine) { return auto_alloc_clear(&machine, chanbara_state(machine)); }
void ui_menu_control_device_image::handle() { switch(state) { case START_FILE: { bool can_create = false; if(image->is_creatable()) { zippath_directory *directory = NULL; file_error err = zippath_opendir(current_directory, &directory); can_create = err == FILERR_NONE && !zippath_is_zip(directory); if(directory) zippath_closedir(directory); } submenu_result = -1; ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_selector(machine(), container, image, current_directory, current_file, true, image->image_interface()!=NULL, can_create, &submenu_result))); state = SELECT_FILE; break; } case START_SOFTLIST: sld = 0; ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software(machine(), container, image->image_interface(), &sld))); state = SELECT_SOFTLIST; break; case START_OTHER_PART: { submenu_result = -1; ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_parts(machine(), container, swi, swp->interface_, &swp, true, &submenu_result))); state = SELECT_OTHER_PART; break; } case SELECT_SOFTLIST: if(!sld) { ui_menu::stack_pop(machine()); break; } software_info_name = ""; ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container, sld, image->image_interface(), software_info_name))); state = SELECT_PARTLIST; break; case SELECT_PARTLIST: swl = software_list_open(machine().options(), sld->list_name(), false, NULL); swi = software_list_find(swl, software_info_name, NULL); if(swinfo_has_multiple_parts(swi, image->image_interface())) { submenu_result = -1; swp = 0; ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_parts(machine(), container, swi, image->image_interface(), &swp, false, &submenu_result))); state = SELECT_ONE_PART; } else { swp = software_find_part(swi, NULL, NULL); load_software_part(); software_list_close(swl); ui_menu::stack_pop(machine()); } break; case SELECT_ONE_PART: switch(submenu_result) { case ui_menu_software_parts::T_ENTRY: { load_software_part(); software_list_close(swl); ui_menu::stack_pop(machine()); break; } case -1: // return to list software_list_close(swl); state = SELECT_SOFTLIST; break; } break; case SELECT_OTHER_PART: switch(submenu_result) { case ui_menu_software_parts::T_ENTRY: { load_software_part(); break; } case ui_menu_software_parts::T_FMGR: state = START_FILE; handle(); break; case -1: // return to system ui_menu::stack_pop(machine()); break; } break; case SELECT_FILE: switch(submenu_result) { case ui_menu_file_selector::R_EMPTY: image->unload(); ui_menu::stack_pop(machine()); break; case ui_menu_file_selector::R_FILE: hook_load(current_file, false); break; case ui_menu_file_selector::R_CREATE: ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_create(machine(), container, image, current_directory, current_file))); state = CREATE_FILE; break; case ui_menu_file_selector::R_SOFTLIST: state = START_SOFTLIST; handle(); break; case -1: // return to system ui_menu::stack_pop(machine()); break; } break; case CREATE_FILE: { bool can_create, need_confirm; test_create(can_create, need_confirm); if(can_create) { if(need_confirm) { ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_confirm_save_as(machine(), container, &create_confirmed))); state = CREATE_CONFIRM; } else { state = DO_CREATE; handle(); } } else { state = START_FILE; handle(); } break; } case CREATE_CONFIRM: { state = create_confirmed ? DO_CREATE : START_FILE; handle(); break; } case DO_CREATE: { astring path; zippath_combine(path, current_directory, current_file); int err = image->create(path, 0, NULL); if (err != 0) popmessage("Error: %s", image->error()); ui_menu::stack_pop(machine()); break; } } }
static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, skeetsht_state(machine)); }
ui_menu *device_image_interface::get_selection_menu(running_machine &machine, render_container *container) { return auto_alloc_clear(machine, ui_menu_control_device_image(machine, container, this)); }