Major changes to NVR, system initialization (pc.c), and what goes on in the Windows startup (win.c.) Not fully done yet, but good enough for a first commit.

This commit is contained in:
waltje
2017-10-07 00:46:54 -04:00
parent 95fe21b651
commit 2b37b7fbfb
108 changed files with 5628 additions and 5912 deletions

View File

@@ -1,8 +1,15 @@
#ifndef EMU_SOUND_MIDI_H
# define EMU_SOUND_MIDI_H
extern int midi_device_current;
int midi_device_available(int card);
char *midi_device_getname(int card);
struct device_t *midi_device_getdevice(int card);
#ifdef EMU_DEVICE_H
device_t *midi_device_getdevice(int card);
#endif
int midi_device_has_config(int card);
char *midi_device_get_internal_name(int card);
int midi_device_get_from_internal_name(char *s);
@@ -32,4 +39,7 @@ void midi_poll();
#else
#define SYSTEM_MIDI_NAME "System MIDI"
#define SYSTEM_MIDI_INTERNAL_NAME "system_midi"
#endif
#endif
#endif /*EMU_SOUND_MIDI_H*/

View File

@@ -222,12 +222,12 @@ void* mt32emu_init(wchar_t *control_rom, wchar_t *pcm_rom)
return dev;
}
void *mt32_init()
void *mt32_init(device_t *info)
{
return mt32emu_init(L"roms/sound/mt32/mt32_control.rom", L"roms/sound/mt32/mt32_pcm.rom");
}
void *cm32l_init()
void *cm32l_init(device_t *info)
{
return mt32emu_init(L"roms/sound/cm32l/cm32l_control.rom", L"roms/sound/cm32l/cm32l_pcm.rom");
}
@@ -316,8 +316,10 @@ device_t mt32_device =
{
"Roland MT-32 Emulation",
0,
0,
mt32_init,
mt32_close,
NULL,
mt32_available,
NULL,
NULL,
@@ -329,8 +331,10 @@ device_t cm32l_device =
{
"Roland CM-32L Emulation",
0,
0,
cm32l_init,
mt32_close,
NULL,
cm32l_available,
NULL,
NULL,

View File

@@ -9,7 +9,7 @@
#include "midi_system.h"
void* system_midi_init()
void* system_midi_init(device_t *info)
{
midi_device_t* dev = malloc(sizeof(midi_device_t));
memset(dev, 0, sizeof(midi_device_t));
@@ -32,7 +32,7 @@ void system_midi_close(void* p)
midi_close();
}
int system_midi_available()
int system_midi_available(void)
{
return plat_midi_get_num_devs();
}
@@ -53,9 +53,10 @@ static device_config_t system_midi_config[] =
device_t system_midi_device =
{
SYSTEM_MIDI_NAME,
0,
0, 0,
system_midi_init,
system_midi_close,
NULL,
system_midi_available,
NULL,
NULL,

View File

@@ -63,7 +63,7 @@ void adlib_mca_write(int port, uint8_t val, void *p)
adlib->pos_regs[port & 7] = val;
}
void *adlib_init()
void *adlib_init(device_t *info)
{
adlib_t *adlib = malloc(sizeof(adlib_t));
memset(adlib, 0, sizeof(adlib_t));
@@ -75,9 +75,9 @@ void *adlib_init()
return adlib;
}
void *adlib_mca_init()
void *adlib_mca_init(device_t *info)
{
adlib_t *adlib = adlib_init();
adlib_t *adlib = adlib_init(info);
io_removehandler(0x0388, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &adlib->opl);
mca_add(adlib_mca_read, adlib_mca_write, adlib);
@@ -98,11 +98,9 @@ device_t adlib_device =
{
"AdLib",
0,
adlib_init,
adlib_close,
NULL,
NULL,
NULL,
0,
adlib_init, adlib_close, NULL,
NULL, NULL, NULL, NULL,
NULL
};
@@ -110,10 +108,8 @@ device_t adlib_mca_device =
{
"AdLib (MCA)",
DEVICE_MCA,
adlib_init,
adlib_close,
NULL,
NULL,
NULL,
0,
adlib_init, adlib_close, NULL,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -754,7 +754,7 @@ static void adgold_get_buffer(int32_t *buffer, int len, void *p)
}
void *adgold_init()
void *adgold_init(device_t *info)
{
FILE *f;
int c;
@@ -840,9 +840,10 @@ static device_config_t adgold_config[] =
device_t adgold_device =
{
"AdLib Gold",
0,
0, 0,
adgold_init,
adgold_close,
NULL,
NULL,
NULL,
NULL,

View File

@@ -158,7 +158,7 @@ uint8_t cms_read(uint16_t addr, void *p)
return cms->regs[chip][cms->addrs[chip] & 31];
}
void *cms_init()
void *cms_init(device_t *info)
{
cms_t *cms = malloc(sizeof(cms_t));
memset(cms, 0, sizeof(cms_t));
@@ -179,11 +179,8 @@ void cms_close(void *p)
device_t cms_device =
{
"Creative Music System / Game Blaster",
0,
cms_init,
cms_close,
NULL,
NULL,
NULL,
0, 0,
cms_init, cms_close, NULL,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -995,7 +995,7 @@ static void gus_get_buffer(int32_t *buffer, int len, void *p)
}
void *gus_init()
void *gus_init(device_t *info)
{
int c;
double out = 1.0;
@@ -1060,11 +1060,8 @@ void gus_speed_changed(void *p)
device_t gus_device =
{
"Gravis UltraSound",
0,
gus_init,
gus_close,
NULL,
gus_speed_changed,
NULL,
0, 0,
gus_init, gus_close, NULL, NULL,
gus_speed_changed, NULL, NULL,
NULL
};

View File

@@ -8,7 +8,7 @@
*
* Roland MPU-401 emulation.
*
* Version: @(#)snd_mpu401.c 1.0.2 2017/09/24
* Version: @(#)snd_mpu401.c 1.0.3 2017/10/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* DOSBox Team,
@@ -788,7 +788,7 @@ void mpu401_device_add(void)
device_add(&mpu401_device);
}
void *mpu401_standalone_init()
void *mpu401_standalone_init(device_t *info)
{
mpu_t *mpu;
@@ -872,11 +872,10 @@ static device_config_t mpu401_standalone_config[] =
device_t mpu401_device =
{
"MPU-401 (Standalone)",
0,
0, 0,
mpu401_standalone_init,
mpu401_standalone_close,
NULL,
NULL,
NULL, NULL, NULL,
NULL,
NULL,
mpu401_standalone_config

View File

@@ -718,7 +718,8 @@ void pas16_get_buffer(int32_t *buffer, int len, void *p)
pas16->dsp.pos = 0;
}
void *pas16_init()
static void *pas16_init(device_t *info)
{
pas16_t *pas16 = malloc(sizeof(pas16_t));
memset(pas16, 0, sizeof(pas16_t));
@@ -735,7 +736,7 @@ void *pas16_init()
return pas16;
}
void pas16_close(void *p)
static void pas16_close(void *p)
{
pas16_t *pas16 = (pas16_t *)p;
@@ -746,10 +747,8 @@ device_t pas16_device =
{
"Pro Audio Spectrum 16",
DEVICE_NOT_WORKING,
pas16_init,
pas16_close,
NULL,
NULL,
NULL,
NULL
0,
pas16_init, pas16_close, NULL,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -138,7 +138,7 @@ static void ps1_audio_get_buffer(int32_t *buffer, int len, void *p)
ps1->pos = 0;
}
static void *ps1_audio_init()
static void *ps1_audio_init(device_t *info)
{
ps1_audio_t *ps1 = malloc(sizeof(ps1_audio_t));
memset(ps1, 0, sizeof(ps1_audio_t));
@@ -163,9 +163,10 @@ static void ps1_audio_close(void *p)
device_t ps1_audio_device =
{
"PS/1 Audio Card",
0,
0, 0,
ps1_audio_init,
ps1_audio_close,
NULL,
NULL,
NULL,
NULL,

View File

@@ -184,7 +184,7 @@ static void pssj_get_buffer(int32_t *buffer, int len, void *p)
pssj->pos = 0;
}
void *pssj_init()
void *pssj_init(device_t *info)
{
pssj_t *pssj = malloc(sizeof(pssj_t));
memset(pssj, 0, sizeof(pssj_t));
@@ -208,9 +208,10 @@ void pssj_close(void *p)
device_t pssj_device =
{
"Tandy PSSJ",
0,
0, 0,
pssj_init,
pssj_close,
NULL,
NULL,
NULL,
NULL,

View File

@@ -8,7 +8,7 @@
*
* Sound Blaster emulation.
*
* Version: @(#)sound_sb.c 1.0.1 2017/09/24
* Version: @(#)sound_sb.c 1.0.2 2017/10/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -502,7 +502,7 @@ void sb_pro_mcv_write(int port, uint8_t val, void *p)
sb_dsp_setdma8(&sb->dsp, sb->pos_regs[4] & 3);
}
void *sb_1_init()
void *sb_1_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
uint16_t addr = device_get_config_hex16("base");
@@ -519,7 +519,7 @@ void *sb_1_init()
sound_add_handler(sb_get_buffer_opl2, sb);
return sb;
}
void *sb_15_init()
void *sb_15_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
uint16_t addr = device_get_config_hex16("base");
@@ -537,7 +537,7 @@ void *sb_15_init()
return sb;
}
void *sb_mcv_init()
void *sb_mcv_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
memset(sb, 0, sizeof(sb_t));
@@ -554,7 +554,7 @@ void *sb_mcv_init()
sb->pos_regs[1] = 0x50;
return sb;
}
void *sb_2_init()
void *sb_2_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
uint16_t addr = device_get_config_hex16("base");
@@ -572,7 +572,7 @@ void *sb_2_init()
return sb;
}
void *sb_pro_v1_init()
void *sb_pro_v1_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
uint16_t addr = device_get_config_hex16("base");
@@ -600,7 +600,7 @@ void *sb_pro_v1_init()
return sb;
}
void *sb_pro_v2_init()
void *sb_pro_v2_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
uint16_t addr = device_get_config_hex16("base");
@@ -627,7 +627,7 @@ void *sb_pro_v2_init()
return sb;
}
void *sb_pro_mcv_init()
void *sb_pro_mcv_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
memset(sb, 0, sizeof(sb_t));
@@ -650,7 +650,7 @@ void *sb_pro_mcv_init()
return sb;
}
void *sb_16_init()
void *sb_16_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
uint16_t addr = device_get_config_hex16("base");
@@ -690,12 +690,12 @@ void *sb_16_init()
return sb;
}
int sb_awe32_available()
int sb_awe32_available(void)
{
return rom_present(L"roms/sound/awe32.raw");
}
void *sb_awe32_init()
void *sb_awe32_init(device_t *info)
{
sb_t *sb = malloc(sizeof(sb_t));
uint16_t addr = device_get_config_hex16("base");
@@ -1212,9 +1212,8 @@ device_t sb_1_device =
{
"Sound Blaster v1.0",
0,
sb_1_init,
sb_close,
NULL,
0,
sb_1_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1224,9 +1223,8 @@ device_t sb_15_device =
{
"Sound Blaster v1.5",
0,
sb_15_init,
sb_close,
NULL,
0,
sb_15_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1236,9 +1234,8 @@ device_t sb_mcv_device =
{
"Sound Blaster MCV",
DEVICE_MCA,
sb_mcv_init,
sb_close,
NULL,
0,
sb_mcv_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1248,9 +1245,8 @@ device_t sb_2_device =
{
"Sound Blaster v2.0",
0,
sb_2_init,
sb_close,
NULL,
0,
sb_2_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1260,9 +1256,8 @@ device_t sb_pro_v1_device =
{
"Sound Blaster Pro v1",
0,
sb_pro_v1_init,
sb_close,
NULL,
0,
sb_pro_v1_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1272,9 +1267,8 @@ device_t sb_pro_v2_device =
{
"Sound Blaster Pro v2",
0,
sb_pro_v2_init,
sb_close,
NULL,
0,
sb_pro_v2_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1284,9 +1278,8 @@ device_t sb_pro_mcv_device =
{
"Sound Blaster Pro MCV",
DEVICE_MCA,
sb_pro_mcv_init,
sb_close,
NULL,
0,
sb_pro_mcv_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1296,9 +1289,8 @@ device_t sb_16_device =
{
"Sound Blaster 16",
0,
sb_16_init,
sb_close,
NULL,
0,
sb_16_init, sb_close, NULL, NULL,
sb_speed_changed,
NULL,
sb_add_status_info,
@@ -1308,8 +1300,8 @@ device_t sb_awe32_device =
{
"Sound Blaster AWE32",
0,
sb_awe32_init,
sb_close,
0,
sb_awe32_init, sb_close, NULL,
sb_awe32_available,
sb_speed_changed,
NULL,

View File

@@ -205,7 +205,7 @@ void sn76489_init(sn76489_t *sn76489, uint16_t base, uint16_t size, int type, in
io_sethandler(base, size, NULL, NULL, NULL, sn76489_write, NULL, NULL, sn76489);
}
void *sn76489_device_init()
void *sn76489_device_init(device_t *info)
{
sn76489_t *sn76489 = malloc(sizeof(sn76489_t));
memset(sn76489, 0, sizeof(sn76489_t));
@@ -214,7 +214,7 @@ void *sn76489_device_init()
return sn76489;
}
void *ncr8496_device_init()
void *ncr8496_device_init(device_t *info)
{
sn76489_t *sn76489 = malloc(sizeof(sn76489_t));
memset(sn76489, 0, sizeof(sn76489_t));
@@ -235,21 +235,19 @@ device_t sn76489_device =
{
"TI SN74689 PSG",
0,
0,
sn76489_device_init,
sn76489_device_close,
NULL,
NULL,
NULL,
NULL, NULL, NULL, NULL,
NULL
};
device_t ncr8496_device =
{
"NCR8496 PSG",
0,
0,
ncr8496_device_init,
sn76489_device_close,
NULL,
NULL,
NULL,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -57,7 +57,7 @@ static void ssi2001_write(uint16_t addr, uint8_t val, void *p)
sid_write(addr, val, p);
}
void *ssi2001_init()
void *ssi2001_init(device_t *info)
{
ssi2001_t *ssi2001 = malloc(sizeof(ssi2001_t));
memset(ssi2001, 0, sizeof(ssi2001_t));
@@ -82,11 +82,8 @@ void ssi2001_close(void *p)
device_t ssi2001_device =
{
"Innovation SSI-2001",
0,
ssi2001_init,
ssi2001_close,
NULL,
NULL,
NULL,
0, 0,
ssi2001_init, ssi2001_close, NULL,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -77,7 +77,7 @@ static void wss_get_buffer(int32_t *buffer, int len, void *p)
wss->ad1848.pos = 0;
}
void *wss_init()
void *wss_init(device_t *info)
{
wss_t *wss = malloc(sizeof(wss_t));
@@ -115,11 +115,10 @@ void wss_speed_changed(void *p)
device_t wss_device =
{
"Windows Sound System",
0,
wss_init,
wss_close,
0, 0,
wss_init, wss_close, NULL,
NULL,
wss_speed_changed,
NULL,
NULL, NULL,
NULL
};

View File

@@ -8,13 +8,16 @@
*
* Sound emulation core.
*
* Version: @(#)sound.h 1.0.1 2017/06/14
* Version: @(#)sound.h 1.0.2 2017/10/04
*
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2016,2017 Miran Grca.
*/
#ifndef EMU_SOUND_H
# define EMU_SOUND_H
void sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p);
@@ -22,7 +25,9 @@ extern int sound_card_current;
int sound_card_available(int card);
char *sound_card_getname(int card);
struct device_t *sound_card_getdevice(int card);
#ifdef EMU_DEVICE_H
device_t *sound_card_getdevice(int card);
#endif
int sound_card_has_config(int card);
char *sound_card_get_internal_name(int card);
int sound_card_get_from_internal_name(char *s);
@@ -48,3 +53,6 @@ void initalmain(int argc, char *argv[]);
void inital();
void givealbuffer(void *buf);
void givealbuffer_cd(void *buf);
#endif /*EMU_SOUND_H*/