diff --git a/src/device/isamem.c b/src/device/isamem.c index a53f5e66c..fcbbbfb15 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -2145,3 +2145,12 @@ isamem_get_device(int board) /* Add the instance to the system. */ return boards[board].dev; } + +int +isamem_has_config(int board) +{ + if (boards[board].dev == NULL) + return 0; + + return (boards[board].dev->config ? 1 : 0); +} diff --git a/src/device/isartc.c b/src/device/isartc.c index 46f31c137..fea108426 100644 --- a/src/device/isartc.c +++ b/src/device/isartc.c @@ -815,3 +815,12 @@ isartc_get_device(int board) { return (boards[board].dev); } + +int +isartc_has_config(int board) +{ + if (boards[board].dev == NULL) + return 0; + + return (boards[board].dev->config ? 1 : 0); +} diff --git a/src/include/86box/isamem.h b/src/include/86box/isamem.h index 9a1841c53..51fe50e33 100644 --- a/src/include/86box/isamem.h +++ b/src/include/86box/isamem.h @@ -64,6 +64,7 @@ extern const char *isamem_get_name(int t); extern const char *isamem_get_internal_name(int t); extern int isamem_get_from_internal_name(const char *s); extern const device_t *isamem_get_device(int t); +extern int isamem_has_config(int board); #ifdef __cplusplus } diff --git a/src/include/86box/isartc.h b/src/include/86box/isartc.h index 92c58e350..0224180b3 100644 --- a/src/include/86box/isartc.h +++ b/src/include/86box/isartc.h @@ -58,6 +58,7 @@ extern void isartc_reset(void); extern const char *isartc_get_internal_name(int t); extern int isartc_get_from_internal_name(char *s); extern const device_t *isartc_get_device(int t); +extern int isartc_has_config(int board); #ifdef __cplusplus } diff --git a/src/qt/qt_settingsotherperipherals.cpp b/src/qt/qt_settingsotherperipherals.cpp index 3904b653a..a7db551ad 100644 --- a/src/qt/qt_settingsotherperipherals.cpp +++ b/src/qt/qt_settingsotherperipherals.cpp @@ -81,6 +81,7 @@ SettingsOtherPeripherals::onCurrentMachineChanged(int machineId) ++d; } ui->comboBoxRTC->setCurrentIndex(selectedRow); + ui->pushButtonConfigureRTC->setEnabled((isartc_type != 0) && isartc_has_config(isartc_type) && machineHasIsa); for (int c = 0; c < ISAMEM_MAX; c++) { auto *cbox = findChild(QString("comboBoxCard%1").arg(c + 1)); @@ -106,7 +107,7 @@ SettingsOtherPeripherals::onCurrentMachineChanged(int machineId) cbox->setCurrentIndex(-1); cbox->setCurrentIndex(selectedRow); cbox->setEnabled(machineHasIsa); - findChild(QString("pushButtonConfigureCard%1").arg(c + 1))->setEnabled(isamem_type[c] != 0 && machineHasIsa); + findChild(QString("pushButtonConfigureCard%1").arg(c + 1))->setEnabled((isamem_type[c] != 0) && isamem_has_config(isamem_type[c]) && machineHasIsa); } } @@ -138,7 +139,7 @@ SettingsOtherPeripherals::on_comboBoxRTC_currentIndexChanged(int index) if (index < 0) { return; } - ui->pushButtonConfigureRTC->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA)); + ui->pushButtonConfigureRTC->setEnabled((index != 0) && isartc_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void @@ -153,7 +154,7 @@ SettingsOtherPeripherals::on_comboBoxCard1_currentIndexChanged(int index) if (index < 0) { return; } - ui->pushButtonConfigureCard1->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA)); + ui->pushButtonConfigureCard1->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void @@ -168,7 +169,7 @@ SettingsOtherPeripherals::on_comboBoxCard2_currentIndexChanged(int index) if (index < 0) { return; } - ui->pushButtonConfigureCard2->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA)); + ui->pushButtonConfigureCard2->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void @@ -183,7 +184,7 @@ SettingsOtherPeripherals::on_comboBoxCard3_currentIndexChanged(int index) if (index < 0) { return; } - ui->pushButtonConfigureCard3->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA)); + ui->pushButtonConfigureCard3->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void @@ -198,7 +199,7 @@ SettingsOtherPeripherals::on_comboBoxCard4_currentIndexChanged(int index) if (index < 0) { return; } - ui->pushButtonConfigureCard4->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA)); + ui->pushButtonConfigureCard4->setEnabled((index != 0) && isamem_has_config(index) && machine_has_bus(machineId, MACHINE_BUS_ISA)); } void