mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
ui/confswitch.cpp: Do an extra item reset the next time through the event loop after making a change.
Updated DIP switch and configuration field values aren't seen in the port value until the next I/O port manager frame update, and hence enable state won't be seen until then.
This commit is contained in:
parent
147f94e7dd
commit
2070980421
@ -473,7 +473,8 @@ void spg2xx_audio_device::audio_ctrl_w(offs_t offset, uint16_t data)
|
||||
else
|
||||
{
|
||||
LOGMASKED(LOG_SPU_WRITES, "Disabling channel %d\n", channel_bit);
|
||||
if (m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] & mask) {
|
||||
if (m_audio_ctrl_regs[AUDIO_CHANNEL_STATUS] & mask)
|
||||
{
|
||||
LOGMASKED(LOG_SPU_WRITES, "Stopping channel %d\n", channel_bit);
|
||||
stop_channel(channel_bit);
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ menu_confswitch::menu_confswitch(mame_ui_manager &mui, render_container &contain
|
||||
, m_switch_groups()
|
||||
, m_active_switch_groups(0U)
|
||||
, m_type(type)
|
||||
, m_changed(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -175,17 +176,18 @@ void menu_confswitch::populate()
|
||||
|
||||
bool menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
if (!ev || !ev->itemref)
|
||||
return false;
|
||||
|
||||
if (IPT_CUSTOM == ev->iptkey)
|
||||
bool const was_changed(std::exchange(m_changed, false));
|
||||
bool need_update(false);
|
||||
if (ev && (IPT_CUSTOM == ev->iptkey))
|
||||
{
|
||||
// clicked a switch
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
return true;
|
||||
m_changed = true;
|
||||
}
|
||||
|
||||
if (uintptr_t(ev->itemref) == 1U)
|
||||
else if (!ev || !ev->itemref)
|
||||
{
|
||||
// no user input
|
||||
}
|
||||
else if (uintptr_t(ev->itemref) == 1U)
|
||||
{
|
||||
// reset
|
||||
if (ev->iptkey == IPT_UI_SELECT)
|
||||
@ -195,21 +197,20 @@ bool menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
// actual settings
|
||||
ioport_field &field(*reinterpret_cast<ioport_field *>(ev->itemref));
|
||||
bool changed(false);
|
||||
|
||||
switch (ev->iptkey)
|
||||
{
|
||||
// left goes to previous setting
|
||||
case IPT_UI_LEFT:
|
||||
field.select_previous_setting();
|
||||
changed = true;
|
||||
m_changed = true;
|
||||
break;
|
||||
|
||||
// right goes to next setting
|
||||
case IPT_UI_SELECT:
|
||||
case IPT_UI_RIGHT:
|
||||
field.select_next_setting();
|
||||
changed = true;
|
||||
m_changed = true;
|
||||
break;
|
||||
|
||||
// if cleared, reset to default value
|
||||
@ -221,7 +222,7 @@ bool menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
settings.value = field.defvalue();
|
||||
field.set_user_settings(settings);
|
||||
changed = true;
|
||||
m_changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -242,7 +243,8 @@ bool menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
set_selected_index(current);
|
||||
set_top_line(current - 1);
|
||||
return true;
|
||||
need_update = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -264,7 +266,7 @@ bool menu_confswitch::handle(event const *ev)
|
||||
{
|
||||
set_selected_index(current + 1);
|
||||
set_top_line(current);
|
||||
return true;
|
||||
need_update = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -272,14 +274,12 @@ bool menu_confswitch::handle(event const *ev)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// if anything changed, rebuild the menu, trying to stay on the same field
|
||||
if (changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
}
|
||||
|
||||
// changing settings triggers an item rebuild because it can affect whether things are enabled
|
||||
return false;
|
||||
if (m_changed || was_changed)
|
||||
reset(reset_options::REMEMBER_REF);
|
||||
return need_update;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,6 +72,7 @@ private:
|
||||
switch_group_vector m_switch_groups;
|
||||
unsigned m_active_switch_groups;
|
||||
int const m_type;
|
||||
bool m_changed;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user