diff --git a/Source/RMG-Input-GCA/UserInterface/MainDialog.cpp b/Source/RMG-Input-GCA/UserInterface/MainDialog.cpp index e4d2b3a8..8b89ecbe 100644 --- a/Source/RMG-Input-GCA/UserInterface/MainDialog.cpp +++ b/Source/RMG-Input-GCA/UserInterface/MainDialog.cpp @@ -21,6 +21,7 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent) this->sensitivitySlider->setValue(CoreSettingsGetIntValue(SettingsID::GCAInput_Sensitivity)); this->triggerTresholdSlider->setValue(CoreSettingsGetIntValue(SettingsID::GCAInput_TriggerTreshold)); this->cButtonTresholdSlider->setValue(CoreSettingsGetIntValue(SettingsID::GCAInput_CButtonTreshold)); + this->swapZLCheckBox->setChecked(CoreSettingsGetBoolValue(SettingsID::GCAInput_SwapZL)); } MainDialog::~MainDialog() @@ -39,6 +40,7 @@ void MainDialog::on_buttonBox_clicked(QAbstractButton* button) CoreSettingsSetValue(SettingsID::GCAInput_Sensitivity, this->sensitivitySlider->value()); CoreSettingsSetValue(SettingsID::GCAInput_TriggerTreshold, this->triggerTresholdSlider->value()); CoreSettingsSetValue(SettingsID::GCAInput_CButtonTreshold, this->cButtonTresholdSlider->value()); + CoreSettingsSetValue(SettingsID::GCAInput_SwapZL, this->swapZLCheckBox->isChecked()); CoreSettingsSave(); } else if (pushButton == defaultButton) @@ -47,6 +49,7 @@ void MainDialog::on_buttonBox_clicked(QAbstractButton* button) this->sensitivitySlider->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GCAInput_Sensitivity)); this->triggerTresholdSlider->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GCAInput_TriggerTreshold)); this->cButtonTresholdSlider->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GCAInput_CButtonTreshold)); + this->swapZLCheckBox->setChecked(CoreSettingsGetDefaultBoolValue(SettingsID::GCAInput_SwapZL)); } } diff --git a/Source/RMG-Input-GCA/UserInterface/MainDialog.ui b/Source/RMG-Input-GCA/UserInterface/MainDialog.ui index 329f7568..bc880dfa 100644 --- a/Source/RMG-Input-GCA/UserInterface/MainDialog.ui +++ b/Source/RMG-Input-GCA/UserInterface/MainDialog.ui @@ -90,6 +90,22 @@ + + + + Buttons + + + + + + Swap Z and L + + + + + + diff --git a/Source/RMG-Input-GCA/main.cpp b/Source/RMG-Input-GCA/main.cpp index 18ff0dfc..34f7c599 100644 --- a/Source/RMG-Input-GCA/main.cpp +++ b/Source/RMG-Input-GCA/main.cpp @@ -52,6 +52,8 @@ struct SettingsProfile double TriggerTreshold = 0.5; double CButtonTreshold = 0.4; + + bool SwapZL = false; }; struct GameCubeAdapterControllerState @@ -307,6 +309,7 @@ static void load_settings(void) l_Settings.SensitivityValue = static_cast(CoreSettingsGetIntValue(SettingsID::GCAInput_Sensitivity)) / 100.0; l_Settings.CButtonTreshold = static_cast(CoreSettingsGetIntValue(SettingsID::GCAInput_CButtonTreshold)) / 100.0; l_Settings.TriggerTreshold = static_cast(CoreSettingsGetIntValue(SettingsID::GCAInput_TriggerTreshold)) / 100.0; + l_Settings.SwapZL = CoreSettingsGetBoolValue(SettingsID::GCAInput_SwapZL); } static double apply_deadzone(const double input, const double deadzone) @@ -424,15 +427,15 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys) Keys->R_DPAD = state.DpadRight; Keys->D_DPAD = state.DpadDown; Keys->U_DPAD = state.DpadUp; - Keys->Z_TRIG = state.Z; const int triggerTreshold = INT8_MAX * l_Settings.TriggerTreshold; const int cStickTreshold = INT8_MAX * l_Settings.CButtonTreshold; const int8_t cX = static_cast(state.RightStickX + 128); const int8_t cY = static_cast(state.RightStickY + 128); - Keys->L_TRIG = state.LeftTrigger > triggerTreshold; Keys->R_TRIG = state.RightTrigger > triggerTreshold; + Keys->L_TRIG = l_Settings.SwapZL ? state.Z : (state.LeftTrigger > triggerTreshold); + Keys->Z_TRIG = l_Settings.SwapZL ? (state.LeftTrigger > triggerTreshold) : state.Z; Keys->L_CBUTTON = cX < -cStickTreshold; Keys->R_CBUTTON = cX > cStickTreshold;