mirror of https://github.com/stella-emu/stella.git
fixed occasional NoType mappings being saved and loaded
This commit is contained in:
parent
f4d135fc6e
commit
4d784d4a5b
|
@ -218,7 +218,7 @@ json JoyMap::saveMapping(const EventMode mode) const
|
|||
json eventMappings = json::array();
|
||||
|
||||
for (const auto& [_mapping, _event]: sortedMap) {
|
||||
if (_mapping.mode != mode) continue;
|
||||
if(_mapping.mode != mode || _event == Event::NoType) continue;
|
||||
|
||||
json eventMapping = json::object();
|
||||
|
||||
|
@ -255,6 +255,10 @@ int JoyMap::loadMapping(const json& eventMappings, const EventMode mode)
|
|||
JoyHatDir hatDirection = eventMapping.contains("hat") ? eventMapping.at("hatDirection").get<JoyHatDir>() : JoyHatDir::CENTER;
|
||||
|
||||
try {
|
||||
// avoid blocking mappings for NoType events
|
||||
if(eventMapping.at("event").get<Event::Type>() == Event::NoType)
|
||||
continue;
|
||||
|
||||
add(
|
||||
eventMapping.at("event").get<Event::Type>(),
|
||||
mode,
|
||||
|
|
|
@ -241,7 +241,7 @@ json KeyMap::saveMapping(const EventMode mode) const
|
|||
json mappings = json::array();
|
||||
|
||||
for (const auto& [_mapping, _event]: sortedMap) {
|
||||
if (_mapping.mode != mode) continue;
|
||||
if (_mapping.mode != mode || _event == Event::NoType) continue;
|
||||
|
||||
json mapping = json::object();
|
||||
|
||||
|
@ -264,6 +264,10 @@ int KeyMap::loadMapping(const json& mappings, const EventMode mode) {
|
|||
for(const json& mapping : mappings)
|
||||
{
|
||||
try {
|
||||
// avoid blocking mappings for NoType events
|
||||
if(mapping.at("event").get<Event::Type>() == Event::NoType)
|
||||
continue;
|
||||
|
||||
add(
|
||||
mapping.at("event").get<Event::Type>(),
|
||||
mode,
|
||||
|
|
Loading…
Reference in New Issue