8514/A and XGA handling refactor:

* separate (ibm8514|xga)_enabled into (ibm8514|xga)_standalone_enabled
  and (ibm8514|xga)_active, the former being enabled only for standalone
  8514/A or XGA cards, the latter for all 8514/A and XGA-capable cards
  and not saved into the config file;
* remove (ibm8514|xga)_has_vga and replace all uses of it with
  (ibm8514|xga)_standalone_enabled;
* Qt UI: the checkboxes for standalone 8514/A and XGA are now correctly
  grayed out if an (S)VGA card with 8514/A or XGA capability is selected,
  including cases when the card is an internal/onboard one; said cards are
  now no longer appear as SVGA multi-monitor compatible.
This commit is contained in:
Alexander Babikov
2023-08-22 17:56:55 +05:00
parent e3cc8eaf5d
commit ef631a8133
12 changed files with 85 additions and 84 deletions

View File

@@ -173,8 +173,8 @@ int gfxcard[2] = { 0, 0 }; /* (C) graphic
int show_second_monitors = 1; /* (C) show non-primary monitors */
int sound_is_float = 1; /* (C) sound uses FP values */
int voodoo_enabled = 0; /* (C) video option */
int ibm8514_enabled = 0; /* (C) video option */
int xga_enabled = 0; /* (C) video option */
int ibm8514_standalone_enabled = 0; /* (C) video option */
int xga_standalone_enabled = 0; /* (C) video option */
uint32_t mem_size = 0; /* (C) memory size (Installed on system board)*/
uint32_t isa_mem_size = 0; /* (C) memory size (ISA Memory Cards) */
int cpu_use_dynarec = 0; /* (C) cpu uses/needs Dyna */

View File

@@ -564,9 +564,16 @@ load_video(void)
free(p);
}
if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_8514A)) || video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_8514)
ini_section_delete_var(cat, "8514a");
if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_XGA)) || video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_XGA)
ini_section_delete_var(cat, "xga");
voodoo_enabled = !!ini_section_get_int(cat, "voodoo", 0);
ibm8514_enabled = !!ini_section_get_int(cat, "8514a", 0);
xga_enabled = !!ini_section_get_int(cat, "xga", 0);
ibm8514_standalone_enabled = !!ini_section_get_int(cat, "8514a", 0);
ibm8514_active = ibm8514_standalone_enabled;
xga_standalone_enabled = !!ini_section_get_int(cat, "xga", 0);
xga_active = xga_standalone_enabled;
show_second_monitors = !!ini_section_get_int(cat, "show_second_monitors", 1);
video_fullscreen_scale_maximized = !!ini_section_get_int(cat, "video_fullscreen_scale_maximized", 0);
@@ -2352,15 +2359,15 @@ save_video(void)
else
ini_section_set_int(cat, "voodoo", voodoo_enabled);
if (ibm8514_enabled == 0)
if (ibm8514_standalone_enabled == 0)
ini_section_delete_var(cat, "8514a");
else
ini_section_set_int(cat, "8514a", ibm8514_enabled);
ini_section_set_int(cat, "8514a", ibm8514_standalone_enabled);
if (xga_enabled == 0)
if (xga_standalone_enabled == 0)
ini_section_delete_var(cat, "xga");
else
ini_section_set_int(cat, "xga", xga_enabled);
ini_section_set_int(cat, "xga", xga_standalone_enabled);
if (gfxcard[1] == 0)
ini_section_delete_var(cat, "gfxcard_2");

View File

@@ -356,7 +356,7 @@ softresetx86(void)
if (soft_reset_mask)
return;
if (ibm8514_enabled || xga_enabled)
if (ibm8514_active || xga_active)
vga_on = 1;
reset_common(0);

View File

@@ -130,8 +130,8 @@ extern int isamem_type[]; /* (C) enable ISA mem cards */
extern int isartc_type; /* (C) enable ISA RTC card */
extern int sound_is_float; /* (C) sound uses FP values */
extern int voodoo_enabled; /* (C) video option */
extern int ibm8514_enabled; /* (C) video option */
extern int xga_enabled; /* (C) video option */
extern int ibm8514_standalone_enabled; /* (C) video option */
extern int xga_standalone_enabled; /* (C) video option */
extern uint32_t mem_size; /* (C) memory size (Installed on system board) */
extern uint32_t isa_mem_size; /* (C) memory size (ISA Memory Cards) */
extern int cpu; /* (C) cpu type */

View File

