mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
cosmetic - spaces -> tabs to match rest of file
This commit is contained in:
parent
d14195e4a0
commit
fa513e4c2d
|
@ -293,54 +293,54 @@ void InputManager::loadDefaultKBConfig()
|
||||||
|
|
||||||
void InputManager::writeDeviceConfig(InputConfig* config)
|
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))
|
if(fs::exists(path))
|
||||||
{
|
{
|
||||||
// merge files
|
// merge files
|
||||||
pugi::xml_parse_result result = doc.load_file(path.c_str());
|
pugi::xml_parse_result result = doc.load_file(path.c_str());
|
||||||
if(!result)
|
if(!result)
|
||||||
{
|
{
|
||||||
LOG(LogError) << "Error parsing input config: " << result.description();
|
LOG(LogError) << "Error parsing input config: " << result.description();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// successfully loaded, delete the old entry if it exists
|
// successfully loaded, delete the old entry if it exists
|
||||||
pugi::xml_node root = doc.child("inputList");
|
pugi::xml_node root = doc.child("inputList");
|
||||||
if(root)
|
if(root)
|
||||||
{
|
{
|
||||||
// if inputAction @type=onfinish is set, let onfinish command take care for creating input configuration.
|
// 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.
|
// we just put the input configuration into a temporary input config file.
|
||||||
pugi::xml_node actionnode = root.find_child_by_attribute("inputAction", "type", "onfinish");
|
pugi::xml_node actionnode = root.find_child_by_attribute("inputAction", "type", "onfinish");
|
||||||
if(actionnode)
|
if(actionnode)
|
||||||
{
|
{
|
||||||
path = getTemporaryConfigPath();
|
path = getTemporaryConfigPath();
|
||||||
doc.reset();
|
doc.reset();
|
||||||
root = doc.append_child("inputList");
|
root = doc.append_child("inputList");
|
||||||
root.append_copy(actionnode);
|
root.append_copy(actionnode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pugi::xml_node oldEntry = root.find_child_by_attribute("inputConfig", "deviceGUID",
|
pugi::xml_node oldEntry = root.find_child_by_attribute("inputConfig", "deviceGUID",
|
||||||
config->getDeviceGUIDString().c_str());
|
config->getDeviceGUIDString().c_str());
|
||||||
if(oldEntry)
|
if(oldEntry)
|
||||||
{
|
{
|
||||||
root.remove_child(oldEntry);
|
root.remove_child(oldEntry);
|
||||||
}
|
}
|
||||||
oldEntry = root.find_child_by_attribute("inputConfig", "deviceName",
|
oldEntry = root.find_child_by_attribute("inputConfig", "deviceName",
|
||||||
config->getDeviceName().c_str());
|
config->getDeviceName().c_str());
|
||||||
if(oldEntry)
|
if(oldEntry)
|
||||||
{
|
{
|
||||||
root.remove_child(oldEntry);
|
root.remove_child(oldEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pugi::xml_node root = doc.child("inputList");
|
pugi::xml_node root = doc.child("inputList");
|
||||||
if(!root)
|
if(!root)
|
||||||
|
@ -356,44 +356,44 @@ void InputManager::writeDeviceConfig(InputConfig* config)
|
||||||
|
|
||||||
void InputManager::doOnFinish()
|
void InputManager::doOnFinish()
|
||||||
{
|
{
|
||||||
assert(initialized());
|
assert(initialized());
|
||||||
std::string path = getConfigPath();
|
std::string path = getConfigPath();
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
|
|
||||||
if(fs::exists(path))
|
if(fs::exists(path))
|
||||||
{
|
{
|
||||||
pugi::xml_parse_result result = doc.load_file(path.c_str());
|
pugi::xml_parse_result result = doc.load_file(path.c_str());
|
||||||
if(!result)
|
if(!result)
|
||||||
{
|
{
|
||||||
LOG(LogError) << "Error parsing input config: " << result.description();
|
LOG(LogError) << "Error parsing input config: " << result.description();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pugi::xml_node root = doc.child("inputList");
|
pugi::xml_node root = doc.child("inputList");
|
||||||
if(root)
|
if(root)
|
||||||
{
|
{
|
||||||
root = root.find_child_by_attribute("inputAction", "type", "onfinish");
|
root = root.find_child_by_attribute("inputAction", "type", "onfinish");
|
||||||
if(root)
|
if(root)
|
||||||
{
|
{
|
||||||
for(pugi::xml_node command = root.child("command"); command;
|
for(pugi::xml_node command = root.child("command"); command;
|
||||||
command = command.next_sibling("command"))
|
command = command.next_sibling("command"))
|
||||||
{
|
{
|
||||||
std::string tocall = command.text().get();
|
std::string tocall = command.text().get();
|
||||||
|
|
||||||
LOG(LogInfo) << " " << tocall;
|
LOG(LogInfo) << " " << tocall;
|
||||||
std::cout << "==============================================\ninput config finish command:\n";
|
std::cout << "==============================================\ninput config finish command:\n";
|
||||||
int exitCode = runSystemCommand(tocall);
|
int exitCode = runSystemCommand(tocall);
|
||||||
std::cout << "==============================================\n";
|
std::cout << "==============================================\n";
|
||||||
|
|
||||||
if(exitCode != 0)
|
if(exitCode != 0)
|
||||||
{
|
{
|
||||||
LOG(LogWarning) << "...launch terminated with nonzero exit code " << exitCode << "!";
|
LOG(LogWarning) << "...launch terminated with nonzero exit code " << exitCode << "!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string InputManager::getConfigPath()
|
std::string InputManager::getConfigPath()
|
||||||
|
|
|
@ -18,111 +18,111 @@
|
||||||
static const int inputCount = 24;
|
static const int inputCount = 24;
|
||||||
static const char* inputName[inputCount] =
|
static const char* inputName[inputCount] =
|
||||||
{
|
{
|
||||||
"Up",
|
"Up",
|
||||||
"Down",
|
"Down",
|
||||||
"Left",
|
"Left",
|
||||||
"Right",
|
"Right",
|
||||||
"Start",
|
"Start",
|
||||||
"Select",
|
"Select",
|
||||||
"A",
|
"A",
|
||||||
"B",
|
"B",
|
||||||
"X",
|
"X",
|
||||||
"Y",
|
"Y",
|
||||||
"LeftShoulder",
|
"LeftShoulder",
|
||||||
"RightShoulder",
|
"RightShoulder",
|
||||||
"LeftTrigger",
|
"LeftTrigger",
|
||||||
"RightTrigger",
|
"RightTrigger",
|
||||||
"LeftThumb",
|
"LeftThumb",
|
||||||
"RightThumb",
|
"RightThumb",
|
||||||
"LeftAnalogUp",
|
"LeftAnalogUp",
|
||||||
"LeftAnalogDown",
|
"LeftAnalogDown",
|
||||||
"LeftAnalogLeft",
|
"LeftAnalogLeft",
|
||||||
"LeftAnalogRight",
|
"LeftAnalogRight",
|
||||||
"RightAnalogUp",
|
"RightAnalogUp",
|
||||||
"RightAnalogDown",
|
"RightAnalogDown",
|
||||||
"RightAnalogLeft",
|
"RightAnalogLeft",
|
||||||
"RightAnalogRight"
|
"RightAnalogRight"
|
||||||
};
|
};
|
||||||
static const bool inputSkippable[inputCount] =
|
static const bool inputSkippable[inputCount] =
|
||||||
{
|
{
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
static const char* inputDispName[inputCount] =
|
static const char* inputDispName[inputCount] =
|
||||||
{
|
{
|
||||||
"D-PAD UP",
|
"D-PAD UP",
|
||||||
"D-PAD DOWN",
|
"D-PAD DOWN",
|
||||||
"D-PAD LEFT",
|
"D-PAD LEFT",
|
||||||
"D-PAD RIGHT",
|
"D-PAD RIGHT",
|
||||||
"START",
|
"START",
|
||||||
"SELECT",
|
"SELECT",
|
||||||
"A",
|
"A",
|
||||||
"B",
|
"B",
|
||||||
"X",
|
"X",
|
||||||
"Y",
|
"Y",
|
||||||
"LEFT SHOULDER",
|
"LEFT SHOULDER",
|
||||||
"RIGHT SHOULDER",
|
"RIGHT SHOULDER",
|
||||||
"LEFT TRIGGER",
|
"LEFT TRIGGER",
|
||||||
"RIGHT TRIGGER",
|
"RIGHT TRIGGER",
|
||||||
"LEFT THUMB",
|
"LEFT THUMB",
|
||||||
"RIGHT THUMB",
|
"RIGHT THUMB",
|
||||||
"LEFT ANALOG UP",
|
"LEFT ANALOG UP",
|
||||||
"LEFT ANALOG DOWN",
|
"LEFT ANALOG DOWN",
|
||||||
"LEFT ANALOG LEFT",
|
"LEFT ANALOG LEFT",
|
||||||
"LEFT ANALOG RIGHT",
|
"LEFT ANALOG RIGHT",
|
||||||
"RIGHT ANALOG UP",
|
"RIGHT ANALOG UP",
|
||||||
"RIGHT ANALOG DOWN",
|
"RIGHT ANALOG DOWN",
|
||||||
"RIGHT ANALOG LEFT",
|
"RIGHT ANALOG LEFT",
|
||||||
"RIGHT ANALOG RIGHT"
|
"RIGHT ANALOG RIGHT"
|
||||||
};
|
};
|
||||||
static const char* inputIcon[inputCount] =
|
static const char* inputIcon[inputCount] =
|
||||||
{
|
{
|
||||||
":/help/dpad_up.svg",
|
":/help/dpad_up.svg",
|
||||||
":/help/dpad_down.svg",
|
":/help/dpad_down.svg",
|
||||||
":/help/dpad_left.svg",
|
":/help/dpad_left.svg",
|
||||||
":/help/dpad_right.svg",
|
":/help/dpad_right.svg",
|
||||||
":/help/button_start.svg",
|
":/help/button_start.svg",
|
||||||
":/help/button_select.svg",
|
":/help/button_select.svg",
|
||||||
":/help/button_a.svg",
|
":/help/button_a.svg",
|
||||||
":/help/button_b.svg",
|
":/help/button_b.svg",
|
||||||
":/help/button_x.svg",
|
":/help/button_x.svg",
|
||||||
":/help/button_y.svg",
|
":/help/button_y.svg",
|
||||||
":/help/button_l.svg",
|
":/help/button_l.svg",
|
||||||
":/help/button_r.svg",
|
":/help/button_r.svg",
|
||||||
":/help/button_l.svg",
|
":/help/button_l.svg",
|
||||||
":/help/button_r.svg",
|
":/help/button_r.svg",
|
||||||
":/help/analog_thumb.svg",
|
":/help/analog_thumb.svg",
|
||||||
":/help/analog_thumb.svg",
|
":/help/analog_thumb.svg",
|
||||||
":/help/analog_up.svg",
|
":/help/analog_up.svg",
|
||||||
":/help/analog_down.svg",
|
":/help/analog_down.svg",
|
||||||
":/help/analog_left.svg",
|
":/help/analog_left.svg",
|
||||||
":/help/analog_right.svg",
|
":/help/analog_right.svg",
|
||||||
":/help/analog_up.svg",
|
":/help/analog_up.svg",
|
||||||
":/help/analog_down.svg",
|
":/help/analog_down.svg",
|
||||||
":/help/analog_left.svg",
|
":/help/analog_left.svg",
|
||||||
":/help/analog_right.svg"
|
":/help/analog_right.svg"
|
||||||
};
|
};
|
||||||
|
|
||||||
//MasterVolUp and MasterVolDown are also hooked up, but do not appear on this screen.
|
//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(5, (mList->getRowHeight(0) * 5 + 2) / mSize.y());
|
||||||
mGrid.setRowHeightPerc(6, mButtonGrid->getSize().y() / mSize.y());
|
mGrid.setRowHeightPerc(6, mButtonGrid->getSize().y() / mSize.y());
|
||||||
|
|
||||||
mBusyAnim.setSize(mSize);
|
mBusyAnim.setSize(mSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiInputConfig::update(int deltaTime)
|
void GuiInputConfig::update(int deltaTime)
|
||||||
|
|
Loading…
Reference in a new issue