mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
find_dipname considered harmful (nw)
This commit is contained in:
parent
e624a3cd38
commit
39f56a0df7
@ -54,24 +54,6 @@ machine_info::machine_info(running_machine &machine)
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// find_dipname - look up DIP switch by name
|
||||
//-------------------------------------------------
|
||||
|
||||
ioport_field *machine_info::find_dipname(const char *name) const
|
||||
{
|
||||
if (!m_has_dips)
|
||||
return nullptr;
|
||||
|
||||
for (auto &port : m_machine.ioport().ports())
|
||||
for (ioport_field &field : port.second->fields())
|
||||
if (field.type() == IPT_DIPSWITCH && strcmp(field.name(), name) == 0)
|
||||
return &field;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TEXT GENERATORS
|
||||
***************************************************************************/
|
||||
|
@ -31,8 +31,6 @@ public:
|
||||
bool has_keyboard() const { return m_has_keyboard; }
|
||||
bool has_test_switch() const { return m_has_test_switch; }
|
||||
|
||||
ioport_field *find_dipname(const char *name) const;
|
||||
|
||||
// text generators
|
||||
std::string warnings_string();
|
||||
std::string game_info_string();
|
||||
|
@ -257,11 +257,14 @@ void mame_ui_manager::initialize(running_machine &machine)
|
||||
slider_current = nullptr;
|
||||
}
|
||||
|
||||
if (!m_machine_info->has_test_switch())
|
||||
// if no test switch found, assign its input sequence to a service mode DIP
|
||||
if (!m_machine_info->has_test_switch() && m_machine_info->has_dips())
|
||||
{
|
||||
ioport_field *service_mode_sw = m_machine_info->find_dipname(ioport_configurer::string_from_token(DEF_STR(Service_Mode)));
|
||||
if (service_mode_sw != nullptr)
|
||||
service_mode_sw->set_defseq(machine.ioport().type_seq(IPT_SERVICE));
|
||||
const char *const service_mode_dipname = ioport_configurer::string_from_token(DEF_STR(Service_Mode));
|
||||
for (auto &port : machine.ioport().ports())
|
||||
for (ioport_field &field : port.second->fields())
|
||||
if (field.type() == IPT_DIPSWITCH && strcmp(field.name(), service_mode_dipname) == 0)
|
||||
field.set_defseq(machine.ioport().type_seq(IPT_SERVICE));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user