Try to guess the proper inputConfig entry from deviceName if deviceGUID is missing.

This commit is contained in:
Aloshi 2014-03-22 11:43:33 -05:00
parent 3c5fa89eaf
commit 98b17bf246

View file

@ -252,7 +252,9 @@ bool InputManager::loadInputConfig(InputConfig* config)
if(!root)
return false;
pugi::xml_node configNode = root.find_child_by_attribute("inputConfig", "deviceGUID", getDeviceGUIDString(config->getDeviceId()).c_str());
pugi::xml_node configNode = root.find_child_by_attribute("inputConfig", "deviceGUID", config->getDeviceGUIDString().c_str());
if(!configNode)
configNode = root.find_child_by_attribute("inputConfig", "deviceName", config->getDeviceName().c_str());
if(!configNode)
return false;
@ -304,6 +306,9 @@ void InputManager::writeDeviceConfig(InputConfig* config)
pugi::xml_node oldEntry = root.find_child_by_attribute("inputConfig", "deviceGUID", config->getDeviceGUIDString().c_str());
if(oldEntry)
root.remove_child(oldEntry);
oldEntry = root.find_child_by_attribute("inputConfig", "deviceName", config->getDeviceName().c_str());
if(oldEntry)
root.remove_child(oldEntry);
}
}
}