Commit 4ecb44b1 authored by Sam Lantinga's avatar Sam Lantinga

Formatting update

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402120
parent d0a80f6b
......@@ -147,7 +147,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
surface);
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
const char *icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title, const char **icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
const char **icon);
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
......
......@@ -523,7 +523,7 @@ ALSA_OpenAudio(_THIS, SDL_AudioSpec * spec)
status = -1;
for (test_format = SDL_FirstAudioFormat(spec->format);
test_format && (status < 0);) {
status = 0; /* if we can't support a format, it'll become -1. */
status = 0; /* if we can't support a format, it'll become -1. */
switch (test_format) {
case AUDIO_U8:
format = SND_PCM_FORMAT_U8;
......
......@@ -235,50 +235,50 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
while ((!valid_datatype) && (test_format)) {
valid_datatype = 1;
switch (test_format) {
case AUDIO_S8:
D(bug("AUDIO_S8...\n"));
spec->format = AUDIO_S8;
this->hidden->bytespersample = 1;
if (spec->channels < 2)
this->hidden->type = AHIST_M8S;
else
this->hidden->type = AHIST_S8S;
break;
case AUDIO_S16MSB:
D(bug("AUDIO_S16MSB...\n"));
spec->format = AUDIO_S16MSB;
this->hidden->bytespersample = 2;
if (spec->channels < 2)
this->hidden->type = AHIST_M16S;
else
this->hidden->type = AHIST_S16S;
break;
case AUDIO_S32MSB:
D(bug("AUDIO_S32MSB...\n"));
spec->format = AUDIO_S32MSB;
this->hidden->bytespersample = 4;
if (spec->channels < 2)
this->hidden->type = AHIST_M32S;
else
this->hidden->type = AHIST_S32S;
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
case AUDIO_S8:
D(bug("AUDIO_S8...\n"));
spec->format = AUDIO_S8;
this->hidden->bytespersample = 1;
if (spec->channels < 2)
this->hidden->type = AHIST_M8S;
else
this->hidden->type = AHIST_S8S;
break;
case AUDIO_S16MSB:
D(bug("AUDIO_S16MSB...\n"));
spec->format = AUDIO_S16MSB;
this->hidden->bytespersample = 2;
if (spec->channels < 2)
this->hidden->type = AHIST_M16S;
else
this->hidden->type = AHIST_S16S;
break;
case AUDIO_S32MSB:
D(bug("AUDIO_S32MSB...\n"));
spec->format = AUDIO_S32MSB;
this->hidden->bytespersample = 4;
if (spec->channels < 2)
this->hidden->type = AHIST_M32S;
else
this->hidden->type = AHIST_S32S;
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}
if (spec->channels > 2) {
spec->channels = 2; /* will convert at higher level. */
spec->channels = 2; /* will convert at higher level. */
}
D(bug("Before CalculateAudioSpec\n"));
......
......@@ -160,7 +160,7 @@ extern "C"
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
/* Parse the audio format and fill the Be raw audio format */
memset(&format, '\0', sizeof (media_raw_audio_format));
memset(&format, '\0', sizeof(media_raw_audio_format));
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
format.frame_rate = (float) spec->freq;
format.channel_count = spec->channels; /* !!! FIXME: support > 2? */
......@@ -168,51 +168,51 @@ extern "C"
valid_datatype = 1;
spec->format = test_format;
switch (test_format) {
case AUDIO_S8:
format.format = media_raw_audio_format::B_AUDIO_CHAR;
break;
case AUDIO_U8:
format.format = media_raw_audio_format::B_AUDIO_UCHAR;
break;
case AUDIO_S16LSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
break;
case AUDIO_S16MSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;
case AUDIO_S32LSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
break;
case AUDIO_S32MSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;
case AUDIO_F32LSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
break;
case AUDIO_F32MSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
case AUDIO_S8:
format.format = media_raw_audio_format::B_AUDIO_CHAR;
break;
case AUDIO_U8:
format.format = media_raw_audio_format::B_AUDIO_UCHAR;
break;
case AUDIO_S16LSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
break;
case AUDIO_S16MSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;
case AUDIO_S32LSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
break;
case AUDIO_S32MSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;
case AUDIO_F32LSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
break;
case AUDIO_F32MSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}
format.buffer_size = spec->samples;
if (!valid_datatype) { /* shouldn't happen, but just in case... */
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}
......
......@@ -108,34 +108,34 @@ DART_OpenAudio(_THIS, SDL_AudioSpec * spec)
// Determine the audio parameters from the AudioSpec
if (spec->channels > 2)
spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
while ((!valid_datatype) && (test_format)) {
spec->format = test_format;
valid_datatype = 1;
switch (test_format) {
case AUDIO_U8:
// Unsigned 8 bit audio data
iSilence = 0x80;
iBits = 8;
break;
case AUDIO_S16LSB:
// Signed 16 bit audio data
iSilence = 0x00;
iBits = 16;
break;
case AUDIO_U8:
// Unsigned 8 bit audio data
iSilence = 0x80;
iBits = 8;
break;
case AUDIO_S16LSB:
// Signed 16 bit audio data
iSilence = 0x00;
iBits = 16;
break;
// !!! FIXME: int32?
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}
if (!valid_datatype) { // shouldn't happen, but just in case...
if (!valid_datatype) { // shouldn't happen, but just in case...
// Close DART, and exit with error code!
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
SDL_SetError("Unsupported audio format");
......
......@@ -226,24 +226,24 @@ DCAUD_OpenAudio(_THIS, SDL_AudioSpec * spec)
spec->format = test_format;
switch (test_format) {
/* only formats Dreamcast accepts... */
case AUDIO_S8:
case AUDIO_S16LSB:
valid_datatype = 1;
break;
default:
test_format = SDL_NextAudioFormat();
break;
case AUDIO_S8:
case AUDIO_S16LSB:
valid_datatype = 1;
break;
default:
test_format = SDL_NextAudioFormat();
break;
}
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}
if (spec->channels > 2)
spec->channels = 2; /* no more than stereo on the Dreamcast. */
spec->channels = 2; /* no more than stereo on the Dreamcast. */
/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(spec);
......
......@@ -176,27 +176,27 @@ AL_OpenAudio(_THIS, SDL_AudioSpec * spec)
spec->format = test_format;
switch (test_format) {
case AUDIO_S8:
width = AL_SAMPLE_8;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_S8:
width = AL_SAMPLE_8;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_S16SYS:
width = AL_SAMPLE_16;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_S16SYS:
width = AL_SAMPLE_16;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_F32SYS:
width = 0; /* not used here... */
fmt = AL_SAMPFMT_FLOAT;
break;
case AUDIO_F32SYS:
width = 0; /* not used here... */
fmt = AL_SAMPFMT_FLOAT;
break;
/* Docs say there is int24, but not int32.... */
default:
valid = 0;
test_format = SDL_NextAudioFormat();
break;
default:
valid = 0;
test_format = SDL_NextAudioFormat();
break;
}
if (valid) {
......@@ -204,8 +204,8 @@ AL_OpenAudio(_THIS, SDL_AudioSpec * spec)
valid = 0;
if (audio_config) {
if (alSetChannels(audio_config, spec->channels) < 0) {
if (spec->channels > 2) { /* can't handle > stereo? */
spec->channels = 2; /* try again below. */
if (spec->channels > 2) { /* can't handle > stereo? */
spec->channels = 2; /* try again below. */
}
}
......
......@@ -212,7 +212,7 @@ Core_OpenAudio(_THIS, SDL_AudioSpec * spec)
int valid_datatype = 0;
/* Setup a AudioStreamBasicDescription with the requested format */
memset(&strdesc, '\0', sizeof (AudioStreamBasicDescription));
memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription));
strdesc.mFormatID = kAudioFormatLinearPCM;
strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
strdesc.mChannelsPerFrame = spec->channels;
......@@ -223,30 +223,30 @@ Core_OpenAudio(_THIS, SDL_AudioSpec * spec)
spec->format = test_format;
/* Just a list of valid SDL formats, so people don't pass junk here. */
switch (test_format) {
case AUDIO_U8:
case AUDIO_S8:
case AUDIO_U16LSB:
case AUDIO_S16LSB:
case AUDIO_U16MSB:
case AUDIO_S16MSB:
case AUDIO_S32LSB:
case AUDIO_S32MSB:
case AUDIO_F32LSB:
case AUDIO_F32MSB:
valid_datatype = 1;
strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(spec->format);
if (SDL_AUDIO_ISBIGENDIAN(spec->format))
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
if (SDL_AUDIO_ISFLOAT(spec->format))
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
else if (SDL_AUDIO_ISSIGNED(spec->format))
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
break;
case AUDIO_U8:
case AUDIO_S8:
case AUDIO_U16LSB:
case AUDIO_S16LSB:
case AUDIO_U16MSB:
case AUDIO_S16MSB:
case AUDIO_S32LSB:
case AUDIO_S32MSB:
case AUDIO_F32LSB:
case AUDIO_F32MSB:
valid_datatype = 1;
strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(spec->format);
if (SDL_AUDIO_ISBIGENDIAN(spec->format))
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
if (SDL_AUDIO_ISFLOAT(spec->format))
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
else if (SDL_AUDIO_ISSIGNED(spec->format))
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
break;
}
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}
......@@ -257,7 +257,7 @@ Core_OpenAudio(_THIS, SDL_AudioSpec * spec)
strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
/* Locate the default output audio unit */
memset(&desc, '\0', sizeof (ComponentDescription));
memset(&desc, '\0', sizeof(ComponentDescription));
desc.componentType = kAudioUnitComponentType;
desc.componentSubType = kAudioUnitSubType_Output;
desc.componentManufacturer = kAudioUnitID_DefaultOutput;
......@@ -280,8 +280,7 @@ Core_OpenAudio(_THIS, SDL_AudioSpec * spec)
result = AudioUnitSetProperty(outputAudioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&strdesc, sizeof (strdesc));
0, &strdesc, sizeof(strdesc));
CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)")
/* Set the audio callback */
callback.inputProc = audioCallback;
......
......@@ -146,23 +146,24 @@ SDL_MintAudio_SearchFrequency(_THIS, int desired_freq)
}
/* Check if FPU is present */
void SDL_MintAudio_CheckFpu(void)
void
SDL_MintAudio_CheckFpu(void)
{
unsigned long cookie_fpu;
SDL_MintAudio_hasfpu = 0;
if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) {
return;
}
switch ((cookie_fpu>>16)&0xfffe) {
case 2:
case 4:
case 6:
case 8:
case 16:
SDL_MintAudio_hasfpu = 1;
break;
}
unsigned long cookie_fpu;
SDL_MintAudio_hasfpu = 0;
if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) {
return;
}
switch ((cookie_fpu >> 16) & 0xfffe) {
case 2:
case 4:
case 6:
case 8:
case 16:
SDL_MintAudio_hasfpu = 1;
break;
}
}
/* The thread function, used under MiNT with xbios */
......
......@@ -128,7 +128,7 @@ extern volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
extern volatile unsigned short SDL_MintAudio_mutex;
extern cookie_stfa_t *SDL_MintAudio_stfa;
extern volatile unsigned long SDL_MintAudio_clocktics;
extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */
extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */
/* MiNT thread variables */
extern SDL_bool SDL_MintAudio_mint_present;
......
......@@ -218,7 +218,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
int i, masterprediv, sfreq;
unsigned long masterclock;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......@@ -226,7 +227,7 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */
......@@ -274,7 +275,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......
......@@ -223,49 +223,49 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
spec->channels = 2; /* no more than stereo! */
}
while ((!valid_datatype) && (test_format)) {
spec->format = test_format;
switch (test_format) {
case AUDIO_U8:
case AUDIO_S8:
case AUDIO_U16LSB:
case AUDIO_S16LSB:
case AUDIO_U16MSB:
case AUDIO_S16MSB:
case AUDIO_S32LSB:
case AUDIO_S32MSB:
case AUDIO_U8:
case AUDIO_S8:
case AUDIO_U16LSB:
case AUDIO_S16LSB:
case AUDIO_U16MSB:
case AUDIO_S16MSB:
case AUDIO_S32LSB:
case AUDIO_S32MSB:
/* no float support... */
resolution = SDL_AUDIO_BITSIZE(spec->format);
format_signed = SDL_AUDIO_ISSIGNED(spec->format);
format_bigendian = SDL_AUDIO_ISBIGENDIAN(spec->format);
/* Check formats available */
snd_format = Sndstatus(SND_QUERYFORMATS);
switch (resolution) {
case 8:
if (snd_format & SND_FORMAT8) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY8BIT);
}
break;
case 16:
if (snd_format & SND_FORMAT16) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY16BIT);
}
break;
case 32:
if (snd_format & SND_FORMAT32) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY32BIT);
}
break;
resolution = SDL_AUDIO_BITSIZE(spec->format);
format_signed = SDL_AUDIO_ISSIGNED(spec->format);
format_bigendian = SDL_AUDIO_ISBIGENDIAN(spec->format);
/* Check formats available */
snd_format = Sndstatus(SND_QUERYFORMATS);
switch (resolution) {
case 8:
if (snd_format & SND_FORMAT8) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY8BIT);
}
break;
case 16:
if (snd_format & SND_FORMAT16) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY16BIT);
}
break;
case 32:
if (snd_format & SND_FORMAT32) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY32BIT);
}
break;
}
break;
}
}
......@@ -328,7 +328,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......
......@@ -225,7 +225,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
int i;
unsigned long masterclock, masterprediv;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......@@ -233,7 +234,7 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */
......@@ -241,7 +242,7 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
switch (cookie_mcsn->play) {
case MCSN_ST:
spec->channels = 1;
spec->format = AUDIO_S8; /* FIXME: is it signed or unsigned ? */
spec->format = AUDIO_S8; /* FIXME: is it signed or unsigned ? */
SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1);
break;
case MCSN_TT: /* Also STE, Mega STE */
......@@ -279,9 +280,9 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
(1 << i) - 1, -1);
}
}
spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
if ((SDL_AUDIO_BITSIZE(spec->format)) == 16) {
spec->format |= SDL_AUDIO_MASK_ENDIAN; /* Audio is always big endian */
spec->format |= SDL_AUDIO_MASK_ENDIAN; /* Audio is always big endian */
spec->channels = 2; /* 16 bits always stereo */
}
break;
......@@ -299,7 +300,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......
......@@ -206,7 +206,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
{
int i;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......@@ -214,11 +215,11 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (SDL_AUDIO_BITSIZE(spec->format) > 16) {
spec->format = AUDIO_S16SYS; /* clamp out int32/float32 ... */
spec->format = AUDIO_S16SYS; /* clamp out int32/float32 ... */
}
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */
......@@ -239,7 +240,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......
......@@ -83,7 +83,7 @@ Audio_Available(void)
unsigned long dummy;
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
/*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);*/
/*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND); */
SDL_MintAudio_mint_present = SDL_FALSE;
/* We can't use XBIOS in interrupt with Magic, don't know about thread */
......@@ -360,21 +360,22 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
int i;
Uint32 extclock;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq));
spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
/* clamp out int32/float32 */
if (SDL_AUDIO_BITSIZE(spec->format) >= 16) {
spec->format = AUDIO_S16MSB; /* Audio is always big endian */
spec->format = AUDIO_S16MSB; /* Audio is always big endian */
spec->channels = 2; /* 16 bits always stereo */
} else if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
spec->channels = 2; /* no more than stereo! */
}
MINTAUDIO_freqcount = 0;
......@@ -406,7 +407,8 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
......@@ -468,7 +470,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
} else {
/* Install interrupt */
Jdisint(MFP_DMASOUND);
/*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);*/
/*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt); */
Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
Jenabint(MFP_DMASOUND);
......
......@@ -202,13 +202,13 @@ SDL_SYS_JoystickInit(void)
}
if ((cookie_mch == MCH_STE << 16) || (cookie_mch == MCH_F30 << 16)) {
atarijoysticks[PORTA_PAD0].enabled =
atarijoysticks[PORTA_PAD1].enabled =
atarijoysticks[PORTA_PAD2].enabled =
atarijoysticks[PORTA_PAD3].enabled =
atarijoysticks[PORTB_PAD0].enabled =
atarijoysticks[PORTB_PAD1].enabled =
atarijoysticks[PORTB_PAD2].enabled =
atarijoysticks[PORTB_PAD3].enabled = SDL_TRUE;
atarijoysticks[PORTA_PAD1].enabled =
atarijoysticks[PORTA_PAD2].enabled =
atarijoysticks[PORTA_PAD3].enabled =
atarijoysticks[PORTB_PAD0].enabled =
atarijoysticks[PORTB_PAD1].enabled =
atarijoysticks[PORTB_PAD2].enabled =
atarijoysticks[PORTB_PAD3].enabled = SDL_TRUE;
}
if (!atarijoysticks[IKBD_JOY1].enabled) {
atarijoysticks[XBIOS_JOY1].enabled = (SDL_AtariXbios_enabled != 0);
......@@ -432,24 +432,32 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
int numjoypad, i;
numjoypad = 0;
switch(numjoystick) {
switch (numjoystick) {
case PORTA_PAD0:
numjoypad = 0; break;
numjoypad = 0;
break;
case PORTA_PAD1:
numjoypad = 1; break;
numjoypad = 1;
break;
case PORTA_PAD2:
numjoypad = 2; break;
numjoypad = 2;
break;
case PORTA_PAD3:
numjoypad = 3; break;
numjoypad = 3;
break;
case PORTB_PAD0:
numjoypad = 4; break;
numjoypad = 4;
break;
case PORTB_PAD1:
numjoypad = 5; break;
numjoypad = 5;
break;
case PORTB_PAD2:
numjoypad = 6; break;
numjoypad = 6;
break;
case PORTB_PAD3:
numjoypad = 7; break;
}
numjoypad = 7;
break;
}
curstate = jp_joypads[numjoypad];
if (curstate != prevstate) {
......@@ -647,7 +655,7 @@ struct JOYPAD_IO_S
};
#define JOYPAD_IO ((*(volatile struct JOYPAD_IO_S *)JOYPAD_IO_BASE))
static const Uint16 joypad_masks[8*4]={
static const Uint16 joypad_masks[8 * 4] = {
0xfffe, 0xfffd, 0xfffb, 0xfff7,
0xfff0, 0xfff1, 0xfff2, 0xfff3,
0xfff4, 0xfff5, 0xfff6, 0xfff8,
......@@ -685,35 +693,35 @@ UpdateJoypads(void)
tmp = (JOYPAD_IO.paddles[3] & 255);
jp_paddles[3] = (tmp << 8) | tmp;
/* Update joypads on teamtap port A */
for (i=0; i<4; i++) {
/* Update joypads on teamtap port A */
for (i = 0; i < 4; i++) {
jp_joypads[i] = 0;
for (j=0; j<4; j++) {
JOYPAD_IO.directions = joypad_masks[(i*4)+j];
for (j = 0; j < 4; j++) {
JOYPAD_IO.directions = joypad_masks[(i * 4) + j];
cur_fire = (~(JOYPAD_IO.fires) & 3)<<16;
cur_dir = (~(JOYPAD_IO.directions)>>8) & 15;
cur_fire = (~(JOYPAD_IO.fires) & 3) << 16;
cur_dir = (~(JOYPAD_IO.directions) >> 8) & 15;
jp_joypads[i] |= cur_fire<<(j*2);
jp_joypads[i] |= cur_dir<<(j*4);
jp_joypads[i] |= cur_fire << (j * 2);
jp_joypads[i] |= cur_dir << (j * 4);
}
}
/* Update joypads on teamtap port B */
for (i=4; i<8; i++) {
/* Update joypads on teamtap port B */
for (i = 4; i < 8; i++) {
jp_joypads[i] = 0;
for (j=0; j<4; j++) {
JOYPAD_IO.directions = joypad_masks[(i*4)+j];
for (j = 0; j < 4; j++) {
JOYPAD_IO.directions = joypad_masks[(i * 4) + j];
cur_fire = (~(JOYPAD_IO.fires) & 0xc)<<14;
cur_dir = (~(JOYPAD_IO.directions)>>12) & 15;
cur_fire = (~(JOYPAD_IO.fires) & 0xc) << 14;
cur_dir = (~(JOYPAD_IO.directions) >> 12) & 15;
jp_joypads[i] |= cur_fire<<(j*2);
jp_joypads[i] |= cur_dir<<(j*4);
jp_joypads[i] |= cur_fire << (j * 2);
jp_joypads[i] |= cur_dir << (j * 4);
}
}
JOYPAD_IO.directions=0xffff;
JOYPAD_IO.directions = 0xffff;
}
#endif /* SDL_JOYSTICK_MINT */
......
......@@ -134,12 +134,12 @@ SDL_Atari_InitInternalKeymap(_THIS)
keytab_normal = key_tables->unshift;
/* Initialize keymap */
for ( i=0; i<ATARIBIOS_MAXKEYS; i++ )
for (i = 0; i < ATARIBIOS_MAXKEYS; i++)
keymap[i] = SDLK_UNKNOWN;
/* Functions keys */
for ( i = 0; i<10; i++ )
keymap[SCANCODE_F1 + i] = SDLK_F1+i;
for (i = 0; i < 10; i++)
keymap[SCANCODE_F1 + i] = SDLK_F1 + i;
/* Cursor keypad */
keymap[SCANCODE_HELP] = SDLK_HELP;
......@@ -208,8 +208,7 @@ Uint16 SDL_AtariToUnicodeTable[256] = {
};
SDL_keysym *
SDL_Atari_TranslateKey(int scancode, SDL_keysym *keysym,
SDL_bool pressed)
SDL_Atari_TranslateKey(int scancode, SDL_keysym * keysym, SDL_bool pressed)
{
int asciicode = 0;
......@@ -220,14 +219,14 @@ SDL_Atari_TranslateKey(int scancode, SDL_keysym *keysym,
keysym->unicode = 0;
if (keysym->sym == SDLK_UNKNOWN) {
keysym->sym = asciicode = keytab_normal[scancode];
keysym->sym = asciicode = keytab_normal[scancode];
}
if (SDL_TranslateUNICODE && pressed) {
keysym->unicode = SDL_AtariToUnicodeTable[asciicode];
}
return(keysym);
return (keysym);
}
/* vi: set ts=4 sw=4 expandtab: */
......@@ -36,8 +36,9 @@
/* Special keys state */
#ifndef K_RSHIFT
enum {
K_RSHIFT=0,
enum
{
K_RSHIFT = 0,
K_LSHIFT,
K_CTRL,
K_ALT,
......@@ -55,8 +56,8 @@ extern void SDL_Atari_InitInternalKeymap(_THIS);
/* Atari to Unicode charset translation table */
extern Uint16 SDL_AtariToUnicodeTable[256];
SDL_keysym *SDL_Atari_TranslateKey(int scancode, SDL_keysym *keysym,
SDL_bool pressed);
SDL_keysym *SDL_Atari_TranslateKey(int scancode, SDL_keysym * keysym,
SDL_bool pressed);
#endif /* _SDL_ATARI_EVENTS_H_ */
/* vi: set ts=4 sw=4 expandtab: */
......@@ -512,11 +512,11 @@ InitNew(_THIS, SDL_Surface * current)
gl_ctx =
_this->gl_data->OSMesaCreateContextExt(osmesa_format,
_this->gl_config.
depth_size,
_this->gl_config.
stencil_size,
newaccumsize, NULL);
_this->gl_config.
depth_size,
_this->gl_config.
stencil_size,
newaccumsize, NULL);
if (gl_ctx) {
gl_curformat = osmesa_format;
......@@ -679,7 +679,7 @@ InitOld(_THIS, SDL_Surface * current)
gl_shadow =
_this->gl_data->OSMesaCreateLDG(osmesa_format, GL_UNSIGNED_BYTE,
current->w, current->h);
current->w, current->h);
if (gl_shadow) {
gl_curformat = osmesa_format;
......
......@@ -61,8 +61,8 @@ AtariBios_InitOSKeymap(_THIS)
vectors_mask |= ATARI_XBIOS_MOUSEEVENTS; /* XBIOS mouse events */
}
/*if (Getcookie(C_MiNT, &dummy) == C_FOUND) {
vectors_mask = 0;
}*/
vectors_mask = 0;
} */
SDL_AtariXbios_InstallVectors(vectors_mask);
}
......@@ -78,8 +78,9 @@ AtariBios_PumpEvents(_THIS)
while (Bconstat(_CON)) {
unsigned long key_pressed;
key_pressed=Bconin(_CON);
bios_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
key_pressed = Bconin(_CON);
bios_currentkeyboard[(key_pressed >> 16) & (ATARIBIOS_MAXKEYS - 1)] =
0xFF;
}
/* Read special keys */
......@@ -95,7 +96,8 @@ AtariBios_PumpEvents(_THIS)
/* Key unpressed ? */
if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
SDL_PrivateKeyboard(SDL_RELEASED,
SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
SDL_Atari_TranslateKey(i, &keysym,
SDL_FALSE));
}
if (use_dev_mouse) {
......
......@@ -45,9 +45,10 @@ static unsigned char gemdos_currentkeyboard[ATARIBIOS_MAXKEYS];
static unsigned char gemdos_previouskeyboard[ATARIBIOS_MAXKEYS];
static SDL_bool use_dev_mouse = SDL_FALSE;
enum {
DEV_BUSY=0,
DEV_READY
enum
{
DEV_BUSY = 0,
DEV_READY
};
static void UpdateSpecialKeys(int special_keys_state);
......@@ -68,8 +69,8 @@ AtariGemdos_InitOSKeymap(_THIS)
vectors_mask |= ATARI_XBIOS_MOUSEEVENTS; /* XBIOS mouse events */
}
/*if (Getcookie(C_MiNT, &dummy) == C_FOUND) {
vectors_mask = 0;
}*/
vectors_mask = 0;
} */
SDL_AtariXbios_InstallVectors(vectors_mask);
}
......@@ -85,8 +86,9 @@ AtariGemdos_PumpEvents(_THIS)
while (Cconis() != DEV_BUSY) {
unsigned long key_pressed;
key_pressed=Cnecin();
gemdos_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
key_pressed = Cnecin();
gemdos_currentkeyboard[(key_pressed >> 16) & (ATARIBIOS_MAXKEYS - 1)]
= 0xFF;
}
/* Read special keys */
......@@ -102,7 +104,8 @@ AtariGemdos_PumpEvents(_THIS)
/* Key unpressed ? */
if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i])
SDL_PrivateKeyboard(SDL_RELEASED,
SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
SDL_Atari_TranslateKey(i, &keysym,
SDL_FALSE));
}
if (use_dev_mouse) {
......
......@@ -46,7 +46,8 @@ static Uint16 atari_prevmouseb; /* save state of mouse buttons */
void
AtariIkbd_InitOSKeymap(_THIS)
{
SDL_memset(SDL_AtariIkbd_keyboard, KEY_UNDEFINED, sizeof(SDL_AtariIkbd_keyboard));
SDL_memset(SDL_AtariIkbd_keyboard, KEY_UNDEFINED,
sizeof(SDL_AtariIkbd_keyboard));
/* Now install our handler */
SDL_AtariIkbd_mouseb = SDL_AtariIkbd_mousex = SDL_AtariIkbd_mousey = 0;
......@@ -90,7 +91,8 @@ AtariIkbd_PumpEvents(_THIS)
/* Key released ? */
if (SDL_AtariIkbd_keyboard[i] == KEY_RELEASED) {
SDL_PrivateKeyboard(SDL_RELEASED,
SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
SDL_Atari_TranslateKey(i, &keysym,
SDL_FALSE));
SDL_AtariIkbd_keyboard[i] = KEY_UNDEFINED;
}
}
......
......@@ -152,8 +152,10 @@ SDL_AtariXbios_PostMouseEvents(_THIS, SDL_bool buttonEvents)
}
}
void SDL_AtariXbios_LockMousePosition(SDL_bool lockPosition)
void
SDL_AtariXbios_LockMousePosition(SDL_bool lockPosition)
{
SDL_AtariXbios_mouselock = lockPosition;
}
/* vi: set ts=4 sw=4 expandtab: */
......@@ -36,7 +36,7 @@
/* Variables */
extern volatile Uint16 SDL_AtariXbios_mouselock; /* mouse lock position */
extern volatile Uint16 SDL_AtariXbios_mouselock; /* mouse lock position */
extern volatile Uint16 SDL_AtariXbios_mouseb; /* buttons */
extern volatile Sint16 SDL_AtariXbios_mousex; /* X relative motion */
extern volatile Sint16 SDL_AtariXbios_mousey; /* Y relative motion */
......
......@@ -147,7 +147,8 @@ GEM_PumpEvents(_THIS)
/* Key unpressed ? */
if (gem_previouskeyboard[i] && !gem_currentkeyboard[i])
SDL_PrivateKeyboard(SDL_RELEASED,
SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
SDL_Atari_TranslateKey(i, &keysym,
SDL_FALSE));
}
SDL_memcpy(gem_previouskeyboard, gem_currentkeyboard,
......@@ -291,8 +292,8 @@ do_keyboard(short kc, short ks)
int scancode, asciicode;
if (kc) {
scancode=(kc>>8) & (ATARIBIOS_MAXKEYS-1);
gem_currentkeyboard[scancode]=0xFF;
scancode = (kc >> 8) & (ATARIBIOS_MAXKEYS - 1);
gem_currentkeyboard[scancode] = 0xFF;
}
/* Read special keys */
......
......@@ -204,8 +204,8 @@ GEM_CreateDevice(int devindex)
vectors_mask |= ATARI_XBIOS_MOUSEEVENTS; /* XBIOS mouse events */
}
/*if (Getcookie(C_MiNT, &dummy) == C_FOUND) {
vectors_mask = 0;
}*/
vectors_mask = 0;
} */
SDL_AtariXbios_InstallVectors(vectors_mask);
......
......@@ -171,8 +171,8 @@ XBIOS_CreateDevice(int devindex)
device->VideoQuit = XBIOS_VideoQuit;
/* Modes */
device->GetDisplayModes = NULL /*XBIOS_GetDisplayModes*/;
device->SetDisplayMode = NULL /*XBIOS_SetDisplayMode*/;
device->GetDisplayModes = NULL /*XBIOS_GetDisplayModes */ ;
device->SetDisplayMode = NULL /*XBIOS_SetDisplayMode */ ;
/* Events */
device->PumpEvents = SDL_Atari_PumpEvents;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment