diff --git a/src/86box.c b/src/86box.c index 32724802c..fb96ed87e 100644 --- a/src/86box.c +++ b/src/86box.c @@ -166,8 +166,7 @@ int bugger_enabled = 0; /* (C) enable ISAbug int postcard_enabled = 0; /* (C) enable POST card */ int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */ int isartc_type = 0; /* (C) enable ISA RTC card */ -int gfxcard = 0; /* (C) graphics/video card */ -int gfxcard_2 = 0; /* (C) graphics/video card */ +int gfxcard[2] = { 0, 0 }; /* (C) graphics/video card */ 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 */ @@ -869,34 +868,34 @@ pc_init_modules(void) } /* Make sure we have a usable video card. */ - if (!video_card_available(gfxcard)) { + if (!video_card_available(gfxcard[0])) { memset(tempc, 0, sizeof(tempc)); - device_get_name(video_card_getdevice(gfxcard), 0, tempc); + device_get_name(video_card_getdevice(gfxcard[0]), 0, tempc); swprintf(temp, sizeof(temp), plat_get_string(IDS_2064), tempc); c = 0; while (video_get_internal_name(c) != NULL) { - gfxcard = -1; + gfxcard[0] = -1; if (video_card_available(c)) { ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2129, temp); - gfxcard = c; + gfxcard[0] = c; config_save(); break; } c++; } - if (gfxcard == -1) { + if (gfxcard[0] == -1) { fatal("No available video cards\n"); exit(-1); return (0); } } - if (!video_card_available(gfxcard_2)) { + if (!video_card_available(gfxcard[1])) { char tempc[512] = { 0 }; - device_get_name(video_card_getdevice(gfxcard_2), 0, tempc); + device_get_name(video_card_getdevice(gfxcard[1]), 0, tempc); swprintf(temp, sizeof(temp), (wchar_t *) "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card.", tempc); ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2129, temp); - gfxcard_2 = 0; + gfxcard[1] = 0; } atfullspeed = 0; diff --git a/src/config.c b/src/config.c index f573d3d4b..a0f9a71f0 100644 --- a/src/config.c +++ b/src/config.c @@ -530,7 +530,7 @@ load_video(void) if (machine_has_flags(machine, MACHINE_VIDEO_ONLY)) { ini_section_delete_var(cat, "gfxcard"); - gfxcard = VID_INTERNAL; + gfxcard[0] = VID_INTERNAL; } else { p = ini_section_get_string(cat, "gfxcard", NULL); if (p == NULL) { @@ -544,9 +544,9 @@ load_video(void) free_p = 1; } if (!strcmp(p, "virge375_vbe20_pci")) /* migrate renamed cards */ - gfxcard = video_get_video_from_internal_name("virge385_pci"); + gfxcard[0] = video_get_video_from_internal_name("virge385_pci"); else - gfxcard = video_get_video_from_internal_name(p); + gfxcard[0] = video_get_video_from_internal_name(p); if (free_p) free(p); } @@ -560,7 +560,7 @@ load_video(void) p = ini_section_get_string(cat, "gfxcard_2", NULL); if (!p) p = "none"; - gfxcard_2 = video_get_video_from_internal_name(p); + gfxcard[1] = video_get_video_from_internal_name(p); } /* Load "Input Devices" section. */ @@ -1851,7 +1851,7 @@ config_load(void) dpi_scale = 1; fpu_type = fpu_get_type(cpu_f, cpu, "none"); - gfxcard = video_get_video_from_internal_name("cga"); + gfxcard[0] = video_get_video_from_internal_name("cga"); vid_api = plat_vidapi("default"); vid_resize = 0; video_fullscreen_first = 1; @@ -2235,7 +2235,7 @@ save_video(void) ini_section_t cat = ini_find_or_create_section(config, "Video"); ini_section_set_string(cat, "gfxcard", - video_get_internal_name(gfxcard)); + video_get_internal_name(gfxcard[0])); if (voodoo_enabled == 0) ini_section_delete_var(cat, "voodoo"); @@ -2252,10 +2252,10 @@ save_video(void) else ini_section_set_int(cat, "xga", xga_enabled); - if (gfxcard_2 == 0) + if (gfxcard[1] == 0) ini_section_delete_var(cat, "gfxcard_2"); else - ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard_2)); + ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard[1])); if (show_second_monitors == 1) ini_section_delete_var(cat, "show_second_monitors"); diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index dc385c011..c71213aa6 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -2491,7 +2491,7 @@ kbd_init(const device_t *info) dev->flags = info->local; - video_reset(gfxcard); + video_reset(gfxcard[0]); kbd_reset(dev); io_sethandler(0x0060, 1, kbd_read, NULL, NULL, kbd_write, NULL, NULL, dev); diff --git a/src/device/keyboard_xt.c b/src/device/keyboard_xt.c index 676f99f54..fe523cd2f 100644 --- a/src/device/keyboard_xt.c +++ b/src/device/keyboard_xt.c @@ -730,7 +730,7 @@ kbd_init(const device_t *info) key_queue_start = key_queue_end = 0; - video_reset(gfxcard); + video_reset(gfxcard[0]); if ((kbd->type == KBD_TYPE_PC81) || (kbd->type == KBD_TYPE_PC82) || (kbd->type == KBD_TYPE_PRAVETZ) || (kbd->type == KBD_TYPE_XT82) || diff --git a/src/device/phoenix_486_jumper.c b/src/device/phoenix_486_jumper.c index 357240ba7..d5e833404 100644 --- a/src/device/phoenix_486_jumper.c +++ b/src/device/phoenix_486_jumper.c @@ -91,7 +91,7 @@ phoenix_486_jumper_reset(void *priv) dev->jumper = 0x00; else { dev->jumper = 0x9f; - if (gfxcard != 0x01) + if (gfxcard[0] != 0x01) dev->jumper |= 0x40; } } diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index ca8d797cc..b88fa24ef 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -107,7 +107,7 @@ extern int vid_cga_contrast, /* (C) video */ video_filter_method, /* (C) video */ video_vsync, /* (C) video */ video_framerate, /* (C) video */ - gfxcard; /* (C) graphics/video card */ + gfxcard[2]; /* (C) graphics/video card */ extern char video_shader[512]; /* (C) video */ extern int bugger_enabled, /* (C) enable ISAbugger */ postcard_enabled, /* (C) enable POST card */ diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 6f35dc5ee..a49f3bf34 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -132,7 +132,6 @@ extern monitor_t monitors[MONITORS_NUM]; extern monitor_settings_t monitor_settings[MONITORS_NUM]; extern atomic_bool doresize_monitors[MONITORS_NUM]; extern int monitor_index_global; -extern int gfxcard_2; extern int show_second_monitors; extern int video_fullscreen_scale_maximized; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 89f8f5670..a37427de1 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -2474,9 +2474,9 @@ machine_amstrad_init(const machine_t *model, int type) ams->language = 7; - video_reset(gfxcard); + video_reset(gfxcard[0]); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) switch (type) { case AMS_PC1512: loadfont("roms/machines/pc1512/40078", 8); diff --git a/src/machine/m_at_286_386sx.c b/src/machine/m_at_286_386sx.c index 253ce804d..54e7d6b9e 100644 --- a/src/machine/m_at_286_386sx.c +++ b/src/machine/m_at_286_386sx.c @@ -114,7 +114,7 @@ machine_at_ama932j_init(const machine_t *model) machine_at_common_ide_init(model); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&oti067_ama932j_device); machine_at_headland_common_init(2); @@ -420,7 +420,7 @@ machine_at_spc4620p_init(const machine_t *model) if (bios_only || !ret) return ret; - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ati28800k_spc4620p_device); machine_at_scat_init(model, 1, 1); @@ -527,7 +527,7 @@ machine_at_wd76c10_init(const machine_t *model) machine_at_common_init(model); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(¶dise_wd90c11_megapc_device); device_add(&keyboard_ps2_quadtel_device); @@ -591,7 +591,7 @@ machine_at_cmdsl386sx25_init(const machine_t *model) if (bios_only || !ret) return ret; - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&gd5402_onboard_device); machine_at_scamp_common_init(model, 1); @@ -626,7 +626,7 @@ machine_at_spc6033p_init(const machine_t *model) if (bios_only || !ret) return ret; - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ati28800k_spc6033p_device); machine_at_scamp_common_init(model, 1); @@ -711,7 +711,7 @@ machine_at_flytech386_init(const machine_t *model) device_add(&ali1217_device); device_add(&w83787f_ide_en_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&tvga8900d_device); device_add(&keyboard_ps2_device); @@ -833,7 +833,7 @@ machine_at_3302_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(¶dise_pvga1a_ncr3302_device); device_add(&keyboard_at_ncr_device); diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index 036eac550..eeebbb784 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -168,7 +168,7 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 machine_at_common_ide_init(model); device_add(&sis_85c461_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&et4000w32_onboard_device); device_add(&keyboard_ps2_device); @@ -310,7 +310,7 @@ machine_at_pb410a_init(const machine_t *model) device_add(&phoenix_486_jumper_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ht216_32_pb410a_device); return ret; @@ -331,7 +331,7 @@ machine_at_vect486vl_init(const machine_t *model) // has HDC problems device_add(&vl82c480_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&gd5428_onboard_device); device_add(&keyboard_ps2_ami_device); @@ -355,7 +355,7 @@ machine_at_d824_init(const machine_t *model) device_add(&vl82c480_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&gd5428_onboard_device); device_add(&keyboard_ps2_device); @@ -378,7 +378,7 @@ machine_at_acera1g_init(const machine_t *model) machine_at_common_init(model); device_add(&ali1429g_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&gd5428_onboard_device); device_add(&keyboard_ps2_acer_pci_device); @@ -428,7 +428,7 @@ machine_at_decpclpv_init(const machine_t *model) device_add(&sis_85c461_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&s3_86c805_onboard_vlb_device); /* TODO: Phoenix MultiKey KBC */ @@ -1365,7 +1365,7 @@ machine_at_sbc490_init(const machine_t *model) device_add(&ali1489_device); device_add(&fdc37c665_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&tgui9440_onboard_pci_device); device_add(&keyboard_ps2_ami_device); diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index 0b3a901b5..e74261b8a 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -787,21 +787,21 @@ machine_at_compaq_init(const machine_t *model, int type) write_ram, write_ramw, write_raml, 0xa0000 + ram, MEM_MAPPING_INTERNAL, NULL); - video_reset(gfxcard); + video_reset(gfxcard[0]); switch (type) { case COMPAQ_PORTABLEII: break; case COMPAQ_PORTABLEIII: - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&compaq_plasma_device); break; case COMPAQ_PORTABLEIII386: if (hdc_current == 1) device_add(&ide_isa_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&compaq_plasma_device); break; diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index c30f39603..3cedb669a 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -663,7 +663,7 @@ machine_at_ms6168_common_init(const machine_t *model) device_add(&piix4e_device); device_add(&w83977ef_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&voodoo_3_2000_agp_onboard_8m_device); device_add(&keyboard_ps2_ami_pci_device); diff --git a/src/machine/m_at_socket4.c b/src/machine/m_at_socket4.c index 2aa94cce5..ef745d088 100644 --- a/src/machine/m_at_socket4.c +++ b/src/machine/m_at_socket4.c @@ -345,7 +345,7 @@ machine_at_pb520r_init(const machine_t *model) device_add(&i430lx_device); device_add(&ide_cmd640_pci_single_channel_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&gd5434_onboard_pci_device); device_add(&keyboard_ps2_pci_device); diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index f7faae167..0e76ac1c9 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -398,7 +398,7 @@ machine_at_presario2240_init(const machine_t *model) pci_register_slot(0x14, PCI_CARD_VIDEO, 3, 0, 0, 0); pci_register_slot(0x13, PCI_CARD_NORMAL, 1, 2, 3, 4); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&s3_trio64v2_dx_onboard_pci_device); device_add(&i430vx_device); @@ -429,7 +429,7 @@ machine_at_presario4500_init(const machine_t *model) pci_register_slot(0x14, PCI_CARD_VIDEO, 3, 0, 0, 0); pci_register_slot(0x13, PCI_CARD_NORMAL, 1, 2, 3, 4); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&s3_trio64v2_dx_onboard_pci_device); device_add(&i430vx_device); diff --git a/src/machine/m_at_socket7_3v.c b/src/machine/m_at_socket7_3v.c index 03be14c37..55a5068d9 100644 --- a/src/machine/m_at_socket7_3v.c +++ b/src/machine/m_at_socket7_3v.c @@ -58,7 +58,7 @@ machine_at_thor_common_init(const machine_t *model, int mr) pci_register_slot(0x10, PCI_CARD_NORMAL, 4, 3, 2, 1); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&s3_phoenix_trio64vplus_onboard_pci_device); // device_add(&keyboard_ps2_ami_pci_device); @@ -222,7 +222,7 @@ machine_at_endeavor_init(const machine_t *model) pci_register_slot(0x10, PCI_CARD_NORMAL, 4, 1, 2, 3); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&s3_phoenix_trio64_onboard_pci_device); device_add(&keyboard_ps2_intel_ami_pci_device); @@ -286,7 +286,7 @@ machine_at_pb640_init(const machine_t *model) device_add(&i430fx_rev02_device); device_add(&piix_rev02_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&gd5440_onboard_pci_device); device_add(&keyboard_ps2_intel_ami_pci_device); @@ -616,7 +616,7 @@ machine_at_vectra54_init(const machine_t *model) pci_register_slot(0x07, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x08, PCI_CARD_NORMAL, 3, 4, 1, 2); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&s3_phoenix_trio64_onboard_pci_device); device_add(&keyboard_ps2_ami_pci_device); diff --git a/src/machine/m_elt.c b/src/machine/m_elt.c index 81647612c..0370b45a2 100644 --- a/src/machine/m_elt.c +++ b/src/machine/m_elt.c @@ -178,7 +178,7 @@ machine_elt_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_xt_device); - if (gfxcard == VID_INTERNAL) { + if (gfxcard[0] == VID_INTERNAL) { cga = device_add(&cga_device); io_removehandler(0x03d0, 0x0010, cga_in, NULL, NULL, cga_out, NULL, NULL, cga); io_sethandler(0x03d0, 0x0010, elt_vid_in, NULL, NULL, elt_vid_out, NULL, NULL, cga); diff --git a/src/machine/m_europc.c b/src/machine/m_europc.c index 116e10e5f..b1368dd5d 100644 --- a/src/machine/m_europc.c +++ b/src/machine/m_europc.c @@ -549,7 +549,7 @@ europc_boot(const device_t *info) * with values set by the user. */ b = (sys->nvr.regs[MRTC_CONF_D] & ~0x17); - video_reset(gfxcard); + video_reset(gfxcard[0]); if (video_is_cga()) b |= 0x12; /* external video, CGA80 */ else if (video_is_mda()) diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index b03272f3d..0b1f8ec58 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -781,7 +781,7 @@ machine_pcjr_init(const machine_t *model) cpu_set(); /* Initialize the video controller. */ - video_reset(gfxcard); + video_reset(gfxcard[0]); loadfont("roms/video/mda/mda.rom", 0); mem_mapping_add(&pcjr->mapping, 0xb8000, 0x08000, vid_read, NULL, NULL, diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index 209b5d7a4..d002ba6bd 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -300,7 +300,7 @@ ps1_setup(int model) 0xfc0000, 0x40000, 0x3ffff, 0, MEM_MAPPING_EXTERNAL); /* Initialize the video controller. */ - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ibm_ps1_2121_device); device_add(&fdc_at_ps1_device); diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index f77b6f4a0..5057b65ea 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -950,7 +950,7 @@ ps2_mca_board_model_50_init(int slots) ps2_mca_mem_fffc_init(2); } - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ps1vga_mca_device); } @@ -1008,7 +1008,7 @@ ps2_mca_board_model_55sx_init(int has_sec_nvram, int slots) ps2.planar_read = model_55sx_read; ps2.planar_write = model_55sx_write; - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ps1vga_mca_device); model_55sx_mem_recalc(); @@ -1244,7 +1244,7 @@ ps2_mca_board_model_70_type34_init(int is_type4, int slots) } } - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ps1vga_mca_device); } @@ -1318,7 +1318,7 @@ ps2_mca_board_model_80_type2_init(int is486) } } - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ps1vga_mca_device); ps2.split_size = 0; diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 0eddc1e19..04f5e5381 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -1437,7 +1437,7 @@ machine_tandy1k_init(const machine_t *model, int type) if (fdc_type == FDC_INTERNAL) device_add(&fdc_xt_tandy_device); - video_reset(gfxcard); + video_reset(gfxcard[0]); switch (type) { case TYPE_TANDY: diff --git a/src/machine/m_v86p.c b/src/machine/m_v86p.c index 03bfda842..af90ab629 100644 --- a/src/machine/m_v86p.c +++ b/src/machine/m_v86p.c @@ -90,7 +90,7 @@ machine_v86p_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_xt_device); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&f82c425_video_device); if (hdc_current <= 1) diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index bb52c2049..e9c24f88f 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -1807,9 +1807,9 @@ machine_xt_m24_init(const machine_t *model) mm58174_init(nvr, model->nvrmask + 1); - video_reset(gfxcard); + video_reset(gfxcard[0]); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&ogc_m24_device); pit_devs[0].set_out_func(pit_devs[0].data, 1, pit_refresh_timer_xt); @@ -1919,7 +1919,7 @@ machine_xt_m19_init(const machine_t *model) nmi_init(); - video_reset(gfxcard); + video_reset(gfxcard[0]); m19_vid_init(vid); device_add_ex(&m19_vid_device, vid); diff --git a/src/machine/m_xt_t1000.c b/src/machine/m_xt_t1000.c index f6f2e5322..f632003ac 100644 --- a/src/machine/m_xt_t1000.c +++ b/src/machine/m_xt_t1000.c @@ -897,7 +897,7 @@ machine_xt_t1000_init(const machine_t *model) t1000_nvr_load(); nvr_set_ven_save(t1000_nvr_save); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&t1000_video_device); return ret; @@ -957,7 +957,7 @@ machine_xt_t1200_init(const machine_t *model) t1200_nvr_load(); nvr_set_ven_save(t1200_nvr_save); - if (gfxcard == VID_INTERNAL) + if (gfxcard[0] == VID_INTERNAL) device_add(&t1200_video_device); if (hdc_current <= 1) diff --git a/src/machine/machine.c b/src/machine/machine.c index f7970d4f1..7a69f4879 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -96,7 +96,7 @@ machine_init_ex(int m) /* Prepare some video-related things if we're using internal or no video. */ - video_pre_reset(gfxcard); + video_pre_reset(gfxcard[0]); /* Reset any ISA memory cards. */ isamem_reset(); @@ -112,7 +112,7 @@ machine_init_ex(int m) if (bios_only || !ret) return ret; - if (gfxcard != VID_NONE) { + if (gfxcard[0] != VID_NONE) { if (ibm8514_enabled) { ibm8514_device_add(); } @@ -122,7 +122,7 @@ machine_init_ex(int m) /* Reset the graphics card (or do nothing if it was already done by the machine's init function). */ - video_reset(gfxcard); + video_reset(gfxcard[0]); return ret; } diff --git a/src/qt/qt_settingsdisplay.cpp b/src/qt/qt_settingsdisplay.cpp index 10321cb2c..e64dc74dd 100644 --- a/src/qt/qt_settingsdisplay.cpp +++ b/src/qt/qt_settingsdisplay.cpp @@ -36,8 +36,8 @@ SettingsDisplay::SettingsDisplay(QWidget *parent) { ui->setupUi(this); - videoCard = gfxcard; - videoCard_2 = gfxcard_2; + videoCard[0] = gfxcard[0]; + videoCard[1] = gfxcard[1]; onCurrentMachineChanged(machine); } @@ -49,8 +49,8 @@ SettingsDisplay::~SettingsDisplay() void SettingsDisplay::save() { - gfxcard = ui->comboBoxVideo->currentData().toInt(); - gfxcard_2 = ui->comboBoxVideoSecondary->currentData().toInt(); + 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; @@ -61,7 +61,7 @@ SettingsDisplay::onCurrentMachineChanged(int machineId) { // win_settings_video_proc, WM_INITDIALOG this->machineId = machineId; - auto curVideoCard = videoCard; + auto curVideoCard = videoCard[0]; auto *model = ui->comboBoxVideo->model(); auto removeRows = model->rowCount(); @@ -103,7 +103,7 @@ SettingsDisplay::onCurrentMachineChanged(int machineId) ui->pushButtonConfigureSecondary->setEnabled(true); } ui->comboBoxVideo->setCurrentIndex(selectedRow); - if (gfxcard_2 == 0) + if (gfxcard[1] == 0) ui->pushButtonConfigureSecondary->setEnabled(false); } @@ -136,9 +136,9 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index) if (index < 0) { return; } - auto curVideoCard_2 = videoCard_2; - videoCard = ui->comboBoxVideo->currentData().toInt(); - ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard) > 0); + auto curVideoCard_2 = videoCard[1]; + videoCard[0] = ui->comboBoxVideo->currentData().toInt(); + ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0); bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0; ui->checkBoxVoodoo->setEnabled(machineHasPci); @@ -167,7 +167,7 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index) ui->comboBoxVideoSecondary->setCurrentIndex(0); // TODO: Implement support for selecting non-MDA secondary cards properly when MDA cards are the primary ones. - if (video_card_get_flags(videoCard) == VIDEO_FLAG_TYPE_MDA) { + if (video_card_get_flags(videoCard[0]) == VIDEO_FLAG_TYPE_MDA) { ui->comboBoxVideoSecondary->setCurrentIndex(0); return; } @@ -178,7 +178,7 @@ 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) && (video_card_get_flags(c) != VIDEO_FLAG_TYPE_SPECIAL))) { + 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))) { ui->comboBoxVideoSecondary->addItem(name, c); if (c == curVideoCard_2) ui->comboBoxVideoSecondary->setCurrentIndex(ui->comboBoxVideoSecondary->count() - 1); @@ -187,7 +187,7 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index) c++; } - if (videoCard_2 == 0 || (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0)) { + if (videoCard[1] == 0 || (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0)) { ui->comboBoxVideoSecondary->setCurrentIndex(0); ui->pushButtonConfigureSecondary->setEnabled(false); } @@ -212,8 +212,8 @@ SettingsDisplay::on_comboBoxVideoSecondary_currentIndexChanged(int index) ui->pushButtonConfigureSecondary->setEnabled(false); return; } - videoCard_2 = ui->comboBoxVideoSecondary->currentData().toInt(); - ui->pushButtonConfigureSecondary->setEnabled(index != 0 && video_card_has_config(videoCard_2) > 0); + videoCard[1] = ui->comboBoxVideoSecondary->currentData().toInt(); + ui->pushButtonConfigureSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0); } void diff --git a/src/qt/qt_settingsdisplay.hpp b/src/qt/qt_settingsdisplay.hpp index c02e55ce0..8331bbb5b 100644 --- a/src/qt/qt_settingsdisplay.hpp +++ b/src/qt/qt_settingsdisplay.hpp @@ -35,9 +35,8 @@ private slots: private: Ui::SettingsDisplay *ui; - int machineId = 0; - int videoCard = 0; - int videoCard_2 = 0; + int machineId = 0; + int videoCard[2] = { 0, 0 }; }; #endif // QT_SETTINGSDISPLAY_HPP diff --git a/src/unix/unix.c b/src/unix/unix.c index b9e842280..730d5be4c 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -1074,7 +1074,7 @@ monitor_thread(void *param) #endif } -extern int gfxcard_2; +extern int gfxcard[2]; int main(int argc, char **argv) { @@ -1089,7 +1089,7 @@ main(int argc, char **argv) return 6; } - gfxcard_2 = 0; + gfxcard[1] = 0; eventthread = SDL_ThreadID(); blitmtx = SDL_CreateMutex(); if (!blitmtx) { diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 92b82d17a..fb6624ced 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -331,7 +331,7 @@ video_reset(int card) if ((video_get_type() != VIDEO_FLAG_TYPE_NONE) && was_reset) return; - vid_table_log("VIDEO: reset (gfxcard=%d, internal=%d)\n", + vid_table_log("VIDEO: reset (gfxcard[0]=%d, internal=%d)\n", card, machine_has_flags(machine, MACHINE_VIDEO) ? 1 : 0); monitor_index_global = 0; @@ -349,11 +349,11 @@ video_reset(int card) if (!(card == VID_NONE) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY) - && gfxcard_2 != 0 - && device_is_valid(video_card_getdevice(gfxcard_2), machine)) { + && gfxcard[1] != 0 + && device_is_valid(video_card_getdevice(gfxcard[1]), machine)) { video_monitor_init(1); monitor_index_global = 1; - device_add(video_cards[gfxcard_2].device); + device_add(video_cards[gfxcard[1]].device); monitor_index_global = 0; } diff --git a/src/win/win.c b/src/win/win.c index 3dd41fca9..69561036d 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -488,8 +488,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow) return (1); } - extern int gfxcard_2; - gfxcard_2 = 0; + extern int gfxcard[2]; + gfxcard[1] = 0; /* Create console window. */ if (force_debug) { diff --git a/src/win/win_settings.c b/src/win/win_settings.c index ea8d356b9..37a8aafb0 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -93,7 +93,7 @@ static int temp_dynarec; #endif /* Video category */ -static int temp_gfxcard, temp_gfxcard_2, temp_ibm8514, temp_voodoo, temp_xga; +static int temp_gfxcard[2], temp_ibm8514, temp_voodoo, temp_xga; /* Input devices category */ static int temp_mouse, temp_joystick; @@ -326,8 +326,8 @@ win_settings_init(void) temp_sync = time_sync; /* Video category */ - temp_gfxcard = gfxcard; - temp_gfxcard_2 = gfxcard_2; + temp_gfxcard[0] = gfxcard[0]; + temp_gfxcard[1] = gfxcard[1]; temp_voodoo = voodoo_enabled; temp_ibm8514 = ibm8514_enabled; temp_xga = xga_enabled; @@ -453,8 +453,8 @@ win_settings_changed(void) i = i || (temp_sync != time_sync); /* Video category */ - i = i || (gfxcard != temp_gfxcard); - i = i || (gfxcard_2 != temp_gfxcard_2); + 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); @@ -546,8 +546,8 @@ win_settings_save(void) time_sync = temp_sync; /* Video category */ - gfxcard = temp_gfxcard; - gfxcard_2 = temp_gfxcard_2; + gfxcard[0] = temp_gfxcard[0]; + gfxcard[1] = temp_gfxcard[1]; voodoo_enabled = temp_voodoo; ibm8514_enabled = temp_ibm8514; xga_enabled = temp_xga; @@ -1090,7 +1090,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) else settings_add_string(hdlg, IDC_COMBO_VIDEO, (LPARAM) device_name); settings_list_to_device[0][d] = c; - if ((c == 0) || (c == temp_gfxcard)) + if ((c == 0) || (c == temp_gfxcard[0])) settings_set_cur_sel(hdlg, IDC_COMBO_VIDEO, d); d++; } @@ -1120,7 +1120,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (!device_name[0]) break; - if ((c > 1) && (video_card_get_flags(c) == video_card_get_flags(temp_gfxcard))) { + if ((c > 1) && (video_card_get_flags(c) == video_card_get_flags(temp_gfxcard[0]))) { c++; continue; } @@ -1133,7 +1133,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) else settings_add_string(hdlg, IDC_COMBO_VIDEO_2, (LPARAM) device_name); settings_list_to_device[1][d] = c; - if ((c == 0) || (c == temp_gfxcard_2)) + if ((c == 0) || (c == temp_gfxcard[1])) settings_set_cur_sel(hdlg, IDC_COMBO_VIDEO_2, d); d++; } @@ -1163,8 +1163,8 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_COMBO_VIDEO: - temp_gfxcard = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; - settings_enable_window(hdlg, IDC_CONFIGURE_VID, video_card_has_config(temp_gfxcard)); + temp_gfxcard[0] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; + settings_enable_window(hdlg, IDC_CONFIGURE_VID, video_card_has_config(temp_gfxcard[0])); // Secondary Video Card c = d = 0; @@ -1182,7 +1182,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (!device_name[0]) break; - if ((c > 1) && (video_card_get_flags(c) == video_card_get_flags(temp_gfxcard))) { + if ((c > 1) && (video_card_get_flags(c) == video_card_get_flags(temp_gfxcard[0]))) { c++; continue; } @@ -1195,7 +1195,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) else settings_add_string(hdlg, IDC_COMBO_VIDEO_2, (LPARAM) device_name); settings_list_to_device[1][d] = c; - if ((c == 0) || (c == temp_gfxcard_2)) + if ((c == 0) || (c == temp_gfxcard[1])) settings_set_cur_sel(hdlg, IDC_COMBO_VIDEO_2, d); d++; } @@ -1211,8 +1211,8 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_COMBO_VIDEO_2: - temp_gfxcard_2 = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO_2)]; - settings_enable_window(hdlg, IDC_CONFIGURE_VID_2, video_card_has_config(temp_gfxcard_2)); + temp_gfxcard[1] = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO_2)]; + settings_enable_window(hdlg, IDC_CONFIGURE_VID_2, video_card_has_config(temp_gfxcard[1])); break; case IDC_CHECK_VOODOO: @@ -1241,23 +1241,23 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_CONFIGURE_VID: - temp_gfxcard = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; - temp_deviceconfig |= deviceconfig_open(hdlg, (void *) video_card_getdevice(temp_gfxcard)); + temp_gfxcard[0] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *) video_card_getdevice(temp_gfxcard[0])); break; case IDC_CONFIGURE_VID_2: - temp_gfxcard_2 = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO_2)]; - temp_deviceconfig |= deviceconfig_open(hdlg, (void *) video_card_getdevice(temp_gfxcard_2)); + temp_gfxcard[1] = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO_2)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *) video_card_getdevice(temp_gfxcard[1])); break; } return FALSE; case WM_SAVESETTINGS: - temp_gfxcard = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; - temp_gfxcard_2 = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO_2)]; - temp_voodoo = settings_get_check(hdlg, IDC_CHECK_VOODOO); - temp_ibm8514 = settings_get_check(hdlg, IDC_CHECK_IBM8514); - temp_xga = settings_get_check(hdlg, IDC_CHECK_XGA); + temp_gfxcard[0] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)]; + temp_gfxcard[1] = settings_list_to_device[1][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO_2)]; + temp_voodoo = settings_get_check(hdlg, IDC_CHECK_VOODOO); + temp_ibm8514 = settings_get_check(hdlg, IDC_CHECK_IBM8514); + temp_xga = settings_get_check(hdlg, IDC_CHECK_XGA); default: return FALSE;