Update accumulating relative inputs exactly once per frame.
This fixes "amplification" effects that would happen if the frame rate rose above 100 Hz (whether by unthrottling or otherwise). Synchronise with wall clock any time inputs are read. Not doing this has weird effects on relative inputs with frame skipping and contributes to unresponsiveness of menus. Reduce visual latency for mouse movement on menus when paused or skipping frames. The rest of the code changes to menus won't provide benefits until draw can happen after event handling.
This commit is contained in:
parent
3b5dbeea3b
commit
65aeb63a2a
@ -294,7 +294,7 @@ msgstr ""
|
||||
|
||||
#: src/frontend/mame/ui/optsmenu.cpp:85
|
||||
msgid "Input Devices"
|
||||
msgstr ""
|
||||
msgstr "Thiết bị đưa vào"
|
||||
|
||||
#: src/frontend/mame/ui/optsmenu.cpp:87
|
||||
msgid "Save Settings"
|
||||
@ -340,11 +340,11 @@ msgstr ""
|
||||
|
||||
#: src/frontend/mame/ui/filesel.cpp:520
|
||||
msgid "Read-only"
|
||||
msgstr ""
|
||||
msgstr "Chỉ đọc"
|
||||
|
||||
#: src/frontend/mame/ui/filesel.cpp:522
|
||||
msgid "Read-write"
|
||||
msgstr ""
|
||||
msgstr "Đọc/ghi"
|
||||
|
||||
#: src/frontend/mame/ui/filesel.cpp:523
|
||||
msgid "Read this image, write to another image"
|
||||
@ -524,11 +524,11 @@ msgstr ""
|
||||
|
||||
#: src/frontend/mame/ui/submenu.cpp:84
|
||||
msgid "Mouse"
|
||||
msgstr ""
|
||||
msgstr "Chuột"
|
||||
|
||||
#: src/frontend/mame/ui/submenu.cpp:85
|
||||
msgid "Joystick"
|
||||
msgstr ""
|
||||
msgstr "Cần điều khiển"
|
||||
|
||||
#: src/frontend/mame/ui/submenu.cpp:86
|
||||
msgid "Lightgun"
|
||||
@ -688,7 +688,7 @@ msgstr ""
|
||||
#: src/frontend/mame/ui/analogipt.cpp:527 plugins/cheatfind/init.lua:766
|
||||
#: plugins/cheatfind/init.lua:777 plugins/cheat/init.lua:679
|
||||
msgid "On"
|
||||
msgstr ""
|
||||
msgstr "Bật"
|
||||
|
||||
#: src/frontend/mame/ui/menu.cpp:372 src/frontend/mame/ui/menu.cpp:741
|
||||
#: src/frontend/mame/ui/videoopt.cpp:185
|
||||
@ -697,11 +697,11 @@ msgstr ""
|
||||
#: plugins/cheatfind/init.lua:774 plugins/cheat/init.lua:682
|
||||
#: plugins/cheat/init.lua:691
|
||||
msgid "Off"
|
||||
msgstr ""
|
||||
msgstr "Tắt"
|
||||
|
||||
#: src/frontend/mame/ui/menu.cpp:744
|
||||
msgid "Auto"
|
||||
msgstr ""
|
||||
msgstr "Tự động"
|
||||
|
||||
#: src/frontend/mame/ui/menu.cpp:1272
|
||||
#: src/frontend/mame/ui/simpleselgame.cpp:283
|
||||
@ -1243,7 +1243,7 @@ msgstr ""
|
||||
#: src/frontend/mame/ui/utils.cpp:88
|
||||
msgctxt "machine-filter"
|
||||
msgid "Not Working"
|
||||
msgstr ""
|
||||
msgstr "Không hoạt động"
|
||||
|
||||
#: src/frontend/mame/ui/utils.cpp:89
|
||||
msgctxt "machine-filter"
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
static void display_ui_chooser(running_machine &machine);
|
||||
static int start_frontend(emu_options &options, osd_interface &osd, std::vector<std::string> &args);
|
||||
static int start_frontend(emu_options &options, osd_interface &osd, int argc, char *argv[]);
|
||||
static void draw_user_interface(running_machine& machine);
|
||||
static bool draw_user_interface(running_machine& machine);
|
||||
static void periodic_check();
|
||||
static bool frame_hook();
|
||||
static void sound_hook();
|
||||
|
@ -219,8 +219,8 @@ void video_manager::frame_update(bool from_debugger)
|
||||
bool anything_changed = update_screens && finish_screen_updates();
|
||||
|
||||
// update inputs and draw the user interface
|
||||
machine().osd().input_update();
|
||||
emulator_info::draw_user_interface(machine());
|
||||
machine().osd().input_update(true);
|
||||
anything_changed = emulator_info::draw_user_interface(machine()) || anything_changed;
|
||||
|
||||
// let plugins draw over the UI
|
||||
anything_changed = emulator_info::frame_hook() || anything_changed;
|
||||
@ -235,7 +235,7 @@ void video_manager::frame_update(bool from_debugger)
|
||||
|
||||
// if we're throttling, synchronize before rendering
|
||||
attotime current_time = machine().time();
|
||||
if (!from_debugger && !skipped_it && phase > machine_phase::INIT && !m_low_latency && effective_throttle())
|
||||
if (!from_debugger && phase > machine_phase::INIT && !m_low_latency && effective_throttle())
|
||||
update_throttle(current_time);
|
||||
|
||||
// ask the OSD to update
|
||||
@ -244,10 +244,10 @@ void video_manager::frame_update(bool from_debugger)
|
||||
g_profiler.stop();
|
||||
|
||||
// we synchronize after rendering instead of before, if low latency mode is enabled
|
||||
if (!from_debugger && !skipped_it && phase > machine_phase::INIT && m_low_latency && effective_throttle())
|
||||
if (!from_debugger && phase > machine_phase::INIT && m_low_latency && effective_throttle())
|
||||
update_throttle(current_time);
|
||||
|
||||
machine().osd().input_update();
|
||||
machine().osd().input_update(false);
|
||||
emulator_info::periodic_check();
|
||||
|
||||
if (!from_debugger)
|
||||
|
@ -458,9 +458,9 @@ int emulator_info::start_frontend(emu_options &options, osd_interface &osd, int
|
||||
return start_frontend(options, osd, args);
|
||||
}
|
||||
|
||||
void emulator_info::draw_user_interface(running_machine& machine)
|
||||
bool emulator_info::draw_user_interface(running_machine& machine)
|
||||
{
|
||||
mame_machine_manager::instance()->ui().update_and_render(machine.render().ui_container());
|
||||
return mame_machine_manager::instance()->ui().update_and_render(machine.render().ui_container());
|
||||
}
|
||||
|
||||
void emulator_info::periodic_check()
|
||||
|
@ -125,10 +125,12 @@ void menu_about::populate()
|
||||
// handle - manages inputs in the about modal
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_about::handle(event const *ev)
|
||||
bool menu_about::handle(event const *ev)
|
||||
{
|
||||
if (ev)
|
||||
handle_key(ev->iptkey);
|
||||
return handle_key(ev->iptkey);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::vector<std::string> const m_header;
|
||||
};
|
||||
|
@ -227,15 +227,17 @@ void menu_analog::menu_activated()
|
||||
}
|
||||
|
||||
|
||||
void menu_analog::handle(event const *ev)
|
||||
bool menu_analog::handle(event const *ev)
|
||||
{
|
||||
// handle events
|
||||
if (ev)
|
||||
if (!ev)
|
||||
{
|
||||
if (IPT_UI_ON_SCREEN_DISPLAY == ev->iptkey)
|
||||
return false;
|
||||
}
|
||||
else if (IPT_UI_ON_SCREEN_DISPLAY == ev->iptkey)
|
||||
{
|
||||
m_hide_menu = !m_hide_menu;
|
||||
set_process_flags(PROCESS_LR_REPEAT | (m_hide_menu ? (PROCESS_CUSTOM_NAV | PROCESS_CUSTOM_ONLY) : 0));
|
||||
return true;
|
||||
}
|
||||
else if (IPT_UI_HELP == ev->iptkey)
|
||||
{
|
||||
@ -252,6 +254,7 @@ void menu_analog::handle(event const *ev)
|
||||
ui().get_general_input_setting(IPT_UI_PREV_GROUP),
|
||||
ui().get_general_input_setting(IPT_UI_NEXT_GROUP),
|
||||
ui().get_general_input_setting(IPT_UI_BACK)));
|
||||
return false;
|
||||
}
|
||||
else if (m_hide_menu)
|
||||
{
|
||||
@ -259,16 +262,18 @@ void menu_analog::handle(event const *ev)
|
||||
{
|
||||
case IPT_UI_UP:
|
||||
--m_top_field;
|
||||
break;
|
||||
return true;
|
||||
case IPT_UI_DOWN:
|
||||
++m_top_field;
|
||||
break;
|
||||
return true;
|
||||
case IPT_UI_HOME:
|
||||
m_top_field = 0;
|
||||
break;
|
||||
return true;
|
||||
case IPT_UI_END:
|
||||
m_top_field = m_field_data.size();
|
||||
break;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ev->itemref)
|
||||
@ -320,7 +325,7 @@ void menu_analog::handle(event const *ev)
|
||||
{
|
||||
set_selection(&m_item_data[current]);
|
||||
set_top_line(selected_index() - 1);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -330,7 +335,7 @@ void menu_analog::handle(event const *ev)
|
||||
{
|
||||
set_selection(&m_item_data[current]);
|
||||
set_top_line(selected_index() - 1);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -347,7 +352,7 @@ void menu_analog::handle(event const *ev)
|
||||
{
|
||||
set_selection(&m_item_data[current]);
|
||||
set_top_line(selected_index() - 1);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -377,8 +382,16 @@ void menu_analog::handle(event const *ev)
|
||||
// update the menu item
|
||||
ev->item->set_subtext(item_text(data.type, newval));
|
||||
ev->item->set_flags((data.cur <= data.min) ? FLAG_RIGHT_ARROW : (data.cur >= data.max) ? FLAG_LEFT_ARROW : FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
using field_data_vector = std::vector<field_data>;
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void find_fields();
|
||||
|
||||
|
@ -150,7 +150,7 @@ void menu_audit::populate()
|
||||
item_append(menu_item_type::SEPARATOR, 0);
|
||||
}
|
||||
|
||||
void menu_audit::handle(event const *ev)
|
||||
bool menu_audit::handle(event const *ev)
|
||||
{
|
||||
switch (m_phase)
|
||||
{
|
||||
@ -166,6 +166,7 @@ void menu_audit::handle(event const *ev)
|
||||
m_future.resize(std::thread::hardware_concurrency());
|
||||
for (auto &future : m_future)
|
||||
future = std::async(std::launch::async, [this] () { return do_audit(); });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -191,13 +192,17 @@ void menu_audit::handle(event const *ev)
|
||||
m_phase = phase::CANCELLATION;
|
||||
else
|
||||
m_phase = phase::AUDIT;
|
||||
return true;
|
||||
}
|
||||
else if ((phase::CANCELLATION == m_phase) && machine().ui_input().pressed(IPT_UI_SELECT))
|
||||
{
|
||||
m_cancel.store(true);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool menu_audit::do_audit()
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
enum class phase { CONFIRMATION, AUDIT, CANCELLATION };
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
bool do_audit();
|
||||
void save_available_machines();
|
||||
|
@ -75,34 +75,34 @@ void menu_barcode_reader::populate()
|
||||
// handle - manages inputs in the barcode input menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_barcode_reader::handle(event const *ev)
|
||||
bool menu_barcode_reader::handle(event const *ev)
|
||||
{
|
||||
// process the event
|
||||
if (ev)
|
||||
{
|
||||
// handle selections
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
case IPT_UI_LEFT:
|
||||
if (ev->itemref == ITEMREF_SELECT_READER)
|
||||
previous();
|
||||
return previous();
|
||||
break;
|
||||
|
||||
case IPT_UI_RIGHT:
|
||||
if (ev->itemref == ITEMREF_SELECT_READER)
|
||||
next();
|
||||
return next();
|
||||
break;
|
||||
|
||||
case IPT_UI_SELECT:
|
||||
if (ev->itemref == ITEMREF_ENTER_BARCODE)
|
||||
{
|
||||
std::string tmp_file(m_barcode_buffer);
|
||||
//printf("code %s\n", m_barcode_buffer);
|
||||
if (!current_device()->is_valid(tmp_file.length()))
|
||||
//osd_printf_verbose("code %s\n", m_barcode_buffer);
|
||||
if (!current_device()->is_valid(m_barcode_buffer.length()))
|
||||
{
|
||||
ui().popup_time(5, "%s", _("Barcode length invalid!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
current_device()->write_code(tmp_file.c_str(), tmp_file.length());
|
||||
current_device()->write_code(m_barcode_buffer.c_str(), m_barcode_buffer.length());
|
||||
// if sending was successful, reset char buffer
|
||||
m_barcode_buffer.clear();
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
@ -111,10 +111,11 @@ void menu_barcode_reader::handle(event const *ev)
|
||||
break;
|
||||
|
||||
case IPT_UI_CLEAR:
|
||||
if (get_selection_ref() == ITEMREF_NEW_BARCODE)
|
||||
if (ev->itemref == ITEMREF_NEW_BARCODE)
|
||||
{
|
||||
m_barcode_buffer.clear();
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
ev->item->set_subtext(m_barcode_buffer);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -122,7 +123,10 @@ void menu_barcode_reader::handle(event const *ev)
|
||||
if (get_selection_ref() == ITEMREF_NEW_BARCODE)
|
||||
{
|
||||
if (paste_text(m_barcode_buffer, uchar_is_digit))
|
||||
{
|
||||
ev->item->set_subtext(m_barcode_buffer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -130,11 +134,15 @@ void menu_barcode_reader::handle(event const *ev)
|
||||
if (get_selection_ref() == ITEMREF_NEW_BARCODE)
|
||||
{
|
||||
if (input_character(m_barcode_buffer, ev->unichar, uchar_is_digit))
|
||||
{
|
||||
ev->item->set_subtext(m_barcode_buffer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -13,9 +13,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "machine/bcreader.h"
|
||||
#include "ui/devctrl.h"
|
||||
|
||||
#include "machine/bcreader.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
class menu_barcode_reader : public menu_device_control<barcode_reader_device> {
|
||||
@ -25,7 +29,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::string m_barcode_buffer;
|
||||
};
|
||||
|
@ -29,11 +29,11 @@ namespace ui {
|
||||
menu_cheat - handle the cheat menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void menu_cheat::handle(event const *ev)
|
||||
{
|
||||
// handle events
|
||||
if (ev && ev->itemref)
|
||||
bool menu_cheat::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
// clear cheat comment on any movement or keypress
|
||||
@ -98,7 +98,8 @@ void menu_cheat::handle(event const *ev)
|
||||
// if things changed, update
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
return false; // always triggers an item reset if the menu needs to be redrawn
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -171,11 +171,11 @@ void menu_confswitch::populate()
|
||||
}
|
||||
|
||||
|
||||
void menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
// handle events
|
||||
if (ev && ev->itemref)
|
||||
bool menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
if (uintptr_t(ev->itemref) == 1U)
|
||||
{
|
||||
// reset
|
||||
@ -233,7 +233,7 @@ void menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
set_selected_index(current);
|
||||
set_top_line(current - 1);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -255,6 +255,7 @@ void menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
set_selected_index(current + 1);
|
||||
set_top_line(current);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -267,7 +268,9 @@ void menu_confswitch::handle(event const *ev)
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
|
||||
// changing settings triggers an item rebuild because it can affect whether things are enabled
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ protected:
|
||||
unsigned active_switch_groups() const { return m_active_switch_groups; }
|
||||
|
||||
private:
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void find_fields();
|
||||
|
||||
|
@ -110,11 +110,11 @@ void menu_custom_ui::menu_dismissed()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_custom_ui::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
bool menu_custom_ui::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
switch ((uintptr_t)ev->itemref)
|
||||
{
|
||||
case FONT_MENU:
|
||||
@ -136,6 +136,7 @@ void menu_custom_ui::handle(event const *ev)
|
||||
m_currlang = 0;
|
||||
ev->item->set_subtext(m_languages[m_currlang]);
|
||||
ev->item->set_flags(get_arrow_flags<std::size_t>(0, m_languages.size() - 1, m_currlang));
|
||||
return true;
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
@ -161,6 +162,7 @@ void menu_custom_ui::handle(event const *ev)
|
||||
m_currsysnames = 0;
|
||||
ev->item->set_subtext(m_sysnames[m_currsysnames]);
|
||||
ev->item->set_flags(get_arrow_flags<std::size_t>(0, m_sysnames.size() - 1, m_currsysnames));
|
||||
return true;
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
@ -186,6 +188,7 @@ void menu_custom_ui::handle(event const *ev)
|
||||
m_currpanels = 0;
|
||||
ev->item->set_subtext(_(HIDE_STATUS[m_currpanels]));
|
||||
ev->item->set_flags(get_arrow_flags<uint16_t>(0, HIDE_BOTH, m_currpanels));
|
||||
return true;
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
@ -202,7 +205,8 @@ void menu_custom_ui::handle(event const *ev)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -405,11 +409,11 @@ void menu_font_ui::menu_dismissed()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_font_ui::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
bool menu_font_ui::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
switch ((uintptr_t)ev->itemref)
|
||||
{
|
||||
case FONT_SIZE:
|
||||
@ -424,6 +428,7 @@ void menu_font_ui::handle(event const *ev)
|
||||
m_font_size = parse_number<int>(ui().options().get_entry(OPTION_FONT_ROWS)->default_value().c_str());
|
||||
ev->item->set_subtext(string_format("%d", m_font_size));
|
||||
ev->item->set_flags(get_arrow_flags(m_font_min, m_font_max, m_font_size));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -439,6 +444,7 @@ void menu_font_ui::handle(event const *ev)
|
||||
m_info_size = parse_number<float>(ui().options().get_entry(OPTION_INFOS_SIZE)->default_value().c_str());
|
||||
ev->item->set_subtext(string_format("%.2f", m_info_size));
|
||||
ev->item->set_flags(get_arrow_flags(m_info_min, m_info_max, m_info_size));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -487,11 +493,13 @@ void menu_font_ui::handle(event const *ev)
|
||||
val = !val;
|
||||
ev->item->set_subtext(val ? _("On") : _("Off"));
|
||||
ev->item->set_flags(val ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -601,9 +609,8 @@ void menu_colors_ui::menu_dismissed()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_colors_ui::handle(event const *ev)
|
||||
bool menu_colors_ui::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref && ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
if ((uintptr_t)ev->itemref != MUI_RESTORE)
|
||||
@ -613,8 +620,11 @@ void menu_colors_ui::handle(event const *ev)
|
||||
else
|
||||
{
|
||||
restore_colors();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -813,11 +823,11 @@ menu_rgb_ui::menu_rgb_ui(mame_ui_manager &mui, render_container &container, rgb_
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_rgb_ui::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
bool menu_rgb_ui::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
case IPT_UI_LEFT:
|
||||
@ -864,6 +874,7 @@ void menu_rgb_ui::handle(event const *ev)
|
||||
{
|
||||
ev->item->set_subtext(string_format("%3u", updated));
|
||||
ev->item->set_flags(get_arrow_flags<uint8_t>(0, 255, updated));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -882,12 +893,12 @@ void menu_rgb_ui::handle(event const *ev)
|
||||
case RGB_RED:
|
||||
case RGB_GREEN:
|
||||
case RGB_BLUE:
|
||||
inkey_special(ev);
|
||||
break;
|
||||
return inkey_special(ev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -997,7 +1008,7 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
|
||||
// handle special key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_rgb_ui::inkey_special(const event *menu_event)
|
||||
bool menu_rgb_ui::inkey_special(const event *menu_event)
|
||||
{
|
||||
if (menu_event->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
@ -1040,11 +1051,16 @@ void menu_rgb_ui::inkey_special(const event *menu_event)
|
||||
menu_event->item->set_subtext("_");
|
||||
menu_event->item->set_flags(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (m_key_active)
|
||||
else if (m_key_active && input_character(m_search, 3, menu_event->unichar, uchar_is_digit))
|
||||
{
|
||||
input_character(m_search, 3, menu_event->unichar, uchar_is_digit);
|
||||
menu_event->item->set_subtext(m_search + "_");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1074,9 +1090,8 @@ menu_palette_sel::menu_palette_sel(mame_ui_manager &mui, render_container &conta
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_palette_sel::handle(event const *ev)
|
||||
bool menu_palette_sel::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
{
|
||||
if (ev->iptkey == IPT_UI_SELECT)
|
||||
@ -1086,6 +1101,8 @@ void menu_palette_sel::handle(event const *ev)
|
||||
stack_pop();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "ui/menu.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace ui {
|
||||
@ -34,7 +36,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void find_languages();
|
||||
void find_sysnames();
|
||||
@ -63,7 +65,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void list();
|
||||
|
||||
@ -126,7 +128,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
s_color_table m_color_table[MUI_RESTORE];
|
||||
void restore_colors();
|
||||
@ -156,15 +158,14 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void inkey_special(const event *menu_event);
|
||||
bool inkey_special(const event *menu_event);
|
||||
|
||||
rgb_t *m_color;
|
||||
std::string m_search;
|
||||
bool m_key_active;
|
||||
int m_lock_ref;
|
||||
std::string m_title;
|
||||
};
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -178,7 +179,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
static std::pair<const char *, const char *> const s_palette[];
|
||||
rgb_t &m_original;
|
||||
|
@ -166,10 +166,11 @@ void menu_dats_view::add_info_text(text_layout &layout, std::string_view text, r
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_dats_view::handle(event const *ev)
|
||||
{
|
||||
if (ev)
|
||||
bool menu_dats_view::handle(event const *ev)
|
||||
{
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
case IPT_UI_LEFT:
|
||||
@ -177,6 +178,7 @@ void menu_dats_view::handle(event const *ev)
|
||||
{
|
||||
m_actual--;
|
||||
reset_layout();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -185,13 +187,15 @@ void menu_dats_view::handle(event const *ev)
|
||||
{
|
||||
m_actual++;
|
||||
reset_layout();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
handle_key(ev->iptkey);
|
||||
}
|
||||
return handle_key(ev->iptkey);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void get_data(std::string &buffer);
|
||||
void get_data_sw(std::string &buffer);
|
||||
|
@ -37,8 +37,8 @@ protected:
|
||||
int count() { return m_count; }
|
||||
|
||||
int current_index();
|
||||
void previous();
|
||||
void next();
|
||||
bool previous();
|
||||
bool next();
|
||||
std::string current_display_name();
|
||||
uint32_t current_display_flags();
|
||||
|
||||
@ -82,7 +82,7 @@ int menu_device_control<DeviceType>::current_index()
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class DeviceType>
|
||||
void menu_device_control<DeviceType>::previous()
|
||||
bool menu_device_control<DeviceType>::previous()
|
||||
{
|
||||
// left arrow - rotate left through devices
|
||||
if (m_device && (1 < m_count))
|
||||
@ -96,6 +96,7 @@ void menu_device_control<DeviceType>::previous()
|
||||
m_device = iter.byindex(index);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
return false; // triggers an item reset on changes anyway
|
||||
}
|
||||
|
||||
|
||||
@ -104,7 +105,7 @@ void menu_device_control<DeviceType>::previous()
|
||||
//-------------------------------------------------
|
||||
|
||||
template<class DeviceType>
|
||||
void menu_device_control<DeviceType>::next()
|
||||
bool menu_device_control<DeviceType>::next()
|
||||
{
|
||||
// right arrow - rotate right through cassette devices
|
||||
if (m_device && (1 < m_count))
|
||||
@ -118,6 +119,7 @@ void menu_device_control<DeviceType>::next()
|
||||
m_device = iter.byindex(index);
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
return false; // triggers an item reset on changes anyway
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,10 +359,12 @@ void menu_device_config::populate()
|
||||
{
|
||||
}
|
||||
|
||||
void menu_device_config::handle(event const *ev)
|
||||
bool menu_device_config::handle(event const *ev)
|
||||
{
|
||||
if (ev)
|
||||
handle_key(ev->iptkey);
|
||||
return handle_key(ev->iptkey);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -29,7 +29,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
device_slot_interface::slot_option const *const m_option;
|
||||
bool const m_mounted;
|
||||
|
@ -9,11 +9,10 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/dirmenu.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/dirmenu.h"
|
||||
#include "ui/utils.h"
|
||||
#include "ui/optsmenu.h"
|
||||
|
||||
#include "emuopts.h"
|
||||
#include "fileio.h"
|
||||
@ -83,7 +82,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::string m_searchpath;
|
||||
int const m_ref;
|
||||
@ -115,7 +114,7 @@ menu_remove_folder::menu_remove_folder(mame_ui_manager &mui, render_container &c
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_remove_folder::handle(event const *ev)
|
||||
bool menu_remove_folder::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref && ev->iptkey == IPT_UI_SELECT)
|
||||
@ -132,13 +131,13 @@ void menu_remove_folder::handle(event const *ev)
|
||||
if (ui().options().exists(f_folders[m_ref].option))
|
||||
ui().options().set_value(f_folders[m_ref].option, tmppath, OPTION_PRIORITY_CMDLINE);
|
||||
else if (machine().options().value(f_folders[m_ref].option) != tmppath)
|
||||
{
|
||||
machine().options().set_value(f_folders[m_ref].option, tmppath, OPTION_PRIORITY_CMDLINE);
|
||||
}
|
||||
|
||||
reset_parent(reset_options::REMEMBER_REF);
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -172,7 +171,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void update_search();
|
||||
|
||||
@ -211,11 +210,11 @@ menu_add_change_folder::menu_add_change_folder(mame_ui_manager &mui, render_cont
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_add_change_folder::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
bool menu_add_change_folder::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
if (ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
assert(ev->item);
|
||||
@ -244,7 +243,10 @@ void menu_add_change_folder::handle(event const *ev)
|
||||
else if (ev->iptkey == IPT_UI_PASTE)
|
||||
{
|
||||
if (paste_text(m_search, uchar_is_printable))
|
||||
{
|
||||
update_search();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (ev->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
@ -283,14 +285,17 @@ void menu_add_change_folder::handle(event const *ev)
|
||||
{
|
||||
// if it's any other key and we're not maxed out, update
|
||||
update_search();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_CANCEL)
|
||||
{
|
||||
// reset the char buffer also in this case
|
||||
m_search.clear();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -451,7 +456,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
bool is_multipath(std::string_view folder) const;
|
||||
|
||||
@ -480,9 +485,8 @@ bool menu_display_actual::is_multipath(std::string_view folder) const
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_display_actual::handle(event const *ev)
|
||||
bool menu_display_actual::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref && ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
switch ((uintptr_t)ev->itemref)
|
||||
@ -496,6 +500,8 @@ void menu_display_actual::handle(event const *ev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -589,11 +595,12 @@ menu_directory::~menu_directory()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_directory::handle(event const *ev)
|
||||
bool menu_directory::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref && ev->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_display_actual>(ui(), container(), selected_index());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -53,11 +53,11 @@ CONFIRM SAVE AS MENU
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
menu_confirm_save_as::menu_confirm_save_as(mame_ui_manager &mui, render_container &container, bool *yes)
|
||||
menu_confirm_save_as::menu_confirm_save_as(mame_ui_manager &mui, render_container &container, bool &yes)
|
||||
: menu(mui, container)
|
||||
, m_yes(yes)
|
||||
{
|
||||
m_yes = yes;
|
||||
*m_yes = false;
|
||||
m_yes = false;
|
||||
}
|
||||
|
||||
|
||||
@ -86,17 +86,19 @@ void menu_confirm_save_as::populate()
|
||||
// handle - confirm save as menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_confirm_save_as::handle(event const *ev)
|
||||
bool menu_confirm_save_as::handle(event const *ev)
|
||||
{
|
||||
// process the event
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT))
|
||||
{
|
||||
if (ev->itemref == ITEMREF_YES)
|
||||
*m_yes = true;
|
||||
m_yes = true;
|
||||
|
||||
// no matter what, pop out
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -207,11 +209,11 @@ void menu_file_create::populate()
|
||||
// handle - file creator menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_file_create::handle(event const *ev)
|
||||
{
|
||||
// process the event
|
||||
if (ev)
|
||||
bool menu_file_create::handle(event const *ev)
|
||||
{
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
// handle selections
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
@ -236,7 +238,10 @@ void menu_file_create::handle(event const *ev)
|
||||
if (ev->itemref == ITEMREF_NEW_IMAGE_NAME)
|
||||
{
|
||||
if (paste_text(m_filename, &osd_is_valid_filename_char))
|
||||
{
|
||||
ev->item->set_subtext(m_filename + "_");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -244,7 +249,10 @@ void menu_file_create::handle(event const *ev)
|
||||
if (ev->itemref == ITEMREF_NEW_IMAGE_NAME)
|
||||
{
|
||||
if (input_character(m_filename, ev->unichar, &osd_is_valid_filename_char))
|
||||
{
|
||||
ev->item->set_subtext(m_filename + "_");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -253,10 +261,12 @@ void menu_file_create::handle(event const *ev)
|
||||
{
|
||||
m_filename.clear();
|
||||
ev->item->set_subtext("_");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -308,7 +318,7 @@ void menu_select_format::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_format::handle(event const *ev)
|
||||
bool menu_select_format::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->iptkey == IPT_UI_SELECT)
|
||||
@ -316,6 +326,8 @@ void menu_select_format::handle(event const *ev)
|
||||
*m_result = (floppy_image_format_t *)ev->itemref;
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -362,7 +374,7 @@ void menu_select_floppy_init::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_floppy_init::handle(event const *ev)
|
||||
bool menu_select_floppy_init::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->iptkey == IPT_UI_SELECT)
|
||||
@ -370,6 +382,8 @@ void menu_select_floppy_init::handle(event const *ev)
|
||||
*m_result = int(uintptr_t(ev->itemref));
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,14 +27,14 @@ namespace ui {
|
||||
class menu_confirm_save_as : public menu
|
||||
{
|
||||
public:
|
||||
menu_confirm_save_as(mame_ui_manager &mui, render_container &container, bool *yes);
|
||||
menu_confirm_save_as(mame_ui_manager &mui, render_container &container, bool &yes);
|
||||
virtual ~menu_confirm_save_as() override;
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
bool *m_yes;
|
||||
bool &m_yes;
|
||||
};
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
bool & m_ok;
|
||||
device_image_interface * m_image;
|
||||
@ -74,7 +74,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// internal state
|
||||
std::vector<const floppy_image_format_t *> m_formats;
|
||||
@ -93,7 +93,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// internal state
|
||||
std::vector<std::reference_wrapper<const floppy_image_device::fs_info>> m_fs;
|
||||
|
@ -171,11 +171,11 @@ void menu_file_manager::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_file_manager::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref && (ev->iptkey == IPT_UI_SELECT))
|
||||
bool menu_file_manager::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref || (ev->iptkey != IPT_UI_SELECT))
|
||||
return false;
|
||||
|
||||
if ((uintptr_t)ev->itemref == 1)
|
||||
{
|
||||
machine().schedule_hard_reset();
|
||||
@ -195,7 +195,8 @@ void menu_file_manager::handle(event const *ev)
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// force file manager menu
|
||||
|
@ -35,7 +35,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void fill_image_line(device_image_interface *img, std::string &instance, std::string &filename);
|
||||
|
||||
|
@ -446,21 +446,27 @@ void menu_file_selector::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_file_selector::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev)
|
||||
bool menu_file_selector::handle(event const *ev)
|
||||
{
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
if (ev->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
// if it's any other key and we're not maxed out, update
|
||||
if (input_character(m_filename, ev->unichar, uchar_is_printable))
|
||||
{
|
||||
update_search();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_PASTE)
|
||||
{
|
||||
if (paste_text(m_filename, uchar_is_printable))
|
||||
{
|
||||
update_search();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_CANCEL)
|
||||
{
|
||||
@ -469,6 +475,7 @@ void menu_file_selector::handle(event const *ev)
|
||||
{
|
||||
m_filename.clear();
|
||||
ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (ev->itemref && (ev->iptkey == IPT_UI_SELECT))
|
||||
@ -478,8 +485,10 @@ void menu_file_selector::handle(event const *ev)
|
||||
|
||||
// reset the char buffer when pressing IPT_UI_SELECT
|
||||
m_filename.clear();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -529,14 +538,15 @@ void menu_select_rw::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_rw::handle(event const *ev)
|
||||
bool menu_select_rw::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
m_result = result_from_itemref(ev->itemref);
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,7 +84,7 @@ private:
|
||||
std::string m_filename;
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// methods
|
||||
file_selector_entry &append_entry(file_selector_entry_type entry_type, const std::string &entry_basename, const std::string &entry_fullpath);
|
||||
@ -121,7 +121,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// internal state
|
||||
bool m_can_in_place;
|
||||
|
@ -12,20 +12,22 @@
|
||||
|
||||
#include "ui/imgcntrl.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/filesel.h"
|
||||
#include "ui/filecreate.h"
|
||||
#include "ui/filesel.h"
|
||||
#include "ui/swlist.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "audit.h"
|
||||
#include "drivenum.h"
|
||||
#include "emuopts.h"
|
||||
#include "image.h"
|
||||
#include "softlist_dev.h"
|
||||
#include "zippath.h"
|
||||
|
||||
#include "util/zippath.h"
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
***************************************************************************/
|
||||
@ -194,7 +196,7 @@ void menu_control_device_image::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_control_device_image::handle(event const *ev)
|
||||
bool menu_control_device_image::handle(event const *ev)
|
||||
{
|
||||
throw emu_fatalerror("menu_control_device_image::handle: Shouldn't get here!");
|
||||
}
|
||||
@ -338,7 +340,7 @@ void menu_control_device_image::menu_activated()
|
||||
{
|
||||
if (need_confirm)
|
||||
{
|
||||
menu::stack_push<menu_confirm_save_as>(ui(), container(), &m_create_confirmed);
|
||||
menu::stack_push<menu_confirm_save_as>(ui(), container(), m_create_confirmed);
|
||||
m_state = CREATE_CONFIRM;
|
||||
}
|
||||
else
|
||||
|
@ -56,7 +56,7 @@ protected:
|
||||
|
||||
// methods
|
||||
virtual void menu_activated() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
virtual void hook_load(const std::string &filename);
|
||||
|
||||
private:
|
||||
|
@ -552,10 +552,9 @@ void menu_game_info::populate()
|
||||
{
|
||||
}
|
||||
|
||||
void menu_game_info::handle(event const *ev)
|
||||
bool menu_game_info::handle(event const *ev)
|
||||
{
|
||||
if (ev)
|
||||
handle_key(ev->iptkey);
|
||||
return ev && handle_key(ev->iptkey);
|
||||
}
|
||||
|
||||
|
||||
@ -617,10 +616,9 @@ void menu_warn_info::populate()
|
||||
{
|
||||
}
|
||||
|
||||
void menu_warn_info::handle(event const *ev)
|
||||
bool menu_warn_info::handle(event const *ev)
|
||||
{
|
||||
if (ev)
|
||||
handle_key(ev->iptkey);
|
||||
return ev && handle_key(ev->iptkey);
|
||||
}
|
||||
|
||||
|
||||
@ -648,8 +646,9 @@ void menu_image_info::populate()
|
||||
image_info(&image);
|
||||
}
|
||||
|
||||
void menu_image_info::handle(event const *ev)
|
||||
bool menu_image_info::handle(event const *ev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
void image_info(device_image_interface *image);
|
||||
};
|
||||
|
||||
|
@ -39,8 +39,9 @@ void menu_pty_info::populate()
|
||||
}
|
||||
}
|
||||
|
||||
void menu_pty_info::handle(event const *ev)
|
||||
bool menu_pty_info::handle(event const *ev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -139,7 +139,7 @@ private:
|
||||
set_custom_space(0.0F, (line_height() * (m_have_analog ? 2.0F : 1.0F)) + (tb_border() * 3.0F));
|
||||
}
|
||||
|
||||
virtual void handle(event const *ev) override
|
||||
virtual bool handle(event const *ev) override
|
||||
{
|
||||
// FIXME: hacky, depending on first item being "copy ID", but need a better model for item reference values
|
||||
if (ev && ev->item && (IPT_UI_SELECT == ev->iptkey) && (&item(0) == ev->item))
|
||||
@ -150,17 +150,25 @@ private:
|
||||
machine().popmessage(_("menu-inputdev", "Error copying device ID to clipboard"));
|
||||
}
|
||||
|
||||
bool updated = false;
|
||||
for (int i = 0; item_count() > i; ++i)
|
||||
{
|
||||
void *const ref(item(i).ref());
|
||||
if (ref)
|
||||
{
|
||||
input_device_item &input = *reinterpret_cast<input_device_item *>(ref);
|
||||
item(i).set_subtext(format_value(input));
|
||||
std::string value(format_value(input));
|
||||
if (item(i).subtext() != value)
|
||||
{
|
||||
item(i).set_subtext(std::move(value));
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
static std::string format_value(input_device_item &input)
|
||||
{
|
||||
switch (input.itemclass())
|
||||
@ -233,10 +241,11 @@ void menu_input_devices::populate()
|
||||
}
|
||||
|
||||
|
||||
void menu_input_devices::handle(event const *ev)
|
||||
{
|
||||
if (ev && ev->itemref)
|
||||
bool menu_input_devices::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
input_device &dev = *reinterpret_cast<input_device *>(ev->itemref);
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
@ -267,13 +276,13 @@ void menu_input_devices::handle(event const *ev)
|
||||
else
|
||||
{
|
||||
set_selected_index(target);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!i && found_break)
|
||||
{
|
||||
set_selected_index(target);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -288,13 +297,14 @@ void menu_input_devices::handle(event const *ev)
|
||||
if (candidate && (candidate->devclass() != group))
|
||||
{
|
||||
set_selected_index(i);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -46,9 +46,8 @@ void menu_input_groups::populate()
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
}
|
||||
|
||||
void menu_input_groups::handle(event const *ev)
|
||||
bool menu_input_groups::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT))
|
||||
{
|
||||
menu::stack_push<menu_input_general>(
|
||||
@ -57,6 +56,8 @@ void menu_input_groups::handle(event const *ev)
|
||||
int(uintptr_t(ev->itemref) - 1),
|
||||
util::string_format(_("Input Assignments (%1$s)"), ev->item->text()));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -377,10 +378,11 @@ void menu_input::custom_render(void *selectedref, float top, float bottom, float
|
||||
}
|
||||
}
|
||||
|
||||
void menu_input::handle(event const *ev)
|
||||
bool menu_input::handle(event const *ev)
|
||||
{
|
||||
input_item_data *seqchangeditem = nullptr;
|
||||
bool invalidate = false;
|
||||
bool redraw = false;
|
||||
|
||||
// process the menu
|
||||
if (pollingitem)
|
||||
@ -421,6 +423,11 @@ void menu_input::handle(event const *ev)
|
||||
seq_poll.reset();
|
||||
machine().ui_input().reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
// always redraw to ensure it updates as soon as possible in response to changes
|
||||
redraw = true;
|
||||
}
|
||||
}
|
||||
else if (ev && ev->itemref)
|
||||
{
|
||||
@ -516,6 +523,7 @@ void menu_input::handle(event const *ev)
|
||||
}
|
||||
record_next = false;
|
||||
lastitem = &item;
|
||||
redraw = true;
|
||||
}
|
||||
|
||||
// flip between set and append
|
||||
@ -531,6 +539,7 @@ void menu_input::handle(event const *ev)
|
||||
{
|
||||
record_next = !record_next;
|
||||
}
|
||||
redraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -546,6 +555,8 @@ void menu_input::handle(event const *ev)
|
||||
// if the menu is invalidated, clear it now
|
||||
if (invalidate)
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
|
||||
return redraw && !invalidate;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ private:
|
||||
osd_ticks_t modified_ticks;
|
||||
input_seq starting_seq;
|
||||
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
virtual void update_input(input_item_data &seqchangeditem) = 0;
|
||||
};
|
||||
|
||||
|
@ -111,7 +111,7 @@ void menu_input_options::populate()
|
||||
}
|
||||
|
||||
|
||||
void menu_input_options::handle(event const *ev)
|
||||
bool menu_input_options::handle(event const *ev)
|
||||
{
|
||||
if (ev && (IPT_UI_SELECT == ev->iptkey))
|
||||
{
|
||||
@ -137,6 +137,8 @@ void menu_input_options::handle(event const *ev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -29,7 +29,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -110,10 +110,11 @@ void menu_input_toggles::populate()
|
||||
}
|
||||
|
||||
|
||||
void menu_input_toggles::handle(event const *ev)
|
||||
{
|
||||
if (ev && ev->itemref)
|
||||
bool menu_input_toggles::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
auto const ref = reinterpret_cast<std::reference_wrapper<ioport_field> *>(ev->itemref);
|
||||
ioport_field &field = ref->get();
|
||||
bool invalidate = false;
|
||||
@ -176,7 +177,7 @@ void menu_input_toggles::handle(event const *ev)
|
||||
{
|
||||
set_selection(candidate);
|
||||
set_top_line(selected_index() - 1);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
else if (m_fields[current].get().enabled())
|
||||
{
|
||||
@ -186,7 +187,7 @@ void menu_input_toggles::handle(event const *ev)
|
||||
{
|
||||
set_selection(candidate);
|
||||
set_top_line(selected_index() - 1);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +203,7 @@ void menu_input_toggles::handle(event const *ev)
|
||||
{
|
||||
set_selection(&m_fields[current]);
|
||||
set_top_line(selected_index() - 1);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,7 +213,8 @@ void menu_input_toggles::handle(event const *ev)
|
||||
// changing value can enable or disable other fields
|
||||
if (invalidate)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::vector<std::reference_wrapper<ioport_field> > m_fields;
|
||||
};
|
||||
|
@ -71,10 +71,11 @@ menu_keyboard_mode::~menu_keyboard_mode()
|
||||
{
|
||||
}
|
||||
|
||||
void menu_keyboard_mode::handle(event const *ev)
|
||||
{
|
||||
if (ev && uintptr_t(ev->itemref))
|
||||
bool menu_keyboard_mode::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !uintptr_t(ev->itemref))
|
||||
return false;
|
||||
|
||||
natural_keyboard &natkbd(machine().natkeyboard());
|
||||
uintptr_t const ref(uintptr_t(ev->itemref));
|
||||
bool left(IPT_UI_LEFT == ev->iptkey);
|
||||
@ -91,6 +92,7 @@ void menu_keyboard_mode::handle(event const *ev)
|
||||
natkbd.set_in_use(right);
|
||||
ev->item->set_subtext(right ? _("menu-keyboard", "Natural") : _("menu-keyboard", "Emulated"));
|
||||
ev->item->set_flags(right ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (ITEM_KBDEV_FIRST <= ref)
|
||||
@ -109,9 +111,11 @@ void menu_keyboard_mode::handle(event const *ev)
|
||||
natkbd.disable_keyboard(kbdno);
|
||||
ev->item->set_subtext(right ? _("Enabled") : _("Disabled"));
|
||||
ev->item->set_flags(right ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -28,7 +28,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -206,7 +206,7 @@ void menu_main::populate()
|
||||
handle - handle main menu events
|
||||
-------------------------------------------------*/
|
||||
|
||||
void menu_main::handle(event const *ev)
|
||||
bool menu_main::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT))
|
||||
@ -321,12 +321,14 @@ void menu_main::handle(event const *ev)
|
||||
|
||||
case DISMISS:
|
||||
stack_pop();
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
fatalerror("ui::menu_main::handle - unknown reference\n");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -29,7 +29,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
machine_phase m_phase;
|
||||
};
|
||||
|
@ -195,8 +195,7 @@ uint32_t menu::global_state::ui_handler(render_container &container)
|
||||
|
||||
// update the menu state
|
||||
m_hide = false;
|
||||
if (m_stack)
|
||||
m_stack->do_handle();
|
||||
bool need_update = m_stack && m_stack->do_handle();
|
||||
|
||||
// clear up anything pending being released
|
||||
clear_free_list();
|
||||
@ -216,10 +215,10 @@ uint32_t menu::global_state::ui_handler(render_container &container)
|
||||
m_stack->menu_deactivated();
|
||||
}
|
||||
}
|
||||
return UI_HANDLER_CANCEL;
|
||||
return mame_ui_manager::HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return need_update ? mame_ui_manager::HANDLER_UPDATE : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -392,7 +391,7 @@ void menu::set_custom_space(float top, float bottom)
|
||||
// and returning any interesting events
|
||||
//-------------------------------------------------
|
||||
|
||||
const menu::event *menu::process()
|
||||
std::pair<const menu::event *, bool> menu::process()
|
||||
{
|
||||
// reset the event
|
||||
m_event.iptkey = IPT_INVALID;
|
||||
@ -414,6 +413,8 @@ const menu::event *menu::process()
|
||||
container().add_rect(0.0F, 0.0F, 1.0F, 1.0F, rgb_t(114, 0, 0, 0), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
// draw the menu proper
|
||||
// FIXME: this should happen after processing events to fix the egregious latency
|
||||
// The main thing preventing this is that mouse handling is mixed up with drawing
|
||||
draw(m_process_flags);
|
||||
|
||||
// process input
|
||||
@ -432,11 +433,11 @@ const menu::event *menu::process()
|
||||
{
|
||||
m_event.itemref = get_selection_ref();
|
||||
m_event.item = &m_items[m_selected];
|
||||
return &m_event;
|
||||
return std::make_pair(&m_event, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
return std::make_pair(nullptr, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1250,8 +1251,10 @@ void menu::validate_selection(int scandir)
|
||||
MENU STACK MANAGEMENT
|
||||
***************************************************************************/
|
||||
|
||||
void menu::do_handle()
|
||||
bool menu::do_handle()
|
||||
{
|
||||
bool need_update = false;
|
||||
|
||||
// let OSD do its thing
|
||||
machine().osd().check_osd_inputs();
|
||||
|
||||
@ -1265,6 +1268,7 @@ void menu::do_handle()
|
||||
m_last_size = uisize;
|
||||
m_last_aspect = aspect;
|
||||
recompute_metrics(uisize.first, uisize.second, aspect);
|
||||
need_update = true;
|
||||
}
|
||||
|
||||
if (m_items.empty())
|
||||
@ -1278,6 +1282,7 @@ void menu::do_handle()
|
||||
|
||||
// let implementation add other items
|
||||
populate();
|
||||
need_update = true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -1287,7 +1292,11 @@ void menu::do_handle()
|
||||
}
|
||||
m_rebuilding = false;
|
||||
}
|
||||
handle(process());
|
||||
|
||||
auto [eventptr, changed] = process();
|
||||
need_update = need_update || changed;
|
||||
need_update = handle(eventptr) || need_update;
|
||||
return need_update;
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
// Used by sliders
|
||||
void validate_selection(int scandir);
|
||||
|
||||
void do_handle();
|
||||
bool do_handle();
|
||||
|
||||
protected:
|
||||
using bitmap_ptr = widgets_manager::bitmap_ptr;
|
||||
@ -418,7 +418,7 @@ private:
|
||||
};
|
||||
|
||||
// process a menu, drawing it and returning any interesting events
|
||||
const event *process();
|
||||
std::pair<const event *, bool> process();
|
||||
virtual void draw(uint32_t flags);
|
||||
|
||||
// request the specific handling of the game selection main menu
|
||||
@ -428,7 +428,7 @@ private:
|
||||
virtual void populate() = 0;
|
||||
|
||||
// to be implemented in derived classes
|
||||
virtual void handle(event const *ev) = 0;
|
||||
virtual bool handle(event const *ev) = 0;
|
||||
|
||||
void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, std::string_view text, int direction);
|
||||
|
||||
|
@ -90,27 +90,31 @@ menu_bios_selection::~menu_bios_selection()
|
||||
menu_bios_selection - menu that
|
||||
-------------------------------------------------*/
|
||||
|
||||
void menu_bios_selection::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
bool menu_bios_selection::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
if ((uintptr_t)ev->itemref == 1 && ev->iptkey == IPT_UI_SELECT)
|
||||
machine().schedule_hard_reset();
|
||||
else
|
||||
{
|
||||
device_t *dev = (device_t *)ev->itemref;
|
||||
machine().schedule_hard_reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
device_t *const dev = (device_t *)ev->itemref;
|
||||
int bios_val = 0;
|
||||
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
// reset to default
|
||||
case IPT_UI_SELECT:
|
||||
case IPT_UI_CLEAR:
|
||||
bios_val = dev->default_bios();
|
||||
break;
|
||||
|
||||
// previous/next bios setting
|
||||
case IPT_UI_LEFT: case IPT_UI_RIGHT:
|
||||
// previous/next BIOS setting
|
||||
case IPT_UI_SELECT:
|
||||
case IPT_UI_LEFT:
|
||||
case IPT_UI_RIGHT:
|
||||
{
|
||||
int const cnt = ([bioses = romload::entries(dev->rom_region()).get_system_bioses()] () { return std::distance(bioses.begin(), bioses.end()); })();
|
||||
bios_val = dev->system_bios() + ((ev->iptkey == IPT_UI_LEFT) ? -1 : +1);
|
||||
@ -120,9 +124,8 @@ void menu_bios_selection::handle(event const *ev)
|
||||
bios_val = cnt;
|
||||
if (bios_val > cnt)
|
||||
bios_val = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -131,16 +134,20 @@ void menu_bios_selection::handle(event const *ev)
|
||||
if (bios_val > 0)
|
||||
{
|
||||
dev->set_system_bios(bios_val);
|
||||
if (strcmp(dev->tag(),":")==0) {
|
||||
if (!strcmp(dev->tag(), ":"))
|
||||
{
|
||||
machine().options().set_value("bios", bios_val - 1, OPTION_PRIORITY_CMDLINE);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *slot_option_name = dev->owner()->tag() + 1;
|
||||
machine().options().slot_option(slot_option_name).set_bios(string_format("%d", bios_val - 1));
|
||||
}
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// triggers an item reset for any change
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -168,13 +175,14 @@ void menu_network_devices::populate()
|
||||
const char *title = nullptr;
|
||||
for (auto &entry : get_netdev_list())
|
||||
{
|
||||
if(entry->id==curr) {
|
||||
if (entry->id == curr)
|
||||
{
|
||||
title = entry->description;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
item_append(network.device().tag(), (title) ? title : "------", FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)&network);
|
||||
item_append(network.device().tag(), title ? title : "------", FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)&network);
|
||||
}
|
||||
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
@ -184,14 +192,15 @@ void menu_network_devices::populate()
|
||||
menu_network_devices - menu that
|
||||
-------------------------------------------------*/
|
||||
|
||||
void menu_network_devices::handle(event const *ev)
|
||||
bool menu_network_devices::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
if (!ev || !ev->itemref)
|
||||
{
|
||||
if (ev->iptkey == IPT_UI_LEFT || ev->iptkey == IPT_UI_RIGHT)
|
||||
return false;
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_LEFT || ev->iptkey == IPT_UI_RIGHT)
|
||||
{
|
||||
device_network_interface *network = (device_network_interface *)ev->itemref;
|
||||
device_network_interface *const network = (device_network_interface *)ev->itemref;
|
||||
int curr = network->get_interface();
|
||||
if (ev->iptkey == IPT_UI_LEFT)
|
||||
curr--;
|
||||
@ -200,9 +209,25 @@ void menu_network_devices::handle(event const *ev)
|
||||
if (curr == -2)
|
||||
curr = netdev_count() - 1;
|
||||
network->set_interface(curr);
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
|
||||
curr = network->get_interface();
|
||||
const char *title = nullptr;
|
||||
for (auto &entry : get_netdev_list())
|
||||
{
|
||||
if (entry->id == curr)
|
||||
{
|
||||
title = entry->description;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ev->item->set_subtext(title ? title : "------");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -272,16 +297,20 @@ void menu_bookkeeping::populate()
|
||||
{
|
||||
}
|
||||
|
||||
void menu_bookkeeping::handle(event const *ev)
|
||||
bool menu_bookkeeping::handle(event const *ev)
|
||||
{
|
||||
// if the time has rolled over another second, regenerate
|
||||
// TODO: what about other bookkeeping events happening with the menu open?
|
||||
attotime const curtime = machine().time();
|
||||
if (curtime.seconds() != prevtime.seconds())
|
||||
{
|
||||
reset_layout();
|
||||
|
||||
if (ev)
|
||||
handle_key(ev->iptkey);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ev && handle_key(ev->iptkey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -290,7 +319,7 @@ void menu_bookkeeping::handle(event const *ev)
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void menu_crosshair::handle(event const *ev)
|
||||
bool menu_crosshair::handle(event const *ev)
|
||||
{
|
||||
// handle events
|
||||
if (ev && ev->itemref)
|
||||
@ -383,6 +412,9 @@ void menu_crosshair::handle(event const *ev)
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF); // rebuild the menu
|
||||
}
|
||||
|
||||
// triggers an item reset for any changes
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -601,7 +633,7 @@ menu_export::~menu_export()
|
||||
// handle the export menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_export::handle(event const *ev)
|
||||
bool menu_export::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
@ -695,6 +727,8 @@ void menu_export::handle(event const *ev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -752,7 +786,7 @@ menu_machine_configure::~menu_machine_configure()
|
||||
// handle the machine options menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_machine_configure::handle(event const *ev)
|
||||
bool menu_machine_configure::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
@ -805,6 +839,9 @@ void menu_machine_configure::handle(event const *ev)
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
// triggers an item reset for any changes
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -905,25 +942,25 @@ menu_plugins_configure::~menu_plugins_configure()
|
||||
// handle the plugins menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_plugins_configure::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
bool changed = false;
|
||||
plugin_options &plugins = mame_machine_manager::instance()->plugins();
|
||||
if (ev && ev->itemref)
|
||||
bool menu_plugins_configure::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
if (ev->iptkey == IPT_UI_LEFT || ev->iptkey == IPT_UI_RIGHT || ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
plugin_options &plugins = mame_machine_manager::instance()->plugins();
|
||||
plugin_options::plugin *p = plugins.find((const char*)ev->itemref);
|
||||
if (p)
|
||||
{
|
||||
p->m_start = !p->m_start;
|
||||
changed = true;
|
||||
ev->item->set_subtext(p->m_start ? _("On") : _("Off"));
|
||||
ev->item->set_flags(p->m_start ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
class menu_bookkeeping : public menu_textbox
|
||||
@ -49,7 +49,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
attotime prevtime;
|
||||
};
|
||||
@ -82,7 +82,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::vector<crosshair_item_data> m_data;
|
||||
std::vector<std::string> m_pics;
|
||||
@ -97,7 +97,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::vector<const game_driver*> m_list;
|
||||
};
|
||||
@ -149,7 +149,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void setup_bios();
|
||||
|
||||
@ -175,7 +175,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -60,11 +60,9 @@ menu_simple_game_options::~menu_simple_game_options()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_simple_game_options::handle(event const *ev)
|
||||
bool menu_simple_game_options::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
handle_item_event(*ev);
|
||||
return ev && ev->itemref && handle_item_event(*ev);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -91,7 +89,7 @@ void menu_simple_game_options::populate()
|
||||
// handle item
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_simple_game_options::handle_item_event(event const &menu_event)
|
||||
bool menu_simple_game_options::handle_item_event(event const &menu_event)
|
||||
{
|
||||
if (IPT_UI_SELECT == menu_event.iptkey)
|
||||
{
|
||||
@ -130,6 +128,7 @@ void menu_simple_game_options::handle_item_event(event const &menu_event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -161,11 +160,9 @@ menu_game_options::~menu_game_options()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_game_options::handle(event const *ev)
|
||||
bool menu_game_options::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref)
|
||||
handle_item_event(*ev);
|
||||
return ev && ev->itemref && handle_item_event(*ev);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -203,7 +200,7 @@ void menu_game_options::populate()
|
||||
// handle item
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_game_options::handle_item_event(event const &menu_event)
|
||||
bool menu_game_options::handle_item_event(event const &menu_event)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@ -268,12 +265,14 @@ void menu_game_options::handle_item_event(event const &menu_event)
|
||||
menu::stack_push<menu_custom_ui>(ui(), container(), [this] () { reset(reset_options::REMEMBER_REF); });
|
||||
break;
|
||||
default:
|
||||
menu_simple_game_options::handle_item_event(menu_event);
|
||||
return;
|
||||
return menu_simple_game_options::handle_item_event(menu_event);
|
||||
}
|
||||
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
|
||||
// triggers an item reset for any changes
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -28,10 +28,10 @@ public:
|
||||
virtual ~menu_simple_game_options() override;
|
||||
|
||||
protected:
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
virtual void populate() override;
|
||||
|
||||
void handle_item_event(event const &menu_event);
|
||||
bool handle_item_event(event const &menu_event);
|
||||
|
||||
private:
|
||||
enum
|
||||
@ -62,10 +62,10 @@ public:
|
||||
virtual ~menu_game_options() override;
|
||||
|
||||
protected:
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
virtual void populate() override;
|
||||
|
||||
void handle_item_event(event const &menu_event);
|
||||
bool handle_item_event(event const &menu_event);
|
||||
|
||||
private:
|
||||
enum
|
||||
|
@ -19,13 +19,14 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
void menu_plugin::handle(event const *ev)
|
||||
bool menu_plugin::handle(event const *ev)
|
||||
{
|
||||
if (ev && ev->itemref)
|
||||
{
|
||||
if (ev->iptkey == IPT_UI_SELECT)
|
||||
menu::stack_push<menu_plugin_opt>(ui(), container(), (char *)ev->itemref);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_plugin::menu_plugin(mame_ui_manager &mui, render_container &container) :
|
||||
@ -68,7 +69,7 @@ menu_plugin_opt::menu_plugin_opt(mame_ui_manager &mui, render_container &contain
|
||||
{
|
||||
}
|
||||
|
||||
void menu_plugin_opt::handle(event const *ev)
|
||||
bool menu_plugin_opt::handle(event const *ev)
|
||||
{
|
||||
void *const itemref = ev ? ev->itemref : get_selection_ref();
|
||||
std::string key;
|
||||
@ -116,8 +117,10 @@ void menu_plugin_opt::handle(event const *ev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!key.empty() || m_need_idle)
|
||||
{
|
||||
|
||||
if (key.empty() && !m_need_idle)
|
||||
return false;
|
||||
|
||||
auto const result = mame_machine_manager::instance()->lua()->menu_callback(m_menu, uintptr_t(itemref), key);
|
||||
if (result.second)
|
||||
set_selection(reinterpret_cast<void *>(uintptr_t(*result.second)));
|
||||
@ -125,7 +128,8 @@ void menu_plugin_opt::handle(event const *ev)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
else if (ev && (ev->iptkey == IPT_UI_BACK))
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return result.second && !result.first;
|
||||
}
|
||||
|
||||
void menu_plugin_opt::populate()
|
||||
|
@ -33,11 +33,12 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::vector<std::string> &m_plugins;
|
||||
};
|
||||
|
||||
|
||||
class menu_plugin_opt : public menu
|
||||
{
|
||||
public:
|
||||
@ -49,7 +50,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::string const m_menu;
|
||||
bool m_need_idle;
|
||||
|
@ -20,7 +20,8 @@ menu_confirm_quit::menu_confirm_quit(mame_ui_manager &mui, render_container &con
|
||||
: autopause_menu<>(mui, container)
|
||||
{
|
||||
set_one_shot(true);
|
||||
set_process_flags(PROCESS_CUSTOM_ONLY | PROCESS_NOINPUT);
|
||||
set_needs_prev_menu_item(false);
|
||||
set_heading(_("menu-quit", "Are you sure you want to quit?"));
|
||||
}
|
||||
|
||||
|
||||
@ -29,33 +30,24 @@ menu_confirm_quit::~menu_confirm_quit()
|
||||
}
|
||||
|
||||
|
||||
void menu_confirm_quit::custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2)
|
||||
{
|
||||
ui().draw_text_box(
|
||||
container(),
|
||||
util::string_format(
|
||||
_("Are you sure you want to quit?\n\n"
|
||||
"Press %1$s to quit\n"
|
||||
"Press %2$s to return to emulation"),
|
||||
ui().get_general_input_setting(IPT_UI_SELECT),
|
||||
ui().get_general_input_setting(IPT_UI_BACK)),
|
||||
text_layout::text_justify::CENTER,
|
||||
0.5f, 0.5f,
|
||||
UI_RED_COLOR);
|
||||
}
|
||||
|
||||
|
||||
void menu_confirm_quit::populate()
|
||||
{
|
||||
item_append(_("menu-quit", "Quit"), 0, nullptr);
|
||||
item_append(_("menu-quit", "Return to emulation"), 0, nullptr);
|
||||
}
|
||||
|
||||
|
||||
void menu_confirm_quit::handle(event const *ev)
|
||||
bool menu_confirm_quit::handle(event const *ev)
|
||||
{
|
||||
if (machine().ui_input().pressed(IPT_UI_SELECT))
|
||||
if (ev && (IPT_UI_SELECT == ev->iptkey))
|
||||
{
|
||||
if (0 == selected_index())
|
||||
machine().schedule_exit();
|
||||
else if (machine().ui_input().pressed(IPT_UI_BACK))
|
||||
else
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -23,12 +23,9 @@ public:
|
||||
menu_confirm_quit(mame_ui_manager &mui, render_container &container);
|
||||
virtual ~menu_confirm_quit();
|
||||
|
||||
protected:
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -49,11 +49,11 @@ menu_selector::~menu_selector()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_selector::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev)
|
||||
bool menu_selector::handle(event const *ev)
|
||||
{
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
case IPT_UI_SELECT:
|
||||
@ -88,7 +88,8 @@ void menu_selector::handle(event const *ev)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false; // any changes will trigger an item reset
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -46,7 +46,7 @@ private:
|
||||
enum { VISIBLE_SEARCH_ITEMS = 200 };
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void find_matches(const char *str);
|
||||
|
||||
|
@ -194,7 +194,7 @@ void menu_select_game::menu_deactivated()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_game::handle(event const *ev)
|
||||
bool menu_select_game::handle(event const *ev)
|
||||
{
|
||||
if (!m_prev_selected && item_count() > 0)
|
||||
m_prev_selected = item(0).ref();
|
||||
@ -207,38 +207,52 @@ void menu_select_game::handle(event const *ev)
|
||||
const ui_software_info *software;
|
||||
get_selection(software, system);
|
||||
menu::stack_push<menu_select_software>(ui(), container(), *system);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME: everything above here used to run before events were processed
|
||||
|
||||
// process the menu
|
||||
bool changed = false;
|
||||
if (ev)
|
||||
{
|
||||
if (dismiss_error())
|
||||
{
|
||||
// reset the error on any subsequent menu event
|
||||
changed = true;
|
||||
}
|
||||
else switch (ev->iptkey)
|
||||
{
|
||||
case IPT_UI_UP:
|
||||
if ((get_focus() == focused_menu::LEFT) && (machine_filter::FIRST < m_filter_highlight))
|
||||
{
|
||||
--m_filter_highlight;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_DOWN:
|
||||
if ((get_focus() == focused_menu::LEFT) && (machine_filter::LAST > m_filter_highlight))
|
||||
{
|
||||
m_filter_highlight++;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_HOME:
|
||||
if (get_focus() == focused_menu::LEFT)
|
||||
{
|
||||
m_filter_highlight = machine_filter::FIRST;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_END:
|
||||
if (get_focus() == focused_menu::LEFT)
|
||||
{
|
||||
m_filter_highlight = machine_filter::LAST;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_EXPORT:
|
||||
@ -258,9 +272,9 @@ void menu_select_game::handle(event const *ev)
|
||||
if (get_focus() == focused_menu::MAIN)
|
||||
{
|
||||
if (m_populated_favorites)
|
||||
inkey_select_favorite(ev);
|
||||
changed = inkey_select_favorite(ev);
|
||||
else
|
||||
inkey_select(ev);
|
||||
changed = inkey_select(ev);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -292,16 +306,16 @@ void menu_select_game::handle(event const *ev)
|
||||
|
||||
case IPT_UI_LEFT:
|
||||
if (right_panel() == RP_IMAGES)
|
||||
previous_image_view(); // Images
|
||||
changed = previous_image_view(); // Images
|
||||
else if (right_panel() == RP_INFOS)
|
||||
change_info_pane(-1); // Infos
|
||||
changed = change_info_pane(-1); // Infos
|
||||
break;
|
||||
|
||||
case IPT_UI_RIGHT:
|
||||
if (right_panel() == RP_IMAGES)
|
||||
next_image_view(); // Images
|
||||
changed = next_image_view(); // Images
|
||||
else if (right_panel() == RP_INFOS)
|
||||
change_info_pane(1); // Infos
|
||||
changed = change_info_pane(1); // Infos
|
||||
break;
|
||||
|
||||
case IPT_UI_FAVORITES:
|
||||
@ -322,6 +336,7 @@ void menu_select_game::handle(event const *ev)
|
||||
mfav.remove_favorite_system(driver);
|
||||
machine().popmessage(_("%s\n removed from favorites list."), info.description);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -343,6 +358,7 @@ void menu_select_game::handle(event const *ev)
|
||||
|
||||
// if we're in an error state, overlay an error message
|
||||
draw_error_text();
|
||||
return changed;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -606,7 +622,7 @@ void menu_select_game::force_game_select(mame_ui_manager &mui, render_container
|
||||
// handle select key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_game::inkey_select(const event *menu_event)
|
||||
bool menu_select_game::inkey_select(const event *menu_event)
|
||||
{
|
||||
auto const system = reinterpret_cast<ui_system_info const *>(menu_event->itemref);
|
||||
|
||||
@ -618,13 +634,14 @@ void menu_select_game::inkey_select(const event *menu_event)
|
||||
container(),
|
||||
m_persistent_data.filter_data(),
|
||||
[this] () { reset(reset_options::SELECT_FIRST); });
|
||||
return false;
|
||||
}
|
||||
else if (uintptr_t(system) == CONF_MACHINE)
|
||||
{
|
||||
// special case for configure machine
|
||||
if (m_prev_selected)
|
||||
menu::stack_push<menu_machine_configure>(ui(), container(), *reinterpret_cast<const ui_system_info *>(m_prev_selected));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -638,7 +655,7 @@ void menu_select_game::inkey_select(const event *menu_event)
|
||||
if (!swlistdev.get_info().empty())
|
||||
{
|
||||
menu::stack_push<menu_select_software>(ui(), container(), *system);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,11 +668,13 @@ void menu_select_game::inkey_select(const event *menu_event)
|
||||
{
|
||||
if (!select_bios(*system->driver, false))
|
||||
launch_system(*system->driver);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
set_error(reset_options::REMEMBER_REF, make_system_audit_fail_text(auditor, summary));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -664,7 +683,7 @@ void menu_select_game::inkey_select(const event *menu_event)
|
||||
// handle select key event for favorites menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
bool menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
{
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref;
|
||||
|
||||
@ -676,6 +695,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
container(),
|
||||
m_persistent_data.filter_data(),
|
||||
[this] () { reset(reset_options::SELECT_FIRST); });
|
||||
return false;
|
||||
}
|
||||
else if ((uintptr_t)ui_swinfo == CONF_MACHINE)
|
||||
{
|
||||
@ -694,7 +714,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
reset(empty ? reset_options::SELECT_FIRST : reset_options::REMEMBER_REF);
|
||||
});
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
else if (ui_swinfo->startempty)
|
||||
{
|
||||
@ -708,7 +728,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
{
|
||||
ui_system_info const &system(m_persistent_data.systems()[driver_list::find(ui_swinfo->driver->name)]);
|
||||
menu::stack_push<menu_select_software>(ui(), container(), system);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -724,11 +744,13 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
reselect_last::reselect(true);
|
||||
launch_system(*ui_swinfo->driver);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
set_error(reset_options::REMEMBER_REF, make_system_audit_fail_text(auditor, summary));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -741,6 +763,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
if (!audit_passed(sysaudit))
|
||||
{
|
||||
set_error(reset_options::REMEMBER_REF, make_system_audit_fail_text(auditor, sysaudit));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -755,11 +778,13 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
|
||||
reselect_last::reselect(true);
|
||||
if (!select_bios(*ui_swinfo, false) && !select_part(*swinfo, *ui_swinfo))
|
||||
launch_system(drv.driver(), *ui_swinfo, ui_swinfo->part);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
set_error(reset_options::REMEMBER_REF, make_software_audit_fail_text(auditor, swaudit));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -779,9 +804,10 @@ bool menu_select_game::isfavorite() const
|
||||
// change what's displayed in the info box
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_game::change_info_pane(int delta)
|
||||
bool menu_select_game::change_info_pane(int delta)
|
||||
{
|
||||
auto const cap_delta = [this, &delta] (uint8_t ¤t, uint8_t &total)
|
||||
auto const cap_delta =
|
||||
[this, &delta] (uint8_t ¤t, uint8_t &total) -> bool
|
||||
{
|
||||
if ((0 > delta) && (-delta > current))
|
||||
delta = -int(unsigned(current));
|
||||
@ -791,6 +817,11 @@ void menu_select_game::change_info_pane(int delta)
|
||||
{
|
||||
current += delta;
|
||||
m_topline_datsview = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
ui_system_info const *sys;
|
||||
@ -799,14 +830,20 @@ void menu_select_game::change_info_pane(int delta)
|
||||
if (!m_populated_favorites)
|
||||
{
|
||||
if (uintptr_t(sys) > m_skip_main_items)
|
||||
cap_delta(ui_globals::curdats_view, ui_globals::curdats_total);
|
||||
return cap_delta(ui_globals::curdats_view, ui_globals::curdats_total);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (uintptr_t(soft) > m_skip_main_items)
|
||||
{
|
||||
if (soft->startempty)
|
||||
cap_delta(ui_globals::curdats_view, ui_globals::curdats_total);
|
||||
return cap_delta(ui_globals::curdats_view, ui_globals::curdats_total);
|
||||
else
|
||||
cap_delta(ui_globals::cur_sw_dats_view, ui_globals::cur_sw_dats_total);
|
||||
return cap_delta(ui_globals::cur_sw_dats_view, ui_globals::cur_sw_dats_total);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ private:
|
||||
static bool s_first_start;
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// drawing
|
||||
virtual float draw_left_panel(float x1, float y1, float x2, float y2) override;
|
||||
@ -80,7 +80,7 @@ private:
|
||||
virtual void inkey_export() override;
|
||||
|
||||
// internal methods
|
||||
void change_info_pane(int delta);
|
||||
bool change_info_pane(int delta);
|
||||
|
||||
void build_available_list();
|
||||
|
||||
@ -90,8 +90,8 @@ private:
|
||||
void load_custom_filters();
|
||||
|
||||
// handlers
|
||||
void inkey_select(const event *menu_event);
|
||||
void inkey_select_favorite(const event *menu_event);
|
||||
bool inkey_select(const event *menu_event);
|
||||
bool inkey_select_favorite(const event *menu_event);
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -173,7 +173,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
ui_software_info const &m_uiinfo;
|
||||
s_parts const m_parts;
|
||||
@ -190,7 +190,7 @@ private:
|
||||
bios_selection(mame_ui_manager &mui, render_container &container, s_bios &&biosname, void const *driver, bool software, bool inlist);
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
void const *m_driver;
|
||||
bool m_software, m_inlist;
|
||||
@ -297,9 +297,8 @@ void menu_select_launch::software_parts::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_launch::software_parts::handle(event const *ev)
|
||||
bool menu_select_launch::software_parts::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT) && ev->itemref)
|
||||
{
|
||||
for (auto const &elem : m_parts)
|
||||
@ -311,6 +310,8 @@ void menu_select_launch::software_parts::handle(event const *ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -362,9 +363,8 @@ void menu_select_launch::bios_selection::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_launch::bios_selection::handle(event const *ev)
|
||||
bool menu_select_launch::bios_selection::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT) && ev->itemref)
|
||||
{
|
||||
for (auto & elem : m_bios)
|
||||
@ -402,6 +402,8 @@ void menu_select_launch::bios_selection::handle(event const *ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -526,22 +528,32 @@ menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &c
|
||||
}
|
||||
|
||||
|
||||
void menu_select_launch::next_image_view()
|
||||
bool menu_select_launch::next_image_view()
|
||||
{
|
||||
if (LAST_VIEW > m_image_view)
|
||||
{
|
||||
++m_image_view;
|
||||
set_switch_image();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void menu_select_launch::previous_image_view()
|
||||
bool menu_select_launch::previous_image_view()
|
||||
{
|
||||
if (FIRST_VIEW < m_image_view)
|
||||
{
|
||||
--m_image_view;
|
||||
set_switch_image();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,8 +114,8 @@ protected:
|
||||
|
||||
focused_menu get_focus() const { return m_focus; }
|
||||
void set_focus(focused_menu focus) { m_focus = focus; }
|
||||
void next_image_view();
|
||||
void previous_image_view();
|
||||
bool next_image_view();
|
||||
bool previous_image_view();
|
||||
|
||||
bool dismiss_error();
|
||||
void set_error(reset_options ropt, std::string &&message);
|
||||
|
@ -420,7 +420,7 @@ menu_select_software::~menu_select_software()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_software::handle(event const *ev)
|
||||
bool menu_select_software::handle(event const *ev)
|
||||
{
|
||||
if (m_prev_selected == nullptr && item_count() > 0)
|
||||
m_prev_selected = item(0).ref();
|
||||
@ -428,30 +428,33 @@ void menu_select_software::handle(event const *ev)
|
||||
// FIXME: everything above here used run before events were processed
|
||||
|
||||
// process the menu
|
||||
bool changed = false;
|
||||
if (ev)
|
||||
{
|
||||
if (dismiss_error())
|
||||
{
|
||||
// reset the error on any subsequent menu event
|
||||
changed = true;
|
||||
}
|
||||
else switch (ev->iptkey)
|
||||
{
|
||||
case IPT_UI_SELECT:
|
||||
if ((get_focus() == focused_menu::MAIN) && ev->itemref)
|
||||
inkey_select(ev);
|
||||
changed = inkey_select(ev);
|
||||
break;
|
||||
|
||||
case IPT_UI_LEFT:
|
||||
if (right_panel() == RP_IMAGES)
|
||||
{
|
||||
// Images
|
||||
previous_image_view();
|
||||
changed = previous_image_view();
|
||||
}
|
||||
else if (right_panel() == RP_INFOS && ui_globals::cur_sw_dats_view > 0)
|
||||
{
|
||||
// Infos
|
||||
ui_globals::cur_sw_dats_view--;
|
||||
m_topline_datsview = 0;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -459,34 +462,47 @@ void menu_select_software::handle(event const *ev)
|
||||
if (right_panel() == RP_IMAGES)
|
||||
{
|
||||
// Images
|
||||
next_image_view();
|
||||
changed = next_image_view();
|
||||
}
|
||||
else if (right_panel() == RP_INFOS && ui_globals::cur_sw_dats_view < (ui_globals::cur_sw_dats_total - 1))
|
||||
{
|
||||
// Infos
|
||||
ui_globals::cur_sw_dats_view++;
|
||||
m_topline_datsview = 0;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_UP:
|
||||
if ((get_focus() == focused_menu::LEFT) && (software_filter::FIRST < m_filter_highlight))
|
||||
{
|
||||
--m_filter_highlight;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_DOWN:
|
||||
if ((get_focus() == focused_menu::LEFT) && (software_filter::LAST > m_filter_highlight))
|
||||
{
|
||||
++m_filter_highlight;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_HOME:
|
||||
if (get_focus() == focused_menu::LEFT)
|
||||
{
|
||||
m_filter_highlight = software_filter::FIRST;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_END:
|
||||
if (get_focus() == focused_menu::LEFT)
|
||||
{
|
||||
m_filter_highlight = software_filter::LAST;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPT_UI_DATS:
|
||||
@ -509,12 +525,12 @@ void menu_select_software::handle(event const *ev)
|
||||
mfav.add_favorite_software(*swinfo);
|
||||
machine().popmessage(_("%s\n added to favorites list."), swinfo->longname);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname);
|
||||
mfav.remove_favorite_software(*swinfo);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -523,6 +539,7 @@ void menu_select_software::handle(event const *ev)
|
||||
|
||||
// if we're in an error state, overlay an error message
|
||||
draw_error_text();
|
||||
return changed;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -633,7 +650,7 @@ void menu_select_software::populate()
|
||||
// handle select key event
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_select_software::inkey_select(const event *menu_event)
|
||||
bool menu_select_software::inkey_select(const event *menu_event)
|
||||
{
|
||||
ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref;
|
||||
driver_enumerator drivlist(machine().options(), *ui_swinfo->driver);
|
||||
@ -645,6 +662,7 @@ void menu_select_software::inkey_select(const event *menu_event)
|
||||
if (!audit_passed(sysaudit))
|
||||
{
|
||||
set_error(reset_options::REMEMBER_REF, make_system_audit_fail_text(auditor, sysaudit));
|
||||
return true;
|
||||
}
|
||||
else if (ui_swinfo->startempty == 1)
|
||||
{
|
||||
@ -653,6 +671,7 @@ void menu_select_software::inkey_select(const event *menu_event)
|
||||
reselect_last::reselect(true);
|
||||
launch_system(*ui_swinfo->driver, *ui_swinfo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -668,11 +687,13 @@ void menu_select_software::inkey_select(const event *menu_event)
|
||||
reselect_last::reselect(true);
|
||||
launch_system(drivlist.driver(), *ui_swinfo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
set_error(reset_options::REMEMBER_REF, make_software_audit_fail_text(auditor, swaudit));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
class machine_data;
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// drawing
|
||||
virtual float draw_left_panel(float x1, float y1, float x2, float y2) override;
|
||||
@ -65,7 +65,7 @@ private:
|
||||
virtual void inkey_export() override { throw false; }
|
||||
|
||||
// handlers
|
||||
void inkey_select(const event *menu_event);
|
||||
bool inkey_select(const event *menu_event);
|
||||
|
||||
std::map<std::string, std::string> m_icon_paths;
|
||||
ui_system_info const &m_system;
|
||||
|
@ -110,24 +110,25 @@ void simple_menu_select_game::build_driver_list()
|
||||
// handle - handle the game select menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void simple_menu_select_game::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev)
|
||||
bool simple_menu_select_game::handle(event const *ev)
|
||||
{
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
if (m_error)
|
||||
{
|
||||
// reset the error on any subsequent menu event
|
||||
m_error = false;
|
||||
machine().ui_input().reset();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// handle selections
|
||||
bool changed = false;
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
case IPT_UI_SELECT:
|
||||
inkey_select(*ev);
|
||||
changed = inkey_select(*ev);
|
||||
break;
|
||||
case IPT_UI_CANCEL:
|
||||
inkey_cancel();
|
||||
@ -140,8 +141,6 @@ void simple_menu_select_game::handle(event const *ev)
|
||||
inkey_special(*ev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we're in an error state, overlay an error message
|
||||
if (m_error)
|
||||
@ -152,6 +151,7 @@ void simple_menu_select_game::handle(event const *ev)
|
||||
"Please select a different game.\n\nPress any key to continue."),
|
||||
text_layout::text_justify::CENTER, 0.5f, 0.5f, UI_RED_COLOR);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ void simple_menu_select_game::handle(event const *ev)
|
||||
// inkey_select
|
||||
//-------------------------------------------------
|
||||
|
||||
void simple_menu_select_game::inkey_select(const event &menu_event)
|
||||
bool simple_menu_select_game::inkey_select(const event &menu_event)
|
||||
{
|
||||
const game_driver *driver = (const game_driver *)menu_event.itemref;
|
||||
|
||||
@ -169,10 +169,12 @@ void simple_menu_select_game::inkey_select(const event &menu_event)
|
||||
ui(),
|
||||
container(),
|
||||
[this] () { reset(reset_options::SELECT_FIRST); });
|
||||
return false;
|
||||
}
|
||||
else if (!driver) // special case for previous menu
|
||||
{
|
||||
stack_pop();
|
||||
return false;
|
||||
}
|
||||
else // anything else is a driver
|
||||
{
|
||||
@ -188,12 +190,14 @@ void simple_menu_select_game::inkey_select(const event &menu_event)
|
||||
mame_machine_manager::instance()->schedule_new_driver(*driver);
|
||||
machine().schedule_hard_reset();
|
||||
stack_reset();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, display an error
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
m_error = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,11 +37,11 @@ private:
|
||||
enum { VISIBLE_GAMES_IN_LIST = 15 };
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// internal methods
|
||||
void build_driver_list();
|
||||
void inkey_select(const event &menu_event);
|
||||
bool inkey_select(const event &menu_event);
|
||||
void inkey_cancel();
|
||||
void inkey_special(const event &menu_event);
|
||||
|
||||
|
@ -39,28 +39,30 @@ menu_sliders::~menu_sliders()
|
||||
// menu_sliders - handle the sliders menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_sliders::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev)
|
||||
bool menu_sliders::handle(event const *ev)
|
||||
{
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
if (ev->iptkey == IPT_UI_ON_SCREEN_DISPLAY)
|
||||
{
|
||||
// toggle visibility
|
||||
if (m_menuless_mode)
|
||||
{
|
||||
stack_pop();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hidden = !m_hidden;
|
||||
set_process_flags(PROCESS_LR_REPEAT | (m_hidden ? PROCESS_CUSTOM_ONLY : 0));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (ev->itemref && (ev->item->type() == menu_item_type::SLIDER))
|
||||
{
|
||||
// handle keys if there is a valid item selected
|
||||
if (ev->itemref && (ev->item->type() == menu_item_type::SLIDER))
|
||||
{
|
||||
const slider_state *slider = (const slider_state *)ev->itemref;
|
||||
int32_t curvalue = slider->update(nullptr, SLIDER_NOCHANGE);
|
||||
int32_t increment = 0;
|
||||
@ -121,10 +123,14 @@ void menu_sliders::handle(event const *ev)
|
||||
ui().get_session_data<menu_sliders, void *>(nullptr) = ev->itemref;
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
// slider changes trigger an item reset as they can change the available sliders
|
||||
return false;
|
||||
}
|
||||
else if (m_hidden)
|
||||
|
||||
// when highlighting an item that isn't a slider with the menu is hidden, skip to the next one
|
||||
if (m_hidden)
|
||||
{
|
||||
// if we are selecting an invalid item and we are hidden, skip to the next one
|
||||
if (ev->iptkey == IPT_UI_UP || ev->iptkey == IPT_UI_PAGE_UP)
|
||||
{
|
||||
// if we got here via up or page up, select the previous item
|
||||
@ -137,20 +143,30 @@ void menu_sliders::handle(event const *ev)
|
||||
set_selected_index(selected_index() - 1);
|
||||
validate_selection(-1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_DOWN || ev->iptkey == IPT_UI_PAGE_DOWN)
|
||||
{
|
||||
// otherwise select the next item
|
||||
if (is_last_selected())
|
||||
{
|
||||
select_first_item();
|
||||
}
|
||||
else
|
||||
{
|
||||
set_selected_index(selected_index() + 1);
|
||||
validate_selection(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// didn't do anything
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
bool const m_menuless_mode;
|
||||
bool m_hidden;
|
||||
|
@ -242,11 +242,11 @@ void menu_slot_devices::custom_render(void *selectedref, float top, float bottom
|
||||
// handle - process an input event
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_slot_devices::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && ev->itemref != nullptr)
|
||||
bool menu_slot_devices::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
if (ev->itemref == ITEMREF_RESET)
|
||||
{
|
||||
if (ev->iptkey == IPT_UI_SELECT)
|
||||
@ -264,7 +264,8 @@ void menu_slot_devices::handle(event const *ev)
|
||||
if (option)
|
||||
menu::stack_push<menu_device_config>(ui(), container(), slot, option);
|
||||
}
|
||||
}
|
||||
|
||||
return false; // any changes require the menu to be rebuilt
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
device_slot_interface::slot_option const *get_current_option(device_slot_interface &slot) const;
|
||||
void set_slot_device(device_slot_interface &slot, std::string_view val);
|
||||
|
@ -72,7 +72,7 @@ void menu_sound_options::menu_dismissed()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_sound_options::handle(event const *ev)
|
||||
bool menu_sound_options::handle(event const *ev)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@ -130,8 +130,9 @@ void menu_sound_options::handle(event const *ev)
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
if (changed) // FIXME: most changes only require the item sub text to be updated
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
uint16_t m_cur_rates;
|
||||
static const int m_sound_rate[];
|
||||
|
@ -234,13 +234,14 @@ void menu_load_save_state_base::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_load_save_state_base::handle(event const *ev)
|
||||
bool menu_load_save_state_base::handle(event const *ev)
|
||||
{
|
||||
// process the event
|
||||
if (INPUT_CODE_INVALID != m_slot_selected)
|
||||
{
|
||||
if (!machine().input().code_pressed(m_slot_selected))
|
||||
stack_pop();
|
||||
return false;
|
||||
}
|
||||
else if (ev && (ev->iptkey == IPT_UI_SELECT))
|
||||
{
|
||||
@ -251,6 +252,7 @@ void menu_load_save_state_base::handle(event const *ev)
|
||||
slot_selected(std::string(entry.file_name()));
|
||||
}
|
||||
stack_pop();
|
||||
return false;
|
||||
}
|
||||
else if (ev && (ev->iptkey == IPT_UI_CLEAR))
|
||||
{
|
||||
@ -263,6 +265,11 @@ void menu_load_save_state_base::handle(event const *ev)
|
||||
m_confirm_delete->visible_name(),
|
||||
ui().get_general_input_setting(IPT_UI_SELECT),
|
||||
ui().get_general_input_setting(IPT_UI_BACK));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!m_confirm_delete)
|
||||
@ -275,6 +282,11 @@ void menu_load_save_state_base::handle(event const *ev)
|
||||
m_switch_poller.reset();
|
||||
m_slot_selected = code;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ protected:
|
||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
|
||||
virtual void handle_keys(uint32_t flags, int &iptkey) override;
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
virtual void process_file(std::string &&file_name) = 0;
|
||||
|
||||
|
@ -245,7 +245,7 @@ submenu::~submenu()
|
||||
// handle the options menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void submenu::handle(event const *ev)
|
||||
bool submenu::handle(event const *ev)
|
||||
{
|
||||
bool changed = false;
|
||||
std::string error_string, tmptxt;
|
||||
@ -332,8 +332,9 @@ void submenu::handle(event const *ev)
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
if (changed) // FIXME: most changes should only require updating the item's subtext
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -65,7 +65,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::vector<option> m_options;
|
||||
game_driver const *const m_driver;
|
||||
|
@ -124,9 +124,8 @@ void menu_software_parts::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_software_parts::handle(event const *ev)
|
||||
bool menu_software_parts::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT) && ev->itemref)
|
||||
{
|
||||
software_part_menu_entry *entry = (software_part_menu_entry *)ev->itemref;
|
||||
@ -134,6 +133,8 @@ void menu_software_parts::handle(event const *ev)
|
||||
*m_selected_part = entry->part;
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -286,12 +287,13 @@ void menu_software_list::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_software_list::handle(event const *ev)
|
||||
bool menu_software_list::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev)
|
||||
if (!ev)
|
||||
{
|
||||
if (ev->iptkey == IPT_UI_SELECT)
|
||||
return false;
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_SELECT)
|
||||
{
|
||||
if (ev->itemref == ITEMREF_SWITCH_ITEM_ORDERING)
|
||||
{
|
||||
@ -314,16 +316,31 @@ void menu_software_list::handle(event const *ev)
|
||||
m_result = info->short_name;
|
||||
stack_pop();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_PASTE)
|
||||
{
|
||||
if (paste_text(m_search, m_ordered_by_shortname ? is_valid_softlist_part_char : uchar_is_printable))
|
||||
{
|
||||
update_search(ev->itemref);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ev->iptkey == IPT_SPECIAL)
|
||||
{
|
||||
if (input_character(m_search, ev->unichar, m_ordered_by_shortname ? is_valid_softlist_part_char : uchar_is_printable))
|
||||
{
|
||||
update_search(ev->itemref);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ev->iptkey == IPT_UI_CANCEL)
|
||||
{
|
||||
@ -332,8 +349,16 @@ void menu_software_list::handle(event const *ev)
|
||||
{
|
||||
m_search.clear();
|
||||
ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_search);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,15 +445,16 @@ void menu_software::populate()
|
||||
// handle
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_software::handle(event const *ev)
|
||||
bool menu_software::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT))
|
||||
{
|
||||
//menu::stack_push<menu_software_list>(ui(), container(), (software_list_config *)ev->itemref, image);
|
||||
*m_result = reinterpret_cast<software_list_device *>(ev->itemref);
|
||||
stack_pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
using entry_list = std::list<software_part_menu_entry>;
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// variables
|
||||
entry_list m_entries;
|
||||
@ -89,7 +89,7 @@ private:
|
||||
bool m_ordered_by_shortname;
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
// functions
|
||||
void append_software_entry(const software_info &swinfo);
|
||||
@ -105,7 +105,7 @@ public:
|
||||
menu_software(mame_ui_manager &mui, render_container &container, const char *interface, software_list_device **result);
|
||||
virtual ~menu_software() override;
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
private:
|
||||
const char * m_interface;
|
||||
|
@ -118,7 +118,7 @@ void menu_tape_control::populate()
|
||||
// handle - main tape control menu
|
||||
//-------------------------------------------------
|
||||
|
||||
void menu_tape_control::handle(event const *ev)
|
||||
bool menu_tape_control::handle(event const *ev)
|
||||
{
|
||||
// process the menu
|
||||
if (ev)
|
||||
@ -158,6 +158,7 @@ void menu_tape_control::handle(event const *ev)
|
||||
|
||||
// hacky way to update the tape counter by repopulating every frame
|
||||
reset(reset_options::REMEMBER_POSITION);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
static void get_time_string(std::string &dest, cassette_image_device *cassette, int *curpos, int *endpos);
|
||||
};
|
||||
|
@ -102,33 +102,36 @@ void menu_textbox::reset_layout()
|
||||
}
|
||||
|
||||
|
||||
void menu_textbox::handle_key(int key)
|
||||
bool menu_textbox::handle_key(int key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case IPT_UI_UP:
|
||||
--m_top_line;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case IPT_UI_DOWN:
|
||||
++m_top_line;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case IPT_UI_PAGE_UP:
|
||||
m_top_line -= m_window_lines - 3;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case IPT_UI_PAGE_DOWN:
|
||||
m_top_line += m_window_lines - 3;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case IPT_UI_HOME:
|
||||
m_top_line = 0;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case IPT_UI_END:
|
||||
m_top_line = m_layout->lines() - m_window_lines;
|
||||
break;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,10 +368,9 @@ void menu_fixed_textbox::populate()
|
||||
}
|
||||
|
||||
|
||||
void menu_fixed_textbox::handle(event const *ev)
|
||||
bool menu_fixed_textbox::handle(event const *ev)
|
||||
{
|
||||
if (ev)
|
||||
handle_key(ev->iptkey);
|
||||
return ev && handle_key(ev->iptkey);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -28,7 +28,7 @@ protected:
|
||||
menu_textbox(mame_ui_manager &mui, render_container &container);
|
||||
|
||||
void reset_layout();
|
||||
void handle_key(int key);
|
||||
bool handle_key(int key);
|
||||
|
||||
virtual void populate_text(std::optional<text_layout> &layout, float &width, int &lines) = 0;
|
||||
|
||||
@ -65,7 +65,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
std::string const m_heading;
|
||||
std::string const m_content;
|
||||
|
@ -175,7 +175,6 @@ mame_ui_manager::mame_ui_manager(running_machine &machine)
|
||||
, m_font()
|
||||
, m_handler_callback()
|
||||
, m_handler_callback_type(ui_callback_type::GENERAL)
|
||||
, m_handler_param(0)
|
||||
, m_single_step(false)
|
||||
, m_showfps(false)
|
||||
, m_showfps_end(0)
|
||||
@ -184,6 +183,8 @@ mame_ui_manager::mame_ui_manager(running_machine &machine)
|
||||
, m_mouse_bitmap(32, 32)
|
||||
, m_mouse_arrow_texture(nullptr)
|
||||
, m_mouse_show(false)
|
||||
, m_mouse_target(-1)
|
||||
, m_mouse_position(0, 0)
|
||||
, m_target_font_height(0)
|
||||
, m_has_warnings(false)
|
||||
, m_unthrottle_mute(false)
|
||||
@ -439,17 +440,17 @@ void mame_ui_manager::display_startup_screens(bool first_time)
|
||||
{
|
||||
// if the user cancels, exit out completely
|
||||
machine().schedule_exit();
|
||||
return UI_HANDLER_CANCEL;
|
||||
return HANDLER_CANCEL;
|
||||
}
|
||||
else if (machine().ui_input().pressed(IPT_UI_MENU))
|
||||
{
|
||||
config_menu = true;
|
||||
return UI_HANDLER_CANCEL;
|
||||
return HANDLER_CANCEL;
|
||||
}
|
||||
else if (poller.poll() != INPUT_CODE_INVALID)
|
||||
{
|
||||
// if any key is pressed, just exit
|
||||
return UI_HANDLER_CANCEL;
|
||||
return HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -632,7 +633,7 @@ void mame_ui_manager::set_startup_text(const char *text, bool force)
|
||||
// render it; called by video.c
|
||||
//-------------------------------------------------
|
||||
|
||||
void mame_ui_manager::update_and_render(render_container &container)
|
||||
bool mame_ui_manager::update_and_render(render_container &container)
|
||||
{
|
||||
// always start clean
|
||||
container.empty();
|
||||
@ -668,7 +669,7 @@ void mame_ui_manager::update_and_render(render_container &container)
|
||||
mame_machine_manager::instance()->cheat().render_text(*this, container);
|
||||
|
||||
// call the current UI handler
|
||||
m_handler_param = m_handler_callback(container);
|
||||
uint32_t const handler_result = m_handler_callback(container);
|
||||
|
||||
// display any popup messages
|
||||
if (osd_ticks() < m_popup_text_end)
|
||||
@ -677,28 +678,42 @@ void mame_ui_manager::update_and_render(render_container &container)
|
||||
m_popup_text_end = 0;
|
||||
|
||||
// display the internal mouse cursor
|
||||
bool mouse_moved = false;
|
||||
if (m_mouse_show || (is_menu_active() && machine().options().ui_mouse()))
|
||||
{
|
||||
int32_t mouse_target_x, mouse_target_y;
|
||||
bool mouse_button;
|
||||
render_target *mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
|
||||
render_target *const mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
|
||||
|
||||
if (mouse_target != nullptr)
|
||||
{
|
||||
float mouse_y = -1, mouse_x = -1;
|
||||
if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, container, mouse_x, mouse_y))
|
||||
if (mouse_target && mouse_target->map_point_container(mouse_target_x, mouse_target_y, container, mouse_x, mouse_y))
|
||||
{
|
||||
const float cursor_size = 0.6 * get_line_height();
|
||||
container.add_quad(mouse_x, mouse_y, mouse_x + cursor_size * container.manager().ui_aspect(&container), mouse_y + cursor_size, colors().text_color(), m_mouse_arrow_texture, PRIMFLAG_ANTIALIAS(1) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
if ((m_mouse_target != mouse_target->index()) || (std::make_pair(mouse_x, mouse_y) != m_mouse_position))
|
||||
{
|
||||
m_mouse_target = mouse_target->index();
|
||||
m_mouse_position = std::make_pair(mouse_x, mouse_y);
|
||||
mouse_moved = true;
|
||||
}
|
||||
}
|
||||
else if (0 <= m_mouse_target)
|
||||
{
|
||||
m_mouse_target = -1;
|
||||
mouse_moved = true;
|
||||
}
|
||||
}
|
||||
else if (0 <= m_mouse_target)
|
||||
{
|
||||
m_mouse_target = -1;
|
||||
mouse_moved = true;
|
||||
}
|
||||
|
||||
// cancel takes us back to the ingame handler
|
||||
if (m_handler_param == UI_HANDLER_CANCEL)
|
||||
{
|
||||
// cancel takes us back to the in-game handler
|
||||
if (handler_result & HANDLER_CANCEL)
|
||||
set_handler(ui_callback_type::GENERAL, handler_callback_func(&mame_ui_manager::handler_ingame, this));
|
||||
}
|
||||
|
||||
return mouse_moved || (handler_result & HANDLER_UPDATE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,9 +57,6 @@ class laserdisc_device;
|
||||
#define UI_YELLOW_COLOR rgb_t(0xef,0xcc,0x7a,0x28)
|
||||
#define UI_RED_COLOR rgb_t(0xef,0xb2,0x00,0x00)
|
||||
|
||||
/* cancel return value for a UI handler */
|
||||
#define UI_HANDLER_CANCEL ((uint32_t)~0)
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
@ -122,6 +119,12 @@ private:
|
||||
class mame_ui_manager : public ui_manager
|
||||
{
|
||||
public:
|
||||
enum : uint32_t
|
||||
{
|
||||
HANDLER_UPDATE = 1U << 0, // force video update
|
||||
HANDLER_CANCEL = 1U << 1 // return to in-game event handler
|
||||
};
|
||||
|
||||
enum draw_mode
|
||||
{
|
||||
NONE,
|
||||
@ -151,7 +154,7 @@ public:
|
||||
|
||||
void display_startup_screens(bool first_time);
|
||||
virtual void set_startup_text(const char *text, bool force) override;
|
||||
void update_and_render(render_container &container);
|
||||
bool update_and_render(render_container &container);
|
||||
render_font *get_font();
|
||||
float get_line_height(float scale = 1.0F);
|
||||
float get_char_width(char32_t ch);
|
||||
@ -237,16 +240,19 @@ private:
|
||||
std::unique_ptr<render_font> m_font;
|
||||
handler_callback_func m_handler_callback;
|
||||
ui_callback_type m_handler_callback_type;
|
||||
uint32_t m_handler_param;
|
||||
bool m_single_step;
|
||||
bool m_showfps;
|
||||
osd_ticks_t m_showfps_end;
|
||||
bool m_show_profiler;
|
||||
osd_ticks_t m_popup_text_end;
|
||||
std::unique_ptr<uint8_t []> m_non_char_keys_down;
|
||||
|
||||
bitmap_argb32 m_mouse_bitmap;
|
||||
render_texture * m_mouse_arrow_texture;
|
||||
bool m_mouse_show;
|
||||
int m_mouse_target;
|
||||
std::pair<float, float> m_mouse_position;
|
||||
|
||||
ui_options m_ui_options;
|
||||
ui_colors m_ui_colors;
|
||||
float m_target_font_height;
|
||||
|
@ -404,7 +404,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
bool set_filter_type(unsigned pos, typename Base::type n)
|
||||
{
|
||||
@ -556,10 +556,11 @@ void composite_filter_impl_base<Impl, Base, Type>::menu_configure::populate()
|
||||
}
|
||||
|
||||
template <class Impl, class Base, typename Base::type Type>
|
||||
void composite_filter_impl_base<Impl, Base, Type>::menu_configure::handle(event const *ev)
|
||||
{
|
||||
if (ev && ev->itemref)
|
||||
bool composite_filter_impl_base<Impl, Base, Type>::menu_configure::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
m_added = false;
|
||||
bool changed(false);
|
||||
uintptr_t const ref(reinterpret_cast<uintptr_t>(ev->itemref));
|
||||
@ -659,7 +660,7 @@ void composite_filter_impl_base<Impl, Base, Type>::menu_configure::handle(event
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
else if (m_added)
|
||||
reset(reset_options::SELECT_FIRST);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -996,7 +997,7 @@ private:
|
||||
};
|
||||
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
category_machine_filter &m_parent;
|
||||
std::function<void (machine_filter &)> m_handler;
|
||||
@ -1074,10 +1075,11 @@ void category_machine_filter::menu_configure::populate()
|
||||
item_append(menu_item_type::SEPARATOR);
|
||||
}
|
||||
|
||||
void category_machine_filter::menu_configure::handle(event const *ev)
|
||||
{
|
||||
if (ev && ev->itemref)
|
||||
bool category_machine_filter::menu_configure::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
bool changed(false);
|
||||
uintptr_t const ref(reinterpret_cast<uintptr_t>(ev->itemref));
|
||||
inifile_manager const &mgr(mame_machine_manager::instance()->inifile());
|
||||
@ -1172,7 +1174,7 @@ void category_machine_filter::menu_configure::handle(event const *ev)
|
||||
// rebuild if anything changed
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ void menu_video_targets::populate()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void menu_video_targets::handle(event const *ev)
|
||||
bool menu_video_targets::handle(event const *ev)
|
||||
{
|
||||
if (ev && (ev->iptkey == IPT_UI_SELECT))
|
||||
{
|
||||
@ -82,6 +82,8 @@ void menu_video_targets::handle(event const *ev)
|
||||
*target,
|
||||
&machine().video().snapshot_target() == target);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -200,9 +202,14 @@ void menu_video_options::populate()
|
||||
menu
|
||||
-------------------------------------------------*/
|
||||
|
||||
void menu_video_options::handle(event const *ev)
|
||||
bool menu_video_options::handle(event const *ev)
|
||||
{
|
||||
auto const lockout_popup([this] () { machine().popmessage(_("Cannot change options while recording!")); });
|
||||
auto const lockout_popup(
|
||||
[this] ()
|
||||
{
|
||||
machine().popmessage(_("Cannot change options while recording!"));
|
||||
return true;
|
||||
});
|
||||
bool const snap_lockout(m_snapshot && machine().video().is_recording());
|
||||
bool changed(false);
|
||||
|
||||
@ -340,6 +347,7 @@ void menu_video_options::handle(event const *ev)
|
||||
// if something changed, rebuild the menu
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
};
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void populate() override;
|
||||
virtual void handle(event const *ev) override;
|
||||
virtual bool handle(event const *ev) override;
|
||||
|
||||
render_target &m_target;
|
||||
bool const m_snapshot;
|
||||
|
@ -544,7 +544,7 @@ private:
|
||||
m_machine.resume();
|
||||
m_machine.ui_input().reset();
|
||||
m_bitmap_dirty = true;
|
||||
return UI_HANDLER_CANCEL;
|
||||
return mame_ui_manager::HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
uint32_t handle_palette(mame_ui_manager &mui, render_container &container, bool uistate);
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
// general overridables
|
||||
virtual void init(running_machine &machine) override;
|
||||
virtual void update(bool skip_redraw) override;
|
||||
virtual void input_update() override;
|
||||
virtual void input_update(bool relative_reset) override;
|
||||
virtual void check_osd_inputs() override;
|
||||
|
||||
// input overridables
|
||||
|
@ -122,12 +122,12 @@ void mac_osd_interface::update(bool skip_redraw)
|
||||
// input_update
|
||||
//============================================================
|
||||
|
||||
void mac_osd_interface::input_update()
|
||||
void mac_osd_interface::input_update(bool relative_reset)
|
||||
{
|
||||
// poll the joystick values here
|
||||
process_events_buf();
|
||||
MacPollInputs();
|
||||
poll_input_modules();
|
||||
poll_input_modules(relative_reset);
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
@ -195,7 +195,7 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop)
|
||||
show_all();
|
||||
|
||||
// run input polling to ensure that our status is in sync
|
||||
downcast<windows_osd_interface&>(machine().osd()).poll_input_modules();
|
||||
downcast<windows_osd_interface&>(machine().osd()).poll_input_modules(false);
|
||||
|
||||
// get and process messages
|
||||
MSG message;
|
||||
|
@ -286,16 +286,16 @@ void input_module_base::input_init(running_machine &machine)
|
||||
m_manager = &machine.input();
|
||||
}
|
||||
|
||||
void input_module_base::poll_if_necessary()
|
||||
void input_module_base::poll_if_necessary(bool relative_reset)
|
||||
{
|
||||
timepoint_type const now = m_clock.now();
|
||||
if (now >= (m_last_poll + std::chrono::milliseconds(MIN_POLLING_INTERVAL)))
|
||||
if (relative_reset || (now >= (m_last_poll + std::chrono::milliseconds(MIN_POLLING_INTERVAL))))
|
||||
{
|
||||
// grab the current time
|
||||
m_last_poll = now;
|
||||
|
||||
before_poll();
|
||||
|
||||
poll();
|
||||
poll(relative_reset);
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
input_module &module() const { return m_module; }
|
||||
|
||||
// Poll and reset methods
|
||||
virtual void poll() { }
|
||||
virtual void poll(bool relative_reset) = 0;
|
||||
virtual void reset() = 0;
|
||||
virtual void configure(osd::input_device &device) = 0;
|
||||
};
|
||||
@ -266,7 +266,7 @@ public:
|
||||
m_event_queue.pop();
|
||||
}
|
||||
|
||||
void virtual poll() override
|
||||
void virtual poll(bool relative_reset) override
|
||||
{
|
||||
std::lock_guard<std::mutex> scope_lock(m_device_lock);
|
||||
|
||||
@ -296,10 +296,10 @@ public:
|
||||
auto begin() const { return m_list.begin(); }
|
||||
auto end() const { return m_list.end(); }
|
||||
|
||||
void poll_devices()
|
||||
void poll_devices(bool relative_reset)
|
||||
{
|
||||
for (auto &device: m_list)
|
||||
device->poll();
|
||||
device->poll(relative_reset);
|
||||
}
|
||||
|
||||
void reset_devices()
|
||||
@ -408,7 +408,7 @@ private:
|
||||
const osd_options * m_options;
|
||||
osd::input_manager * m_manager;
|
||||
|
||||
virtual void poll() = 0;
|
||||
virtual void poll(bool relative_reset) = 0;
|
||||
|
||||
protected:
|
||||
input_module_base(char const *type, char const *name);
|
||||
@ -423,7 +423,7 @@ public:
|
||||
virtual int init(osd_interface &osd, const osd_options &options) override;
|
||||
|
||||
virtual void input_init(running_machine &machine) override;
|
||||
virtual void poll_if_necessary() override;
|
||||
virtual void poll_if_necessary(bool relative_reset) override;
|
||||
|
||||
virtual void reset_devices() = 0; // SDL OSD uses this to forcibly release keys
|
||||
};
|
||||
@ -490,11 +490,11 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void poll() override final
|
||||
virtual void poll(bool relative_reset) override final
|
||||
{
|
||||
// poll all of the devices
|
||||
if (should_poll_devices())
|
||||
m_devicelist.poll_devices();
|
||||
m_devicelist.poll_devices(relative_reset);
|
||||
else
|
||||
m_devicelist.reset_devices();
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public:
|
||||
DIDEVCAPS const &caps,
|
||||
LPCDIDATAFORMAT format);
|
||||
|
||||
virtual void poll() override;
|
||||
virtual void poll(bool relative_reset) override;
|
||||
virtual void reset() override;
|
||||
virtual void configure(input_device &device) override;
|
||||
|
||||
@ -184,7 +184,7 @@ dinput_keyboard_device::dinput_keyboard_device(
|
||||
{
|
||||
}
|
||||
|
||||
void dinput_keyboard_device::poll()
|
||||
void dinput_keyboard_device::poll(bool relative_reset)
|
||||
{
|
||||
// poll the DirectInput immediate state
|
||||
std::lock_guard<std::mutex> scope_lock(m_device_lock);
|
||||
@ -233,7 +233,7 @@ public:
|
||||
DIDEVCAPS const &caps,
|
||||
LPCDIDATAFORMAT format);
|
||||
|
||||
void poll() override;
|
||||
void poll(bool relative_reset) override;
|
||||
void reset() override;
|
||||
virtual void configure(input_device &device) override;
|
||||
|
||||
@ -256,10 +256,10 @@ dinput_mouse_device::dinput_mouse_device(
|
||||
m_caps.dwButtons = std::min(m_caps.dwButtons, DWORD((m_format == &c_dfDIMouse) ? 4 : 8));
|
||||
}
|
||||
|
||||
void dinput_mouse_device::poll()
|
||||
void dinput_mouse_device::poll(bool relative_reset)
|
||||
{
|
||||
// poll
|
||||
if (poll_dinput(&m_mouse) == DI_OK)
|
||||
if (relative_reset && (poll_dinput(&m_mouse) == DI_OK))
|
||||
{
|
||||
// scale the axis data
|
||||
m_mouse.lX *= input_device::RELATIVE_PER_PIXEL;
|
||||
@ -566,7 +566,7 @@ void dinput_joystick_device::reset()
|
||||
std::fill(std::begin(m_joystick.state.rgdwPOV), std::end(m_joystick.state.rgdwPOV), 0xffff);
|
||||
}
|
||||
|
||||
void dinput_joystick_device::poll()
|
||||
void dinput_joystick_device::poll(bool relative_reset)
|
||||
{
|
||||
// poll the device first
|
||||
if (dinput_device::poll_dinput(&m_joystick.state) == DI_OK)
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
LPCDIDATAFORMAT format);
|
||||
|
||||
void reset() override;
|
||||
void poll() override;
|
||||
void poll(bool relative_reset) override;
|
||||
void configure(input_device &device) override;
|
||||
|
||||
private:
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
virtual ~input_module() = default;
|
||||
|
||||
virtual void input_init(running_machine &machine) = 0;
|
||||
virtual void poll_if_necessary() = 0;
|
||||
virtual void poll_if_necessary(bool relative_reset) = 0;
|
||||
};
|
||||
|
||||
//============================================================
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
keyboard_input_none() : osd_module(OSD_KEYBOARDINPUT_PROVIDER, "none") { }
|
||||
int init(osd_interface &osd, const osd_options &options) override { return 0; }
|
||||
void input_init(running_machine &machine) override { }
|
||||
void poll_if_necessary() override { }
|
||||
void poll_if_necessary(bool relative_reset) override { }
|
||||
};
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ public:
|
||||
mouse_input_none() : osd_module(OSD_MOUSEINPUT_PROVIDER, "none") { }
|
||||
int init(osd_interface &osd, const osd_options &options) override { return 0; }
|
||||
void input_init(running_machine &machine) override { }
|
||||
void poll_if_necessary() override { }
|
||||
void poll_if_necessary(bool relative_reset) override { }
|
||||
};
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
lightgun_input_none() : osd_module(OSD_LIGHTGUNINPUT_PROVIDER, "none") { }
|
||||
int init(osd_interface &osd, const osd_options &options) override { return 0; }
|
||||
void input_init(running_machine &machine) override { }
|
||||
void poll_if_necessary() override { }
|
||||
void poll_if_necessary(bool relative_reset) override { }
|
||||
};
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
joystick_input_none() : osd_module(OSD_JOYSTICKINPUT_PROVIDER, "none") { }
|
||||
int init(osd_interface &osd, const osd_options &options) override { return 0; }
|
||||
void input_init(running_machine &machine) override { }
|
||||
void poll_if_necessary() override { }
|
||||
void poll_if_necessary(bool relative_reset) override { }
|
||||
};
|
||||
|
||||
} // anonymous namesapce
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user