diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/mame/ui/dirmenu.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/filesel.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/menu.cpp | 166 | ||||
-rw-r--r-- | src/frontend/mame/ui/menu.h | 31 | ||||
-rw-r--r-- | src/frontend/mame/ui/swlist.cpp | 2 |
5 files changed, 104 insertions, 99 deletions
diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp index ec9e2753de7..13875c328f5 100644 --- a/src/frontend/mame/ui/dirmenu.cpp +++ b/src/frontend/mame/ui/dirmenu.cpp @@ -444,7 +444,7 @@ void menu_add_change_folder::handle() } } } - top_line = selected - (visible_lines / 2); + centre_selection(); } } else if (menu_event->iptkey == IPT_UI_CANCEL) diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp index 3343d82367c..34e86c99fe8 100644 --- a/src/frontend/mame/ui/filesel.cpp +++ b/src/frontend/mame/ui/filesel.cpp @@ -485,7 +485,7 @@ void menu_file_selector::handle() if (selected_entry != nullptr && selected_entry != cur_selected) { set_selection((void *)selected_entry); - top_line = selected - (visible_lines / 2); + centre_selection(); } } } diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index 623511ae50c..095cae4acf1 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -27,6 +27,9 @@ #include "rendutil.h" #include "uiinput.h" +#include <algorithm> +#include <cmath> + namespace ui { /*************************************************************************** @@ -211,6 +214,8 @@ menu::menu(mame_ui_manager &mui, render_container *_container) , m_event() , m_pool(nullptr) , m_focus(focused_menu::main) + , m_visible_lines(0) + , m_visible_items(0) , m_resetpos(0) , m_resetref(nullptr) { @@ -257,7 +262,7 @@ void menu::reset(reset_options options) for (pool *ppool = m_pool; ppool != nullptr; ppool = ppool->next) ppool->top = (UINT8 *)(ppool + 1); item.clear(); - visitems = 0; + m_visible_items = 0; selected = 0; // add an item to return @@ -547,9 +552,8 @@ void menu::draw(UINT32 flags, float origx0, float origy0) if (visible_main_menu_height + visible_extra_menu_height + 2.0f * UI_BOX_TB_BORDER > 1.0f) visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; - visible_lines = floor(visible_main_menu_height / line_height); - if (visible_lines > item.size()) visible_lines = item.size(); - visible_main_menu_height = (float)visible_lines * line_height; + m_visible_lines = std::min(int(std::floor(visible_main_menu_height / line_height)), int(unsigned(item.size()))); + visible_main_menu_height = float(m_visible_lines) * line_height; // compute top/left of inner menu area by centering float const visible_left = (1.0f - visible_width) * 0.5f; @@ -565,17 +569,17 @@ void menu::draw(UINT32 flags, float origx0, float origy0) if (top_line < 0 || is_first_selected()) top_line = 0; - if (selected >= (top_line + visible_lines)) - top_line = selected - (visible_lines / 2); - if ((top_line > (item.size() - visible_lines)) || (selected == (item.size() - 1))) - top_line = item.size() - visible_lines; + if (selected >= (top_line + m_visible_lines)) + top_line = selected - (m_visible_lines / 2); + if ((top_line > (item.size() - m_visible_lines)) || (selected == (item.size() - 1))) + top_line = item.size() - m_visible_lines; // if scrolling, show arrows - bool const show_top_arrow((item.size() > visible_lines) && (top_line > 0)); - bool const show_bottom_arrow((item.size() > visible_lines) && (top_line != (item.size() - visible_lines))); + bool const show_top_arrow((item.size() > m_visible_lines) && !first_item_visible()); + bool const show_bottom_arrow((item.size() > m_visible_lines) && !last_item_visible()); // set the number of visible lines, minus 1 for top arrow and 1 for bottom arrow - visitems = visible_lines - (show_top_arrow ? 1 : 0) - (show_bottom_arrow ? 1 : 0); + m_visible_items = m_visible_lines - (show_top_arrow ? 1 : 0) - (show_bottom_arrow ? 1 : 0); // determine effective positions taking into account the hilighting arrows float const effective_width = visible_width - 2.0f * gutter_width; @@ -600,7 +604,7 @@ void menu::draw(UINT32 flags, float origx0, float origy0) float const line_x1 = x2 - 0.5f * UI_LINE_WIDTH; if (!customonly) { - for (int linenum = 0; linenum < visible_lines; linenum++) + for (int linenum = 0; linenum < m_visible_lines; linenum++) { auto const itemnum = top_line + linenum; menu_item const &pitem = item[itemnum]; @@ -634,9 +638,9 @@ void menu::draw(UINT32 flags, float origx0, float origy0) if (bgcolor != UI_TEXT_BG_COLOR) highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor); - // if we're on the top line, display the up arrow if (linenum == 0 && show_top_arrow) { + // if we're on the top line, display the up arrow draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y0 + 0.25f * line_height, @@ -647,10 +651,9 @@ void menu::draw(UINT32 flags, float origx0, float origy0) if (hover == itemnum) hover = HOVER_ARROW_UP; } - - // if we're on the bottom line, display the down arrow - else if (linenum == visible_lines - 1 && show_bottom_arrow) + else if (linenum == m_visible_lines - 1 && show_bottom_arrow) { + // if we're on the bottom line, display the down arrow draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y0 + 0.25f * line_height, @@ -661,14 +664,14 @@ void menu::draw(UINT32 flags, float origx0, float origy0) if (hover == itemnum) hover = HOVER_ARROW_DOWN; } - - // if we're just a divider, draw a line else if (pitem.type == menu_item_type::SEPARATOR) + { + // if we're just a divider, draw a line container->add_line(visible_left, line_y0 + 0.5f * line_height, visible_left + visible_width, line_y0 + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); - - // if we don't have a subitem, just draw the string centered + } else if (pitem.subtext.empty()) { + // if we don't have a subitem, just draw the string centered if (pitem.flags & FLAG_UI_HEADING) { float heading_width = ui().get_string_width(itemtext); @@ -678,10 +681,9 @@ void menu::draw(UINT32 flags, float origx0, float origy0) ui().draw_text_full(container, itemtext, effective_left, line_y0, effective_width, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr); } - - // otherwise, draw the item on the left and the subitem text on the right else { + // otherwise, draw the item on the left and the subitem text on the right bool const subitem_invert(pitem.flags & FLAG_INVERT); char const *subitem_text(pitem.subtext.c_str()); float item_width, subitem_width; @@ -871,25 +873,25 @@ void menu::handle_events(UINT32 flags) { if ((flags & FLAG_UI_DATS) != 0) { - top_line -= visitems - (top_line + visible_lines == item.size() - 1); + top_line -= m_visible_items - (last_item_visible() ? 1 : 0); return; } - selected -= visitems; + selected -= m_visible_items; if (selected < 0) selected = 0; - top_line -= visitems - (top_line + visible_lines == item.size() - 1); + top_line -= m_visible_items - (last_item_visible() ? 1 : 0); } else if (hover == HOVER_ARROW_DOWN) { if ((flags & FLAG_UI_DATS) != 0) { - top_line += visible_lines - 2; + top_line += m_visible_lines - 2; return; } - selected += visible_lines - 2 + (selected == 0); + selected += m_visible_lines - 2 + (selected == 0); if (selected > item.size() - 1) selected = item.size() - 1; - top_line += visible_lines - 2; + top_line += m_visible_lines - 2; } } break; @@ -923,7 +925,7 @@ void menu::handle_events(UINT32 flags) is_first_selected() ? selected = top_line = item.size() - 1 : selected -= local_menu_event.num_lines; validate_selection(-1); top_line -= (selected <= top_line && top_line != 0); - if (selected <= top_line && visitems != visible_lines) + if (selected <= top_line && m_visible_items != m_visible_lines) top_line -= local_menu_event.num_lines; } else @@ -935,8 +937,8 @@ void menu::handle_events(UINT32 flags) } is_last_selected() ? selected = top_line = 0 : selected += local_menu_event.num_lines; validate_selection(1); - top_line += (selected >= top_line + visitems + (top_line != 0)); - if (selected >= (top_line + visitems + (top_line != 0))) + top_line += (selected >= top_line + m_visible_items + (top_line != 0)); + if (selected >= (top_line + m_visible_items + (top_line != 0))) top_line += local_menu_event.num_lines; } } @@ -1021,7 +1023,7 @@ void menu::handle_keys(UINT32 flags) is_first_selected() ? selected = top_line = item.size() - 1 : --selected; validate_selection(-1); top_line -= (selected <= top_line && top_line != 0); - if (selected <= top_line && visitems != visible_lines) + if (selected <= top_line && m_visible_items != m_visible_lines) top_line--; } @@ -1035,26 +1037,26 @@ void menu::handle_keys(UINT32 flags) } is_last_selected() ? selected = top_line = 0 : ++selected; validate_selection(1); - top_line += (selected >= top_line + visitems + (top_line != 0)); - if (selected >= (top_line + visitems + (top_line != 0))) + top_line += (selected >= top_line + m_visible_items + (top_line != 0)); + if (selected >= (top_line + m_visible_items + (top_line != 0))) top_line++; } - // page up backs up by visitems + // page up backs up by m_visible_items if (exclusive_input_pressed(IPT_UI_PAGE_UP, 6)) { - selected -= visitems; - top_line -= visitems - (top_line + visible_lines == item.size() - 1); + selected -= m_visible_items; + top_line -= m_visible_items - (last_item_visible() ? 1 : 0); if (selected < 0) selected = 0; validate_selection(1); } - // page down advances by visitems + // page down advances by m_visible_items if (exclusive_input_pressed(IPT_UI_PAGE_DOWN, 6)) { - selected += visible_lines - 2 + (selected == 0); - top_line += visible_lines - 2; + selected += m_visible_lines - 2 + (selected == 0); + top_line += m_visible_lines - 2; if (selected > item.size() - 1) selected = item.size() - 1; @@ -1444,13 +1446,13 @@ void menu::draw_select_game(UINT32 flags) // account for extra space at the top and bottom float visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; - visible_lines = floor(visible_main_menu_height / line_height); - visible_main_menu_height = (float)(visible_lines * line_height); + m_visible_lines = int(std::trunc(visible_main_menu_height / line_height)); + visible_main_menu_height = float(m_visible_lines) * line_height; if (!is_swlist) - ui_globals::visible_main_lines = visible_lines; + ui_globals::visible_main_lines = m_visible_lines; else - ui_globals::visible_sw_lines = visible_lines; + ui_globals::visible_sw_lines = m_visible_lines; // compute top/left of inner menu area by centering float visible_left = primary_left; @@ -1472,24 +1474,24 @@ void menu::draw_select_game(UINT32 flags) // compute and add main box x1 = visible_left - UI_BOX_LR_BORDER; x2 = visible_left + visible_width + UI_BOX_LR_BORDER; - float line = visible_top + (float)(visible_lines * line_height); + float line = visible_top + (float(m_visible_lines) * line_height); ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); - if (visible_items < visible_lines) - visible_lines = visible_items; + if (visible_items < m_visible_lines) + m_visible_lines = visible_items; if (top_line < 0 || is_first_selected()) top_line = 0; - if (selected < visible_items && top_line + visible_lines >= visible_items) - top_line = visible_items - visible_lines; + if (selected < visible_items && top_line + m_visible_lines >= visible_items) + top_line = visible_items - m_visible_lines; // determine effective positions taking into account the hilighting arrows float effective_width = visible_width - 2.0f * gutter_width; float effective_left = visible_left + gutter_width; - int n_loop = (visible_items >= visible_lines) ? visible_lines : visible_items; if (m_prev_selected != nullptr && m_focus == focused_menu::main && selected < visible_items) m_prev_selected = nullptr; + int const n_loop = (std::min)(m_visible_lines, visible_items); for (int linenum = 0; linenum < n_loop; linenum++) { float line_y = visible_top + (float)linenum * line_height; @@ -1532,32 +1534,33 @@ void menu::draw_select_game(UINT32 flags) hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); } - // if we're on the top line, display the up arrow if (linenum == 0 && top_line != 0) { + // if we're on the top line, display the up arrow draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0); if (hover == itemnum) hover = HOVER_ARROW_UP; } - // if we're on the bottom line, display the down arrow - else if (linenum == visible_lines - 1 && itemnum != visible_items - 1) + else if (linenum == m_visible_lines - 1 && itemnum != visible_items - 1) { + // if we're on the bottom line, display the down arrow draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0 ^ ORIENTATION_FLIP_Y); if (hover == itemnum) hover = HOVER_ARROW_DOWN; } - // if we're just a divider, draw a line else if (pitem.type == menu_item_type::SEPARATOR) + { + // if we're just a divider, draw a line container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); - - // draw the item centered + } else if (pitem.subtext.empty()) { + // draw the item centered int item_invert = pitem.flags & FLAG_INVERT; auto icon = draw_icon(linenum, item[itemnum].ref, effective_left, line_y); ui().draw_text_full(container, itemtext, effective_left + icon, line_y, effective_width - icon, ui::text_layout::LEFT, ui::text_layout::TRUNCATE, @@ -1635,7 +1638,7 @@ void menu::draw_select_game(UINT32 flags) custom_render(get_selection_ref(), customtop, custombottom, x1, y1, x2, y2); // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow - visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != visible_items); + m_visible_items = m_visible_lines - (top_line != 0) - (top_line + m_visible_lines != visible_items); // reset redraw icon stage if (!is_swlist) ui_globals::redraw_icon = false; @@ -1796,11 +1799,11 @@ void menu::handle_main_keys(UINT32 flags) selected++; - if (selected == top_line + visitems + (top_line != 0)) + if (selected == top_line + m_visible_items + (top_line != 0)) top_line++; } - // page up backs up by visitems + // page up backs up by m_visible_items if (exclusive_input_pressed(IPT_UI_PAGE_UP, 6)) { // Infos @@ -1813,16 +1816,16 @@ void menu::handle_main_keys(UINT32 flags) if (selected < visible_items && !ui_error) { - selected -= visitems; + selected -= m_visible_items; if (selected < 0) selected = 0; - top_line -= visitems - (top_line + visible_lines == visible_items); + top_line -= m_visible_items - (top_line + m_visible_lines == visible_items); } } - // page down advances by visitems + // page down advances by m_visible_items if (exclusive_input_pressed(IPT_UI_PAGE_DOWN, 6)) { // Infos @@ -1835,12 +1838,12 @@ void menu::handle_main_keys(UINT32 flags) if (selected < visible_items && !ui_error) { - selected += visible_lines - 2 + (selected == 0); + selected += m_visible_lines - 2 + (selected == 0); if (selected >= visible_items) selected = visible_items - 1; - top_line += visible_lines - 2; + top_line += m_visible_lines - 2; } } @@ -1950,18 +1953,18 @@ void menu::handle_main_events() } else if (hover == HOVER_ARROW_UP) { - selected -= visitems; + selected -= m_visible_items; if (selected < 0) selected = 0; - top_line -= visitems - (top_line + visible_lines == visible_items); + top_line -= m_visible_items - (top_line + m_visible_lines == visible_items); set_pressed(); } else if (hover == HOVER_ARROW_DOWN) { - selected += visible_lines - 2 + (selected == 0); + selected += m_visible_lines - 2 + (selected == 0); if (selected >= visible_items) selected = visible_items - 1; - top_line += visible_lines - 2; + top_line += m_visible_lines - 2; set_pressed(); } else if (hover == HOVER_UI_RIGHT) @@ -2065,7 +2068,7 @@ void menu::handle_main_events() selected += local_menu_event.num_lines; if (selected > visible_items - 1) selected = visible_items - 1; - if (selected >= top_line + visitems + (top_line != 0)) + if (selected >= top_line + m_visible_items + (top_line != 0)) top_line += local_menu_event.num_lines; } } @@ -2740,7 +2743,7 @@ void menu::draw_palette_menu() custom_render(get_selection_ref(), customtop, custombottom, x1, y1, x2, y2); // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow - visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != item.size()); + m_visible_items = visible_lines - (top_line != 0) - (top_line + visible_lines != item.size()); } //------------------------------------------------- @@ -2775,8 +2778,8 @@ void menu::draw_dats_menu() // account for extra space at the top and bottom float visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height; - visible_lines = floor(visible_main_menu_height / line_height); - visible_main_menu_height = (float)(visible_lines * line_height); + m_visible_lines = int(std::trunc(visible_main_menu_height / line_height)); + visible_main_menu_height = float(m_visible_lines) * line_height; // compute top/left of inner menu area by centering float visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f; @@ -2789,23 +2792,20 @@ void menu::draw_dats_menu() float y1 = visible_top - UI_BOX_TB_BORDER; float x2 = x1 + visible_width; float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER + extra_height; - float line = visible_top + (float)(visible_lines * line_height); + float line = visible_top + float(m_visible_lines) * line_height; ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); - if (visible_items < visible_lines) - visible_lines = visible_items; - if (top_line < 0) - top_line = 0; - if (top_line + visible_lines >= visible_items) - top_line = visible_items - visible_lines; + m_visible_lines = (std::min)(visible_items, m_visible_lines); + top_line = (std::max)(0, top_line); + if (top_line + m_visible_lines >= visible_items) + top_line = visible_items - m_visible_lines; // determine effective positions taking into account the hilighting arrows float effective_width = visible_width - 2.0f * gutter_width; float effective_left = visible_left + gutter_width; - int n_loop = (visible_items >= visible_lines) ? visible_lines : visible_items; - + int const n_loop = (std::min)(visible_items, m_visible_lines); for (int linenum = 0; linenum < n_loop; linenum++) { float line_y = visible_top + (float)linenum * line_height; @@ -2834,7 +2834,7 @@ void menu::draw_dats_menu() } } // if we're on the bottom line, display the down arrow - else if (linenum == visible_lines - 1 && itemnum != visible_items - 1) + else if (linenum == m_visible_lines - 1 && itemnum != visible_items - 1) { draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height, 0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0 ^ ORIENTATION_FLIP_Y); @@ -2886,7 +2886,7 @@ void menu::draw_dats_menu() custom_render(get_selection_ref(), customtop, custombottom, x1, y1, x2, y2); // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow - visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != visible_items); + m_visible_items = m_visible_lines - (top_line != 0) - (top_line + m_visible_lines != visible_items); } void menu::set_pressed() diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 7317150ba9e..7c292a22753 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -54,7 +54,6 @@ public: render_container *container; // render_container we render to int hover; // which item is being hovered over - int visitems; // number of visible items float customtop; // amount of extra height to add at the top float custombottom; // amount of extra height to add at the bottom std::vector<menu_item> item; // array of items @@ -71,9 +70,6 @@ public: // allocate temporary memory from the menu's memory pool void *m_pool_alloc(size_t size); - // request the specific handling of the game selection main menu - bool is_special_main_menu() const; - // Global initialization static void init(running_machine &machine, ui_options &mopt); static void exit(running_machine &machine); @@ -248,7 +244,6 @@ protected: menu(mame_ui_manager &mui, render_container *container); - // free all items in the menu, and all memory allocated from the memory pool void reset(reset_options options); void reset_parent(reset_options options) { m_parent->reset(options); } static void reset_topmost(reset_options options) { if (menu_stack) menu_stack->reset(options); } @@ -269,6 +264,9 @@ protected: // changes the index of the currently selected menu item void set_selection(void *selected_itemref); + // scroll position control + void centre_selection() { top_line = selected - (m_visible_lines / 2); } + // draw right box float draw_right_box_title(float x1, float y1, float x2, float y2); @@ -291,7 +289,6 @@ protected: template <typename T> static T *topmost_menu() { return dynamic_cast<T *>(menu_stack.get()); } - int visible_lines; // main box visible lines int right_visible_lines; // right box lines static std::unique_ptr<bitmap_argb32> snapx_bitmap; @@ -319,6 +316,7 @@ private: static render_texture *icons_texture[]; // request the specific handling of the game selection main menu + bool is_special_main_menu() const; void set_special_main_menu(bool disable); // push a new menu onto the stack @@ -348,16 +346,23 @@ private: float draw_icon(int linenum, void *selectedref, float x1, float y1); void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction); + bool first_item_visible() const { return top_line <= 0; } + bool last_item_visible() const { return (top_line + m_visible_lines) >= item.size(); } + bool m_special_main_menu; - mame_ui_manager &m_ui; // UI we are attached to - std::unique_ptr<menu> m_parent; // pointer to parent menu - bool m_pressed; // mouse button held down + mame_ui_manager &m_ui; // UI we are attached to + std::unique_ptr<menu> m_parent; // pointer to parent menu + bool m_pressed; // mouse button held down osd_ticks_t m_repeat; - event m_event; // the UI event that occurred - pool *m_pool; // list of memory pools + event m_event; // the UI event that occurred + pool *m_pool; // list of memory pools focused_menu m_focus; - int m_resetpos; // reset position - void *m_resetref; // reset reference + + int m_visible_lines; // main box visible lines + int m_visible_items; // number of visible items + + int m_resetpos; // reset position + void *m_resetref; // reset reference static std::vector<const game_driver *> m_old_icons; diff --git a/src/frontend/mame/ui/swlist.cpp b/src/frontend/mame/ui/swlist.cpp index e0703323eea..859fdcc6f11 100644 --- a/src/frontend/mame/ui/swlist.cpp +++ b/src/frontend/mame/ui/swlist.cpp @@ -306,7 +306,7 @@ void menu_software_list::handle() if (selected_entry != nullptr && selected_entry != cur_selected) { set_selection((void *)selected_entry); - top_line = selected - (visible_lines / 2); + centre_selection(); } } } |