MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / loadFromXML

Method loadFromXML

src/InputConfig.cpp:128–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void InputConfig::loadFromXML(pugi::xml_node node, int playerNum)
129{
130 this->clear();
131
132 setPlayerNum(playerNum);
133
134 for(pugi::xml_node input = node.child("input"); input; input = input.next_sibling("input"))
135 {
136 std::string name = input.attribute("name").as_string();
137 std::string type = input.attribute("type").as_string();
138 InputType typeEnum = stringToInputType(type);
139
140 if(typeEnum == TYPE_COUNT)
141 {
142 LOG(LogError) << "InputConfig load error - input of type \"" << type << "\" is invalid! Skipping input \"" << name << "\".\n";
143 continue;
144 }
145
146 int id = input.attribute("id").as_int();
147 int value = input.attribute("value").as_int();
148
149 if(value == 0)
150 LOG(LogWarning) << "WARNING: InputConfig value is 0 for " << type << " " << id << "!\n";
151
152 mNameMap[toLower(name)] = Input(mDeviceId, typeEnum, id, value, true);
153 }
154}
155
156void InputConfig::writeToXML(pugi::xml_node parent)
157{

Callers 1

loadConfigMethod · 0.80

Calls 9

clearMethod · 0.95
stringToInputTypeFunction · 0.85
toLowerFunction · 0.85
InputClass · 0.85
childMethod · 0.80
next_siblingMethod · 0.80
as_stringMethod · 0.80
attributeMethod · 0.80
as_intMethod · 0.80

Tested by

no test coverage detected