void device(string dev_type) { std.vector <string> params_ = new std.vector <string>(); require_token(m_tok_paren_left); string devname = get_identifier(); m_setup.log().debug.op("Parser: IC: {0}\n", devname); var tok = get_token(); while (tok.is_(m_tok_comma)) { tok = get_token(); if (/*tok.is_type(token_type::IDENTIFIER) ||*/ tok.is_type(parser_t_token_type.STRING)) { params_.push_back(tok.str()); tok = get_token(); } else { var value = stringify_expression(ref tok); params_.push_back(value); } } require_token(tok, m_tok_paren_right); std.vector <string> params_temp = new std.vector <string>(); params_temp.Add(devname); params_temp.AddRange(params_); m_setup.register_dev(dev_type, params_temp.ToArray()); //m_setup.register_dev(dev_type, devname, params); }
/************************************* * * Register to be involved in config * save/load * *************************************/ public void config_register(string nodename, config_saveload_delegate load, config_saveload_delegate save) { config_element element = new config_element(); element.name = nodename; element.load = load; element.save = save; m_typelist.Add(element); }
stream_update_delegate m_callback; // callback function // construction/destruction //------------------------------------------------- // sound_stream - constructor //------------------------------------------------- public sound_stream(device_t device, int inputs, int outputs, int sample_rate, stream_update_delegate callback) { m_device = device; m_next = null; m_sample_rate = (UInt32)sample_rate; m_new_sample_rate = 0xffffffff; m_attoseconds_per_sample = 0; m_max_samples_per_update = 0; m_input = new std.vector <stream_input>(); //(inputs) for (int i = 0; i < inputs; i++) { m_input.Add(new stream_input()); } m_input_array = new ListPointer <stream_sample_t> [inputs]; m_resample_bufalloc = 0; m_output = new std.vector <stream_output>(); //(outputs) for (int i = 0; i < outputs; i++) { m_output.Add(new stream_output()); } m_output_array = new ListPointer <stream_sample_t> [outputs]; m_output_bufalloc = 0; m_output_sampindex = 0; m_output_update_sampindex = 0; m_output_base_sampindex = 0; m_callback = callback; // get the device's sound interface device_sound_interface sound; if (!device.interface_(out sound)) { throw new emu_fatalerror("Attempted to create a sound_stream with a non-sound device"); } if (m_callback == null) { m_callback = sound.sound_stream_update; } // create a unique tag for saving string state_tag = string.Format("{0}", m_device.machine().sound().streams().size()); m_device.machine().save().save_item(device, "stream", state_tag, 0, m_sample_rate, "m_sample_rate"); m_device.machine().save().register_postload(postload); // save the gain of each input and output for (int inputnum = 0; inputnum < m_input.size(); inputnum++) { m_device.machine().save().save_item(device, "stream", state_tag, inputnum, m_input[inputnum].m_gain, "m_input[inputnum].m_gain"); m_device.machine().save().save_item(device, "stream", state_tag, inputnum, m_input[inputnum].m_user_gain, "m_input[inputnum].m_user_gain"); } for (int outputnum = 0; outputnum < m_output.size(); outputnum++) { m_output[outputnum].m_stream = this; m_device.machine().save().save_item(device, "stream", state_tag, outputnum, m_output[outputnum].m_gain, "m_output[outputnum].m_gain"); } // Mark synchronous streams as such m_synchronous = (int)m_sample_rate == sound_global.STREAM_SYNC; if (m_synchronous) { m_sample_rate = 0; m_sync_timer = m_device.machine().scheduler().timer_alloc(sync_update, this); } else { m_sync_timer = null; } // force an update to the sample rates; this will cause everything to be recomputed // and will generate the initial resample buffers for our inputs recompute_sample_rate_data(); // set up the initial output buffer positions now that we have data m_output_base_sampindex = -m_max_samples_per_update; }
protected override void populate(ref float customtop, ref float custombottom) { foreach (var icon in m_icons) // TODO: why is this here? maybe better on resize or setting change? { icon.second().texture = null; //icon.second().texture.reset(); } set_switch_image(); bool have_prev_selected = false; int old_item_selected = -1; if (!isfavorite()) { if (m_populated_favorites) { m_prev_selected = null; } m_populated_favorites = false; m_displaylist.clear(); machine_filter flt = m_persistent_data.filter_data().get_current_filter(); // if search is not empty, find approximate matches if (!string.IsNullOrEmpty(m_search)) { populate_search(); if (flt != null) { for (int i = 0; i < m_searchlist.Count && MAX_VISIBLE_SEARCH > m_displaylist.size(); i++) //for (auto it = m_searchlist.begin(); (m_searchlist.end() != it) && (MAX_VISIBLE_SEARCH > m_displaylist.size()); ++it) { var it = m_searchlist[i]; if (flt.apply(it.second)) { m_displaylist.emplace_back(it.second); } } } else { //std.transform( // m_searchlist.begin(), // std.next(m_searchlist.begin(), std.min(m_searchlist.size(), MAX_VISIBLE_SEARCH)), // std.back_inserter(m_displaylist), // [] (auto const &entry) { return entry.second; }); foreach (var it in m_searchlist) { m_displaylist.Add(it.second); } } } else { // if filter is set on category, build category list var sorted = m_persistent_data.sorted_list(); if (flt == null) { foreach (ui_system_info sysinfo in sorted) { m_displaylist.emplace_back(sysinfo); } } else { foreach (ui_system_info sysinfo in sorted) { if (flt.apply(sysinfo)) { m_displaylist.emplace_back(sysinfo); } } } } // iterate over entries int curitem = 0; foreach (ui_system_info elem in m_displaylist) { have_prev_selected = have_prev_selected || (elem == m_prev_selected); if ((old_item_selected == -1) && (elem.driver.name == reselect_last.driver())) { old_item_selected = curitem; } item_append(elem.description, elem.is_clone ? FLAG_INVERT : 0, elem); curitem++; } } else { // populate favorites list if (!m_populated_favorites) { m_prev_selected = null; } m_populated_favorites = true; m_search = ""; //m_search.clear(); int curitem = 0; mame_machine_manager.instance().favorite().apply_sorted( (info) => //[this, &have_prev_selected, &old_item_selected, curitem = 0] (ui_software_info const &info) mutable { have_prev_selected = have_prev_selected || (info == (ui_software_info)m_prev_selected); if (info.startempty != 0) { if (old_item_selected == -1 && info.shortname == reselect_last.driver()) { old_item_selected = curitem; } bool cloneof = std.strcmp(info.driver.parent, "0") != 0; if (cloneof) { int cx = driver_list.find(info.driver.parent); if ((0 <= cx) && ((driver_list.driver((size_t)cx).flags & machine_flags.type.IS_BIOS_ROOT) != 0)) { cloneof = false; } } item_append(info.longname, cloneof ? FLAG_INVERT : 0, info); } else { if (old_item_selected == -1 && info.shortname == reselect_last.driver()) { old_item_selected = curitem; } item_append(info.longname, info.devicetype, info.parentname.empty() ? 0 : FLAG_INVERT, info); } curitem++; }); } // add special items if (stack_has_special_main_menu()) { item_append(menu_item_type.SEPARATOR, 0); item_append(__("Configure Options"), 0, CONF_OPTS); item_append(__("Configure Machine"), 0, CONF_MACHINE); skip_main_items = 3; if (m_prev_selected != null && !have_prev_selected) { m_prev_selected = item(0).ref_(); } } else { skip_main_items = 0; } // configure the custom rendering customtop = 3.0f * ui().get_line_height() + 5.0f * ui().box_tb_border(); custombottom = 4.0f * ui().get_line_height() + 3.0f * ui().box_tb_border(); // reselect prior game launched, if any if (old_item_selected != -1) { set_selected_index(old_item_selected); if (ui_globals.visible_main_lines == 0) { top_line = (selected_index() != 0) ? selected_index() - 1 : 0; } else { top_line = selected_index() - (ui_globals.visible_main_lines / 2); } if (reselect_last.software().empty()) { reselect_last.reset(); } } else { reselect_last.reset(); } }