public override void Dispose() { base.Dispose(); //string error_string; string last_driver = ""; ui_system_info system; ui_software_info swinfo; get_selection(out swinfo, out system); if (swinfo != null) { last_driver = swinfo.shortname; } else if (system != null) { last_driver = system.driver.name; } string filter = m_persistent_data.filter_data().get_config_string(); ui_options mopt = ui().options(); mopt.set_value(ui_options.OPTION_LAST_RIGHT_PANEL, ui_globals.rpanel, OPTION_PRIORITY_CMDLINE); mopt.set_value(ui_options.OPTION_LAST_USED_FILTER, filter, OPTION_PRIORITY_CMDLINE); mopt.set_value(ui_options.OPTION_LAST_USED_MACHINE, last_driver, OPTION_PRIORITY_CMDLINE); mopt.set_value(ui_options.OPTION_HIDE_PANELS, ui_globals.panels_status, OPTION_PRIORITY_CMDLINE); ui().save_ui_options(); m_isDisposed = true; }
//~system_list(); //{ // if (m_thread) // m_thread->join(); //} public void cache_data(ui_options options) { lock (m_mutex) //std::unique_lock<std::mutex> lock(m_mutex); { if (!m_started) { m_started = true; //m_thread = std::make_unique<std::thread>( // [this, datpath = std::string(options.history_path()), titles = std::string(options.system_names())] // { // do_cache_data(datpath, titles); // }); var datpath = options.history_path(); var titles = options.system_names(); do_cache_data(datpath, titles); } } }
protected machine_static_info(ui_options options, machine_config config, ioport_list ports) { m_options = options; m_flags = config.gamedrv().flags; m_unemulated_features = config.gamedrv().type.unemulated_features(); m_imperfect_features = config.gamedrv().type.imperfect_features(); m_has_bioses = false; m_has_dips = false; m_has_configs = false; m_has_keyboard = false; m_has_test_switch = false; m_has_analog = false; ioport_list local_ports = new ioport_list(); string sink; foreach (device_t device in new device_enumerator(config.root_device())) { // the "no sound hardware" warning doesn't make sense when you plug in a sound card if (device.GetClassInterface <device_sound_interface>() != null) // dynamic_cast<device_sound_interface *>(&device)) { m_flags &= ~machine_flags.type.NO_SOUND_HW; } // build overall emulation status m_unemulated_features |= device.type().unemulated_features(); m_imperfect_features |= device.type().imperfect_features(); // look for BIOS options device_t parent = device.owner(); device_slot_interface slot = device.GetClassInterface <device_slot_interface>(); //device_slot_interface const *const slot(dynamic_cast<device_slot_interface const *>(parent)); if (parent == null || (slot != null && (slot.get_card_device() == device))) { for (Pointer <tiny_rom_entry> rom = device.rom_region(); !m_has_bioses && rom != null && !ROMENTRY_ISEND(rom.op); ++rom) //for (tiny_rom_entry const *rom = device.rom_region(); !m_has_bioses && rom && !ROMENTRY_ISEND(rom); ++rom) { if (ROMENTRY_ISSYSTEM_BIOS(rom.op)) { m_has_bioses = true; } } } } // suppress "requires external artwork" warning when external artwork was loaded if (config.root_device().has_running_machine()) { for (render_target target = config.root_device().machine().render().first_target(); target != null; target = target.next()) { if (!target.hidden() && target.external_artwork()) { m_flags &= ~machine_flags.type.REQUIRES_ARTWORK; break; } } } // unemulated trumps imperfect when aggregating (always be pessimistic) m_imperfect_features &= ~m_unemulated_features; // scan the input port array to see what options we need to enable foreach (var port in (ports != null ? ports : local_ports)) { foreach (ioport_field field in port.Value.fields()) { switch (field.type()) { case ioport_type.IPT_DIPSWITCH: m_has_dips = true; break; case ioport_type.IPT_CONFIG: m_has_configs = true; break; case ioport_type.IPT_KEYBOARD: m_has_keyboard = true; break; case ioport_type.IPT_SERVICE: m_has_test_switch = true; break; default: break; } if (field.is_analog()) { m_has_analog = true; } } } }
//------------------------------------------------- // machine_static_info - constructors //------------------------------------------------- public machine_static_info(ui_options options, machine_config config) : this(options, config, null) { }
//------------------------------------------------- // ctor //------------------------------------------------- menu_select_game(mame_ui_manager mui, render_container container, string gamename) : base(mui, container, false) { m_persistent_data = system_list.instance(); m_icons = new icon_cache(MAX_ICONS_RENDER); m_icon_paths = ""; m_displaylist = new std.vector <ui_system_info>(); m_searchlist = new std.vector <std.pair <double, ui_system_info> >(); m_searched_fields = (unsigned)system_list.available.AVAIL_NONE; m_populated_favorites = false; string error_string; string last_filter; ui_options moptions = mui.options(); // load drivers cache m_persistent_data.cache_data(mui.options()); // check if there are available system icons check_for_icons(null); // build drivers list if (!load_available_machines()) { build_available_list(); } if (s_first_start) { //s_first_start = false; TODO: why wasn't it ever clearing the first start flag? reselect_last.set_driver(moptions.last_used_machine()); ui_globals.rpanel = (uint8_t)std.min(std.max(moptions.last_right_panel(), (int)RP_FIRST), (int)RP_LAST); string tmp = moptions.last_used_filter(); size_t found = tmp.find_first_of(','); string fake_ini; if (found == npos) { fake_ini = util.string_format("\uFEFF{0} = 1\n", tmp); } else { string sub_filter = tmp.substr(found + 1); tmp = tmp.Substring((int)found); // .resize(found); fake_ini = util.string_format("\uFEFF{0} = {1}\n", tmp, sub_filter); } emu_file file = new emu_file(ui().options().ui_path(), OPEN_FLAG_READ); MemoryU8 fake_ini_buffer = new MemoryU8(System.Text.Encoding.ASCII.GetBytes(fake_ini)); if (!file.open_ram(fake_ini_buffer, (u32)fake_ini.size())) //if (!file.open_ram(fake_ini.c_str(), fake_ini.size())) { m_persistent_data.filter_data().load_ini(file); file.close(); } } // do this after processing the last used filter setting so it overwrites the placeholder load_custom_filters(); m_filter_highlight = (int)m_persistent_data.filter_data().get_current_filter_type(); if (!moptions.remember_last()) { reselect_last.reset(); } mui.machine().options().set_value(OPTION_SNAPNAME, "%g/%i", OPTION_PRIORITY_CMDLINE); ui_globals.curdats_view = 0; ui_globals.panels_status = (uint16_t)moptions.hide_panels(); ui_globals.curdats_total = 1; }