diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 04ca79364..f03fbc14e 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -293,54 +293,54 @@ void InputManager::loadDefaultKBConfig() void InputManager::writeDeviceConfig(InputConfig* config) { - assert(initialized()); + assert(initialized()); - std::string path = getConfigPath(); + std::string path = getConfigPath(); - pugi::xml_document doc; + pugi::xml_document doc; - if(fs::exists(path)) - { - // merge files - pugi::xml_parse_result result = doc.load_file(path.c_str()); - if(!result) - { - LOG(LogError) << "Error parsing input config: " << result.description(); - } - else - { - // successfully loaded, delete the old entry if it exists - pugi::xml_node root = doc.child("inputList"); - if(root) - { - // if inputAction @type=onfinish is set, let onfinish command take care for creating input configuration. - // we just put the input configuration into a temporary input config file. - pugi::xml_node actionnode = root.find_child_by_attribute("inputAction", "type", "onfinish"); - if(actionnode) - { - path = getTemporaryConfigPath(); - doc.reset(); - root = doc.append_child("inputList"); - root.append_copy(actionnode); - } - else - { - 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); - } - } - } - } - } + if(fs::exists(path)) + { + // merge files + pugi::xml_parse_result result = doc.load_file(path.c_str()); + if(!result) + { + LOG(LogError) << "Error parsing input config: " << result.description(); + } + else + { + // successfully loaded, delete the old entry if it exists + pugi::xml_node root = doc.child("inputList"); + if(root) + { + // if inputAction @type=onfinish is set, let onfinish command take care for creating input configuration. + // we just put the input configuration into a temporary input config file. + pugi::xml_node actionnode = root.find_child_by_attribute("inputAction", "type", "onfinish"); + if(actionnode) + { + path = getTemporaryConfigPath(); + doc.reset(); + root = doc.append_child("inputList"); + root.append_copy(actionnode); + } + else + { + 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); + } + } + } + } + } pugi::xml_node root = doc.child("inputList"); if(!root) @@ -356,44 +356,44 @@ void InputManager::writeDeviceConfig(InputConfig* config) void InputManager::doOnFinish() { - assert(initialized()); - std::string path = getConfigPath(); - pugi::xml_document doc; + assert(initialized()); + std::string path = getConfigPath(); + pugi::xml_document doc; - if(fs::exists(path)) - { - pugi::xml_parse_result result = doc.load_file(path.c_str()); - if(!result) - { - LOG(LogError) << "Error parsing input config: " << result.description(); - } - else - { - pugi::xml_node root = doc.child("inputList"); - if(root) - { - root = root.find_child_by_attribute("inputAction", "type", "onfinish"); - if(root) - { - for(pugi::xml_node command = root.child("command"); command; - command = command.next_sibling("command")) - { - std::string tocall = command.text().get(); + if(fs::exists(path)) + { + pugi::xml_parse_result result = doc.load_file(path.c_str()); + if(!result) + { + LOG(LogError) << "Error parsing input config: " << result.description(); + } + else + { + pugi::xml_node root = doc.child("inputList"); + if(root) + { + root = root.find_child_by_attribute("inputAction", "type", "onfinish"); + if(root) + { + for(pugi::xml_node command = root.child("command"); command; + command = command.next_sibling("command")) + { + std::string tocall = command.text().get(); - LOG(LogInfo) << " " << tocall; - std::cout << "==============================================\ninput config finish command:\n"; - int exitCode = runSystemCommand(tocall); - std::cout << "==============================================\n"; + LOG(LogInfo) << " " << tocall; + std::cout << "==============================================\ninput config finish command:\n"; + int exitCode = runSystemCommand(tocall); + std::cout << "==============================================\n"; - if(exitCode != 0) - { - LOG(LogWarning) << "...launch terminated with nonzero exit code " << exitCode << "!"; - } - } - } - } - } - } + if(exitCode != 0) + { + LOG(LogWarning) << "...launch terminated with nonzero exit code " << exitCode << "!"; + } + } + } + } + } + } } std::string InputManager::getConfigPath() diff --git a/es-core/src/guis/GuiInputConfig.cpp b/es-core/src/guis/GuiInputConfig.cpp index d0238ebe8..996133596 100644 --- a/es-core/src/guis/GuiInputConfig.cpp +++ b/es-core/src/guis/GuiInputConfig.cpp @@ -18,111 +18,111 @@ static const int inputCount = 24; static const char* inputName[inputCount] = { - "Up", - "Down", - "Left", - "Right", - "Start", - "Select", - "A", - "B", - "X", - "Y", - "LeftShoulder", - "RightShoulder", - "LeftTrigger", - "RightTrigger", - "LeftThumb", - "RightThumb", - "LeftAnalogUp", - "LeftAnalogDown", - "LeftAnalogLeft", - "LeftAnalogRight", - "RightAnalogUp", - "RightAnalogDown", - "RightAnalogLeft", - "RightAnalogRight" + "Up", + "Down", + "Left", + "Right", + "Start", + "Select", + "A", + "B", + "X", + "Y", + "LeftShoulder", + "RightShoulder", + "LeftTrigger", + "RightTrigger", + "LeftThumb", + "RightThumb", + "LeftAnalogUp", + "LeftAnalogDown", + "LeftAnalogLeft", + "LeftAnalogRight", + "RightAnalogUp", + "RightAnalogDown", + "RightAnalogLeft", + "RightAnalogRight" }; static const bool inputSkippable[inputCount] = { - false, - false, - false, - false, - true, - true, - false, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true, - true + false, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true }; static const char* inputDispName[inputCount] = { - "D-PAD UP", - "D-PAD DOWN", - "D-PAD LEFT", - "D-PAD RIGHT", - "START", - "SELECT", - "A", - "B", - "X", - "Y", - "LEFT SHOULDER", - "RIGHT SHOULDER", - "LEFT TRIGGER", - "RIGHT TRIGGER", - "LEFT THUMB", - "RIGHT THUMB", - "LEFT ANALOG UP", - "LEFT ANALOG DOWN", - "LEFT ANALOG LEFT", - "LEFT ANALOG RIGHT", - "RIGHT ANALOG UP", - "RIGHT ANALOG DOWN", - "RIGHT ANALOG LEFT", - "RIGHT ANALOG RIGHT" + "D-PAD UP", + "D-PAD DOWN", + "D-PAD LEFT", + "D-PAD RIGHT", + "START", + "SELECT", + "A", + "B", + "X", + "Y", + "LEFT SHOULDER", + "RIGHT SHOULDER", + "LEFT TRIGGER", + "RIGHT TRIGGER", + "LEFT THUMB", + "RIGHT THUMB", + "LEFT ANALOG UP", + "LEFT ANALOG DOWN", + "LEFT ANALOG LEFT", + "LEFT ANALOG RIGHT", + "RIGHT ANALOG UP", + "RIGHT ANALOG DOWN", + "RIGHT ANALOG LEFT", + "RIGHT ANALOG RIGHT" }; static const char* inputIcon[inputCount] = { - ":/help/dpad_up.svg", - ":/help/dpad_down.svg", - ":/help/dpad_left.svg", - ":/help/dpad_right.svg", - ":/help/button_start.svg", - ":/help/button_select.svg", - ":/help/button_a.svg", - ":/help/button_b.svg", - ":/help/button_x.svg", - ":/help/button_y.svg", - ":/help/button_l.svg", - ":/help/button_r.svg", - ":/help/button_l.svg", - ":/help/button_r.svg", - ":/help/analog_thumb.svg", - ":/help/analog_thumb.svg", - ":/help/analog_up.svg", - ":/help/analog_down.svg", - ":/help/analog_left.svg", - ":/help/analog_right.svg", - ":/help/analog_up.svg", - ":/help/analog_down.svg", - ":/help/analog_left.svg", - ":/help/analog_right.svg" + ":/help/dpad_up.svg", + ":/help/dpad_down.svg", + ":/help/dpad_left.svg", + ":/help/dpad_right.svg", + ":/help/button_start.svg", + ":/help/button_select.svg", + ":/help/button_a.svg", + ":/help/button_b.svg", + ":/help/button_x.svg", + ":/help/button_y.svg", + ":/help/button_l.svg", + ":/help/button_r.svg", + ":/help/button_l.svg", + ":/help/button_r.svg", + ":/help/analog_thumb.svg", + ":/help/analog_thumb.svg", + ":/help/analog_up.svg", + ":/help/analog_down.svg", + ":/help/analog_left.svg", + ":/help/analog_right.svg", + ":/help/analog_up.svg", + ":/help/analog_down.svg", + ":/help/analog_left.svg", + ":/help/analog_right.svg" }; //MasterVolUp and MasterVolDown are also hooked up, but do not appear on this screen. @@ -285,7 +285,7 @@ void GuiInputConfig::onSizeChanged() mGrid.setRowHeightPerc(5, (mList->getRowHeight(0) * 5 + 2) / mSize.y()); mGrid.setRowHeightPerc(6, mButtonGrid->getSize().y() / mSize.y()); - mBusyAnim.setSize(mSize); + mBusyAnim.setSize(mSize); } void GuiInputConfig::update(int deltaTime)