mirror of
https://github.com/holub/mame
synced 2025-05-23 14:19:01 +03:00
removed runtime ioport tagmap lookup when using PORT_CONDITION with PORT_BIT, used by gmgalax for example [smf]
This commit is contained in:
parent
eba5498d6a
commit
47c3ba0bf1
@ -1522,14 +1522,14 @@ astring natural_keyboard::dump()
|
||||
// eval - evaluate condition
|
||||
//-------------------------------------------------
|
||||
|
||||
bool ioport_condition::eval(device_t &device) const
|
||||
bool ioport_condition::eval() const
|
||||
{
|
||||
// always condition is always true
|
||||
if (m_condition == ALWAYS)
|
||||
return true;
|
||||
|
||||
// otherwise, read the referenced port and switch off the condition type
|
||||
ioport_value condvalue = device.ioport(m_tag)->read();
|
||||
ioport_value condvalue = m_port->read();
|
||||
switch (m_condition)
|
||||
{
|
||||
case ALWAYS: return true;
|
||||
@ -1544,6 +1544,17 @@ bool ioport_condition::eval(device_t &device) const
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// initialize - create the live state
|
||||
//-------------------------------------------------
|
||||
|
||||
void ioport_condition::initialize(device_t &device)
|
||||
{
|
||||
if (m_tag != NULL)
|
||||
m_port = device.ioport(m_tag);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// I/O PORT SETTING
|
||||
@ -2257,6 +2268,11 @@ void ioport_field::init_live_state(analog_field *analog)
|
||||
|
||||
// allocate live state
|
||||
m_live = global_alloc(ioport_field_live(*this, analog));
|
||||
|
||||
m_condition.initialize(device());
|
||||
|
||||
for (ioport_setting *setting = first_setting(); setting != NULL; setting = setting->next())
|
||||
setting->condition().initialize(setting->device());
|
||||
}
|
||||
|
||||
|
||||
|
@ -917,7 +917,7 @@ public:
|
||||
|
||||
// operators
|
||||
bool operator==(const ioport_condition &rhs) const { return (m_mask == rhs.m_mask && m_value == rhs.m_value && m_condition == rhs.m_condition && strcmp(m_tag, rhs.m_tag) == 0); }
|
||||
bool eval(device_t &device) const;
|
||||
bool eval() const;
|
||||
bool none() const { return (m_condition == ALWAYS); }
|
||||
|
||||
// configuration
|
||||
@ -930,10 +930,13 @@ public:
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
void initialize(device_t &device);
|
||||
|
||||
private:
|
||||
// internal state
|
||||
condition_t m_condition; // condition to use
|
||||
const char * m_tag; // tag of port whose condition is to be tested
|
||||
ioport_port * m_port; // reference to the port to be tested
|
||||
ioport_value m_mask; // mask to apply to the port
|
||||
ioport_value m_value; // value to compare against
|
||||
};
|
||||
@ -961,7 +964,7 @@ public:
|
||||
const char *name() const { return m_name; }
|
||||
|
||||
// helpers
|
||||
bool enabled() { return m_condition.eval(device()); }
|
||||
bool enabled() { return m_condition.eval(); }
|
||||
|
||||
private:
|
||||
// internal state
|
||||
@ -1084,7 +1087,7 @@ public:
|
||||
bool is_digital_joystick() const { return (m_type > IPT_DIGITAL_JOYSTICK_FIRST && m_type < IPT_DIGITAL_JOYSTICK_LAST); }
|
||||
|
||||
// additional operations
|
||||
bool enabled() const { return m_condition.eval(device()); }
|
||||
bool enabled() const { return m_condition.eval(); }
|
||||
const char *setting_name() const;
|
||||
bool has_previous_setting() const;
|
||||
void select_previous_setting();
|
||||
|
Loading…
Reference in New Issue
Block a user