| 90 | } |
| 91 | |
| 92 | std::vector<std::string> InputConfig::getMappedTo(Input input) |
| 93 | { |
| 94 | std::vector<std::string> maps; |
| 95 | |
| 96 | typedef std::map<std::string, Input>::iterator it_type; |
| 97 | for(it_type iterator = mNameMap.begin(); iterator != mNameMap.end(); iterator++) |
| 98 | { |
| 99 | Input chk = iterator->second; |
| 100 | |
| 101 | if(!chk.configured) |
| 102 | continue; |
| 103 | |
| 104 | if(chk.device == input.device && chk.type == input.type && chk.id == input.id) |
| 105 | { |
| 106 | if(chk.type == TYPE_HAT) |
| 107 | { |
| 108 | if(input.value == 0 || input.value & chk.value) |
| 109 | { |
| 110 | maps.push_back(iterator->first); |
| 111 | } |
| 112 | continue; |
| 113 | } |
| 114 | |
| 115 | if(input.type == TYPE_AXIS) |
| 116 | { |
| 117 | if(input.value == 0 || chk.value == input.value) |
| 118 | maps.push_back(iterator->first); |
| 119 | }else{ |
| 120 | maps.push_back(iterator->first); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | return maps; |
| 126 | } |
| 127 | |
| 128 | void InputConfig::loadFromXML(pugi::xml_node node, int playerNum) |
| 129 | { |