Include HID and configuration changes related to motion
This commit is contained in:
parent
80a56e8893
commit
ff679f3d17
13 changed files with 448 additions and 16 deletions
|
@ -36,6 +36,11 @@ const std::array<int, Settings::NativeButton::NumButtons> Config::default_button
|
|||
Qt::Key_H, Qt::Key_G, Qt::Key_D, Qt::Key_C, Qt::Key_B, Qt::Key_V,
|
||||
};
|
||||
|
||||
const std::array<int, Settings::NativeMotion::NumMotions> Config::default_motions = {
|
||||
Qt::Key_7,
|
||||
Qt::Key_8,
|
||||
};
|
||||
|
||||
const std::array<std::array<int, 4>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{
|
||||
{
|
||||
Qt::Key_Up,
|
||||
|
@ -284,6 +289,22 @@ void Config::ReadPlayerValues() {
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Settings::NativeMotion::NumMotions; ++i) {
|
||||
const std::string default_param =
|
||||
InputCommon::GenerateKeyboardParam(default_motions[i]);
|
||||
auto& player_motions = player.motions[i];
|
||||
|
||||
player_motions = qt_config
|
||||
->value(QStringLiteral("player_%1_").arg(p) +
|
||||
QString::fromUtf8(Settings::NativeMotion::mapping[i]),
|
||||
QString::fromStdString(default_param))
|
||||
.toString()
|
||||
.toStdString();
|
||||
if (player_motions.empty()) {
|
||||
player_motions = default_param;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
|
||||
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
|
||||
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
|
||||
|
@ -922,6 +943,14 @@ void Config::SavePlayerValues() {
|
|||
QString::fromStdString(player.buttons[i]),
|
||||
QString::fromStdString(default_param));
|
||||
}
|
||||
for (int i = 0; i < Settings::NativeMotion::NumMotions; ++i) {
|
||||
const std::string default_param =
|
||||
InputCommon::GenerateKeyboardParam(default_motions[i]);
|
||||
WriteSetting(QStringLiteral("player_%1_").arg(p) +
|
||||
QString::fromStdString(Settings::NativeMotion::mapping[i]),
|
||||
QString::fromStdString(player.motions[i]),
|
||||
QString::fromStdString(default_param));
|
||||
}
|
||||
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
|
||||
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
|
||||
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue