ISA memory and RTC cards: Only enable the configure button if the device actually has a configuration structure present.

This commit is contained in:
OBattler
2024-06-08 04:35:29 +02:00
parent ec0287cd2f
commit f95b1d984d
5 changed files with 27 additions and 6 deletions

View File

@@ -2145,3 +2145,12 @@ isamem_get_device(int board)
/* Add the instance to the system. */ /* Add the instance to the system. */
return boards[board].dev; return boards[board].dev;
} }
int
isamem_has_config(int board)
{
if (boards[board].dev == NULL)
return 0;
return (boards[board].dev->config ? 1 : 0);
}

View File

@@ -815,3 +815,12 @@ isartc_get_device(int board)
{ {
return (boards[board].dev); return (boards[board].dev);
} }
int
isartc_has_config(int board)
{
if (boards[board].dev == NULL)
return 0;
return (boards[board].dev->config ? 1 : 0);
}

View File

@@ -64,6 +64,7 @@ extern const char *isamem_get_name(int t);
extern const char *isamem_get_internal_name(int t); extern const char *isamem_get_internal_name(int t);
extern int isamem_get_from_internal_name(const char *s); extern int isamem_get_from_internal_name(const char *s);
extern const device_t *isamem_get_device(int t); extern const device_t *isamem_get_device(int t);
extern int isamem_has_config(int board);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -58,6 +58,7 @@ extern void isartc_reset(void);
extern const char *isartc_get_internal_name(int t); extern const char *isartc_get_internal_name(int t);
extern int isartc_get_from_internal_name(char *s); extern int isartc_get_from_internal_name(char *s);
extern const device_t *isartc_get_device(int t); extern const device_t *isartc_get_device(int t);
extern int isartc_has_config(int board);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -81,6 +81,7 @@ SettingsOtherPeripherals::onCurrentMachineChanged(int machineId)
++d; ++d;
} }
ui->comboBoxRTC->setCurrentIndex(selectedRow); ui->comboBoxRTC->setCurrentIndex(selectedRow);
ui->pushButtonConfigureRTC->setEnabled((isartc_type != 0) && isartc_has_config(isartc_type) && machineHasIsa);
for (int c = 0; c < ISAMEM_MAX; c++) { for (int c = 0; c < ISAMEM_MAX; c++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxCard%1").arg(c + 1)); auto *cbox = findChild<QComboBox *>(QString("comboBoxCard%1").arg(c + 1));
@@ -106,7 +107,7 @@ SettingsOtherPeripherals::onCurrentMachineChanged(int machineId)
cbox->setCurrentIndex(-1); cbox->setCurrentIndex(-1);
cbox->setCurrentIndex(selectedRow); cbox->setCurrentIndex(selectedRow);
cbox->setEnabled(machineHasIsa); cbox->setEnabled(machineHasIsa);
findChild<QPushButton *>(QString("pushButtonConfigureCard%1").arg(c + 1))->setEnabled(isamem_type[c] != 0 && machineHasIsa); findChild<QPushButton *>(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) { if (index < 0) {
return; 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 void
@@ -153,7 +154,7 @@ SettingsOtherPeripherals::on_comboBoxCard1_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; 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 void
@@ -168,7 +169,7 @@ SettingsOtherPeripherals::on_comboBoxCard2_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; 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 void
@@ -183,7 +184,7 @@ SettingsOtherPeripherals::on_comboBoxCard3_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; 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 void
@@ -198,7 +199,7 @@ SettingsOtherPeripherals::on_comboBoxCard4_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; 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 void