Core: Unbreak default keyboard mappings.

This commit is contained in:
Jordan Woyak 2020-09-26 08:25:56 -05:00
parent c64d41d3e7
commit 24771aac5a
2 changed files with 20 additions and 37 deletions

View File

@ -190,7 +190,7 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
m_buttons->SetControlExpression(5, "RETURN"); // Start m_buttons->SetControlExpression(5, "RETURN"); // Start
#else #else
// OS X/Linux // OS X/Linux
m_buttons->SetControlExpression(5, "Return"); // Start m_buttons->SetControlExpression(5, "Return"); // Start
#endif #endif
// stick modifiers to 50 % // stick modifiers to 50 %
@ -208,38 +208,28 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
m_c_stick->SetControlExpression(1, "K"); // Down m_c_stick->SetControlExpression(1, "K"); // Down
m_c_stick->SetControlExpression(2, "J"); // Left m_c_stick->SetControlExpression(2, "J"); // Left
m_c_stick->SetControlExpression(3, "L"); // Right m_c_stick->SetControlExpression(3, "L"); // Right
#ifdef _WIN32
m_c_stick->SetControlExpression(4, "LCONTROL"); // Modifier
// Control Stick
m_main_stick->SetControlExpression(0, "UP"); // Up
m_main_stick->SetControlExpression(1, "DOWN"); // Down
m_main_stick->SetControlExpression(2, "LEFT"); // Left
m_main_stick->SetControlExpression(3, "RIGHT"); // Right
m_main_stick->SetControlExpression(4, "LSHIFT"); // Modifier
#elif __APPLE__
// Modifier // Modifier
m_c_stick->SetControlExpression(4, "Left Control"); m_c_stick->SetControlExpression(4, "Ctrl");
// Control Stick // Control Stick
#ifdef _WIN32
m_main_stick->SetControlExpression(0, "UP"); // Up
m_main_stick->SetControlExpression(1, "DOWN"); // Down
m_main_stick->SetControlExpression(2, "LEFT"); // Left
m_main_stick->SetControlExpression(3, "RIGHT"); // Right
#elif __APPLE__
m_main_stick->SetControlExpression(0, "Up Arrow"); // Up m_main_stick->SetControlExpression(0, "Up Arrow"); // Up
m_main_stick->SetControlExpression(1, "Down Arrow"); // Down m_main_stick->SetControlExpression(1, "Down Arrow"); // Down
m_main_stick->SetControlExpression(2, "Left Arrow"); // Left m_main_stick->SetControlExpression(2, "Left Arrow"); // Left
m_main_stick->SetControlExpression(3, "Right Arrow"); // Right m_main_stick->SetControlExpression(3, "Right Arrow"); // Right
m_main_stick->SetControlExpression(4, "Left Shift"); // Modifier
#else #else
// not sure if these are right m_main_stick->SetControlExpression(0, "Up"); // Up
m_main_stick->SetControlExpression(1, "Down"); // Down
m_c_stick->SetControlExpression(4, "Control_L"); // Modifier m_main_stick->SetControlExpression(2, "Left"); // Left
m_main_stick->SetControlExpression(3, "Right"); // Right
// Control Stick
m_main_stick->SetControlExpression(0, "Up"); // Up
m_main_stick->SetControlExpression(1, "Down"); // Down
m_main_stick->SetControlExpression(2, "Left"); // Left
m_main_stick->SetControlExpression(3, "Right"); // Right
m_main_stick->SetControlExpression(4, "Shift_L"); // Modifier
#endif #endif
// Modifier
m_main_stick->SetControlExpression(4, "Shift");
// Because our defaults use keyboard input, set calibration shapes to squares. // Because our defaults use keyboard input, set calibration shapes to squares.
m_c_stick->SetCalibrationFromGate(ControllerEmu::SquareStickGate(1.0)); m_c_stick->SetCalibrationFromGate(ControllerEmu::SquareStickGate(1.0));

View File

@ -415,15 +415,8 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
->control_ref->SetExpression(expression); ->control_ref->SetExpression(expression);
}; };
auto hotkey_string = [](std::vector<std::string_view> inputs) { auto hotkey_string = [](std::vector<std::string> inputs) {
std::string result; return "@(" + JoinStrings(inputs, "+") + ')';
for (auto& input : inputs)
{
if (!result.empty())
result += '+';
result += input;
}
return "@(" + result + ')';
}; };
// General hotkeys // General hotkeys
@ -453,8 +446,8 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
#endif #endif
// Freelook // Freelook
set_key_expression(HK_FREELOOK_DECREASE_SPEED, hotkey_string({"Shift", "1"})); set_key_expression(HK_FREELOOK_DECREASE_SPEED, hotkey_string({"Shift", "`1`"}));
set_key_expression(HK_FREELOOK_INCREASE_SPEED, hotkey_string({"Shift", "2"})); set_key_expression(HK_FREELOOK_INCREASE_SPEED, hotkey_string({"Shift", "`2`"}));
set_key_expression(HK_FREELOOK_RESET_SPEED, hotkey_string({"Shift", "F"})); set_key_expression(HK_FREELOOK_RESET_SPEED, hotkey_string({"Shift", "F"}));
set_key_expression(HK_FREELOOK_UP, hotkey_string({"Shift", "E"})); set_key_expression(HK_FREELOOK_UP, hotkey_string({"Shift", "E"}));
set_key_expression(HK_FREELOOK_DOWN, hotkey_string({"Shift", "Q"})); set_key_expression(HK_FREELOOK_DOWN, hotkey_string({"Shift", "Q"}));
@ -471,9 +464,9 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
// Savestates // Savestates
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
set_key_expression(HK_LOAD_STATE_SLOT_1 + i, fmt::format("F%d", i + 1)); set_key_expression(HK_LOAD_STATE_SLOT_1 + i, fmt::format("F{}", i + 1));
set_key_expression(HK_SAVE_STATE_SLOT_1 + i, set_key_expression(HK_SAVE_STATE_SLOT_1 + i,
hotkey_string({"Shift", fmt::format("F%d", i + 1)})); hotkey_string({"Shift", fmt::format("F{}", i + 1)}));
} }
set_key_expression(HK_UNDO_LOAD_STATE, "F12"); set_key_expression(HK_UNDO_LOAD_STATE, "F12");
set_key_expression(HK_UNDO_SAVE_STATE, hotkey_string({"Shift", "F12"})); set_key_expression(HK_UNDO_SAVE_STATE, hotkey_string({"Shift", "F12"}));