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

Commit

Permalink
First commit. Added header configs for DS as well as a Makefile. Init…
Browse files Browse the repository at this point in the history
…ial work on framebuffer video driver, currently not functioning as desired.
  • Loading branch information
Darren Alton committed Jun 10, 2008
1 parent ec4df7d commit bf7f5ea
Show file tree
Hide file tree
Showing 43 changed files with 90 additions and 127 deletions.
4 changes: 3 additions & 1 deletion include/SDL_config.h.default
Expand Up @@ -26,7 +26,9 @@
#include "SDL_platform.h"

/* Add any platform that doesn't build using the configure system */
#if defined(__DREAMCAST__)
#if defined(__NINTENDODS__)
#include "SDL_config_nintendods.h"
#elif defined(__DREAMCAST__)
#include "SDL_config_dreamcast.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
Expand Down
5 changes: 5 additions & 0 deletions include/SDL_platform.h
Expand Up @@ -97,4 +97,9 @@
#define __WIN32__ 1
#endif

#if defined(__NDS__)
#undef __NINTENDODS__
#define __NINTENDODS__ 1
#endif

#endif /* _SDL_platform_h */
9 changes: 9 additions & 0 deletions include/SDL_stdinc.h
Expand Up @@ -147,8 +147,12 @@ SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
#ifndef __NINTENDODS__ /* TODO: figure out why the following happens:
include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
#endif
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */

/* Check to make sure enums are the size of ints, for structure packing.
Expand All @@ -162,12 +166,14 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
#endif

#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#ifndef __NINTENDODS__ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum
{
DUMMY_ENUM_VALUE
} SDL_DUMMY_ENUM;

SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#endif
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */

#include "begin_code.h"
Expand Down Expand Up @@ -425,6 +431,9 @@ extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
#ifdef HAVE_WCSLEN
#define SDL_wcslen wcslen
#else
#if !defined(wchar_t) && defined(__NINTENDODS__)
#define wchar_t short /* TODO: figure out why libnds doesn't have this */
#endif
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
#endif

Expand Down
6 changes: 2 additions & 4 deletions src/audio/SDL_wave.c
Expand Up @@ -462,8 +462,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
}
/* 2 Uint32's for chunk header+len, plus the lenread */
headerDiff += lenread + 2 * sizeof(Uint32);
}
while ((chunk.magic == FACT) || (chunk.magic == LIST));
} while ((chunk.magic == FACT) || (chunk.magic == LIST));

/* Decode the audio data format */
format = (WaveFMT *) chunk.data;
Expand Down Expand Up @@ -564,8 +563,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
*audio_buf = chunk.data;
if (chunk.magic != DATA)
headerDiff += lenread + 2 * sizeof(Uint32);
}
while (chunk.magic != DATA);
} while (chunk.magic != DATA);
headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */

if (MS_ADPCM_encoded) {
Expand Down
3 changes: 1 addition & 2 deletions src/audio/bsd/SDL_bsdaudio.c
Expand Up @@ -270,8 +270,7 @@ BSDAUDIO_PlayDevice(_THIS)
|| ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) {
SDL_Delay(1); /* Let a little CPU time go by */
}
}
while (p < written);
} while (p < written);

/* If timer synchronization is enabled, set the next write frame */
if (this->hidden->frame_ticks) {
Expand Down
3 changes: 1 addition & 2 deletions src/audio/dma/SDL_dmaaudio.c
Expand Up @@ -498,8 +498,7 @@ DMA_GetDeviceBuf(_THIS)
this->enabled = 0;
return (NULL);
}
}
while (frame_ticks && (info.blocks < 1));
} while (frame_ticks && (info.blocks < 1));
#ifdef DEBUG_AUDIO
if (info.blocks > 1) {
printf("Warning: audio underflow (%d frags)\n", info.blocks - 1);
Expand Down
5 changes: 2 additions & 3 deletions src/audio/esd/SDL_esdaudio.c
Expand Up @@ -154,9 +154,8 @@ ESD_PlayDevice(_THIS)
if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
SDL_Delay(1); /* Let a little CPU time go by */
}
}
while ((written < 0) &&
((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
} while ((written < 0) &&
((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));

/* Set the next write frame */
this->hidden->next_frame += this->hidden->frame_ticks;
Expand Down
6 changes: 2 additions & 4 deletions src/audio/nto/SDL_nto_audio.c
Expand Up @@ -154,8 +154,7 @@ NTO_WaitDevice(_THIS)
}
break;
}
}
while (1);
} while (1);
}

