Joystick code improvements

This commit is contained in:
Jasmine Iwanek
2023-08-14 17:20:48 -04:00
parent 1811115b65
commit 7c0e1f7f83
7 changed files with 63 additions and 56 deletions

View File

@@ -87,9 +87,9 @@ SettingsInput::onCurrentMachineChanged(int machineId)
mouseModel->removeRows(0, removeRows);
ui->comboBoxMouse->setCurrentIndex(selectedRow);
int i = 0;
char *joyName = joystick_get_name(i);
auto *joystickModel = ui->comboBoxJoystick->model();
int i = 0;
const char *joyName = joystick_get_name(i);
auto *joystickModel = ui->comboBoxJoystick->model();
removeRows = joystickModel->rowCount();
selectedRow = 0;
while (joyName) {
@@ -116,7 +116,7 @@ void
SettingsInput::on_comboBoxJoystick_currentIndexChanged(int index)
{
int joystickId = ui->comboBoxJoystick->currentData().toInt();
for (int i = 0; i < 4; ++i) {
for (int i = 0; i < MAX_JOYSTICKS; ++i) {
auto *btn = findChild<QPushButton *>(QString("pushButtonJoystick%1").arg(i + 1));
if (btn == nullptr) {
continue;