@@ -17,7 +17,6 @@
#ifndef VIDEO_XGA_DEVICE_H
#define VIDEO_XGA_DEVICE_H
extern int xga_has_vga;
#ifdef EMU_DEVICE_H
extern const device_t xga_device;

View File

@@ -208,7 +208,8 @@ extern double cpuclock;
extern int emu_fps;
extern int frames;
extern int readflash;
extern int ibm8514_has_vga;
extern int ibm8514_active;
extern int xga_active;
/* Function handler pointers. */
extern void (*video_recalctimings)(void);

View File

@@ -49,11 +49,11 @@ SettingsDisplay::~SettingsDisplay()
void
SettingsDisplay::save()
{
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
gfxcard[1] = ui->comboBoxVideoSecondary->currentData().toInt();
voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0;
ibm8514_enabled = ui->checkBox8514->isChecked() ? 1 : 0;
xga_enabled = ui->checkBoxXga->isChecked() ? 1 : 0;
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
gfxcard[1] = ui->comboBoxVideoSecondary->currentData().toInt();
voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0;
ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0;
xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0;
}
void
@@ -102,17 +102,6 @@ SettingsDisplay::onCurrentMachineChanged(int machineId)
ui->comboBoxVideoSecondary->setEnabled(true);
ui->pushButtonConfigureSecondary->setEnabled(true);
}
if (gfxcard[0] == VID_INTERNAL) {
if (video_get_type_monitor(0) != VIDEO_FLAG_TYPE_8514)
ibm8514_has_vga = 0;
if (video_get_type_monitor(0) != VIDEO_FLAG_TYPE_XGA)
xga_has_vga = 0;
} else {
if (video_card_get_flags(gfxcard[0]) != VIDEO_FLAG_TYPE_8514)
ibm8514_has_vga = 0;
if (video_card_get_flags(gfxcard[0]) != VIDEO_FLAG_TYPE_XGA)
xga_has_vga = 0;
}
ui->comboBoxVideo->setCurrentIndex(selectedRow);
if (gfxcard[1] == 0)
ui->pushButtonConfigureSecondary->setEnabled(false);
@@ -134,12 +123,10 @@ SettingsDisplay::on_pushButtonConfigureVoodoo_clicked()
void
SettingsDisplay::on_pushButtonConfigureXga_clicked()
{
if (!xga_has_vga) {
if (machine_has_bus(machineId, MACHINE_BUS_MCA) > 0) {
DeviceConfig::ConfigureDevice(&xga_device, 0, qobject_cast<Settings *>(Settings::settings));
} else {
DeviceConfig::ConfigureDevice(&xga_isa_device, 0, qobject_cast<Settings *>(Settings::settings));
}
if (machine_has_bus(machineId, MACHINE_BUS_MCA) > 0) {
DeviceConfig::ConfigureDevice(&xga_device, 0, qobject_cast<Settings *>(Settings::settings));
} else {
DeviceConfig::ConfigureDevice(&xga_isa_device, 0, qobject_cast<Settings *>(Settings::settings));
}
}
@@ -159,18 +146,21 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
}
ui->pushButtonConfigureVoodoo->setEnabled(machineHasPci && ui->checkBoxVoodoo->isChecked());
bool hasIsa16 = machine_has_bus(machineId, MACHINE_BUS_ISA16) > 0;
bool has_MCA = machine_has_bus(machineId, MACHINE_BUS_MCA) > 0;
ui->checkBox8514->setEnabled((hasIsa16 || has_MCA) && !ibm8514_has_vga);
if (hasIsa16 || has_MCA) {
ui->checkBox8514->setChecked(ibm8514_enabled);
}
bool machineHasIsa16 = machine_has_bus(machineId, MACHINE_BUS_ISA16) > 0;
bool machineHasMca = machine_has_bus(machineId, MACHINE_BUS_MCA) > 0;
ui->checkBoxXga->setEnabled((hasIsa16 || has_MCA) && !xga_has_vga);
if (hasIsa16 || has_MCA)
ui->checkBoxXga->setChecked(xga_enabled);
bool videoCardHas8514 = ((videoCard[0] == VID_INTERNAL) ? machine_has_flags(machineId, MACHINE_VIDEO_8514A) : (video_card_get_flags(videoCard[0]) == VIDEO_FLAG_TYPE_8514));
bool videoCardHasXga = ((videoCard[0] == VID_INTERNAL) ? machine_has_flags(machineId, MACHINE_VIDEO_XGA) : (video_card_get_flags(videoCard[0]) == VIDEO_FLAG_TYPE_XGA));
ui->pushButtonConfigureXga->setEnabled((hasIsa16 || has_MCA) && ui->checkBoxXga->isChecked() && !xga_has_vga);
ui->checkBox8514->setEnabled((machineHasIsa16 || machineHasMca) && !videoCardHas8514);
if (machineHasIsa16 || machineHasMca)
ui->checkBox8514->setChecked(ibm8514_standalone_enabled && !videoCardHas8514);
ui->checkBoxXga->setEnabled((machineHasIsa16 || machineHasMca) && !videoCardHasXga);
if (machineHasIsa16 || machineHasMca)
ui->checkBoxXga->setChecked(xga_standalone_enabled && !videoCardHasXga);
ui->pushButtonConfigureXga->setEnabled((machineHasIsa16 || machineHasMca) && ui->checkBoxXga->isChecked() && !videoCardHasXga);
int c = 2;
@@ -190,7 +180,13 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
break;
}
if (video_card_available(c) && device_is_valid(video_dev, machineId) && !(video_card_get_flags(c) == video_card_get_flags(videoCard[0]) && (video_card_get_flags(c) != VIDEO_FLAG_TYPE_SPECIAL))) {
int primaryFlags = video_card_get_flags(videoCard[0]);
int secondaryFlags = video_card_get_flags(c);
if (video_card_available(c)
&& device_is_valid(video_dev, machineId)
&& !((secondaryFlags == primaryFlags) && (secondaryFlags != VIDEO_FLAG_TYPE_SPECIAL))
&& !(((primaryFlags == VIDEO_FLAG_TYPE_8514) || (primaryFlags == VIDEO_FLAG_TYPE_XGA)) && (secondaryFlags != VIDEO_FLAG_TYPE_MDA) && (secondaryFlags != VIDEO_FLAG_TYPE_SPECIAL))
&& !((primaryFlags != VIDEO_FLAG_TYPE_MDA) && (primaryFlags != VIDEO_FLAG_TYPE_SPECIAL) && ((secondaryFlags == VIDEO_FLAG_TYPE_8514) || (secondaryFlags == VIDEO_FLAG_TYPE_XGA)))) {
ui->comboBoxVideoSecondary->addItem(name, c);
if (c == curVideoCard_2)
ui->comboBoxVideoSecondary->setCurrentIndex(ui->comboBoxVideoSecondary->count() - 1);
@@ -214,7 +210,7 @@ SettingsDisplay::on_checkBoxVoodoo_stateChanged(int state)
void
SettingsDisplay::on_checkBoxXga_stateChanged(int state)
{
ui->pushButtonConfigureXga->setEnabled((state == Qt::Checked) && !xga_has_vga);
ui->pushButtonConfigureXga->setEnabled(state == Qt::Checked);
}
void

View File

@@ -188,7 +188,7 @@ ibm8514_log(const char *fmt, ...)
dev->changedvram[(((addr)) & (dev->vram_mask)) >> 12] = changeframecount; \
}
int ibm8514_has_vga = 0;
int ibm8514_active = 0;
int
ibm8514_cpu_src(svga_t *svga)
@@ -4224,7 +4224,7 @@ ibm8514_recalctimings(svga_t *svga)
svga->clock = (cpuclock * (double) (1ULL << 32)) / 25175000.0;
}
svga->render8514 = ibm8514_render_8bpp;
ibm8514_log("BPP=%d, Pitch = %d, rowoffset = %d, crtc13 = %02x, mode = %d, highres bit = %02x, has_vga? = %d.\n", dev->bpp, dev->pitch, dev->rowoffset, svga->crtc[0x13], dev->ibm_mode, dev->accel.advfunc_cntl & 4, ibm8514_has_vga);
ibm8514_log("BPP=%d, Pitch = %d, rowoffset = %d, crtc13 = %02x, mode = %d, highres bit = %02x, has_vga? = %d.\n", dev->bpp, dev->pitch, dev->rowoffset, svga->crtc[0x13], dev->ibm_mode, dev->accel.advfunc_cntl & 4, !ibm8514_standalone_enabled);
}
ibm8514_log("8514 enabled, hdisp=%d, vtotal=%d, htotal=%d, dispend=%d, rowoffset=%d, split=%d, vsyncstart=%d, split=%08x\n", dev->hdisp, dev->vtotal, dev->htotal, dev->dispend, dev->rowoffset, dev->split, dev->vsyncstart, dev->split);
}
@@ -4351,7 +4351,7 @@ const device_t ibm8514_mca_device = {
void
ibm8514_device_add(void)
{
if (!ibm8514_enabled || (ibm8514_enabled && ibm8514_has_vga))
if (!ibm8514_standalone_enabled)
return;
if (machine_has_bus(machine, MACHINE_BUS_MCA))

View File

@@ -207,9 +207,9 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
svga_recalctimings(svga);
break;
case 0x3c3:
if (xga_enabled)
if (xga_active)
xga->on = (val & 0x01) ? 0 : 1;
if (ibm8514_enabled)
if (ibm8514_active)
dev->on = (val & 0x01) ? 0 : 1;
vga_on = val & 0x01;
@@ -517,7 +517,7 @@ svga_set_ramdac_type(svga_t *svga, int type)
svga->ramdac_type = type;
for (int c = 0; c < 256; c++) {
if (ibm8514_enabled) {
if (ibm8514_active) {
if (svga->ramdac_type == RAMDAC_8BIT)
dev->pallook[c] = makecol32(svga->vgapal[c].r, svga->vgapal[c].g, svga->vgapal[c].b);
else
@@ -706,12 +706,12 @@ svga_recalctimings(svga_t *svga)
svga->recalctimings_ex(svga);
}
if (ibm8514_enabled) {
if (ibm8514_active) {
if (!dev->local)
ibm8514_recalctimings(svga);
}
if (xga_enabled)
if (xga_active)
xga_recalctimings(svga);
if (svga->hdisp >= 2048)
@@ -815,11 +815,11 @@ svga_poll(void *priv)
int ret;
int old_ma;
if (ibm8514_enabled && dev->on) {
if (ibm8514_active && dev->on) {
ibm8514_poll(dev, svga);
return;
}
if (xga_enabled && xga->on) {
if (xga_active && xga->on) {
xga_poll(xga, svga);
return;
}
@@ -1231,7 +1231,7 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *priv)
cycles -= svga->monitor->mon_video_timing_write_b;
if (!linear) {
if (xga_enabled) {
if (xga_active) {
if (((xga->op_mode & 7) >= 4) && (xga->aperture_cntl >= 1)) {
if (val == 0xa5) { /*Memory size test of XGA*/
xga->test = val;
@@ -1438,7 +1438,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *priv)
cycles -= svga->monitor->mon_video_timing_read_b;
if (!linear) {
if (xga_enabled) {
if (xga_active) {
if (((xga->op_mode & 7) >= 4) && (xga->aperture_cntl >= 1)) {
if (xga->test == 0xa5) { /*Memory size test of XGA*/
xga->on = 1;

View File

@@ -370,6 +370,7 @@ video_reset(int card)
void
video_post_reset(void)
{
int ibm8514_has_vga = 0;
if (gfxcard[0] == VID_INTERNAL)
ibm8514_has_vga = (video_get_type_monitor(0) == VIDEO_FLAG_TYPE_8514);
else if (gfxcard[0] != VID_NONE)
@@ -378,14 +379,12 @@ video_post_reset(void)
ibm8514_has_vga = 0;
if (ibm8514_has_vga)
ibm8514_enabled = 1;
ibm8514_active = 1;
if (ibm8514_enabled) {
if (!ibm8514_has_vga)
ibm8514_device_add();
}
if (ibm8514_standalone_enabled)
ibm8514_device_add();
if (xga_enabled)
if (xga_standalone_enabled)
xga_device_add();
/* Reset the graphics card (or do nothing if it was already done

View File

@@ -49,7 +49,7 @@ static uint8_t xga_ext_inb(uint16_t addr, void *priv);
static void xga_writew(uint32_t addr, uint16_t val, void *priv);
static uint16_t xga_readw(uint32_t addr, void *priv);
int xga_has_vga = 0;
int xga_active = 0;
#ifdef ENABLE_XGA_LOG
int xga_do_log = ENABLE_XGA_LOG;
@@ -2133,7 +2133,7 @@ xga_mem_read(uint32_t addr, xga_t *xga, UNUSED(svga_t *svga))
addr &= 0x1fff;
if (addr < 0x1800) {
if (!xga_has_vga)
if (xga_standalone_enabled)
temp = xga->bios_rom.rom[addr];
else
temp = xga->vga_bios_rom.rom[addr];
@@ -2938,7 +2938,7 @@ xga_pos_in(uint16_t addr, void *priv)
xga_t *xga = &svga->xga;
uint8_t ret = 0xff;
if (xga_has_vga) {
if (!xga_standalone_enabled) {
switch (addr) {
case 0x0100:
case 0x0101:
@@ -3053,7 +3053,7 @@ xga_pos_out(uint16_t addr, uint8_t val, void *priv)
svga_t *svga = (svga_t *) priv;
xga_t *xga = &svga->xga;
if (xga_has_vga) {
if (!xga_standalone_enabled) {
switch (addr) {
case 0x0106:
xga->pos_idx = (xga->pos_idx & 0x00ff) | (val << 8);
@@ -3148,7 +3148,7 @@ xga_init(const device_t *info)
xga->rom_addr = 0;
rom_init(&xga->bios_rom, xga->type ? XGA2_BIOS_PATH : XGA_BIOS_PATH, 0xc0000, 0x2000, 0x1fff, 0, MEM_MAPPING_EXTERNAL);
} else {
if (xga_has_vga) {
if (!xga_standalone_enabled) {
rom_init(&xga->vga_bios_rom, INMOS_XGA_BIOS_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
} else
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_xga_isa);
@@ -3168,7 +3168,7 @@ xga_init(const device_t *info)
NULL, MEM_MAPPING_EXTERNAL, svga);
mem_mapping_add(&xga->memio_mapping, 0, 0, xga_memio_readb, xga_memio_readw, xga_memio_readl,
xga_memio_writeb, xga_memio_writew, xga_memio_writel,
xga_has_vga ? xga->vga_bios_rom.rom : xga->bios_rom.rom, MEM_MAPPING_EXTERNAL, svga);
!xga_standalone_enabled ? xga->vga_bios_rom.rom : xga->bios_rom.rom, MEM_MAPPING_EXTERNAL, svga);
mem_mapping_disable(&xga->video_mapping);
mem_mapping_disable(&xga->linear_mapping);
@@ -3181,7 +3181,7 @@ xga_init(const device_t *info)
mca_add(xga_mca_read, xga_mca_write, xga_mca_feedb, xga_mca_reset, svga);
} else {
io_sethandler(0x0100, 0x0008, xga_pos_in, NULL, NULL, NULL, NULL, NULL, svga);
if (xga_has_vga)
if (!xga_standalone_enabled)
io_sethandler(0x0106, 0x0002, NULL, NULL, NULL, xga_pos_out, NULL, NULL, svga);
io_sethandler(0x2100 + (xga->instance << 4), 0x0010, xga_ext_inb, NULL, NULL, xga_ext_outb, NULL, NULL, svga);
@@ -3209,8 +3209,7 @@ svga_xga_init(const device_t *info)
svga->bpp = 8;
svga->miscout = 1;
xga_has_vga = 1;
xga_enabled = 1;
xga_active = 1;
return xga_init(info);
}
@@ -3411,7 +3410,7 @@ const device_t inmos_isa_device = {
void
xga_device_add(void)
{
if (!xga_enabled || (xga_has_vga && xga_enabled))
if (!xga_standalone_enabled)
return;
if (machine_has_bus(machine, MACHINE_BUS_MCA))

View File

@@ -371,8 +371,8 @@ win_settings_init(void)
temp_gfxcard[0] = gfxcard[0];
temp_gfxcard[1] = gfxcard[1];
temp_voodoo = voodoo_enabled;
temp_ibm8514 = ibm8514_enabled;
temp_xga = xga_enabled;
temp_ibm8514 = ibm8514_standalone_enabled;
temp_xga = xga_standalone_enabled;
/* Input devices category */
temp_mouse = mouse_type;
@@ -501,8 +501,8 @@ win_settings_changed(void)
i = i || (gfxcard[0] != temp_gfxcard[0]);
i = i || (gfxcard[1] != temp_gfxcard[1]);
i = i || (voodoo_enabled != temp_voodoo);
i = i || (ibm8514_enabled != temp_ibm8514);
i = i || (xga_enabled != temp_xga);
i = i || (ibm8514_standalone_enabled != temp_ibm8514);
i = i || (xga_standalone_enabled != temp_xga);
/* Input devices category */
i = i || (mouse_type != temp_mouse);
@@ -592,11 +592,11 @@ win_settings_save(void)
time_sync = temp_sync;
/* Video category */
gfxcard[0] = temp_gfxcard[0];
gfxcard[1] = temp_gfxcard[1];
voodoo_enabled = temp_voodoo;
ibm8514_enabled = temp_ibm8514;
xga_enabled = temp_xga;
gfxcard[0] = temp_gfxcard[0];
gfxcard[1] = temp_gfxcard[1];
voodoo_enabled = temp_voodoo;
ibm8514_standalone_enabled = temp_ibm8514;
xga_standalone_enabled = temp_xga;
/* Input devices category */
mouse_type = temp_mouse;