static void
Expand Down Expand Up @@ -213,8 +212,7 @@ NTO_PlayDevice(_THIS)
towrite -= written;
pcmbuffer += written * this->spec.channels;
}
}
while ((towrite > 0) && (this->enabled));
} while ((towrite > 0) && (this->enabled));

/* If we couldn't write, assume fatal error for now */
if (towrite != 0) {
Expand Down
5 changes: 2 additions & 3 deletions src/audio/paudio/SDL_paudio.c
Expand Up @@ -208,9 +208,8 @@ PAUDIO_PlayDevice(_THIS)
if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) {
SDL_Delay(1); /* Let a little CPU time go by */
}
}
while ((written < 0) &&
((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));
} while ((written < 0) &&
((errno == 0) || (errno == EAGAIN) || (errno == EINTR)));

/* If timer synchronization is enabled, set the next write frame */
if (this->hidden->frame_ticks) {
Expand Down
6 changes: 2 additions & 4 deletions src/audio/ums/SDL_umsaudio.c
Expand Up @@ -218,8 +218,7 @@ UMS_PlayAudio(_THIS)
#endif
return;
}
}
while (samplesToWrite > 0);
} while (samplesToWrite > 0);

SDL_LockAudio();
SDL_memcpy(&swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer));
Expand Down Expand Up @@ -326,8 +325,7 @@ UMS_OpenAudio(_THIS, SDL_AudioSpec * spec)
if (!success) {
test_format = SDL_NextAudioFormat();
}
}
while (!success && test_format);
} while (!success && test_format);

if (success == 0) {
SDL_SetError("Couldn't find any hardware audio formats");
Expand Down
3 changes: 1 addition & 2 deletions src/audio/windib/SDL_dibaudio.c
Expand Up @@ -136,8 +136,7 @@ WINWAVEOUT_WaitDone(_THIS)
if (left > 0) {
SDL_Delay(100);
}
}
while (left > 0);
} while (left > 0);
}

void
Expand Down
15 changes: 5 additions & 10 deletions src/cdrom/aix/SDL_syscdrom.c
Expand Up @@ -181,8 +181,7 @@ CheckMounts()
#endif
return;
}
}
while (ret == 0);
} while (ret == 0);

#ifdef DEBUG_CDROM
fprintf(stderr, "Read %d vmount structures\n", ret);
Expand Down Expand Up @@ -211,8 +210,7 @@ CheckMounts()
}
ptr = (struct vmount *) ((char *) ptr + ptr->vmt_length);
ret--;
}
while (ret > 0);
} while (ret > 0);

free(buffer);
}
Expand Down Expand Up @@ -247,8 +245,7 @@ CheckNonmounts()
}
}
}
}
while (ret == 0);
} while (ret == 0);
ret = endfsent_r(&fsFile);
if (ret != 0)
return -1;
Expand All @@ -275,8 +272,7 @@ CheckNonmounts()
}
}
}
}
while (entry != NULL);
} while (entry != NULL);
endfsent();
#endif
}
Expand Down Expand Up @@ -326,8 +322,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/beos/SDL_syscdrom.cc
Expand Up @@ -193,8 +193,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/bsdi/SDL_syscdrom.c
Expand Up @@ -286,8 +286,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/freebsd/SDL_syscdrom.c
Expand Up @@ -176,8 +176,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/linux/SDL_syscdrom.c
Expand Up @@ -312,8 +312,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/macosx/AudioFilePlayer.c
Expand Up @@ -311,8 +311,7 @@ AudioFilePlayer_OpenFile(AudioFilePlayer * afp, const FSRef * inRef,

/* Skip the chunk data */
offset = chunk.ckSize;
}
while (chunk.ckID != 'SSND');
} while (chunk.ckID != 'SSND');

