merged in machine flags/bus refactoring started in 6661ff5dcc

This commit is contained in:
Joakim L. Gilje
2021-12-14 13:53:56 +01:00
parent 5fcddcbfdd
commit 61ab0e60ca
9 changed files with 54 additions and 47 deletions

View File

@@ -40,7 +40,6 @@ void SettingsSound::save() {
void SettingsSound::onCurrentMachineChanged(int machineId) {
this->machineId = machineId;
auto* machine = &machines[machineId];
auto* model = ui->comboBoxSoundCard->model();
auto removeRows = model->rowCount();
@@ -48,7 +47,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) {
int selectedRow = 0;
while (true) {
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && !(machine->flags & MACHINE_SOUND)) {
if ((c == 1) && (machine_has_flags(machineId, MACHINE_SOUND) == 0)) {
c++;
continue;
}
@@ -60,7 +59,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) {
}
if (sound_card_available(c)) {
if (device_is_valid(sound_dev, machine->flags)) {
if (device_is_valid(sound_dev, machineId)) {
int row = Models::AddEntry(model, name, c);
if (c == sound_card_current) {
selectedRow = row - removeRows;
@@ -128,9 +127,14 @@ void SettingsSound::onCurrentMachineChanged(int machineId) {
ui->checkBoxGUS->setChecked(GUS > 0);
ui->checkBoxFloat32->setChecked(sound_is_float > 0);
ui->pushButtonConfigureSSI2001->setEnabled((SSI2001 > 0) && (machine->flags & MACHINE_BUS_ISA));
ui->pushButtonConfigureCMS->setEnabled((GAMEBLASTER > 0) && (machine->flags & MACHINE_BUS_ISA));
ui->pushButtonConfigureGUS->setEnabled((GUS > 0) && (machine->flags & MACHINE_BUS_ISA16));
bool hasIsa = machine_has_bus(machineId, MACHINE_BUS_ISA) > 0;
bool hasIsa16 = machine_has_bus(machineId, MACHINE_BUS_ISA) > 0;
ui->checkBoxCMS->setEnabled(hasIsa);
ui->pushButtonConfigureCMS->setEnabled((GAMEBLASTER > 0) && hasIsa);
ui->checkBoxGUS->setEnabled(hasIsa16);
ui->pushButtonConfigureGUS->setEnabled((GUS > 0) && hasIsa16);
ui->checkBoxSSI2001->setEnabled(hasIsa);
ui->pushButtonConfigureSSI2001->setEnabled((SSI2001 > 0) && hasIsa);
}
static bool allowMpu401(Ui::SettingsSound *ui) {
@@ -203,7 +207,7 @@ void SettingsSound::on_checkBoxGUS_stateChanged(int state) {
}
void SettingsSound::on_pushButtonConfigureMPU401_clicked() {
if (machines[machineId].flags & MACHINE_MCA) {
if (machine_has_bus(machineId, MACHINE_BUS_MCA) > 0) {
DeviceConfig::ConfigureDevice(&mpu401_mca_device);
} else {
DeviceConfig::ConfigureDevice(&mpu401_device);