fix checking for existing mapping when applying default mappings (fixes #620)

This commit is contained in:
thrust26 2020-04-21 17:21:08 +02:00
parent db51de1bde
commit e502be6048
2 changed files with 9 additions and 4 deletions

View File

@ -250,9 +250,9 @@ void PhysicalJoystickHandler::setDefaultAction(int stick,
if(updateDefaults)
{
// if there is no existing mapping for the event or
// if there is no existing mapping for the event and
// the default mapping for the event is unused, set default key for event
if(j->joyMap.getEventMapping(map.event, mode).size() == 0 ||
if(j->joyMap.getEventMapping(map.event, mode).size() == 0 &&
!j->joyMap.check(mode, map.button, map.axis, map.adir, map.hat, map.hdir))
{
if (map.hat == JOY_CTRL_NONE)

View File

@ -80,11 +80,16 @@ void PhysicalKeyboardHandler::setDefaultKey(EventMapping map, Event::Type event,
if (updateDefaults)
{
// if there is no existing mapping for the event or
if (map.event == Event::ToggleSAPortOrder)
int i = 0;
// if there is no existing mapping for the event and
// the default mapping for the event is unused, set default key for event
if (myKeyMap.getEventMapping(map.event, mode).size() == 0 ||
if (myKeyMap.getEventMapping(map.event, mode).size() == 0 &&
!myKeyMap.check(mode, map.key, map.mod))
{
if (map.event == Event::ConsoleReset)
int i = 0;
addMapping(map.event, mode, map.key, StellaMod(map.mod));
}
}