Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren Alton committed Aug 27, 2008
1 parent b275e10 commit 178ca1e
Show file tree
Hide file tree
Showing 68 changed files with 739 additions and 725 deletions.
32 changes: 7 additions & 25 deletions Makefile.ds
Expand Up @@ -101,31 +101,10 @@ src/video/SDL_yuv_sw.c \
OBJS = $(SRCS:.c=.o)

TEST = \
test/checkkeys.c \
test/graywin.c \
test/loopwave.c \
test/testalpha.c \
test/testbitmap.c \
test/testcdrom.c \
test/testerror.c \
test/testgamma.c \
test/testgl.c \
test/testhread.c \
test/testjoystick.c \
test/testkeys.c \
test/testlock.c \
test/testoverlay.c \
test/testpalette.c \
test/testsem.c \
test/testsprite.c \
test/testtimer.c \
test/testtypes.c \
test/testver.c \
test/testvidinfo.c \
test/testwin.c \
test/testwm.c \
test/threadwin.c \
test/torturethread.c \
test/nds-test-progs/general/general.nds \
test/nds-test-progs/sprite/sprite.nds \
test/nds-test-progs/sprite2/sprite2.nds \


all: $(TARGET)

Expand All @@ -139,6 +118,9 @@ install: $(TARGET)
@mkdir -p $(DEVKITPRO)/libnds/include/SDL/
@cp include/*.h $(DEVKITPRO)/libnds/include/SDL/

nds_test:
$(MAKE) -C test/nds-test-progs

copy_config:
@cp include/SDL_config.h.default include/SDL_config.h

Expand Down
4 changes: 2 additions & 2 deletions include/SDL_endian.h
Expand Up @@ -156,8 +156,8 @@ SDL_Swap64(Uint64 x)
} v;
v.u = x;
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
"1"(v.s.
b));
"1"(v.
s.b));
return v.u;
}
#elif defined(__GNUC__) && defined(__x86_64__)
Expand Down
1 change: 1 addition & 0 deletions src/SDL_compat.c
Expand Up @@ -693,6 +693,7 @@ SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h)
SDL_UpdateRects(screen, 1, &rect);
}
}

void
SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
{
Expand Down
4 changes: 2 additions & 2 deletions src/SDL_error.c
Expand Up @@ -180,8 +180,8 @@ SDL_GetErrorMsg(char *errstr, unsigned int maxlen)
case 's':
len =
SDL_snprintf(msg, maxlen, tmp,
SDL_LookupString(error->
args[argi++].buf));
SDL_LookupString(error->args[argi++].
buf));
msg += len;
maxlen -= len;
break;
Expand Down
7 changes: 7 additions & 0 deletions src/audio/SDL_audio.c
Expand Up @@ -171,31 +171,38 @@ SDL_AudioDetectDevices_Default(int iscapture)
{
return -1;
}

static void
SDL_AudioThreadInit_Default(_THIS)
{ /* no-op. */
}

static void
SDL_AudioWaitDevice_Default(_THIS)
{ /* no-op. */
}

static void
SDL_AudioPlayDevice_Default(_THIS)
{ /* no-op. */
}

static Uint8 *
SDL_AudioGetDeviceBuf_Default(_THIS)
{
return NULL;
}

static void
SDL_AudioWaitDone_Default(_THIS)
{ /* no-op. */
}

static void
SDL_AudioCloseDevice_Default(_THIS)
{ /* no-op. */
}

