mirror of https://github.com/stella-emu/stella.git
Migration fixes.
This commit is contained in:
parent
730932355f
commit
e3e0fc5a47
|
@ -269,11 +269,18 @@ json JoyMap::convertLegacyMapping(string list)
|
|||
json eventMapping = json::object();
|
||||
|
||||
eventMapping["event"] = Event::Type(event);
|
||||
eventMapping["button"] = button;
|
||||
|
||||
if (button != JOY_CTRL_NONE) eventMapping["button"] = button;
|
||||
|
||||
if (JoyAxis(axis) != JoyAxis::NONE) {
|
||||
eventMapping["axis"] = JoyAxis(axis);
|
||||
eventMapping["axisDirection"] = JoyDir(adir);
|
||||
}
|
||||
|
||||
if (hat != -1) {
|
||||
eventMapping["hat"] = hat;
|
||||
eventMapping["hatDirection"] = JoyHatDir(hdir);
|
||||
}
|
||||
|
||||
eventMappings.push_back(eventMapping);
|
||||
}
|
||||
|
|
|
@ -234,7 +234,8 @@ json KeyMap::convertLegacyMapping(string list)
|
|||
|
||||
mapping["event"] = Event::Type(event);
|
||||
mapping["key"] = StellaKey(key);
|
||||
mapping["mod"] = StellaMod(mod);
|
||||
|
||||
if (StellaMod(mod) != StellaMod::KBDM_NONE) mapping["mod"] = StellaMod(mod);
|
||||
|
||||
convertedMapping.push_back(mapping);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ PhysicalJoystickHandler::PhysicalJoystickHandler(
|
|||
try {
|
||||
mappings = json::parse(serializedMapping);
|
||||
} catch (json::exception) {
|
||||
Logger::info("converting legacy joystrick mappings");
|
||||
Logger::info("converting legacy joystick mappings");
|
||||
|
||||
mappings = convertLegacyMapping(serializedMapping);
|
||||
}
|
||||
|
|
|
@ -129,11 +129,12 @@ json PhysicalJoystick::convertLegacyMapping(const string& mapping, const string&
|
|||
map.erase(0, 2);
|
||||
|
||||
json mappingForMode = JoyMap::convertLegacyMapping(map);
|
||||
mappingForMode["name"] = name;
|
||||
|
||||
convertedMapping[jsonName(EventMode(mode))] = mappingForMode;
|
||||
}
|
||||
|
||||
convertedMapping["name"] = name;
|
||||
|
||||
return convertedMapping;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue