summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2024-08-06 11:33:43 +0200
committer hap <happppp@users.noreply.github.com>2024-08-06 11:33:53 +0200
commitf1b0eee723eccd786568bcd4b35868dfc38a62d5 (patch)
treedc2ac21cd0b891aaf1f66dfa3f57369448ab64ca
parenta42144545361874505ed82a50f8a6ebcd5d8505a (diff)
ui pointer options: set inc/dec to 1s (hold shift for shorter 0.1s), reset options to default when pressing Del
-rw-r--r--plugins/hiscore/hiscore.dat2
-rw-r--r--src/frontend/mame/ui/ui.cpp27
-rw-r--r--src/frontend/mame/ui/ui.h1
-rw-r--r--src/frontend/mame/ui/videoopt.cpp38
-rw-r--r--src/mame/konami/xmen.cpp2
5 files changed, 49 insertions, 21 deletions
diff --git a/plugins/hiscore/hiscore.dat b/plugins/hiscore/hiscore.dat
index 96315ad875e..1cd88bfbde0 100644
--- a/plugins/hiscore/hiscore.dat
+++ b/plugins/hiscore/hiscore.dat
@@ -1978,7 +1978,7 @@ gngprot:
@:maincpu,program,00d0,4,00,00
-diamond:
+diamrun:
@:maincpu,program,1200,80,4b,00
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index e697f861da2..2f0a2388c9f 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -191,11 +191,16 @@ struct mame_ui_manager::active_pointer
struct mame_ui_manager::pointer_options
{
pointer_options()
- : timeout(std::chrono::seconds(3))
- , hide_inactive(true)
- , timeout_set(false)
- , hide_inactive_set(false)
{
+ reset();
+ }
+
+ void reset()
+ {
+ timeout = std::chrono::seconds(3);
+ hide_inactive = true;
+ timeout_set = false;
+ hide_inactive_set = false;
}
bool options_set() const
@@ -1773,7 +1778,6 @@ std::chrono::steady_clock::duration mame_ui_manager::pointer_activity_timeout(in
}
-
//-------------------------------------------------
// hide_inactive_pointers - get per-target hide
// inactive pointers setting
@@ -1789,6 +1793,19 @@ bool mame_ui_manager::hide_inactive_pointers(int target) const noexcept
}
+//-------------------------------------------------
+// reset_pointer_options - reset per-target
+// pointer options
+//-------------------------------------------------
+
+void mame_ui_manager::reset_pointer_options(int target) noexcept
+{
+ assert((0 <= target) && (m_pointer_options.size() > target));
+ if ((0 <= target) && (m_pointer_options.size() > target))
+ m_pointer_options[target].reset();
+}
+
+
/***************************************************************************
SLIDER CONTROLS
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h
index 128300576e5..8fb6099dcc4 100644
--- a/src/frontend/mame/ui/ui.h
+++ b/src/frontend/mame/ui/ui.h
@@ -211,6 +211,7 @@ public:
void set_hide_inactive_pointers(int target, bool hide) noexcept;
std::chrono::steady_clock::duration pointer_activity_timeout(int target) const noexcept;
bool hide_inactive_pointers(int target) const noexcept;
+ void reset_pointer_options(int target) noexcept;
// drawing informational overlays
void draw_fps_counter(render_container &container);
diff --git a/src/frontend/mame/ui/videoopt.cpp b/src/frontend/mame/ui/videoopt.cpp
index a179a2ec16f..8f1dd1e7b62 100644
--- a/src/frontend/mame/ui/videoopt.cpp
+++ b/src/frontend/mame/ui/videoopt.cpp
@@ -346,14 +346,10 @@ bool menu_video_options::handle(event const *ev)
// pointer inactivity timeout
case ITEM_POINTERTIMEOUT:
- if (ev->iptkey == IPT_UI_SELECT)
- {
- // toggle hide after delay
- ui().set_hide_inactive_pointers(m_target.index(), !ui().hide_inactive_pointers(m_target.index()));
- changed = true;
- }
- else if (ev->iptkey == IPT_UI_LEFT)
+ switch (ev->iptkey)
{
+ // decrease value
+ case IPT_UI_LEFT:
if (!ui().hide_inactive_pointers(m_target.index()))
{
ui().set_hide_inactive_pointers(m_target.index(), true);
@@ -362,8 +358,8 @@ bool menu_video_options::handle(event const *ev)
}
else
{
- bool const ctrl_pressed = machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL);
- std::chrono::milliseconds const increment(ctrl_pressed ? 1'000 : 100);
+ bool const shift_pressed = machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT);
+ std::chrono::milliseconds const increment(shift_pressed ? 100 : 1'000);
auto timeout = ui().pointer_activity_timeout(m_target.index());
auto const remainder = timeout % increment;
timeout -= remainder.count() ? remainder : increment;
@@ -373,9 +369,10 @@ bool menu_video_options::handle(event const *ev)
changed = true;
}
}
- }
- else if (ev->iptkey == IPT_UI_RIGHT)
- {
+ break;
+
+ // increase value
+ case IPT_UI_RIGHT:
if (ui().hide_inactive_pointers(m_target.index()))
{
auto const timeout = ui().pointer_activity_timeout(m_target.index());
@@ -385,14 +382,27 @@ bool menu_video_options::handle(event const *ev)
}
else
{
- bool const ctrl_pressed = machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL);
- int const increment(ctrl_pressed ? 1'000 : 100);
+ bool const shift_pressed = machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT);
+ int const increment(shift_pressed ? 100 : 1'000);
ui().set_pointer_activity_timeout(
m_target.index(),
std::chrono::milliseconds((1 + (timeout / std::chrono::milliseconds(increment))) * increment));
}
changed = true;
}
+ break;
+
+ // toggle hide after delay
+ case IPT_UI_SELECT:
+ ui().set_hide_inactive_pointers(m_target.index(), !ui().hide_inactive_pointers(m_target.index()));
+ changed = true;
+ break;
+
+ // restore default
+ case IPT_UI_CLEAR:
+ ui().reset_pointer_options(m_target.index());
+ changed = true;
+ break;
}
break;
diff --git a/src/mame/konami/xmen.cpp b/src/mame/konami/xmen.cpp
index 94ab650941d..23703c4cada 100644
--- a/src/mame/konami/xmen.cpp
+++ b/src/mame/konami/xmen.cpp
@@ -514,7 +514,7 @@ static INPUT_PORTS_START( xmen )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE2 )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE3 )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE4 )
- PORT_BIT( 0x0030, IP_ACTIVE_LOW, IPT_UNKNOWN ) // unused
+ PORT_BIT( 0x0030, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, do_read)
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, ready_read)
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )