diff --git a/src/device.h b/src/device.h index f6e9cad..9cb7775 100644 --- a/src/device.h +++ b/src/device.h @@ -3,6 +3,7 @@ typedef struct device_t char name[50]; void *(*init)(); void (*close)(void *p); + int (*available)(); void (*speed_changed)(void *p); void (*force_redraw)(void *p); int (*add_status_info)(char *s, int max_len, void *p); diff --git a/src/mem.c b/src/mem.c index a4b6015..51181ed 100644 --- a/src/mem.c +++ b/src/mem.c @@ -14,6 +14,7 @@ #include "video.h" #include "x86.h" #include "cpu.h" +#include "rom.h" static uint8_t (*_mem_read_b[0x40000])(uint32_t addr, void *priv); static uint16_t (*_mem_read_w[0x40000])(uint32_t addr, void *priv); @@ -44,20 +45,6 @@ int cachesize=256; uint8_t *ram,*rom,*vram,*vrom; uint8_t romext[32768]; -FILE *romfopen(char *fn, char *mode) -{ - char s[512]; -// pclog("romfopen %s\n", fn); - strcpy(s,pcempath); -// pclog("s = %s\n", s); - put_backslash(s); -// pclog("s = %s\n", s); -// pclog("strcat %s %s\n", s, fn); - strcat(s,fn); -// pclog("s = %s\n", s); - return fopen(s,mode); -} - static void mem_load_xtide_bios() { FILE *f; diff --git a/src/sis496.c b/src/sis496.c index 220c390..02df1df 100644 --- a/src/sis496.c +++ b/src/sis496.c @@ -134,5 +134,6 @@ device_t sis496_device = sis496_close, NULL, NULL, + NULL, NULL }; diff --git a/src/sound.c b/src/sound.c index 57cf79d..3e134e8 100644 --- a/src/sound.c +++ b/src/sound.c @@ -43,6 +43,16 @@ static SOUND_CARD sound_cards[] = {"", NULL} }; +int sound_card_available(int card) +{ + if (sound_cards[card].device) + { + if (sound_cards[card].device->available) + return sound_cards[card].device->available(); + } + return 1; +} + char *sound_card_getname(int card) { return sound_cards[card].name; diff --git a/src/sound.h b/src/sound.h index af0f0d3..754b719 100644 --- a/src/sound.h +++ b/src/sound.h @@ -5,5 +5,6 @@ extern int sbtype; extern int sound_card_current; +int sound_card_available(int card); char *sound_card_getname(int card); void sound_card_init(); diff --git a/src/sound_adlib.c b/src/sound_adlib.c index 31561d3..34527eb 100644 --- a/src/sound_adlib.c +++ b/src/sound_adlib.c @@ -60,5 +60,6 @@ device_t adlib_device = adlib_close, NULL, NULL, + NULL, NULL }; diff --git a/src/sound_adlibgold.c b/src/sound_adlibgold.c index 0a9655c..6a7ada2 100644 --- a/src/sound_adlibgold.c +++ b/src/sound_adlibgold.c @@ -595,5 +595,6 @@ device_t adgold_device = adgold_close, NULL, NULL, + NULL, NULL }; diff --git a/src/sound_cms.c b/src/sound_cms.c index 794e3eb..e874646 100644 --- a/src/sound_cms.c +++ b/src/sound_cms.c @@ -177,5 +177,6 @@ device_t cms_device = cms_close, NULL, NULL, + NULL, NULL }; diff --git a/src/sound_gus.c b/src/sound_gus.c index b58e050..0442483 100644 --- a/src/sound_gus.c +++ b/src/sound_gus.c @@ -1105,6 +1105,7 @@ device_t gus_device = "Gravis UltraSound", gus_init, gus_close, + NULL, gus_speed_changed, NULL, NULL diff --git a/src/sound_pas16.c b/src/sound_pas16.c index 59d15c6..63dccad 100644 --- a/src/sound_pas16.c +++ b/src/sound_pas16.c @@ -751,5 +751,6 @@ device_t pas16_device = pas16_close, NULL, NULL, + NULL, NULL }; diff --git a/src/sound_sb.c b/src/sound_sb.c index 2d47cc1..1c652f2 100644 --- a/src/sound_sb.c +++ b/src/sound_sb.c @@ -376,6 +376,11 @@ void *sb_16_init() return sb; } +int sb_awe32_available() +{ + return rom_present("roms/awe32.raw"); +} + void *sb_awe32_init() { sb_t *sb = malloc(sizeof(sb_t)); @@ -429,6 +434,7 @@ device_t sb_1_device = "Sound Blaster v1.0", sb_1_init, sb_close, + NULL, sb_speed_changed, NULL, NULL @@ -438,6 +444,7 @@ device_t sb_15_device = "Sound Blaster v1.5", sb_15_init, sb_close, + NULL, sb_speed_changed, NULL, NULL @@ -447,6 +454,7 @@ device_t sb_2_device = "Sound Blaster v2.0", sb_2_init, sb_close, + NULL, sb_speed_changed, NULL, NULL @@ -456,6 +464,7 @@ device_t sb_pro_v1_device = "Sound Blaster Pro v1", sb_pro_v1_init, sb_close, + NULL, sb_speed_changed, NULL, NULL @@ -465,6 +474,7 @@ device_t sb_pro_v2_device = "Sound Blaster Pro v2", sb_pro_v2_init, sb_close, + NULL, sb_speed_changed, NULL, NULL @@ -474,6 +484,7 @@ device_t sb_16_device = "Sound Blaster 16", sb_16_init, sb_close, + NULL, sb_speed_changed, NULL, NULL @@ -483,6 +494,7 @@ device_t sb_awe32_device = "Sound Blaster AWE32", sb_awe32_init, sb_close, + sb_awe32_available, sb_speed_changed, NULL, NULL diff --git a/src/sound_sn76489.c b/src/sound_sn76489.c index 5ab0dbb..f71e081 100644 --- a/src/sound_sn76489.c +++ b/src/sound_sn76489.c @@ -196,5 +196,6 @@ device_t sn76489_device = sn76489_close, NULL, NULL, + NULL, NULL }; diff --git a/src/sound_wss.c b/src/sound_wss.c index 24e2685..e6ee21a 100644 --- a/src/sound_wss.c +++ b/src/sound_wss.c @@ -305,5 +305,6 @@ device_t wss_device = wss_close, NULL, NULL, + NULL, NULL }; diff --git a/src/vid_ati18800.c b/src/vid_ati18800.c index b573725..9feb110 100644 --- a/src/vid_ati18800.c +++ b/src/vid_ati18800.c @@ -165,6 +165,7 @@ device_t ati18800_device = "ATI-18800", ati18800_init, ati18800_close, + NULL, ati18800_speed_changed, ati18800_force_redraw, svga_add_status_info diff --git a/src/vid_ati28800.c b/src/vid_ati28800.c index 11f31ac..7c85bc5 100644 --- a/src/vid_ati28800.c +++ b/src/vid_ati28800.c @@ -186,6 +186,7 @@ device_t ati28800_device = "ATI-28800", ati28800_init, ati28800_close, + NULL, ati28800_speed_changed, ati28800_force_redraw, svga_add_status_info diff --git a/src/vid_ati_mach64.c b/src/vid_ati_mach64.c index e22108d..09724f0 100644 --- a/src/vid_ati_mach64.c +++ b/src/vid_ati_mach64.c @@ -2084,6 +2084,7 @@ device_t mach64gx_device = "ATI Mach64GX", mach64gx_init, mach64_close, + NULL, mach64_speed_changed, mach64_force_redraw, svga_add_status_info diff --git a/src/vid_cga.c b/src/vid_cga.c index fcc71a7..2e0a90f 100644 --- a/src/vid_cga.c +++ b/src/vid_cga.c @@ -522,6 +522,7 @@ device_t cga_device = "CGA", cga_standalone_init, cga_close, + NULL, cga_speed_changed, NULL, NULL diff --git a/src/vid_cl5429.c b/src/vid_cl5429.c index 4972cae..38a816b 100644 --- a/src/vid_cl5429.c +++ b/src/vid_cl5429.c @@ -855,6 +855,7 @@ device_t gd5429_device = "Cirrus Logic GD5429", gd5429_init, gd5429_close, + NULL, gd5429_speed_changed, gd5429_force_redraw, svga_add_status_info diff --git a/src/vid_ega.c b/src/vid_ega.c index c918e14..2e3e2de 100644 --- a/src/vid_ega.c +++ b/src/vid_ega.c @@ -839,6 +839,7 @@ device_t ega_device = "EGA", ega_standalone_init, ega_close, + NULL, ega_speed_changed, NULL, NULL diff --git a/src/vid_et4000.c b/src/vid_et4000.c index 697a4a0..ea43290 100644 --- a/src/vid_et4000.c +++ b/src/vid_et4000.c @@ -159,6 +159,7 @@ device_t et4000_device = "Tseng Labs ET4000AX", et4000_init, et4000_close, + NULL, et4000_speed_changed, et4000_force_redraw, svga_add_status_info diff --git a/src/vid_et4000w32.c b/src/vid_et4000w32.c index 0d80eb2..a5c083e 100644 --- a/src/vid_et4000w32.c +++ b/src/vid_et4000w32.c @@ -988,6 +988,7 @@ device_t et4000w32p_device = "Tseng Labs ET4000/w32p", et4000w32p_init, et4000w32p_close, + NULL, et4000w32p_speed_changed, et4000w32p_force_redraw, svga_add_status_info diff --git a/src/vid_hercules.c b/src/vid_hercules.c index e9ac6aa..891b5d3 100644 --- a/src/vid_hercules.c +++ b/src/vid_hercules.c @@ -356,6 +356,7 @@ device_t hercules_device = "Hercules", hercules_init, hercules_close, + NULL, hercules_speed_changed, NULL, NULL diff --git a/src/vid_mda.c b/src/vid_mda.c index 4eea5c2..3d7bdc5 100644 --- a/src/vid_mda.c +++ b/src/vid_mda.c @@ -313,6 +313,7 @@ device_t mda_device = "MDA", mda_init, mda_close, + NULL, mda_speed_changed, NULL, NULL diff --git a/src/vid_olivetti_m24.c b/src/vid_olivetti_m24.c index 3c3eea5..4579dd1 100644 --- a/src/vid_olivetti_m24.c +++ b/src/vid_olivetti_m24.c @@ -484,6 +484,7 @@ device_t m24_device = "Olivetti M24 (video)", m24_init, m24_close, + NULL, m24_speed_changed, NULL, NULL diff --git a/src/vid_oti067.c b/src/vid_oti067.c index 343b8b6..1fb0990 100644 --- a/src/vid_oti067.c +++ b/src/vid_oti067.c @@ -154,6 +154,7 @@ device_t oti067_device = "Oak OTI-067", oti067_init, oti067_close, + NULL, oti067_speed_changed, oti067_force_redraw, svga_add_status_info diff --git a/src/vid_paradise.c b/src/vid_paradise.c index adc26b8..9af6dfe 100644 --- a/src/vid_paradise.c +++ b/src/vid_paradise.c @@ -336,6 +336,7 @@ device_t paradise_pvga1a_device = "Paradise PVGA1A", paradise_pvga1a_init, paradise_close, + NULL, paradise_speed_changed, paradise_force_redraw, svga_add_status_info @@ -345,6 +346,7 @@ device_t paradise_wd90c11_device = "Paradise WD90C11", paradise_wd90c11_init, paradise_close, + NULL, paradise_speed_changed, paradise_force_redraw, svga_add_status_info diff --git a/src/vid_pc1512.c b/src/vid_pc1512.c index 175ef00..75133e5 100644 --- a/src/vid_pc1512.c +++ b/src/vid_pc1512.c @@ -483,6 +483,7 @@ device_t pc1512_device = "Amstrad PC1512 (video)", pc1512_init, pc1512_close, + NULL, pc1512_speed_changed, NULL, NULL diff --git a/src/vid_pc1640.c b/src/vid_pc1640.c index 48463e4..b10dc99 100644 --- a/src/vid_pc1640.c +++ b/src/vid_pc1640.c @@ -146,6 +146,7 @@ device_t pc1640_device = "Amstrad PC1640 (video)", pc1640_init, pc1640_close, + NULL, pc1640_speed_changed, NULL, NULL diff --git a/src/vid_pc200.c b/src/vid_pc200.c index f461f6b..3f02a7e 100644 --- a/src/vid_pc200.c +++ b/src/vid_pc200.c @@ -136,6 +136,7 @@ device_t pc200_device = "Amstrad PC200 (video)", pc200_init, pc200_close, + NULL, pc200_speed_changed, NULL, NULL diff --git a/src/vid_s3.c b/src/vid_s3.c index 4a6531a..990c0ad 100644 --- a/src/vid_s3.c +++ b/src/vid_s3.c @@ -1629,6 +1629,7 @@ device_t s3_bahamas64_device = "Paradise Bahamas 64 (S3 Vision864)", s3_bahamas64_init, s3_close, + NULL, s3_speed_changed, s3_force_redraw, svga_add_status_info @@ -1639,6 +1640,7 @@ device_t s3_9fx_device = "Number 9 9FX (S3 Trio64)", s3_9fx_init, s3_close, + NULL, s3_speed_changed, s3_force_redraw, svga_add_status_info diff --git a/src/vid_s3_virge.c b/src/vid_s3_virge.c index 0a0ca99..8f43355 100644 --- a/src/vid_s3_virge.c +++ b/src/vid_s3_virge.c @@ -508,6 +508,7 @@ device_t s3_virge_device = "Diamond Stealth 3D 2000 (S3 VIRGE)", s3_virge_init, s3_virge_close, + NULL, s3_virge_speed_changed, s3_virge_force_redraw, svga_add_status_info diff --git a/src/vid_tandy.c b/src/vid_tandy.c index 0d5f5d1..41e3d36 100644 --- a/src/vid_tandy.c +++ b/src/vid_tandy.c @@ -693,6 +693,7 @@ device_t tandy_device = "Tandy 1000 (video)", tandy_init, tandy_close, + NULL, tandy_speed_changed, NULL, NULL diff --git a/src/vid_tvga.c b/src/vid_tvga.c index 3263311..d0a35ad 100644 --- a/src/vid_tvga.c +++ b/src/vid_tvga.c @@ -513,25 +513,6 @@ void tvga_force_redraw(void *p) tvga->svga.fullchange = changeframecount; } -device_t tvga8900d_device = -{ - "Trident TVGA 8900D", - tvga8900d_init, - tvga_close, - tvga_speed_changed, - tvga_force_redraw, - svga_add_status_info -}; -device_t tgui9440_device = -{ - "Trident TGUI 9440", - tgui9440_init, - tvga_close, - tvga_speed_changed, - tvga_force_redraw, - svga_add_status_info -}; - enum { TGUI_BITBLT = 1 @@ -1119,3 +1100,25 @@ void tvga_accel_write_fb_l(uint32_t addr, uint32_t val, void *p) // pclog("tvga_accel_write_fb_l %08X %08X\n", addr, val); tvga_accel_command(32, ((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24), tvga); } + +device_t tvga8900d_device = +{ + "Trident TVGA 8900D", + tvga8900d_init, + tvga_close, + NULL, + tvga_speed_changed, + tvga_force_redraw, + svga_add_status_info +}; + +device_t tgui9440_device = +{ + "Trident TGUI 9440", + tgui9440_init, + tvga_close, + NULL, + tvga_speed_changed, + tvga_force_redraw, + svga_add_status_info +}; diff --git a/src/vid_vga.c b/src/vid_vga.c index e9bfb9c..3f6fdde 100644 --- a/src/vid_vga.c +++ b/src/vid_vga.c @@ -119,6 +119,7 @@ device_t vga_device = "VGA", vga_init, vga_close, + NULL, vga_speed_changed, vga_force_redraw, svga_add_status_info diff --git a/src/win.c b/src/win.c index a3d0080..d96bff5 100644 --- a/src/win.c +++ b/src/win.c @@ -561,6 +561,7 @@ 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}; int mem_size_to_list[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16, @@ -607,7 +608,7 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara SendMessage(h, CB_SETCURSEL, modeltolist[model], 0); h=GetDlgItem(hdlg,IDC_COMBO2); - for (c=0;c<6;c++) vidtolist[c]=0; + 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; @@ -652,18 +653,26 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara SendMessage(h, CB_SETCURSEL, cpu, 0); h=GetDlgItem(hdlg,IDC_COMBOSND); - c = 0; + c = d = 0; while (1) { char *s = sound_card_getname(c); if (!s[0]) break; - - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); + + settings_sound_to_list[c] = d; + + if (sound_card_available(c)) + { + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); + settings_list_to_sound[d] = c; + d++; + } + c++; } - SendMessage(h, CB_SETCURSEL, sound_card_current, 0); + SendMessage(h, CB_SETCURSEL, settings_sound_to_list[sound_card_current], 0); h=GetDlgItem(hdlg, IDC_CHECK3); SendMessage(h, BM_SETCHECK, GAMEBLASTER, 0); @@ -747,7 +756,7 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0); h = GetDlgItem(hdlg, IDC_COMBOSND); - temp_sound_card_current = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; if (temp_model != model || gfx != gfxcard || mem != mem_size || fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS || temp_sound_card_current != sound_card_current) {