From 657aa19dd182ed5428fa9eb3d30e6e6c15622fe2 Mon Sep 17 00:00:00 2001 From: TomW Date: Thu, 28 Nov 2013 20:03:59 +0000 Subject: [PATCH] Devices can now be marked as not working, and disabled in release builds. Video card menu now build dynamically from list. --- src/device.c | 12 +++ src/device.h | 7 ++ src/pc.rc | 2 +- src/resources.h | 2 +- src/sis496.c | 1 + src/sound.c | 6 +- src/sound_adlib.c | 1 + src/sound_adlibgold.c | 1 + src/sound_cms.c | 1 + src/sound_gus.c | 1 + src/sound_pas16.c | 1 + src/sound_sb.c | 7 ++ src/sound_sn76489.c | 1 + src/sound_wss.c | 1 + src/vid_ati18800.c | 1 + src/vid_ati28800.c | 1 + src/vid_ati_mach64.c | 1 + src/vid_cga.c | 1 + src/vid_cl5429.c | 1 + src/vid_ega.c | 1 + src/vid_et4000.c | 1 + src/vid_et4000w32.c | 1 + src/vid_hercules.c | 1 + src/vid_mda.c | 1 + src/vid_olivetti_m24.c | 1 + src/vid_oti067.c | 1 + src/vid_paradise.c | 2 + src/vid_pc1512.c | 1 + src/vid_pc1640.c | 1 + src/vid_pc200.c | 1 + src/vid_s3.c | 2 + src/vid_s3_virge.c | 1 + src/vid_tandy.c | 1 + src/vid_tgui9440.c | 1 + src/vid_tvga.c | 1 + src/vid_vga.c | 1 + src/video.c | 176 ++++++++++++++++++----------------------- src/video.h | 6 ++ src/win.c | 66 +++++++++------- 39 files changed, 183 insertions(+), 133 deletions(-) diff --git a/src/device.c b/src/device.c index 0e1b6fb..88b6ffb 100644 --- a/src/device.c +++ b/src/device.c @@ -42,6 +42,18 @@ void device_close_all() } } +int device_available(device_t *d) +{ +#ifdef RELEASE_BUILD + if (d->flags & DEVICE_NOT_WORKING) + return 0; +#endif + if (d->available) + return d->available(); + + return 1; +} + void device_speed_changed() { int c; diff --git a/src/device.h b/src/device.h index 9cb7775..61c5221 100644 --- a/src/device.h +++ b/src/device.h @@ -1,6 +1,7 @@ typedef struct device_t { char name[50]; + uint32_t flags; void *(*init)(); void (*close)(void *p); int (*available)(); @@ -12,6 +13,12 @@ typedef struct device_t void device_init(); void device_add(device_t *d); void device_close_all(); +int device_available(device_t *d); void device_speed_changed(); void device_force_redraw(); char *device_add_status_info(char *s, int max_len); + +enum +{ + DEVICE_NOT_WORKING = 1 /*Device does not currently work correctly and will be disabled in a release build*/ +}; diff --git a/src/pc.rc b/src/pc.rc index e4d3ff4..cb08eef 100644 --- a/src/pc.rc +++ b/src/pc.rc @@ -46,7 +46,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,17,216,50,14, WS_TABSTOP PUSHBUTTON "Cancel",IDCANCEL,71,216,50,14, WS_TABSTOP COMBOBOX IDC_COMBO1,62,16,107,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO2,62,36,107,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBOVID,62,36,107,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBOCPUM,62,56,107,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO3,62,76,107,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBOCHC,62,96,107,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP diff --git a/src/resources.h b/src/resources.h index 6b58f1e..a48dea5 100644 --- a/src/resources.h +++ b/src/resources.h @@ -18,7 +18,7 @@ #define IDM_CDROM_DISABLED 40200 #define IDC_COMBO1 1000 -#define IDC_COMBO2 1001 +#define IDC_COMBOVID 1001 #define IDC_COMBO3 1002 #define IDC_COMBO4 1003 #define IDC_COMBO5 1004 diff --git a/src/sis496.c b/src/sis496.c index 02df1df..d18cab3 100644 --- a/src/sis496.c +++ b/src/sis496.c @@ -130,6 +130,7 @@ void sis496_close(void *p) device_t sis496_device = { "SiS 496/497", + 0, sis496_init, sis496_close, NULL, diff --git a/src/sound.c b/src/sound.c index 3e134e8..0097cce 100644 --- a/src/sound.c +++ b/src/sound.c @@ -46,10 +46,8 @@ static SOUND_CARD sound_cards[] = int sound_card_available(int card) { if (sound_cards[card].device) - { - if (sound_cards[card].device->available) - return sound_cards[card].device->available(); - } + return device_available(sound_cards[card].device); + return 1; } diff --git a/src/sound_adlib.c b/src/sound_adlib.c index 34527eb..eb52d73 100644 --- a/src/sound_adlib.c +++ b/src/sound_adlib.c @@ -56,6 +56,7 @@ void adlib_close(void *p) device_t adlib_device = { "AdLib", + 0, adlib_init, adlib_close, NULL, diff --git a/src/sound_adlibgold.c b/src/sound_adlibgold.c index 6a7ada2..6db437a 100644 --- a/src/sound_adlibgold.c +++ b/src/sound_adlibgold.c @@ -591,6 +591,7 @@ void adgold_close(void *p) device_t adgold_device = { "AdLib Gold", + 0, adgold_init, adgold_close, NULL, diff --git a/src/sound_cms.c b/src/sound_cms.c index e874646..9479ef3 100644 --- a/src/sound_cms.c +++ b/src/sound_cms.c @@ -173,6 +173,7 @@ void cms_close(void *p) device_t cms_device = { "Creative Music System / Game Blaster", + 0, cms_init, cms_close, NULL, diff --git a/src/sound_gus.c b/src/sound_gus.c index 0442483..03b0fed 100644 --- a/src/sound_gus.c +++ b/src/sound_gus.c @@ -1103,6 +1103,7 @@ void gus_speed_changed(void *p) device_t gus_device = { "Gravis UltraSound", + 0, gus_init, gus_close, NULL, diff --git a/src/sound_pas16.c b/src/sound_pas16.c index 63dccad..0f9e22b 100644 --- a/src/sound_pas16.c +++ b/src/sound_pas16.c @@ -747,6 +747,7 @@ void pas16_close(void *p) device_t pas16_device = { "Pro Audio Spectrum 16", + DEVICE_NOT_WORKING, pas16_init, pas16_close, NULL, diff --git a/src/sound_sb.c b/src/sound_sb.c index 7f4318e..d684ff1 100644 --- a/src/sound_sb.c +++ b/src/sound_sb.c @@ -432,6 +432,7 @@ void sb_speed_changed(void *p) device_t sb_1_device = { "Sound Blaster v1.0", + 0, sb_1_init, sb_close, NULL, @@ -442,6 +443,7 @@ device_t sb_1_device = device_t sb_15_device = { "Sound Blaster v1.5", + 0, sb_15_init, sb_close, NULL, @@ -452,6 +454,7 @@ device_t sb_15_device = device_t sb_2_device = { "Sound Blaster v2.0", + 0, sb_2_init, sb_close, NULL, @@ -462,6 +465,7 @@ device_t sb_2_device = device_t sb_pro_v1_device = { "Sound Blaster Pro v1", + 0, sb_pro_v1_init, sb_close, NULL, @@ -472,6 +476,7 @@ device_t sb_pro_v1_device = device_t sb_pro_v2_device = { "Sound Blaster Pro v2", + 0, sb_pro_v2_init, sb_close, NULL, @@ -482,6 +487,7 @@ device_t sb_pro_v2_device = device_t sb_16_device = { "Sound Blaster 16", + 0, sb_16_init, sb_close, NULL, @@ -492,6 +498,7 @@ device_t sb_16_device = device_t sb_awe32_device = { "Sound Blaster AWE32", + 0, sb_awe32_init, sb_close, sb_awe32_available, diff --git a/src/sound_sn76489.c b/src/sound_sn76489.c index f71e081..c027240 100644 --- a/src/sound_sn76489.c +++ b/src/sound_sn76489.c @@ -192,6 +192,7 @@ void sn76489_close(void *p) device_t sn76489_device = { "TI SN74689 PSG", + 0, sn76489_init, sn76489_close, NULL, diff --git a/src/sound_wss.c b/src/sound_wss.c index f46bbc8..5253cb5 100644 --- a/src/sound_wss.c +++ b/src/sound_wss.c @@ -123,6 +123,7 @@ void wss_close(void *p) device_t wss_device = { "Windows Sound System", + 0, wss_init, wss_close, NULL, diff --git a/src/vid_ati18800.c b/src/vid_ati18800.c index 37137e4..6041807 100644 --- a/src/vid_ati18800.c +++ b/src/vid_ati18800.c @@ -170,6 +170,7 @@ int ati18800_add_status_info(char *s, int max_len, void *p) device_t ati18800_device = { "ATI-18800", + 0, ati18800_init, ati18800_close, NULL, diff --git a/src/vid_ati28800.c b/src/vid_ati28800.c index c3cb8c1..5993d4b 100644 --- a/src/vid_ati28800.c +++ b/src/vid_ati28800.c @@ -191,6 +191,7 @@ int ati28800_add_status_info(char *s, int max_len, void *p) device_t ati28800_device = { "ATI-28800", + 0, ati28800_init, ati28800_close, NULL, diff --git a/src/vid_ati_mach64.c b/src/vid_ati_mach64.c index e75c7d3..53839a9 100644 --- a/src/vid_ati_mach64.c +++ b/src/vid_ati_mach64.c @@ -2095,6 +2095,7 @@ int mach64_add_status_info(char *s, int max_len, void *p) device_t mach64gx_device = { "ATI Mach64GX", + 0, mach64gx_init, mach64_close, NULL, diff --git a/src/vid_cga.c b/src/vid_cga.c index 2e0a90f..c4bf907 100644 --- a/src/vid_cga.c +++ b/src/vid_cga.c @@ -520,6 +520,7 @@ void cga_speed_changed(void *p) device_t cga_device = { "CGA", + 0, cga_standalone_init, cga_close, NULL, diff --git a/src/vid_cl5429.c b/src/vid_cl5429.c index e9e5399..e74a9d9 100644 --- a/src/vid_cl5429.c +++ b/src/vid_cl5429.c @@ -869,6 +869,7 @@ int gd5429_add_status_info(char *s, int max_len, void *p) device_t gd5429_device = { "Cirrus Logic GD5429", + DEVICE_NOT_WORKING, gd5429_init, gd5429_close, NULL, diff --git a/src/vid_ega.c b/src/vid_ega.c index 2e3e2de..19af6a9 100644 --- a/src/vid_ega.c +++ b/src/vid_ega.c @@ -837,6 +837,7 @@ void ega_speed_changed(void *p) device_t ega_device = { "EGA", + 0, ega_standalone_init, ega_close, NULL, diff --git a/src/vid_et4000.c b/src/vid_et4000.c index 1902f6e..d48029b 100644 --- a/src/vid_et4000.c +++ b/src/vid_et4000.c @@ -173,6 +173,7 @@ int et4000_add_status_info(char *s, int max_len, void *p) device_t et4000_device = { "Tseng Labs ET4000AX", + 0, et4000_init, et4000_close, NULL, diff --git a/src/vid_et4000w32.c b/src/vid_et4000w32.c index cce7f6b..4ff87b9 100644 --- a/src/vid_et4000w32.c +++ b/src/vid_et4000w32.c @@ -1000,6 +1000,7 @@ int et4000w32p_add_status_info(char *s, int max_len, void *p) device_t et4000w32p_device = { "Tseng Labs ET4000/w32p", + 0, et4000w32p_init, et4000w32p_close, NULL, diff --git a/src/vid_hercules.c b/src/vid_hercules.c index 891b5d3..61aa9da 100644 --- a/src/vid_hercules.c +++ b/src/vid_hercules.c @@ -354,6 +354,7 @@ void hercules_speed_changed(void *p) device_t hercules_device = { "Hercules", + 0, hercules_init, hercules_close, NULL, diff --git a/src/vid_mda.c b/src/vid_mda.c index 3d7bdc5..179b3d7 100644 --- a/src/vid_mda.c +++ b/src/vid_mda.c @@ -311,6 +311,7 @@ void mda_speed_changed(void *p) device_t mda_device = { "MDA", + 0, mda_init, mda_close, NULL, diff --git a/src/vid_olivetti_m24.c b/src/vid_olivetti_m24.c index 4579dd1..852f0d1 100644 --- a/src/vid_olivetti_m24.c +++ b/src/vid_olivetti_m24.c @@ -482,6 +482,7 @@ void m24_speed_changed(void *p) device_t m24_device = { "Olivetti M24 (video)", + 0, m24_init, m24_close, NULL, diff --git a/src/vid_oti067.c b/src/vid_oti067.c index a20301e..0f00854 100644 --- a/src/vid_oti067.c +++ b/src/vid_oti067.c @@ -159,6 +159,7 @@ int oti067_add_status_info(char *s, int max_len, void *p) device_t oti067_device = { "Oak OTI-067", + 0, oti067_init, oti067_close, NULL, diff --git a/src/vid_paradise.c b/src/vid_paradise.c index 3578052..286c1af 100644 --- a/src/vid_paradise.c +++ b/src/vid_paradise.c @@ -345,6 +345,7 @@ int paradise_add_status_info(char *s, int max_len, void *p) device_t paradise_pvga1a_device = { "Paradise PVGA1A", + 0, paradise_pvga1a_init, paradise_close, NULL, @@ -355,6 +356,7 @@ device_t paradise_pvga1a_device = device_t paradise_wd90c11_device = { "Paradise WD90C11", + 0, paradise_wd90c11_init, paradise_close, NULL, diff --git a/src/vid_pc1512.c b/src/vid_pc1512.c index 75133e5..9af373a 100644 --- a/src/vid_pc1512.c +++ b/src/vid_pc1512.c @@ -481,6 +481,7 @@ static void pc1512_speed_changed(void *p) device_t pc1512_device = { "Amstrad PC1512 (video)", + 0, pc1512_init, pc1512_close, NULL, diff --git a/src/vid_pc1640.c b/src/vid_pc1640.c index b10dc99..203132f 100644 --- a/src/vid_pc1640.c +++ b/src/vid_pc1640.c @@ -144,6 +144,7 @@ void pc1640_speed_changed(void *p) device_t pc1640_device = { "Amstrad PC1640 (video)", + 0, pc1640_init, pc1640_close, NULL, diff --git a/src/vid_pc200.c b/src/vid_pc200.c index 3f02a7e..57dce0b 100644 --- a/src/vid_pc200.c +++ b/src/vid_pc200.c @@ -134,6 +134,7 @@ void pc200_speed_changed(void *p) device_t pc200_device = { "Amstrad PC200 (video)", + 0, pc200_init, pc200_close, NULL, diff --git a/src/vid_s3.c b/src/vid_s3.c index 46b525b..57f7924 100644 --- a/src/vid_s3.c +++ b/src/vid_s3.c @@ -1689,6 +1689,7 @@ int s3_add_status_info(char *s, int max_len, void *p) device_t s3_bahamas64_device = { "Paradise Bahamas 64 (S3 Vision864)", + 0, s3_bahamas64_init, s3_close, NULL, @@ -1700,6 +1701,7 @@ device_t s3_bahamas64_device = device_t s3_9fx_device = { "Number 9 9FX (S3 Trio64)", + 0, s3_9fx_init, s3_close, NULL, diff --git a/src/vid_s3_virge.c b/src/vid_s3_virge.c index e02575a..c4ac6b2 100644 --- a/src/vid_s3_virge.c +++ b/src/vid_s3_virge.c @@ -517,6 +517,7 @@ int s3_virge_add_status_info(char *s, int max_len, void *p) device_t s3_virge_device = { "Diamond Stealth 3D 2000 (S3 VIRGE)", + DEVICE_NOT_WORKING, s3_virge_init, s3_virge_close, NULL, diff --git a/src/vid_tandy.c b/src/vid_tandy.c index 41e3d36..2454e7c 100644 --- a/src/vid_tandy.c +++ b/src/vid_tandy.c @@ -691,6 +691,7 @@ void tandy_speed_changed(void *p) device_t tandy_device = { "Tandy 1000 (video)", + 0, tandy_init, tandy_close, NULL, diff --git a/src/vid_tgui9440.c b/src/vid_tgui9440.c index 63cfe06..152c2fd 100644 --- a/src/vid_tgui9440.c +++ b/src/vid_tgui9440.c @@ -1124,6 +1124,7 @@ int tgui_add_status_info(char *s, int max_len, void *p) device_t tgui9440_device = { "Trident TGUI 9440", + 0, tgui9440_init, tgui_close, NULL, diff --git a/src/vid_tvga.c b/src/vid_tvga.c index 2934999..813c32d 100644 --- a/src/vid_tvga.c +++ b/src/vid_tvga.c @@ -284,6 +284,7 @@ int tvga_add_status_info(char *s, int max_len, void *p) device_t tvga8900d_device = { "Trident TVGA 8900D", + 0, tvga8900d_init, tvga_close, NULL, diff --git a/src/vid_vga.c b/src/vid_vga.c index cab5b53..95d1ee9 100644 --- a/src/vid_vga.c +++ b/src/vid_vga.c @@ -124,6 +124,7 @@ int vga_add_status_info(char *s, int max_len, void *p) device_t vga_device = { "VGA", + DEVICE_NOT_WORKING, vga_init, vga_close, NULL, diff --git a/src/video.c b/src/video.c index 052bedb..ea1406d 100644 --- a/src/video.c +++ b/src/video.c @@ -33,6 +33,81 @@ #include "vid_tvga.h" #include "vid_vga.h" +typedef struct +{ + char name[64]; + device_t *device; + int legacy_id; +} VIDEO_CARD; + +static VIDEO_CARD video_cards[] = +{ + {"CGA", &cga_device, GFX_CGA}, + {"MDA", &mda_device, GFX_MDA}, + {"Hercules", &hercules_device, GFX_HERCULES}, + {"EGA", &ega_device, GFX_EGA}, + {"Trident TVGA8900D", &tvga8900d_device, GFX_TVGA}, + {"Tseng ET4000AX", &et4000_device, GFX_ET4000}, + {"Diamond Stealth 32 (Tseng ET4000/w32p)", &et4000w32p_device, GFX_ET4000W32}, + {"Paradise Bahamas 64 (S3 Vision864)", &s3_bahamas64_device, GFX_BAHAMAS64}, + {"Number Nine 9FX (S3 Trio64)", &s3_9fx_device, GFX_N9_9FX}, + {"Diamond Stealth 3D 2000 (S3 ViRGE)", &s3_virge_device, GFX_VIRGE}, + {"Trident TGUI9440", &tgui9440_device, GFX_TGUI9440}, + {"VGA", &vga_device, GFX_VGA}, + {"ATI VGA Edge-16 (ATI-18800)", &ati18800_device, GFX_VGAEDGE16}, + {"ATI VGA Charger", &ati28800_device, GFX_VGACHARGER}, + {"OAK OTI-067", &oti067_device, GFX_OTI067}, + {"ATI Graphics Pro Turbo (Mach64 GX)", &mach64gx_device, GFX_MACH64GX}, + {"Cirrus Logic CL-GD5429", &gd5429_device, GFX_CL_GD5429}, + {"", NULL, 0} +}; + +int video_card_available(int card) +{ + if (video_cards[card].device) + return device_available(video_cards[card].device); + + return 1; +} + +char *video_card_getname(int card) +{ + return video_cards[card].name; +} + +int video_card_getid(char *s) +{ + int c = 0; + + while (video_cards[c].device) + { + if (!strcmp(video_cards[c].name, s)) + return c; + c++; + } + + return 0; +} + +int video_old_to_new(int card) +{ + int c = 0; + + while (video_cards[c].device) + { + if (video_cards[c].legacy_id == card) + return c; + c++; + } + + return 0; +} + +int video_new_to_old(int card) +{ + return video_cards[card].legacy_id; +} + uint32_t *video_15to32, *video_16to32; int egareads=0,egawrites=0; @@ -159,82 +234,7 @@ void video_init() device_add(&oti067_device); return; } - switch (gfxcard) - { - case GFX_MDA: - device_add(&mda_device); - break; - - case GFX_HERCULES: - device_add(&hercules_device); - break; - - case GFX_CGA: - device_add(&cga_device); - break; - - case GFX_EGA: - device_add(&ega_device); - break; - - case GFX_TVGA: - device_add(&tvga8900d_device); - break; - - case GFX_ET4000: - device_add(&et4000_device); - break; - - case GFX_ET4000W32: - device_add(&et4000w32p_device); - break; - - case GFX_BAHAMAS64: - device_add(&s3_bahamas64_device); - break; - - case GFX_N9_9FX: - device_add(&s3_9fx_device); - break; - - case GFX_STEALTH64: - break; - - case GFX_VIRGE: - device_add(&s3_virge_device); - break; - - case GFX_TGUI9440: - device_add(&tgui9440_device); - break; - - case GFX_VGA: - device_add(&vga_device); - break; - - case GFX_VGAEDGE16: - device_add(&ati18800_device); - break; - - case GFX_VGACHARGER: - device_add(&ati18800_device); - break; - - case GFX_OTI067: - device_add(&oti067_device); - return; - - case GFX_MACH64GX: - device_add(&mach64gx_device); - return; - - case GFX_CL_GD5429: - device_add(&gd5429_device); - return; - - default: - fatal("Bad gfx card %i\n",gfxcard); - } + device_add(video_cards[video_old_to_new(gfxcard)].device); } @@ -245,29 +245,7 @@ uint8_t fontdatm[256][16]; int xsize=1,ysize=1; - -PALETTE cgapal;/* = -{ - { 0, 0, 0},{0,42,0},{42,0,0},{42,21,0}, - { 0, 0, 0},{0,42,42},{42,0,42},{42,42,42}, - { 0, 0, 0},{21,63,21},{63,21,21},{63,63,21}, - { 0, 0, 0},{21,63,63},{63,21,63},{63,63,63}, - - {0, 0, 0}, { 0, 0, 42}, { 0, 42, 0}, { 0, 42, 42}, - {42, 0, 0}, {42, 0, 42}, {42, 21, 00}, {42, 42, 42}, - {21, 21, 21}, {21, 21, 63}, {21, 63, 21}, {21, 63, 63}, - {63, 21, 21}, {63, 21, 63}, {63, 63, 21}, {63, 63, 63}, - - {0,0,0},{0,21,0},{0,0,42},{0,42,42}, - {42,0,21},{21,10,21},{42,0,42},{42,0,63}, - {21,21,21},{21,63,21},{42,21,42},{21,63,63}, - {63,0,0},{42,42,0},{63,21,42},{41,41,41}, - - {0,0,0},{0,42,42},{42,0,0},{42,42,42}, - {0,0,0},{0,42,42},{42,0,0},{42,42,42}, - {0,0,0},{0,63,63},{63,0,0},{63,63,63}, - {0,0,0},{0,63,63},{63,0,0},{63,63,63}, -};*/ +PALETTE cgapal; void loadfont(char *s, int format) { diff --git a/src/video.h b/src/video.h index ae72dd0..f0c8304 100644 --- a/src/video.h +++ b/src/video.h @@ -1,3 +1,9 @@ +int video_card_available(int card); +char *video_card_getname(int card); +int video_card_getid(char *s); +int video_old_to_new(int card); +int video_new_to_old(int card); + extern int egareads,egawrites; extern int fullchange; diff --git a/src/win.c b/src/win.c index b318c6e..f19a4ba 100644 --- a/src/win.c +++ b/src/win.c @@ -560,7 +560,6 @@ int getsfile(HWND hwnd, char *f, char *fn) extern int is486; int romstolist[26], listtomodel[26], romstomodel[26], modeltolist[26]; -int vidtolist[20],listtovid[20]; static int settings_sound_to_list[20], settings_list_to_sound[20]; int mem_list_to_size[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,32,48,64,256}; @@ -578,6 +577,7 @@ int mem_size_to_list[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,15,15,15 BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { + char temp_str[256]; HWND h; int c, d; int rom,gfx,mem,fpu; @@ -606,29 +606,27 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara c++; } SendMessage(h, CB_SETCURSEL, modeltolist[model], 0); - - h=GetDlgItem(hdlg,IDC_COMBO2); - memset(vidtolist, 0, sizeof(vidtolist)); - c=4; - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"CGA"); vidtolist[GFX_CGA]=0; listtovid[0]=0; - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"MDA"); vidtolist[GFX_MDA]=1; listtovid[1]=1; - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Hercules"); vidtolist[GFX_HERCULES]=2; listtovid[2]=2; - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"EGA"); vidtolist[GFX_EGA]=3; listtovid[3]=3; - if (gfx_present[GFX_TVGA]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Trident 8900D"); vidtolist[GFX_TVGA]=c; listtovid[c]=GFX_TVGA; c++; } - if (gfx_present[GFX_ET4000]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Tseng ET4000AX"); vidtolist[GFX_ET4000]=c; listtovid[c]=GFX_ET4000; c++; } - if (gfx_present[GFX_ET4000W32]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Diamond Stealth 32"); vidtolist[GFX_ET4000W32]=c; listtovid[c]=GFX_ET4000W32; c++; } - if (gfx_present[GFX_BAHAMAS64]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Paradise Bahamas 64"); vidtolist[GFX_BAHAMAS64]=c; listtovid[c]=GFX_BAHAMAS64; c++; } - if (gfx_present[GFX_N9_9FX]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Number Nine 9FX"); vidtolist[GFX_N9_9FX]=c; listtovid[c]=GFX_N9_9FX; c++; } - if (gfx_present[GFX_VIRGE]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"S3 VIRGE"); vidtolist[GFX_VIRGE]=c; listtovid[c]=GFX_VIRGE; c++; } - if (gfx_present[GFX_TGUI9440]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Trident TGUI9440"); vidtolist[GFX_TGUI9440]=c; listtovid[c]=GFX_TGUI9440; c++; } - if (gfx_present[GFX_VGA]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"VGA"); vidtolist[GFX_VGA]=c; listtovid[c]=GFX_VGA; c++; } - if (gfx_present[GFX_VGAEDGE16]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"ATI VGA Edge-16"); vidtolist[GFX_VGAEDGE16]=c; listtovid[c]=GFX_VGAEDGE16; c++; } - if (gfx_present[GFX_VGACHARGER]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"ATI VGA Charger"); vidtolist[GFX_VGACHARGER]=c; listtovid[c]=GFX_VGACHARGER; c++; } - if (gfx_present[GFX_OTI067]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Oak OTI-067"); vidtolist[GFX_OTI067]=c; listtovid[c]=GFX_OTI067; c++; } - if (gfx_present[GFX_MACH64GX]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"ATI Graphics Pro Turbo"); vidtolist[GFX_MACH64GX]=c; listtovid[c]=GFX_MACH64GX; c++; } - if (gfx_present[GFX_CL_GD5429]) { SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Cirrus Logic CL-GD5429"); vidtolist[GFX_CL_GD5429]=c; listtovid[c]=GFX_CL_GD5429; c++; } - SendMessage(h,CB_SETCURSEL,vidtolist[gfxcard],0); - if (models[model].fixed_gfxcard) EnableWindow(h,FALSE); + + h = GetDlgItem(hdlg, IDC_COMBOVID); + c = d = 0; + while (1) + { + char *s = video_card_getname(c); + + if (!s[0]) + break; + + if (video_card_available(c)) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); + if (video_new_to_old(c) == gfxcard) + SendMessage(h, CB_SETCURSEL, d, 0); + + d++; + } + + c++; + } h=GetDlgItem(hdlg,IDC_COMBOCPUM); c = 0; @@ -736,8 +734,9 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara h=GetDlgItem(hdlg,IDC_COMBO1); temp_model = listtomodel[SendMessage(h,CB_GETCURSEL,0,0)]; - h=GetDlgItem(hdlg,IDC_COMBO2); - gfx=listtovid[SendMessage(h,CB_GETCURSEL,0,0)]; + h = GetDlgItem(hdlg, IDC_COMBOVID); + SendMessage(h, CB_GETLBTEXT, SendMessage(h,CB_GETCURSEL,0,0), (LPARAM)temp_str); + gfx = video_new_to_old(video_card_getid(temp_str)); h=GetDlgItem(hdlg,IDC_COMBOMEM); mem=mem_list_to_size[SendMessage(h,CB_GETCURSEL,0,0)]; @@ -818,11 +817,22 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara temp_model = listtomodel[SendMessage(h,CB_GETCURSEL,0,0)]; /*Enable/disable gfxcard list*/ - h = GetDlgItem(hdlg, IDC_COMBO2); + h = GetDlgItem(hdlg, IDC_COMBOVID); if (!models[temp_model].fixed_gfxcard) { + char *s = video_card_getname(video_old_to_new(gfxcard)); + EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, gfxcard, 0); + + c = 0; + while (1) + { + SendMessage(h, CB_GETLBTEXT, c, (LPARAM)temp_str); + if (!strcmp(temp_str, s)) + break; + c++; + } + SendMessage(h, CB_SETCURSEL, c, 0); } else EnableWindow(h, FALSE);