Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Clean up.

  • Loading branch information
Darren Alton committed Aug 27, 2008
1 parent b275e10 commit 178ca1ee777158b38393235faa076786c47fc30d
Showing with 739 additions and 725 deletions.
  1. +7 −25 Makefile.ds
  2. +2 −2 include/SDL_endian.h
  3. +1 −0 src/SDL_compat.c
  4. +2 −2 src/SDL_error.c
  5. +7 −0 src/audio/SDL_audio.c
  6. +3 −0 src/audio/alsa/SDL_alsa_audio.c
  7. +9 −8 src/audio/dart/SDL_dart.c
  8. +19 −30 src/audio/nds/SDL_ndsaudio.c
  9. +1 −1 src/audio/nds/SDL_ndsaudio.h
  10. +2 −2 src/audio/windib/SDL_dibaudio.c
  11. +3 −2 src/audio/windx5/SDL_dx5audio.c
  12. +1 −0 src/cdrom/SDL_cdrom.c
  13. +3 −5 src/cdrom/macosx/AudioFileReaderThread.c
  14. +1 −0 src/events/SDL_events.c
  15. +2 −0 src/events/default_cursor.h
  16. +14 −3 src/file/SDL_rwops.c
  17. +2 −2 src/joystick/darwin/SDL_sysjoystick.c
  18. +17 −10 src/joystick/linux/SDL_sysjoystick.c
  19. +38 −33 src/joystick/nds/SDL_sysjoystick.c
  20. +12 −13 src/joystick/win32/SDL_dxjoystick.c
  21. +3 −2 src/loadso/macosx/SDL_dlcompat.c
  22. +8 −0 src/stdlib/SDL_stdlib.c
  23. +2 −0 src/thread/irix/SDL_syssem.c
  24. +8 −5 src/timer/nds/SDL_systimer.c
  25. +3 −0 src/video/SDL_blit_0.c
  26. +2 −0 src/video/SDL_blit_1.c
  27. +4 −4 src/video/SDL_blit_A.c
  28. +11 −2 src/video/SDL_blit_N.c
  29. +1 −0 src/video/SDL_gamma.c
  30. +1 −0 src/video/SDL_pixels.c
  31. +17 −15 src/video/SDL_renderer_sw.c
  32. +3 −3 src/video/SDL_surface.c
  33. +7 −7 src/video/ataricommon/SDL_atarigl.c
  34. +2 −2 src/video/bwindow/SDL_sysvideo.cc
  35. +2 −4 src/video/dc/SDL_dcevents.c
  36. +2 −0 src/video/dc/SDL_dcvideo.c
  37. +10 −18 src/video/directfb/SDL_DirectFB_events.c
  38. +18 −17 src/video/directfb/SDL_DirectFB_mouse.c
  39. +53 −52 src/video/directfb/SDL_DirectFB_render.c
  40. +40 −33 src/video/directfb/SDL_DirectFB_video.c
  41. +1 −0 src/video/fbcon/SDL_fb3dfx.c
  42. +2 −0 src/video/fbcon/SDL_fbevents.c
  43. +1 −0 src/video/fbcon/SDL_fbmatrox.c
  44. +2 −0 src/video/fbcon/SDL_fbriva.c
  45. +5 −0 src/video/fbcon/SDL_fbvideo.c
  46. +2 −2 src/video/gapi/SDL_gapivideo.c
  47. +7 −4 src/video/ipod/SDL_ipodvideo.c
  48. +3 −3 src/video/nds/SDL_ndsevents.c
  49. +142 −177 src/video/nds/SDL_ndsrender.c
  50. +14 −41 src/video/nds/SDL_ndsvideo.c
  51. +87 −91 src/video/os2fslib/SDL_os2fslib.c
  52. +11 −8 src/video/photon/SDL_ph_gl.c
  53. +2 −3 src/video/photon/SDL_ph_image.c
  54. +2 −2 src/video/photon/SDL_phyuv.c
  55. +4 −0 src/video/ps2gs/SDL_gsvideo.c
  56. +1 −0 src/video/riscos/SDL_riscosvideo.c
  57. +2 −0 src/video/svga/SDL_svgavideo.c
  58. +2 −0 src/video/vgl/SDL_vglvideo.c
  59. +4 −5 src/video/win32/SDL_d3drender.c
  60. +2 −3 src/video/win32/SDL_gdirender.c
  61. +1 −0 src/video/win32/SDL_win32keyboard.c
  62. +1 −2 src/video/win32/SDL_win32opengl.c
  63. +1 −0 src/video/wscons/SDL_wsconsvideo.c
  64. +2 −2 src/video/x11/SDL_x11opengl.c
  65. +4 −4 src/video/xbios/SDL_xbiosmodes.c
  66. +81 −70 test/nds-test-progs/general/source/main.c
  67. +3 −2 test/nds-test-progs/sprite/source/testsprite.c
  68. +7 −4 test/nds-test-progs/sprite2/source/testsprite2.c
@@ -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)

@@ -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

@@ -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__)
@@ -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)
{
@@ -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;
@@ -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. */
@@ -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)
{
@@ -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);
}
}
}
@@ -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;
@@ -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) {
@@ -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;
@@ -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: */
@@ -32,7 +32,7 @@

struct SDL_PrivateAudioData
{
TransferSoundData* sound;
TransferSoundData *sound;
/* The file descriptor for the audio device */
Uint8 *mixbuf;
Uint32 mixlen;
@@ -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
@@ -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);
@@ -44,6 +44,7 @@ struct CDcaps SDL_CDcaps = {
NULL, /* Eject */
NULL, /* Close */
};

int SDL_numcds;

int
@@ -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);
@@ -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);
}

@@ -73,6 +73,7 @@ SDL_Lock_EventThread(void)
}
}
}

void
SDL_Unlock_EventThread(void)
{
@@ -51,6 +51,7 @@ static unsigned char default_cdata[] = {
0x03, 0x00,
0x00, 0x00
};

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

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

0 comments on commit 178ca1e

Please sign in to comment.