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