mirror of
https://github.com/holub/mame
synced 2025-07-05 01:48:29 +03:00
emu/ioport.cpp: Changed config save/load behaviour for conditional fields.
* See GitHub #10937 for issues with current approach. * Only save configuration for enabled fields. * Apply loaded configuration to all matching fields.
This commit is contained in:
parent
e629a85548
commit
678b56c7de
@ -2460,6 +2460,7 @@ bool ioport_manager::load_controller_config(
|
||||
|
||||
// find the matching field
|
||||
ioport_value const defvalue = portnode.get_attribute_int("defvalue", 0);
|
||||
bool matched = false;
|
||||
for (ioport_field &field : port->second->fields())
|
||||
{
|
||||
// find the matching mask and default value
|
||||
@ -2521,13 +2522,16 @@ bool ioport_manager::load_controller_config(
|
||||
#endif
|
||||
}
|
||||
|
||||
// successfully applied
|
||||
return true;
|
||||
// only break out of the loop for unconditional inputs
|
||||
if (field.condition().condition() == ioport_condition::ALWAYS)
|
||||
return true;
|
||||
else
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
|
||||
// no matching field
|
||||
return false;
|
||||
// return whether any field matched
|
||||
return matched;
|
||||
}
|
||||
|
||||
|
||||
@ -2598,7 +2602,10 @@ void ioport_manager::load_system_config(
|
||||
else if (revstring && !strcmp(revstring, "no"))
|
||||
field.live().analog->m_reverse = false;
|
||||
}
|
||||
break;
|
||||
|
||||
// only break out of the loop for unconditional inputs
|
||||
if (field.condition().condition() == ioport_condition::ALWAYS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2822,7 +2829,7 @@ void ioport_manager::save_game_inputs(util::xml::data_node &parentnode)
|
||||
// iterate over ports
|
||||
for (auto &port : m_portlist)
|
||||
for (ioport_field const &field : port.second->fields())
|
||||
if (save_this_input_field_type(field.type()))
|
||||
if (save_this_input_field_type(field.type()) && field.enabled())
|
||||
{
|
||||
// determine if we changed
|
||||
bool changed = false;
|
||||
|
Loading…
Reference in New Issue
Block a user