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