New 'available' function in device API, to determine whether required ROMs are available. Currently used when building soundcard menu, to remove AWE32 when required ROM dump is not present.
This commit is contained in:
parent
4894e97dc5
commit
bd873de9ac
35 changed files with 92 additions and 39 deletions
|
|
@ -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);
|
||||
|
|
|
|||
15
src/mem.c
15
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;
|
||||
|
|
|
|||
|
|
@ -134,5 +134,6 @@ device_t sis496_device =
|
|||
sis496_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
10
src/sound.c
10
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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -60,5 +60,6 @@ device_t adlib_device =
|
|||
adlib_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -595,5 +595,6 @@ device_t adgold_device =
|
|||
adgold_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -177,5 +177,6 @@ device_t cms_device =
|
|||
cms_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1105,6 +1105,7 @@ device_t gus_device =
|
|||
"Gravis UltraSound",
|
||||
gus_init,
|
||||
gus_close,
|
||||
NULL,
|
||||
gus_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -751,5 +751,6 @@ device_t pas16_device =
|
|||
pas16_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -196,5 +196,6 @@ device_t sn76489_device =
|
|||
sn76489_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -305,5 +305,6 @@ device_t wss_device =
|
|||
wss_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -522,6 +522,7 @@ device_t cga_device =
|
|||
"CGA",
|
||||
cga_standalone_init,
|
||||
cga_close,
|
||||
NULL,
|
||||
cga_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -839,6 +839,7 @@ device_t ega_device =
|
|||
"EGA",
|
||||
ega_standalone_init,
|
||||
ega_close,
|
||||
NULL,
|
||||
ega_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -356,6 +356,7 @@ device_t hercules_device =
|
|||
"Hercules",
|
||||
hercules_init,
|
||||
hercules_close,
|
||||
NULL,
|
||||
hercules_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ device_t mda_device =
|
|||
"MDA",
|
||||
mda_init,
|
||||
mda_close,
|
||||
NULL,
|
||||
mda_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -484,6 +484,7 @@ device_t m24_device =
|
|||
"Olivetti M24 (video)",
|
||||
m24_init,
|
||||
m24_close,
|
||||
NULL,
|
||||
m24_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -483,6 +483,7 @@ device_t pc1512_device =
|
|||
"Amstrad PC1512 (video)",
|
||||
pc1512_init,
|
||||
pc1512_close,
|
||||
NULL,
|
||||
pc1512_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ device_t pc1640_device =
|
|||
"Amstrad PC1640 (video)",
|
||||
pc1640_init,
|
||||
pc1640_close,
|
||||
NULL,
|
||||
pc1640_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ device_t pc200_device =
|
|||
"Amstrad PC200 (video)",
|
||||
pc200_init,
|
||||
pc200_close,
|
||||
NULL,
|
||||
pc200_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -693,6 +693,7 @@ device_t tandy_device =
|
|||
"Tandy 1000 (video)",
|
||||
tandy_init,
|
||||
tandy_close,
|
||||
NULL,
|
||||
tandy_speed_changed,
|
||||
NULL,
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ device_t vga_device =
|
|||
"VGA",
|
||||
vga_init,
|
||||
vga_close,
|
||||
NULL,
|
||||
vga_speed_changed,
|
||||
vga_force_redraw,
|
||||
svga_add_status_info
|
||||
|
|
|
|||
19
src/win.c
19
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,7 +653,7 @@ 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);
|
||||
|
|
@ -660,10 +661,18 @@ BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara
|
|||
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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue