Changes since v0.7 : - Major CPU reorganisation. This has possibly broken some stuff, though I fixed all the regressions I could find - Lazy flags. This brought 10% speed improvement at one point, but that's probably been lost now - 430 VX chipset emulation - IDT Winchip emulation (currently sans MMX). Timing is probably wrong - Fixed a few FPU bugs - Timer reorganisation - Sound reorganisation - Other general reorganisation - AdLib Gold emulation - Windows Sound System emulation - Pro Audio Spectrum 16 emulation. This currently works with most DOS stuff, but not in Windows - Major improvements to GUS emulation. Has the downside that it now conflicts with SB emulation, so probably best to not enable both simultaneously - New graphics cards : - ATI-18800 (VGA Edge-16) - ATI-28800 (VGA Charger) - ATI Mach64GX (Graphics Pro Turbo). Quite a few features missing, but Windows doesn't seem to use half the features of this card - Cirrus Logic CL-GD5429. Blitter is a bit broken - Oak OTI-067 - S3 Trio64 (Number Nine 9FX) - S3 Virge. Only framebuffer stuff at the minute, Windows won't recognise the card - Trident TGUI-9440 - VGA. Doesn't work yet - Beginnings of 3DFX emulation, however this is in extremely early stages and doesn't do anything useful - Fixed DMA bug stopping floppy drives working in Windows 3.x - Fixed some other stuff probably - Broke some other stuff probably as well
143 lines
3.3 KiB
C
143 lines
3.3 KiB
C
#define USE_OPENAL
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#ifdef USE_OPENAL
|
|
#include <AL/al.h>
|
|
#include <AL/alut.h>
|
|
#endif
|
|
#include "ibm.h"
|
|
|
|
FILE *allog;
|
|
#ifdef USE_OPENAL
|
|
ALuint buffers[4]; // front and back buffers
|
|
ALuint source; // audio source
|
|
ALenum format; // internal format
|
|
#endif
|
|
#define FREQ 48000
|
|
#define BUFLEN SOUNDBUFLEN
|
|
|
|
void closeal();
|
|
|
|
void initalmain(int argc, char *argv[])
|
|
{
|
|
#ifdef USE_OPENAL
|
|
alutInit(0,0);
|
|
// printf("AlutInit\n");
|
|
atexit(closeal);
|
|
// printf("AlutInit\n");
|
|
#endif
|
|
}
|
|
|
|
void closeal()
|
|
{
|
|
#ifdef USE_OPENAL
|
|
alutExit();
|
|
#endif
|
|
}
|
|
|
|
void check()
|
|
{
|
|
#ifdef USE_OPENAL
|
|
ALenum error;
|
|
if ((error = alGetError()) != AL_NO_ERROR)
|
|
{
|
|
// printf("Error : %08X\n", error);
|
|
// exit(-1);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void inital()
|
|
{
|
|
#ifdef USE_OPENAL
|
|
int c;
|
|
int16_t buf[BUFLEN*2];
|
|
format = AL_FORMAT_STEREO16;
|
|
// printf("1\n");
|
|
check();
|
|
|
|
// printf("2\n");
|
|
alGenBuffers(4, buffers);
|
|
check();
|
|
|
|
// printf("3\n");
|
|
alGenSources(1, &source);
|
|
check();
|
|
|
|
// printf("4\n");
|
|
alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0);
|
|
alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0);
|
|
alSource3f(source, AL_DIRECTION, 0.0, 0.0, 0.0);
|
|
alSourcef (source, AL_ROLLOFF_FACTOR, 0.0 );
|
|
alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE );
|
|
check();
|
|
|
|
memset(buf,0,BUFLEN*4);
|
|
|
|
// printf("5\n");
|
|
for (c=0;c<4;c++)
|
|
alBufferData(buffers[c], AL_FORMAT_STEREO16, buf, BUFLEN*2*2, FREQ);
|
|
alSourceQueueBuffers(source, 4, buffers);
|
|
check();
|
|
// printf("6 %08X\n",source);
|
|
alSourcePlay(source);
|
|
check();
|
|
// printf("InitAL!!! %08X\n",source);
|
|
#endif
|
|
}
|
|
|
|
void givealbuffer(int16_t *buf)
|
|
{
|
|
#ifdef USE_OPENAL
|
|
int processed;
|
|
int state;
|
|
|
|
//return;
|
|
|
|
// printf("Start\n");
|
|
check();
|
|
|
|
// printf("GiveALBuffer %08X\n",source);
|
|
|
|
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
|
|
|
check();
|
|
|
|
if (state==0x1014)
|
|
{
|
|
alSourcePlay(source);
|
|
// printf("Resetting sound\n");
|
|
}
|
|
// printf("State - %i %08X\n",state,state);
|
|
alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
|
|
|
|
// printf("P ");
|
|
check();
|
|
// printf("Processed - %i\n",processed);
|
|
|
|
if (processed>=1)
|
|
{
|
|
ALuint buffer;
|
|
|
|
alSourceUnqueueBuffers(source, 1, &buffer);
|
|
// printf("U ");
|
|
check();
|
|
|
|
// for (c=0;c<BUFLEN*2;c++) buf[c]^=0x8000;
|
|
alBufferData(buffer, AL_FORMAT_STEREO16, buf, BUFLEN*2*2, FREQ);
|
|
// printf("B ");
|
|
check();
|
|
|
|
alSourceQueueBuffers(source, 1, &buffer);
|
|
// printf("Q ");
|
|
check();
|
|
|
|
// printf("\n");
|
|
|
|
// if (!allog) allog=fopen("al.pcm","wb");
|
|
// fwrite(buf,BUFLEN*2,1,allog);
|
|
}
|
|
// printf("\n");
|
|
#endif
|
|
}
|