diff options
| -rw-r--r-- | src/input_common/main.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 57 |
2 files changed, 30 insertions, 35 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 354c734fe..b438482cc 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -96,10 +96,6 @@ struct InputSubsystem::Impl { | |||
| 96 | if (!params.Has("class") || params.Get("class", "") == "any") { | 96 | if (!params.Has("class") || params.Get("class", "") == "any") { |
| 97 | return {}; | 97 | return {}; |
| 98 | } | 98 | } |
| 99 | if (params.Get("class", "") == "keyboard") { | ||
| 100 | // TODO consider returning the SDL key codes for the default keybindings | ||
| 101 | return {}; | ||
| 102 | } | ||
| 103 | if (params.Get("class", "") == "gcpad") { | 99 | if (params.Get("class", "") == "gcpad") { |
| 104 | return gcadapter->GetAnalogMappingForDevice(params); | 100 | return gcadapter->GetAnalogMappingForDevice(params); |
| 105 | } | 101 | } |
| @@ -116,10 +112,6 @@ struct InputSubsystem::Impl { | |||
| 116 | if (!params.Has("class") || params.Get("class", "") == "any") { | 112 | if (!params.Has("class") || params.Get("class", "") == "any") { |
| 117 | return {}; | 113 | return {}; |
| 118 | } | 114 | } |
| 119 | if (params.Get("class", "") == "keyboard") { | ||
| 120 | // TODO consider returning the SDL key codes for the default keybindings | ||
| 121 | return {}; | ||
| 122 | } | ||
| 123 | if (params.Get("class", "") == "gcpad") { | 115 | if (params.Get("class", "") == "gcpad") { |
| 124 | return gcadapter->GetButtonMappingForDevice(params); | 116 | return gcadapter->GetButtonMappingForDevice(params); |
| 125 | } | 117 | } |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 213a76224..460ff08a4 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -693,32 +693,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() { | |||
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | void ConfigureInputPlayer::RestoreDefaults() { | 695 | void ConfigureInputPlayer::RestoreDefaults() { |
| 696 | // Reset Buttons | 696 | UpdateMappingWithDefaults(); |
| 697 | for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) { | ||
| 698 | buttons_param[button_id] = Common::ParamPackage{ | ||
| 699 | InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])}; | ||
| 700 | } | ||
| 701 | |||
| 702 | // Reset Analogs and Modifier Buttons | ||
| 703 | for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) { | ||
| 704 | for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) { | ||
| 705 | Common::ParamPackage params{InputCommon::GenerateKeyboardParam( | ||
| 706 | Config::default_analogs[analog_id][sub_button_id])}; | ||
| 707 | SetAnalogParam(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]); | ||
| 708 | } | ||
| 709 | |||
| 710 | analogs_param[analog_id].Set( | ||
| 711 | "modifier", InputCommon::GenerateKeyboardParam(Config::default_stick_mod[analog_id])); | ||
| 712 | } | ||
| 713 | |||
| 714 | for (int motion_id = 0; motion_id < Settings::NativeMotion::NumMotions; ++motion_id) { | ||
| 715 | motions_param[motion_id] = Common::ParamPackage{ | ||
| 716 | InputCommon::GenerateKeyboardParam(Config::default_motions[motion_id])}; | ||
| 717 | } | ||
| 718 | |||
| 719 | UpdateUI(); | ||
| 720 | UpdateInputDeviceCombobox(); | ||
| 721 | ui->comboControllerType->setCurrentIndex(0); | ||
| 722 | } | 697 | } |
| 723 | 698 | ||
| 724 | void ConfigureInputPlayer::ClearAll() { | 699 | void ConfigureInputPlayer::ClearAll() { |
| @@ -951,9 +926,37 @@ void ConfigureInputPlayer::UpdateMotionButtons() { | |||
| 951 | } | 926 | } |
| 952 | 927 | ||
| 953 | void ConfigureInputPlayer::UpdateMappingWithDefaults() { | 928 | void ConfigureInputPlayer::UpdateMappingWithDefaults() { |
| 954 | if (ui->comboDevices->currentIndex() < 2) { | 929 | if (ui->comboDevices->currentIndex() == 0) { |
| 955 | return; | 930 | return; |
| 956 | } | 931 | } |
| 932 | |||
| 933 | if (ui->comboDevices->currentIndex() == 1) { | ||
| 934 | // Reset keyboard bindings | ||
| 935 | for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) { | ||
| 936 | buttons_param[button_id] = Common::ParamPackage{ | ||
| 937 | InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])}; | ||
| 938 | } | ||
| 939 | for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) { | ||
| 940 | for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) { | ||
| 941 | Common::ParamPackage params{InputCommon::GenerateKeyboardParam( | ||
| 942 | Config::default_analogs[analog_id][sub_button_id])}; | ||
| 943 | SetAnalogParam(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]); | ||
| 944 | } | ||
| 945 | |||
| 946 | analogs_param[analog_id].Set("modifier", InputCommon::GenerateKeyboardParam( | ||
| 947 | Config::default_stick_mod[analog_id])); | ||
| 948 | } | ||
| 949 | |||
| 950 | for (int motion_id = 0; motion_id < Settings::NativeMotion::NumMotions; ++motion_id) { | ||
| 951 | motions_param[motion_id] = Common::ParamPackage{ | ||
| 952 | InputCommon::GenerateKeyboardParam(Config::default_motions[motion_id])}; | ||
| 953 | } | ||
| 954 | |||
| 955 | UpdateUI(); | ||
| 956 | return; | ||
| 957 | } | ||
| 958 | |||
| 959 | // Reset controller bindings | ||
| 957 | const auto& device = input_devices[ui->comboDevices->currentIndex()]; | 960 | const auto& device = input_devices[ui->comboDevices->currentIndex()]; |
| 958 | auto button_mapping = input_subsystem->GetButtonMappingForDevice(device); | 961 | auto button_mapping = input_subsystem->GetButtonMappingForDevice(device); |
| 959 | auto analog_mapping = input_subsystem->GetAnalogMappingForDevice(device); | 962 | auto analog_mapping = input_subsystem->GetAnalogMappingForDevice(device); |