static void
SDL_AudioDeinitialize_Default(void)
{ /* no-op. */
Expand Down
3 changes: 3 additions & 0 deletions src/audio/alsa/SDL_alsa_audio.c
Expand Up @@ -259,16 +259,19 @@ swizzle_alsa_channels_6_64bit(_THIS)
{
SWIZ6(Uint64);
}

static __inline__ void
swizzle_alsa_channels_6_32bit(_THIS)
{
SWIZ6(Uint32);
}

static __inline__ void
swizzle_alsa_channels_6_16bit(_THIS)
{
SWIZ6(Uint16);
}

static __inline__ void
swizzle_alsa_channels_6_8bit(_THIS)
{
Expand Down
17 changes: 9 additions & 8 deletions src/audio/dart/SDL_dart.c
Expand Up @@ -62,8 +62,8 @@ DARTEventFunc(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags)
pBufDesc->iBufferUsage = BUFFER_EMPTY;
// And notify DART feeder thread that it will have to work a bit.
if (pSDLAudioDevice)
DosPostEventSem(pSDLAudioDevice->hidden->
hevAudioBufferPlayed);
DosPostEventSem(pSDLAudioDevice->
hidden->hevAudioBufferPlayed);
}
}
}
Expand Down Expand Up @@ -312,10 +312,11 @@ DART_PlayDevice(_THIS)
(pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf].ulUserParm;
pBufDesc->iBufferUsage = BUFFER_USED;
// Send it to DART to be queued
_this->hidden->MixSetupParms.pmixWrite(_this->hidden->MixSetupParms.
ulMixHandle,
&(_this->hidden->
pMixBuffers[iFreeBuf]), 1);
_this->hidden->MixSetupParms.pmixWrite(_this->hidden->
MixSetupParms.ulMixHandle,
&(_this->
hidden->pMixBuffers[iFreeBuf]),
1);