/* Read the header of the SSND chunk. After this, we are positioned right
at the start of the audio data. */
Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/macosx/CDPlayer.c
Expand Up @@ -400,8 +400,7 @@ ListTrackFiles(FSVolumeRefNum theVolume, FSRef * trackFiles, int numTracks)
}
CFRelease(name);
}
}
while (noErr == result);
} while (noErr == result);
FSCloseIterator(iterator);
}

Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/openbsd/SDL_syscdrom.c
Expand Up @@ -184,8 +184,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down
3 changes: 1 addition & 2 deletions src/cdrom/osf/SDL_syscdrom.c
Expand Up @@ -199,8 +199,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down
6 changes: 2 additions & 4 deletions src/cdrom/qnx/SDL_syscdrom.c
Expand Up @@ -184,8 +184,7 @@ SDL_SYS_CDInit(void)
} else {
SDLcdrom = NULL;
}
}
while (SDLcdrom);
} while (SDLcdrom);
SDL_stack_free(cdpath);
}

Expand Down Expand Up @@ -357,8 +356,7 @@ SDL_SYS_CDStatus(SDL_CD * cdrom, int *position)
devctlret = ENXIO;
break;
}
}
while ((devctlret == EAGAIN) || (devctlret == ESTALE));
} while ((devctlret == EAGAIN) || (devctlret == ESTALE));

if (devctlret != 0) {
if (devctlret == ENXIO) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/beos/SDL_BeApp.cc
Expand Up @@ -78,8 +78,7 @@ SDL_InitBeApp(void)

do {
SDL_Delay(10);
}
while ((be_app == NULL) || be_app->IsLaunching());
} while ((be_app == NULL) || be_app->IsLaunching());

/* Mark the application active */
SDL_BeAppActive = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/thread/SDL_thread_c.h
Expand Up @@ -43,6 +43,8 @@
#include "irix/SDL_systhread_c.h"
#elif SDL_THREAD_WIN32
#include "win32/SDL_systhread_c.h"
#elif SDL_THREAD_NDS
#include "nds/SDL_systhread_c.h"
#else
#error Need thread implementation for this platform
#include "generic/SDL_systhread_c.h"
Expand Down
3 changes: 1 addition & 2 deletions src/thread/irix/SDL_syssem.c
Expand Up @@ -170,8 +170,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
break;
}
SDL_Delay(1);
}
while (SDL_GetTicks() < timeout);
} while (SDL_GetTicks() < timeout);

return retval;
}
Expand Down
3 changes: 1 addition & 2 deletions src/thread/pthread/SDL_syssem.c
Expand Up @@ -125,8 +125,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
break;
}
SDL_Delay(1);
}
while (SDL_GetTicks() < timeout);
} while (SDL_GetTicks() < timeout);

return retval;
}
Expand Down
3 changes: 1 addition & 2 deletions src/thread/riscos/SDL_syssem.c
Expand Up @@ -177,8 +177,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
break;
}
SDL_Delay(1);
}
while (SDL_GetTicks() < timeout);
} while (SDL_GetTicks() < timeout);

return retval;
}
Expand Down
3 changes: 1 addition & 2 deletions src/timer/riscos/SDL_systimer.c
Expand Up @@ -130,8 +130,7 @@ SDL_Delay(Uint32 ms)
pthread_yield();
#endif

}
while (1);
} while (1);
}

#if SDL_THREADS_DISABLED
Expand Down
3 changes: 1 addition & 2 deletions src/timer/unix/SDL_systimer.c
Expand Up @@ -137,8 +137,7 @@ SDL_Delay(Uint32 ms)

was_error = select(0, NULL, NULL, NULL, &tv);
#endif /* HAVE_NANOSLEEP */
}
while (was_error && (errno == EINTR));
} while (was_error && (errno == EINTR));
#endif /* SDL_THREAD_PTH */
}

Expand Down

0 comments on commit bf7f5ea

Please sign in to comment.