From 98b17bf2467f1e7fd53fd611ba767a73b1b8f274 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Sat, 22 Mar 2014 11:43:33 -0500 Subject: [PATCH] Try to guess the proper inputConfig entry from deviceName if deviceGUID is missing. --- src/InputManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/InputManager.cpp b/src/InputManager.cpp index 142778445..462275397 100644 --- a/src/InputManager.cpp +++ b/src/InputManager.cpp @@ -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); } } }