void ui_menu_palette_sel::populate() { for (int x = 0; x < ARRAY_LENGTH(m_palette); ++x) item_append(m_palette[x].name, m_palette[x].argb, MENU_FLAG_UI_PALETTE, (void *)(FPTR)(x + 1)); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); }
void ui_menu_sliders::populate() { std::string tempstring; /* add UI sliders */ for (const slider_state *curslider = machine().ui().get_slider_list(); curslider != nullptr; curslider = curslider->next) { INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE); UINT32 flags = 0; if (curval > curslider->minval) flags |= MENU_FLAG_LEFT_ARROW; if (curval < curslider->maxval) flags |= MENU_FLAG_RIGHT_ARROW; item_append(curslider->description, tempstring.c_str(), flags, (void *)curslider); } /* add OSD sliders */ for (const slider_state *curslider = (slider_state*)machine().osd().get_slider_list(); curslider != nullptr; curslider = curslider->next) { INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE); UINT32 flags = 0; if (curval > curslider->minval) flags |= MENU_FLAG_LEFT_ARROW; if (curval < curslider->maxval) flags |= MENU_FLAG_RIGHT_ARROW; item_append(curslider->description, tempstring.c_str(), flags, (void *)curslider); } custombottom = 2.0f * machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; }
void ui_menu_confirm_save_as::populate() { item_append("File Already Exists - Override?", NULL, MENU_FLAG_DISABLE, NULL); item_append(MENU_SEPARATOR_ITEM, NULL, MENU_FLAG_DISABLE, NULL); item_append("No", NULL, 0, ITEMREF_NO); item_append("Yes", NULL, 0, ITEMREF_YES); }
void ui_menu_selector::populate() { if (m_search[0] != 0) { find_matches(m_search); for (int curitem = 0; m_searchlist[curitem]; ++curitem) item_append(m_searchlist[curitem]->c_str(), nullptr, 0, (void *)m_searchlist[curitem]); } else { for (size_t index = 0, added = 0; index < m_str_items.size(); ++index) if (m_str_items[index] != "_skip_") { if (m_first_pass && m_selector == index) selected = added; added++; item_append(m_str_items[index].c_str(), nullptr, 0, (void *)&m_str_items[index]); } } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; m_first_pass = false; }
void ui_menu_display_actual::populate() { m_tempbuf.assign("Current ").append(s_folders_entry[m_ref - 1].name).append(" Folders"); if (machine().ui().options().exists(s_folders_entry[m_ref - 1].option)) { m_searchpath.assign(machine().ui().options().value(s_folders_entry[m_ref - 1].option)); } else { m_searchpath.assign(machine().options().value(s_folders_entry[m_ref - 1].option)); } path_iterator path(m_searchpath.c_str()); std::string curpath; m_folders.clear(); while (path.next(curpath, nullptr)) m_folders.push_back(curpath); if (m_change) item_append("Change Folder", nullptr, 0, (void *)CHANGE_FOLDER); else item_append("Add Folder", nullptr, 0, (void *)ADD_FOLDER); if (m_folders.size() > 1) item_append("Remove Folder", nullptr, 0, (void *)REMOVE_FOLDER); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = (m_folders.size() + 1) * machine().ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; }
void ui_menu_add_change_folder::populate() { // open a path const char *volume_name; file_enumerator path(m_current_path.c_str()); const osd_directory_entry *dirent; int folders_count = 0; // add the drives for (int i = 0; (volume_name = osd_get_volume_name(i)) != nullptr; i++) item_append(volume_name, "[DRIVE]", 0, (void *)(FPTR)++folders_count); // add the directories while ((dirent = path.next()) != nullptr) { if (dirent->type == ENTTYPE_DIR && strcmp(dirent->name, ".") != 0) item_append(dirent->name, "[DIR]", 0, (void *)(FPTR)++folders_count); } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); // configure the custom rendering customtop = 2.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; custombottom = 1.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_file_create::populate() { astring buffer; const image_device_format *format; const char *new_image_name; /* append the "New Image Name" item */ if (get_selection() == ITEMREF_NEW_IMAGE_NAME) { buffer.cat(filename_buffer).cat("_"); new_image_name = buffer; } else { new_image_name = filename_buffer; } item_append("New Image Name:", new_image_name, 0, ITEMREF_NEW_IMAGE_NAME); /* do we support multiple formats? */ format = image->device_get_creatable_formats(); if (ENABLE_FORMATS && (format != NULL)) { item_append("Image Format:", current_format->m_description, 0, ITEMREF_FORMAT); current_format = format; } /* finish up the menu */ item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); item_append("Create", NULL, 0, ITEMREF_CREATE); customtop = ui_get_line_height(machine()) + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_file_create::populate() { std::string buffer; const image_device_format *format; const char *new_image_name; // append the "New Image Name" item if (get_selection() == ITEMREF_NEW_IMAGE_NAME) { buffer.append(m_filename_buffer).append("_"); new_image_name = buffer.c_str(); } else { new_image_name = m_filename_buffer; } item_append("New Image Name:", new_image_name, 0, ITEMREF_NEW_IMAGE_NAME); // do we support multiple formats? if (ENABLE_FORMATS) format = m_image->formatlist(); if (ENABLE_FORMATS && (format != NULL)) { item_append("Image Format:", m_current_format->description(), 0, ITEMREF_FORMAT); m_current_format = format; } // finish up the menu item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); item_append("Create", NULL, 0, ITEMREF_CREATE); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void menu_selector::populate() { if (m_search[0] != 0) { find_matches(m_search); for (int curitem = 0; m_searchlist[curitem]; ++curitem) item_append(*m_searchlist[curitem], "", 0, (void *)m_searchlist[curitem]); } else { for (size_t index = 0, added = 0; index < m_str_items.size(); ++index) if (m_str_items[index] != "_skip_") { if (m_first_pass && m_selector == index) selected = added; added++; item_append(m_str_items[index], "", 0, (void *)&m_str_items[index]); } } item_append(menu_item_type::SEPARATOR); customtop = custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; m_first_pass = false; }
void ui_menu::reset(ui_menu_reset_options options) { // based on the reset option, set the reset info resetpos = 0; resetref = nullptr; if (options == UI_MENU_RESET_REMEMBER_POSITION) resetpos = selected; else if (options == UI_MENU_RESET_REMEMBER_REF) resetref = item[selected].ref; // reset all the pools and the numitems back to 0 for (ui_menu_pool *ppool = pool; ppool != nullptr; ppool = ppool->next) ppool->top = (UINT8 *)(ppool + 1); numitems = 0; visitems = 0; selected = 0; std::string backtext; strprintf(backtext, "Return to %s", emulator_info::get_capstartgamenoun()); // add an item to return if (parent == nullptr) item_append(backtext.c_str(), nullptr, 0, nullptr); else if (parent->is_special_main_menu()) item_append("Exit", nullptr, 0, nullptr); else item_append("Return to Previous Menu", nullptr, 0, nullptr); }
void menu_plugin_opt::populate(float &customtop, float &custombottom) { std::vector<std::tuple<std::string, std::string, std::string>> menu_list; mame_machine_manager::instance()->lua()->menu_populate(m_menu, menu_list); uintptr_t i = 1; for(auto &item : menu_list) { const std::string &text = std::get<0>(item); const std::string &subtext = std::get<1>(item); const std::string &tflags = std::get<2>(item); uint32_t flags = 0; if(tflags == "off") flags = FLAG_DISABLE; else if(tflags == "l") flags = FLAG_LEFT_ARROW; else if(tflags == "r") flags = FLAG_RIGHT_ARROW; else if(tflags == "lr") flags = FLAG_RIGHT_ARROW | FLAG_LEFT_ARROW; if(text == "---") { item_append(menu_item_type::SEPARATOR); i++; } else item_append(text, subtext, flags, (void *)i++); } item_append(menu_item_type::SEPARATOR); }
void ui_menu_barcode_reader::populate() { if (current_device()) { std::string buffer; const char *new_barcode; // selected device item_append(current_display_name().c_str(), "", current_display_flags(), ITEMREF_SELECT_READER); // append the "New Barcode" item if (get_selection() == ITEMREF_NEW_BARCODE) { buffer.append(m_barcode_buffer); new_barcode = buffer.c_str(); } else { new_barcode = m_barcode_buffer; } item_append("New Barcode:", new_barcode, 0, ITEMREF_NEW_BARCODE); // finish up the menu item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); item_append("Enter Code", NULL, 0, ITEMREF_ENTER_BARCODE); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } }
void menu_add_change_folder::populate(float &customtop, float &custombottom) { // open a path const char *volume_name = nullptr; file_enumerator path(m_current_path.c_str()); const osd::directory::entry *dirent; int folders_count = 0; // add the drives for (int i = 0; (volume_name = osd_get_volume_name(i)) != nullptr; ++i) item_append(volume_name, "[DRIVE]", 0, (void *)(uintptr_t)++folders_count); // add the directories while ((dirent = path.next()) != nullptr) { if (dirent->type == osd::directory::entry::entry_type::DIR && strcmp(dirent->name, ".") != 0) item_append(dirent->name, "[DIR]", 0, (void *)(uintptr_t)++folders_count); } item_append(menu_item_type::SEPARATOR); // configure the custom rendering customtop = 2.0f * ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; custombottom = 1.0f * ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu::reset(ui_menu_reset_options options) { /* based on the reset option, set the reset info */ resetpos = 0; resetref = NULL; if (options == UI_MENU_RESET_REMEMBER_POSITION) resetpos = selected; else if (options == UI_MENU_RESET_REMEMBER_REF) resetref = item[selected].ref; /* reset all the pools and the numitems back to 0 */ for (ui_menu_pool *ppool = pool; ppool != NULL; ppool = ppool->next) ppool->top = (UINT8 *)(ppool + 1); numitems = 0; visitems = 0; selected = 0; astring backtext; backtext.printf("Return to %s",emulator_info::get_capstartgamenoun()); /* add an item to return */ if (parent == NULL) item_append(backtext.cstr(), NULL, 0, NULL); else if (parent->is_special_main_menu()) item_append("-", NULL, 0, NULL); else item_append("Return to Previous Menu", NULL, 0, NULL); }
void ui_menu_export::populate() { // add options items item_append(_("Export XML format (like -listxml)"), nullptr, 0, (void *)(FPTR)1); item_append(_("Export TXT format (like -listfull)"), nullptr, 0, (void *)(FPTR)2); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); }
void menu_directory::populate(float &customtop, float &custombottom) { for (auto & elem : s_folders) item_append(_(elem.name), "", 0, (void *)(uintptr_t)elem.action); item_append(menu_item_type::SEPARATOR); customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_export::populate() { // add options items item_append(_("Export list in XML format (like -listxml)"), nullptr, 0, (void *)(FPTR)1); item_append(_("Export list in XML format (like -listxml, but exclude devices)"), nullptr, 0, (void *)(FPTR)3); item_append(_("Export list in TXT format (like -listfull)"), nullptr, 0, (void *)(FPTR)2); item_append(ui_menu_item_type::SEPARATOR); }
void menu_image_info::populate() { item_append(machine().system().description, "", FLAG_DISABLE, nullptr); item_append("", "", FLAG_DISABLE, nullptr); for (device_image_interface &image : image_interface_iterator(machine().root_device())) image_info(&image); }
void menu_remove_folder::populate(float &customtop, float &custombottom) { int folders_count = 0; for (auto & elem : m_folders) item_append(elem, "", 0, (void *)(uintptr_t)++folders_count); item_append(menu_item_type::SEPARATOR); customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_select_rw::populate() { item_append("Select access mode", NULL, MENU_FLAG_DISABLE, NULL); item_append("Read-only", 0, 0, (void *)READONLY); if (m_can_in_place) item_append("Read-write", 0, 0, (void *)READWRITE); item_append("Read this image, write to another image", 0, 0, (void *)WRITE_OTHER); item_append("Read this image, write to diff", 0, 0, (void *)WRITE_DIFF); }
void ui_menu_misc_options::populate() { // add options items for (int opt = 1; opt < ARRAY_LENGTH(m_options); ++opt) item_append(_(m_options[opt].description), m_options[opt].status ? _("On") : _("Off"), m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }
void ui_menu_machine_configure::populate() { // add options items item_append(_("Dummy"), nullptr, 0, (void *)(FPTR)10); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); item_append(_("Save machine configuration"), nullptr, 0, (void *)(FPTR)1); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }
void menu_select_rw::populate() { item_append(_("Select access mode"), "", FLAG_DISABLE, nullptr); item_append(_("Read-only"), "", 0, itemref_from_result(result::READONLY)); if (m_can_in_place) item_append(_("Read-write"), "", 0, itemref_from_result(result::READWRITE)); item_append(_("Read this image, write to another image"), "", 0, itemref_from_result(result::WRITE_OTHER)); item_append(_("Read this image, write to diff"), "", 0, itemref_from_result(result::WRITE_DIFF)); }
void ui_menu_controller_mapping::populate() { // add options for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) { UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_device_status) - 1, m_options[d].status); item_append(_(m_options[d].description), m_device_status[m_options[d].status], arrow_flags, (void *)(FPTR)d); } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); }
void ui_menu_select_format::populate() { item_append("Select image format", NULL, MENU_FLAG_DISABLE, NULL); for(int i=0; i<total_usable; i++) { const floppy_image_format_t *fmt = formats[i]; if(i && i == ext_match) item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); item_append(fmt->description(), fmt->name(), 0, (void *)(FPTR)i); } }
void menu_video_options::populate(float &customtop, float &custombottom) { const char *subtext = ""; std::string tempstring; int viewnum; int enabled; /* add items for each view */ for (viewnum = 0; ; viewnum++) { const char *name = target->view_name(viewnum); if (name == nullptr) break; /* create a string for the item, replacing underscores with spaces */ tempstring.assign(name); strreplace(tempstring, "_", " "); item_append(tempstring, "", 0, (void *)(uintptr_t)(VIDEO_ITEM_VIEW + viewnum)); } /* add a separator */ item_append(menu_item_type::SEPARATOR); /* add a rotate item */ switch (target->orientation()) { case ROT0: subtext = "None"; break; case ROT90: subtext = "CW 90" UTF8_DEGREES; break; case ROT180: subtext = "180" UTF8_DEGREES; break; case ROT270: subtext = "CCW 90" UTF8_DEGREES; break; } item_append(_("Rotate"), subtext, FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE); /* backdrop item */ enabled = target->backdrops_enabled(); item_append(_("Backdrops"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS); /* overlay item */ enabled = target->overlays_enabled(); item_append(_("Overlays"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS); /* bezel item */ enabled = target->bezels_enabled(); item_append(_("Bezels"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS); /* cpanel item */ enabled = target->cpanels_enabled(); item_append(_("CPanels"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS); /* marquee item */ enabled = target->marquees_enabled(); item_append(_("Marquees"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES); /* cropping */ enabled = target->zoom_to_screen(); item_append(_("View"), enabled ? _("Cropped") : _("Full"), enabled ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM); }
void ui_simple_menu_select_game::populate() { int matchcount; int curitem; for (curitem = matchcount = 0; m_driverlist[curitem] != nullptr && matchcount < VISIBLE_GAMES_IN_LIST; curitem++) if (!(m_driverlist[curitem]->flags & MACHINE_NO_STANDALONE)) matchcount++; // if nothing there, add a single multiline item and return if (matchcount == 0) { std::string txt; strprintf(txt, "No %s found. Please check the rompath specified in the %s.ini file.\n\n" "If this is your first time using %s, please see the config.txt file in " "the docs directory for information on configuring %s.", emulator_info::get_gamesnoun(), emulator_info::get_configname(), emulator_info::get_appname(),emulator_info::get_appname() ); item_append(txt.c_str(), nullptr, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, nullptr); return; } // otherwise, rebuild the match list assert(m_drivlist != nullptr); if (m_search[0] != 0 || m_matchlist[0] == -1 || m_rerandomize) m_drivlist->find_approximate_matches(m_search, matchcount, m_matchlist); m_rerandomize = false; // iterate over entries for (curitem = 0; curitem < matchcount; curitem++) { int curmatch = m_matchlist[curitem]; if (curmatch != -1) { int cloneof = m_drivlist->non_bios_clone(curmatch); item_append(m_drivlist->driver(curmatch).name, m_drivlist->driver(curmatch).description, (cloneof == -1) ? 0 : MENU_FLAG_INVERT, (void *)&m_drivlist->driver(curmatch)); } } // if we're forced into this, allow general input configuration as well if (ui_menu::stack_has_special_main_menu()) { item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); item_append("Configure Options", nullptr, 0, (void *)1); item_append("Save Configuration", nullptr, 0, (void *)2); } // configure the custom rendering customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; custombottom = 4.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void ui_menu_video_options::populate() { const char *subtext = ""; std::string tempstring; int viewnum; int enabled; /* add items for each view */ for (viewnum = 0; ; viewnum++) { const char *name = target->view_name(viewnum); if (name == NULL) break; /* create a string for the item, replacing underscores with spaces */ tempstring.assign(name); strreplace(tempstring, "_", " "); item_append(tempstring.c_str(), NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum)); } /* add a separator */ item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); /* add a rotate item */ switch (target->orientation()) { case ROT0: subtext = "None"; break; case ROT90: subtext = "CW 90" UTF8_DEGREES; break; case ROT180: subtext = "180" UTF8_DEGREES; break; case ROT270: subtext = "CCW 90" UTF8_DEGREES; break; } item_append("Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE); /* backdrop item */ enabled = target->backdrops_enabled(); item_append("Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS); /* overlay item */ enabled = target->overlays_enabled(); item_append("Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS); /* bezel item */ enabled = target->bezels_enabled(); item_append("Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS); /* cpanel item */ enabled = target->cpanels_enabled(); item_append("CPanels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS); /* marquee item */ enabled = target->marquees_enabled(); item_append("Marquees", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES); /* cropping */ enabled = target->zoom_to_screen(); item_append("View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM); }
void ui_menu_remove_folder::populate() { path_iterator path(m_searchpath.c_str()); std::string curpath; int folders_count = 0; while (path.next(curpath, nullptr)) item_append(curpath.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void menu_software_list::populate() { // build up the list of entries for the menu for (const software_info &swinfo : m_swlist->get_info()) append_software_entry(swinfo); // add an entry to change ordering item_append(_("Switch Item Ordering"), "", 0, (void *)1); // append all of the menu entries for (auto &entry : m_entrylist) item_append(entry.short_name, entry.long_name, 0, &entry); }