_this->hidden->iLastPlayedBuf = iFreeBuf;
iFreeBuf = (iFreeBuf + 1) % _this->hidden->iCurrNumBufs;
Expand All @@ -333,8 +334,8 @@ DART_GetDeviceBuf(_THIS)
if (_this->hidden) {
iFreeBuf = _this->hidden->iNextFreeBuffer;
pBufDesc =
(pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf].
ulUserParm;
(pMixBufferDesc) _this->hidden->
pMixBuffers[iFreeBuf].ulUserParm;

if (pBufDesc) {
if (pBufDesc->iBufferUsage == BUFFER_EMPTY) {
Expand Down
49 changes: 19 additions & 30 deletions src/audio/nds/SDL_ndsaudio.c
Expand Up @@ -31,93 +31,83 @@
#include "../SDL_audio_c.h"
#include "SDL_ndsaudio.h"

#define TRACE printf

static int
NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
int valid_datatype = 0;

this->hidden = SDL_malloc(sizeof(*(this->hidden)));
if(!this->hidden) {
if (!this->hidden) {
SDL_OutOfMemory();
return 0;
}
SDL_memset(this->hidden, 0, (sizeof *this->hidden));

TRACE("+NDSAUD_OpenDevice\n");
while ((!valid_datatype) && (test_format)) {
this->spec.format = test_format;
switch (test_format) {
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;
}
}

/* set the generic sound parameters */
setGenericSound(22050, /* sample rate */
127, /* volume */
64, /* panning/balance */
0); /* sound format*/
setGenericSound(22050, /* sample rate */
127, /* volume */
64, /* panning/balance */
0); /* sound format */

TRACE("-NDSAUD_OpenDevice\n");
return 1;
}

static void
NDSAUD_PlayDevice(_THIS)
{
TransferSoundData* sound = SDL_malloc(sizeof(TransferSoundData));
if(!sound) {
TransferSoundData *sound = SDL_malloc(sizeof(TransferSoundData));
if (!sound) {
SDL_OutOfMemory();
}
TRACE("+NDSAUD_PlayDevice\n");

playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);

TRACE("-NDSAUD_PlayDevice\n");
#if 0
// sound->data = this->hidden->mixbuf;/* pointer to raw audio data */
// sound->len = this->hidden->mixlen; /* size of raw data pointed to above */
// sound->rate = 22050; /* sample rate = 22050Hz */
// sound->vol = 127; /* volume [0..127] for [min..max] */
// sound->pan = 64; /* balance [0..127] for [left..right] */
// sound->format = 0; /* 0 for 16-bit, 1 for 8-bit */
// playSound(sound);
#endif
}


static Uint8 *
NDSAUD_GetDeviceBuf(_THIS)
{ /* is this right? */
TRACE("!NDSAUD_GetDeviceBuf\n");
return this->hidden->mixbuf;
{
return this->hidden->mixbuf; /* is this right? */
}

static void
NDSAUD_WaitDevice(_THIS)
{
/* stub */
TRACE("!NDSAUD_WaitDevice\n");
}

static void
NDSAUD_CloseDevice(_THIS)
{
/* stub */
TRACE("!NDSAUD_CloseDevice\n");
}

static int
NDSAUD_Init(SDL_AudioDriverImpl * impl)
{
TRACE("+NDSAUD_Init\n");

/* Set the function pointers */
impl->OpenDevice = NDSAUD_OpenDevice;
impl->PlayDevice = NDSAUD_PlayDevice;
Expand All @@ -130,12 +120,11 @@ NDSAUD_Init(SDL_AudioDriverImpl * impl)
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultInputDevice = 1;

TRACE("-NDSAUD_Init\n");
return 1;
}

AudioBootStrap NDSAUD_bootstrap = {
"nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1?*/
"nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1? */
};

/* vi: set ts=4 sw=4 expandtab: */
2 changes: 1 addition & 1 deletion src/audio/nds/SDL_ndsaudio.h
Expand Up @@ -32,7 +32,7 @@

struct SDL_PrivateAudioData
{
TransferSoundData* sound;
TransferSoundData *sound;
/* The file descriptor for the audio device */
Uint8 *mixbuf;
Uint32 mixlen;
Expand Down
4 changes: 2 additions & 2 deletions src/audio/windib/SDL_dibaudio.c
Expand Up @@ -107,8 +107,8 @@ WINWAVEOUT_WaitDevice(_THIS)
Uint8 *
WINWAVEOUT_GetDeviceBuf(_THIS)
{
return (Uint8 *) (this->hidden->wavebuf[this->hidden->next_buffer].
lpData);
return (Uint8 *) (this->hidden->
wavebuf[this->hidden->next_buffer].lpData);
}

void
Expand Down
5 changes: 3 additions & 2 deletions src/audio/windx5/SDL_dx5audio.c
Expand Up @@ -278,8 +278,9 @@ DSOUND_GetDeviceBuf(_THIS)
IDirectSoundBuffer_Restore(this->hidden->mixbuf);
result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor,
this->hidden->mixlen,
(LPVOID *) & this->hidden->
locked_buf, &rawlen, NULL, &junk, 0);
(LPVOID *) & this->
hidden->locked_buf, &rawlen, NULL,
&junk, 0);
}
if (result != DS_OK) {
SetDSerror("DirectSound Lock", result);
Expand Down
1 change: 1 addition & 0 deletions src/cdrom/SDL_cdrom.c
Expand Up @@ -44,6 +44,7 @@ struct CDcaps SDL_CDcaps = {
NULL, /* Eject */
NULL, /* Close */
};

int SDL_numcds;

int
Expand Down
8 changes: 3 additions & 5 deletions src/cdrom/macosx/AudioFileReaderThread.c
Expand Up @@ -335,9 +335,8 @@ FileReaderThread_ReadNextChunk(FileReaderThread * frt)
}
/* construct pointer */
char *writePtr = (char *) (theItem->GetFileBuffer(theItem) +
(theItem->
mWriteToFirstBuffer ? 0 : theItem->
mChunkSize));
(theItem->mWriteToFirstBuffer ? 0 :
theItem->mChunkSize));

/* read data */
result = theItem->Read(theItem, writePtr, &dataChunkSize);
Expand Down Expand Up @@ -486,8 +485,7 @@ AudioFileManager_GetFileData(AudioFileManager * afm, void **inOutData,
} else {
*inOutDataSize = afm->mChunkSize;
*inOutData =
afm->mReadFromFirstBuffer ? afm->mFileBuffer : (afm->
mFileBuffer +
afm->mReadFromFirstBuffer ? afm->mFileBuffer : (afm->mFileBuffer +
afm->mChunkSize);
}

Expand Down
1 change: 1 addition & 0 deletions src/events/SDL_events.c
Expand Up @@ -73,6 +73,7 @@ SDL_Lock_EventThread(void)
}
}
}

void
SDL_Unlock_EventThread(void)
{
Expand Down
2 changes: 2 additions & 0 deletions src/events/default_cursor.h
Expand Up @@ -51,6 +51,7 @@ static unsigned char default_cdata[] = {
0x03, 0x00,
0x00, 0x00
};

static unsigned char default_cmask[] = {
0xC0, 0x00,
0xE0, 0x00,
Expand Down Expand Up @@ -90,6 +91,7 @@ static unsigned char default_cdata[] = {
0x03, 0x00,
0x00, 0x00
};

static unsigned char default_cmask[] = {
0x40, 0x00,
0xE0, 0x00,
Expand Down

0 comments on commit 178ca1e

Please sign in to comment.