Proper UI support for internal devices, phase 1.

This commit is contained in:
OBattler
2023-10-06 05:28:26 +02:00
parent b624e65380
commit 79e5a1dfbb
5 changed files with 52 additions and 12 deletions

View File

@@ -78,13 +78,9 @@ enum {
NET_LINK_1000_FD = (1 << 8), NET_LINK_1000_FD = (1 << 8),
}; };
/* Supported network cards. */
enum { enum {
NONE = 0, NET_NONE = 0,
NE1000 = 1, NET_INTERNAL
NE2000 = 2,
RTL8019AS = 3,
RTL8029AS = 4
}; };
enum { enum {

View File

@@ -94,8 +94,23 @@ static const device_t net_none_device = {
.config = NULL .config = NULL
}; };
static const device_t net_internal_device = {
.name = "Internal",
.internal_name = "internal",
.flags = 0,
.local = NET_TYPE_NONE,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const device_t *net_cards[] = { static const device_t *net_cards[] = {
&net_none_device, &net_none_device,
&net_internal_device,
&threec501_device, &threec501_device,
&threec503_device, &threec503_device,
&pcnet_am79c960_device, &pcnet_am79c960_device,

View File

@@ -138,7 +138,11 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
} }
auto curVideoCard_2 = videoCard[1]; auto curVideoCard_2 = videoCard[1];
videoCard[0] = ui->comboBoxVideo->currentData().toInt(); videoCard[0] = ui->comboBoxVideo->currentData().toInt();
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0); if (videoCard[0] == VID_INTERNAL)
ui->pushButtonConfigure->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) &&
device_has_config(machine_get_vid_device(machineId)));
else
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0);
bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0; bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0;
ui->checkBoxVoodoo->setEnabled(machineHasPci); ui->checkBoxVoodoo->setEnabled(machineHasPci);
if (machineHasPci) { if (machineHasPci) {

View File

@@ -47,7 +47,12 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP); intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
nic_cbox->setEnabled(adaptersEnabled); nic_cbox->setEnabled(adaptersEnabled);
conf_btn->setEnabled(adaptersEnabled && network_card_has_config(nic_cbox->currentData().toInt())); int netCard = nic_cbox->currentData().toInt();
if (netCard == NET_INTERNAL)
conf_btn->setEnabled(adaptersEnabled && machine_has_flags(machineId, MACHINE_NIC) &&
device_has_config(machine_get_net_device(machineId)));
else
conf_btn->setEnabled(adaptersEnabled && network_card_has_config(nic_cbox->currentData().toInt()));
socket_line->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_VDE); socket_line->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_VDE);
} }
} }

View File

@@ -192,7 +192,12 @@ SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureSoundCard1->setEnabled(sound_card_has_config(ui->comboBoxSoundCard1->currentData().toInt())); int sndCard = ui->comboBoxSoundCard1->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard1->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard1->setEnabled(sound_card_has_config(sndCard));
} }
void void
@@ -207,7 +212,12 @@ SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureSoundCard2->setEnabled(sound_card_has_config(ui->comboBoxSoundCard2->currentData().toInt())); int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard2->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard2->setEnabled(sound_card_has_config(ui->comboBoxSoundCard2->currentData().toInt()));
} }
void void
@@ -222,7 +232,12 @@ SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureSoundCard3->setEnabled(sound_card_has_config(ui->comboBoxSoundCard3->currentData().toInt())); int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard3->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard3->setEnabled(sound_card_has_config(ui->comboBoxSoundCard3->currentData().toInt()));
} }
void void
@@ -237,7 +252,12 @@ SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index)
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureSoundCard4->setEnabled(sound_card_has_config(ui->comboBoxSoundCard4->currentData().toInt())); int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard4->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard4->setEnabled(sound_card_has_config(ui->comboBoxSoundCard4->currentData().toInt()));
} }
void void