Commented out the NEC PowerMate V, because it doesn't work;
Applied all mainline PCem commits; CD-ROM sound thread is now disabled if all CD-ROM drives are either disabled or have audio disabled; Fixed the displayed incorrect zero cylinders, head, and sectors per cylinder when loading an already existing HDI image; Fixed the CD-ROM audio menu item not checking/unchecking correctly.
This commit is contained in:
@@ -496,7 +496,7 @@ float VGACONST1,VGACONST2;
|
|||||||
float RTCCONST;
|
float RTCCONST;
|
||||||
int gated,speakval,speakon;
|
int gated,speakval,speakon;
|
||||||
|
|
||||||
#define SOUNDBUFLEN (48000/10)
|
#define SOUNDBUFLEN (48000/40)
|
||||||
|
|
||||||
|
|
||||||
/*Sound Blaster*/
|
/*Sound Blaster*/
|
||||||
|
|||||||
@@ -1283,6 +1283,14 @@ ide_bad_command:
|
|||||||
ide->atastat = ide_other->atastat = BUSY_STAT;
|
ide->atastat = ide_other->atastat = BUSY_STAT;
|
||||||
// ide_log("IDE Reset %i\n", ide_board);
|
// ide_log("IDE Reset %i\n", ide_board);
|
||||||
}
|
}
|
||||||
|
if (val & 4)
|
||||||
|
{
|
||||||
|
/*Drive held in reset*/
|
||||||
|
timer_process();
|
||||||
|
idecallback[ide_board] = 0;
|
||||||
|
timer_update_outstanding();
|
||||||
|
ide->atastat = ide_other->atastat = BUSY_STAT;
|
||||||
|
}
|
||||||
ide->fdisk = ide_other->fdisk = val;
|
ide->fdisk = ide_other->fdisk = val;
|
||||||
ide_irq_update(ide);
|
ide_irq_update(ide);
|
||||||
return;
|
return;
|
||||||
|
|||||||
7
src/io.c
7
src/io.c
@@ -130,6 +130,9 @@ uint8_t inb(uint16_t port)
|
|||||||
/* if (!port_inb[port][0] && !port_inb[port][1])
|
/* if (!port_inb[port][0] && !port_inb[port][1])
|
||||||
pclog("Bad INB %04X %04X:%04X\n", port, CS, cpu_state.pc); */
|
pclog("Bad INB %04X %04X:%04X\n", port, CS, cpu_state.pc); */
|
||||||
|
|
||||||
|
/* if (port_inb[port][0] || port_inb[port][1])
|
||||||
|
pclog("Good INB %04X %04X:%04X\n", port, CS, cpu_state.pc); */
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,6 +147,10 @@ void outb(uint16_t port, uint8_t val)
|
|||||||
|
|
||||||
/* if (!port_outb[port][0] && !port_outb[port][1])
|
/* if (!port_outb[port][0] && !port_outb[port][1])
|
||||||
pclog("Bad OUTB %04X %02X %04X:%08X\n", port, val, CS, cpu_state.pc); */
|
pclog("Bad OUTB %04X %02X %04X:%08X\n", port, val, CS, cpu_state.pc); */
|
||||||
|
|
||||||
|
/* if (port_outb[port][0] || port_outb[port][1])
|
||||||
|
pclog("Good OUTB %04X %02X %04X:%08X\n", port, val, CS, cpu_state.pc); */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
src/model.c
14
src/model.c
@@ -101,7 +101,9 @@ void at_r418_init();
|
|||||||
void at_586mc1_init();
|
void at_586mc1_init();
|
||||||
void at_plato_init();
|
void at_plato_init();
|
||||||
void at_mb500n_init();
|
void at_mb500n_init();
|
||||||
// void at_powermate_v_init();
|
#if 0
|
||||||
|
void at_powermate_v_init();
|
||||||
|
#endif
|
||||||
void at_p54tp4xe_init();
|
void at_p54tp4xe_init();
|
||||||
void at_acerm3a_init();
|
void at_acerm3a_init();
|
||||||
void at_acerv35n_init();
|
void at_acerv35n_init();
|
||||||
@@ -166,7 +168,9 @@ MODEL models[] =
|
|||||||
{"Intel Premiere/PCI II",ROM_PLATO, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_plato_init, NULL},
|
{"Intel Premiere/PCI II",ROM_PLATO, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_plato_init, NULL},
|
||||||
{"Intel Advanced/EV", ROM_ENDEAVOR, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_endeavor_init, NULL},
|
{"Intel Advanced/EV", ROM_ENDEAVOR, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_endeavor_init, NULL},
|
||||||
{"PC Partner MB500N", ROM_MB500N, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_mb500n_init, NULL},
|
{"PC Partner MB500N", ROM_MB500N, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_mb500n_init, NULL},
|
||||||
/* {"NEC PowerMate V", ROM_POWERMATE_V, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_powermate_v_init, NULL}, */
|
#if 0
|
||||||
|
{"NEC PowerMate V", ROM_POWERMATE_V, { "Intel", cpus_PentiumS5,"IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 128, 1, at_powermate_v_init, NULL},
|
||||||
|
#endif
|
||||||
{"Intel Advanced/ATX", ROM_THOR, { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 256, 1, at_endeavor_init, NULL},
|
{"Intel Advanced/ATX", ROM_THOR, { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 256, 1, at_endeavor_init, NULL},
|
||||||
{"MR Intel Advanced/ATX", ROM_MRTHOR, { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 256, 1, at_endeavor_init, NULL},
|
{"MR Intel Advanced/ATX", ROM_MRTHOR, { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 256, 1, at_endeavor_init, NULL},
|
||||||
{"ASUS P/I-P54TP4XE", ROM_P54TP4XE, { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 512, 1, at_p54tp4xe_init, NULL},
|
{"ASUS P/I-P54TP4XE", ROM_P54TP4XE, { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL}, 0, MODEL_AT|MODEL_PS2, 1, 512, 1, at_p54tp4xe_init, NULL},
|
||||||
@@ -527,7 +531,8 @@ void at_mb500n_init()
|
|||||||
device_add(&intel_flash_bxt_device);
|
device_add(&intel_flash_bxt_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void at_powermate_v_init()
|
#if 0
|
||||||
|
void at_powermate_v_init()
|
||||||
{
|
{
|
||||||
at_init();
|
at_init();
|
||||||
powermate_memregs_init();
|
powermate_memregs_init();
|
||||||
@@ -537,7 +542,8 @@ void at_mb500n_init()
|
|||||||
fdc37c665_init();
|
fdc37c665_init();
|
||||||
acerm3a_io_init();
|
acerm3a_io_init();
|
||||||
device_add(&intel_flash_bxt_device);
|
device_add(&intel_flash_bxt_device);
|
||||||
} */
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void at_p54tp4xe_init()
|
void at_p54tp4xe_init()
|
||||||
{
|
{
|
||||||
|
|||||||
2
src/pc.c
2
src/pc.c
@@ -501,6 +501,8 @@ void resetpchard()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sound_cd_thread_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
char romsets[17][40]={"IBM PC","IBM XT","Generic Turbo XT","Euro PC","Tandy 1000","Amstrad PC1512","Sinclair PC200","Amstrad PC1640","IBM AT","AMI 286 clone","Dell System 200","Misc 286","IBM AT 386","Misc 386","386 clone","486 clone","486 clone 2"};
|
char romsets[17][40]={"IBM PC","IBM XT","Generic Turbo XT","Euro PC","Tandy 1000","Amstrad PC1512","Sinclair PC200","Amstrad PC1640","IBM AT","AMI 286 clone","Dell System 200","Misc 286","IBM AT 386","Misc 386","386 clone","486 clone","486 clone 2"};
|
||||||
|
|||||||
81
src/sound.c
81
src/sound.c
@@ -98,6 +98,7 @@ static float cd_out_buffer[CD_BUFLEN * 2];
|
|||||||
static thread_t *sound_cd_thread_h;
|
static thread_t *sound_cd_thread_h;
|
||||||
static event_t *sound_cd_event;
|
static event_t *sound_cd_event;
|
||||||
static unsigned int cd_vol_l, cd_vol_r;
|
static unsigned int cd_vol_l, cd_vol_r;
|
||||||
|
static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN;
|
||||||
|
|
||||||
void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r)
|
void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r)
|
||||||
{
|
{
|
||||||
@@ -114,18 +115,34 @@ static void sound_cd_thread(void *param)
|
|||||||
int c, has_audio;
|
int c, has_audio;
|
||||||
|
|
||||||
thread_wait_event(sound_cd_event, -1);
|
thread_wait_event(sound_cd_event, -1);
|
||||||
|
if (!soundon)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (c = 0; c < CD_BUFLEN*2; c += 2)
|
for (c = 0; c < CD_BUFLEN*2; c += 2)
|
||||||
{
|
{
|
||||||
cd_out_buffer[c] = 0.0;
|
cd_out_buffer[c] = 0.0;
|
||||||
cd_out_buffer[c+1] = 0.0;
|
cd_out_buffer[c+1] = 0.0;
|
||||||
}
|
}
|
||||||
|
has_audio = 0;
|
||||||
|
for (i = 0; i < CDROM_NUM; i++)
|
||||||
|
{
|
||||||
|
if (cdrom_drives[i].enabled && cdrom_drives[i].sound_on)
|
||||||
|
{
|
||||||
|
has_audio++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!has_audio)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (i = 0; i < CDROM_NUM; i++)
|
for (i = 0; i < CDROM_NUM; i++)
|
||||||
{
|
{
|
||||||
has_audio = 0;
|
has_audio = 0;
|
||||||
if (cdrom_drives[i].handler->audio_callback)
|
if (cdrom_drives[i].handler->audio_callback)
|
||||||
{
|
{
|
||||||
cdrom_drives[i].handler->audio_callback(i, cd_buffer[i], CD_BUFLEN*2);
|
cdrom_drives[i].handler->audio_callback(i, cd_buffer[i], CD_BUFLEN*2);
|
||||||
has_audio = cdrom_drives[i].sound_on;
|
has_audio = (cdrom_drives[i].enabled && cdrom_drives[i].sound_on);
|
||||||
}
|
}
|
||||||
if (soundon && has_audio)
|
if (soundon && has_audio)
|
||||||
{
|
{
|
||||||
@@ -189,16 +206,34 @@ static void sound_cd_thread(void *param)
|
|||||||
static int32_t *outbuffer;
|
static int32_t *outbuffer;
|
||||||
static float *outbuffer_ex;
|
static float *outbuffer_ex;
|
||||||
|
|
||||||
|
static int cd_thread_enable = 0;
|
||||||
|
|
||||||
void sound_init()
|
void sound_init()
|
||||||
{
|
{
|
||||||
|
int i = 0;
|
||||||
|
int available_cdrom_drives = 0;
|
||||||
|
|
||||||
initalmain(0,NULL);
|
initalmain(0,NULL);
|
||||||
inital();
|
inital();
|
||||||
|
|
||||||
outbuffer = malloc(SOUNDBUFLEN * 2 * sizeof(int32_t));
|
outbuffer = malloc(SOUNDBUFLEN * 2 * sizeof(int32_t));
|
||||||
outbuffer_ex = malloc(SOUNDBUFLEN * 2 * sizeof(float));
|
outbuffer_ex = malloc(SOUNDBUFLEN * 2 * sizeof(float));
|
||||||
|
|
||||||
sound_cd_event = thread_create_event();
|
for (i = 0; i < CDROM_NUM; i++)
|
||||||
sound_cd_thread_h = thread_create(sound_cd_thread, NULL);
|
{
|
||||||
|
if (cdrom_drives[i].enabled && cdrom_drives[i].sound_on)
|
||||||
|
{
|
||||||
|
available_cdrom_drives++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (available_cdrom_drives)
|
||||||
|
{
|
||||||
|
sound_cd_event = thread_create_event();
|
||||||
|
sound_cd_thread_h = thread_create(sound_cd_thread, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
cd_thread_enable = available_cdrom_drives ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
|
void sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
|
||||||
@@ -244,7 +279,15 @@ void sound_poll(void *priv)
|
|||||||
|
|
||||||
if (soundon) givealbuffer(outbuffer_ex);
|
if (soundon) givealbuffer(outbuffer_ex);
|
||||||
|
|
||||||
thread_set_event(sound_cd_event);
|
if (cd_thread_enable)
|
||||||
|
{
|
||||||
|
cd_buf_update--;
|
||||||
|
if (!cd_buf_update)
|
||||||
|
{
|
||||||
|
cd_buf_update = (48000 / SOUNDBUFLEN) / (CD_FREQ / CD_BUFLEN);
|
||||||
|
thread_set_event(sound_cd_event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sound_pos_global = 0;
|
sound_pos_global = 0;
|
||||||
}
|
}
|
||||||
@@ -258,6 +301,7 @@ void sound_speed_changed()
|
|||||||
void sound_reset()
|
void sound_reset()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
int available_cdrom_drives = 0;
|
||||||
|
|
||||||
timer_add(sound_poll, &sound_poll_time, TIMER_ALWAYS_ENABLED, NULL);
|
timer_add(sound_poll, &sound_poll_time, TIMER_ALWAYS_ENABLED, NULL);
|
||||||
|
|
||||||
@@ -267,10 +311,37 @@ void sound_reset()
|
|||||||
|
|
||||||
for (i = 0; i < CDROM_NUM; i++)
|
for (i = 0; i < CDROM_NUM; i++)
|
||||||
{
|
{
|
||||||
pclog("Resetting audio for CD-ROM %i...\n", i);
|
|
||||||
if (cdrom_drives[i].handler->audio_stop)
|
if (cdrom_drives[i].handler->audio_stop)
|
||||||
{
|
{
|
||||||
cdrom_drives[i].handler->audio_stop(i);
|
cdrom_drives[i].handler->audio_stop(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sound_cd_thread_reset()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
int available_cdrom_drives = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < CDROM_NUM; i++)
|
||||||
|
{
|
||||||
|
if (cdrom_drives[i].enabled && cdrom_drives[i].sound_on)
|
||||||
|
{
|
||||||
|
available_cdrom_drives++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (available_cdrom_drives && !cd_thread_enable)
|
||||||
|
{
|
||||||
|
thread_destroy_event(sound_cd_event);
|
||||||
|
thread_kill(sound_cd_thread_h);
|
||||||
|
sound_cd_thread_h = NULL;
|
||||||
|
}
|
||||||
|
else if (!available_cdrom_drives && cd_thread_enable)
|
||||||
|
{
|
||||||
|
sound_cd_event = thread_create_event();
|
||||||
|
sound_cd_thread_h = thread_create(sound_cd_thread, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
cd_thread_enable = available_cdrom_drives ? 1 : 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ void inital()
|
|||||||
int c;
|
int c;
|
||||||
float buf[BUFLEN*2];
|
float buf[BUFLEN*2];
|
||||||
|
|
||||||
|
float cd_buf[CD_BUFLEN*2];
|
||||||
|
|
||||||
// printf("1\n");
|
// printf("1\n");
|
||||||
check();
|
check();
|
||||||
|
|
||||||
@@ -114,13 +116,15 @@ void inital()
|
|||||||
alSourcei (source[1], AL_SOURCE_RELATIVE, AL_TRUE );
|
alSourcei (source[1], AL_SOURCE_RELATIVE, AL_TRUE );
|
||||||
check();
|
check();
|
||||||
|
|
||||||
memset(buf,0,BUFLEN*4);
|
memset(buf,0,BUFLEN*2*sizeof(float));
|
||||||
|
memset(cd_buf,0,BUFLEN*2*sizeof(float));
|
||||||
|
|
||||||
// printf("5\n");
|
// printf("5\n");
|
||||||
for (c = 0; c < 4; c++)
|
for (c = 0; c < 4; c++)
|
||||||
{
|
{
|
||||||
alBufferData(buffers[c], AL_FORMAT_STEREO_FLOAT32, buf, BUFLEN*2*sizeof(float), FREQ);
|
alBufferData(buffers[c], AL_FORMAT_STEREO_FLOAT32, buf, BUFLEN*2*sizeof(float), FREQ);
|
||||||
alBufferData(buffers_cd[c], AL_FORMAT_STEREO_FLOAT32, buf, CD_BUFLEN*2*sizeof(float), CD_FREQ);
|
alBufferData(buffers_cd[c], AL_FORMAT_STEREO_FLOAT32, buf, CD_BUFLEN*2*sizeof(float), CD_FREQ);
|
||||||
|
alBufferData(buffers_cd[c], AL_FORMAT_STEREO_FLOAT32, cd_buf, CD_BUFLEN*2*sizeof(float), CD_FREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
alSourceQueueBuffers(source[0], 4, buffers);
|
alSourceQueueBuffers(source[0], 4, buffers);
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ static void hdconf_file(HWND hdlg, int drive_num)
|
|||||||
|
|
||||||
if (image_is_hdi(openfilestring))
|
if (image_is_hdi(openfilestring))
|
||||||
{
|
{
|
||||||
fseeko64(f, 0x10, SEEK_END);
|
fseeko64(f, 0x10, SEEK_SET);
|
||||||
fread(§or_size, 1, 4, f);
|
fread(§or_size, 1, 4, f);
|
||||||
if (sector_size != 512)
|
if (sector_size != 512)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1655,8 +1655,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||||||
cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_SOUND_ON);
|
cdrom_id = convert_cdrom_id(LOWORD(wParam) - IDM_CDROM_1_SOUND_ON);
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
cdrom_drives[cdrom_id].sound_on ^= 1;
|
cdrom_drives[cdrom_id].sound_on ^= 1;
|
||||||
CheckMenuItem(hmenu, IDM_CDROM_1_SOUND_ON + (cdrom_id * 1000), cdrom_drives[cdrom_id].enabled ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(hmenu, IDM_CDROM_1_SOUND_ON + (cdrom_id * 1000), cdrom_drives[cdrom_id].sound_on ? MF_CHECKED : MF_UNCHECKED);
|
||||||
saveconfig();
|
saveconfig();
|
||||||
|
sound_cd_thread_reset();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_CDROM_1_SCSI:
|
case IDM_CDROM_1_SCSI:
|
||||||
|
|||||||
Reference in New Issue
Block a user