# HG changeset patch # User Sam Lantinga # Date 1141305362 0 # Node ID 11134dc42da8e81b2328ea5dff1aa9c9121657db # Parent d79e6b0c2c19e6e9ac1ce09d0ba12a4d8a3d8a47 Updated for Dreamcast KOS June 2005 snapshot: http://cadcdev.sourceforge.net/svn/snapshots/ http://gamedev.allusion.net/softprj/kos/dcsetup.php diff -r d79e6b0c2c19 -r 11134dc42da8 Makefile.dc --- a/Makefile.dc Thu Mar 02 07:46:24 2006 +0000 +++ b/Makefile.dc Thu Mar 02 13:16:02 2006 +0000 @@ -1,20 +1,16 @@ #GL=1 -CC = sh-elf-gcc -ml -m4-single-only +CC = sh-elf-gcc AR = sh-elf-ar -KOS_BASE=/prog/kos-1.1.7 -INCS = -I$(KOS_BASE)/libc/include -I$(KOS_BASE)/include -I$(KOS_BASE)/kernel/arch/dreamcast/include -DEFS =-DNO_SIGNAL_H -DENABLE_DC ifdef GL -DEFS += -DHAVE_OPENGL +DEFS += -DSDL_VIDEO_OPENGL=1 TARGET = libSDL_gl.a else TARGET = libSDL.a endif -OPTFLAGS=-O2 -fomit-frame-pointer -CFLAGS=-D_arch_dreamcast $(DEFS) $(INCS) -Iinclude -Isrc -Isrc/audio -Isrc/cdrom -Isrc/endian -Isrc/events -Isrc/joystick -Isrc/thread/dc -Isrc/thread -Isrc/timer -Isrc/video $(OPTFLAGS) +CFLAGS=$(KOS_CFLAGS) $(DEFS) -Iinclude SRCS = \ src/audio/dc/SDL_dcaudio.c \ @@ -22,12 +18,10 @@ src/audio/SDL_audio.c \ src/audio/SDL_audiocvt.c \ src/audio/SDL_audiodev.c \ - src/audio/SDL_audiomem.c \ src/audio/SDL_mixer.c \ src/audio/SDL_wave.c \ src/cdrom/dc/SDL_syscdrom.c \ src/cdrom/SDL_cdrom.c \ - src/endian/SDL_endian.c \ src/events/SDL_active.c \ src/events/SDL_events.c \ src/events/SDL_expose.c \ @@ -38,11 +32,15 @@ src/file/SDL_rwops.c \ src/joystick/dc/SDL_sysjoystick.c \ src/joystick/SDL_joystick.c \ + src/loadso/dummy/SDL_sysloadso.c \ src/SDL.c \ src/SDL_error.c \ src/SDL_fatal.c \ - src/SDL_getenv.c \ - src/SDL_loadso.c \ + src/stdlib/SDL_getenv.c \ + src/stdlib/SDL_malloc.c \ + src/stdlib/SDL_qsort.c \ + src/stdlib/SDL_stdlib.c \ + src/stdlib/SDL_string.c \ src/thread/dc/SDL_syscond.c \ src/thread/dc/SDL_sysmutex.c \ src/thread/dc/SDL_syssem.c \ @@ -97,9 +95,8 @@ test/threadwin.c \ test/torturethread.c \ -clean: - rm $(OBJS) - -$(TARGET) : $(OBJS) +$(TARGET): $(OBJS) $(AR) rcs $(TARGET) $(OBJS) +clean: + rm -f $(OBJS) diff -r d79e6b0c2c19 -r 11134dc42da8 include/SDL_config.h.in --- a/include/SDL_config.h.in Thu Mar 02 07:46:24 2006 +0000 +++ b/include/SDL_config.h.in Thu Mar 02 13:16:02 2006 +0000 @@ -106,9 +106,11 @@ #undef HAVE__UITOA #undef HAVE__ULTOA #undef HAVE_STRTOL +#undef HAVE_STRTOUL #undef HAVE__I64TOA #undef HAVE__UI64TOA #undef HAVE_STRTOLL +#undef HAVE_STRTOULL #undef HAVE_STRTOD #undef HAVE_ATOI #undef HAVE_ATOF diff -r d79e6b0c2c19 -r 11134dc42da8 include/SDL_config_dreamcast.h --- a/include/SDL_config_dreamcast.h Thu Mar 02 07:46:24 2006 +0000 +++ b/include/SDL_config_dreamcast.h Thu Mar 02 13:16:02 2006 +0000 @@ -25,6 +25,15 @@ /* This is a set of defines to configure the SDL features */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +typedef unsigned long uintptr_t; #define SDL_HAS_64BIT_TYPE 1 /* Useful headers */ @@ -32,8 +41,7 @@ #define HAVE_STDIO_H 1 #define STDC_HEADERS 1 #define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_SIGNAL_H 1 +#define HAVE_CTYPE_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -43,10 +51,31 @@ #define HAVE_ALLOCA 1 #define HAVE_GETENV 1 #define HAVE_PUTENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_INDEX 1 +#define HAVE_RINDEX 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_DC 1 diff -r d79e6b0c2c19 -r 11134dc42da8 include/SDL_platform.h --- a/include/SDL_platform.h Thu Mar 02 07:46:24 2006 +0000 +++ b/include/SDL_platform.h Thu Mar 02 13:16:02 2006 +0000 @@ -41,7 +41,7 @@ #undef __BSDI__ #define __BSDI__ 1 #endif -#if defined(DREAMCAST) +#if defined(_arch_dreamcast) #undef __DREAMCAST__ #define __DREAMCAST__ 1 #endif diff -r d79e6b0c2c19 -r 11134dc42da8 src/audio/dc/SDL_dcaudio.c --- a/src/audio/dc/SDL_dcaudio.c Thu Mar 02 07:46:24 2006 +0000 +++ b/src/audio/dc/SDL_dcaudio.c Thu Mar 02 13:16:02 2006 +0000 @@ -24,13 +24,6 @@ /* Output dreamcast aica */ -#include -#include -#include -#include -#include - - #include "SDL_timer.h" #include "SDL_audio.h" #include "../SDL_audiomem.h" diff -r d79e6b0c2c19 -r 11134dc42da8 src/audio/dc/aica.c --- a/src/audio/dc/aica.c Thu Mar 02 07:46:24 2006 +0000 +++ b/src/audio/dc/aica.c Thu Mar 02 13:16:02 2006 +0000 @@ -6,6 +6,9 @@ */ #include "aica.h" +#include +#include + /* #define dc_snd_base ((volatile unsigned char *)0x00800000) */ /* arm side */ #define dc_snd_base ((volatile unsigned char *)0xa0700000) /* dc side */ @@ -37,7 +40,7 @@ void aica_init() { - int i, j, old; + int i, j, old = 0; /* Initialize AICA channels */ G2_LOCK(old); @@ -146,9 +149,10 @@ This routine (and the similar ones) owe a lot to Marcus' sound example -- I hadn't gotten quite this far into dissecting the individual regs yet. */ void aica_play(int ch,int mode,unsigned long smpptr,int loopst,int loopend,int freq,int vol,int pan,int loopflag) { - int i; +/* int i; +*/ int val; - int old; + int old = 0; /* Stop the channel (if it's already playing) */ aica_stop(ch); diff -r d79e6b0c2c19 -r 11134dc42da8 src/cdrom/dc/SDL_syscdrom.c --- a/src/cdrom/dc/SDL_syscdrom.c Thu Mar 02 07:46:24 2006 +0000 +++ b/src/cdrom/dc/SDL_syscdrom.c Thu Mar 02 13:16:02 2006 +0000 @@ -86,7 +86,7 @@ cdrom->track[i].id = i+1; cdrom->track[i].type = (TOC_CTRL(toc.entry[i])==TRACK_CDDA)?SDL_AUDIO_TRACK:SDL_DATA_TRACK; cdrom->track[i].offset = TOC_LBA(entry)-150; - cdrom->track[i].length = TOC_LBA((i+1track[i].length = TOC_LBA((i+1 -#if SDL_THREADS_DISABLED -int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) -{ - SDL_SetError("Threads are not supported on this platform"); - return(-1); -} - -void SDL_SYS_SetupThread(void) -{ - return; -} - -Uint32 SDL_ThreadID(void) -{ - return(0); -} - -void SDL_SYS_WaitThread(SDL_Thread *thread) -{ - return; -} - -void SDL_SYS_KillThread(SDL_Thread *thread) -{ - return; -} - -#else int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) { thread->handle = thd_create(SDL_RunThread,args); @@ -85,4 +58,3 @@ { thd_destroy(thread->handle); } -#endif diff -r d79e6b0c2c19 -r 11134dc42da8 src/video/dc/SDL_dcevents.c --- a/src/video/dc/SDL_dcevents.c Thu Mar 02 07:46:24 2006 +0000 +++ b/src/video/dc/SDL_dcevents.c Thu Mar 02 13:16:02 2006 +0000 @@ -113,7 +113,7 @@ maple_raddr(addr,&port,&unit); - state = kbd_get_state(port,unit); + state = maple_dev_state(port,unit); if (!state) return; shiftkeys = state->shift_keys ^ old_state.shift_keys; diff -r d79e6b0c2c19 -r 11134dc42da8 src/video/dc/SDL_dcvideo.c --- a/src/video/dc/SDL_dcvideo.c Thu Mar 02 07:46:24 2006 +0000 +++ b/src/video/dc/SDL_dcvideo.c Thu Mar 02 13:16:02 2006 +0000 @@ -53,10 +53,12 @@ static void DC_UpdateRects(_THIS, int numrects, SDL_Rect *rects); /* OpenGL */ +#if SDL_VIDEO_OPENGL static void *DC_GL_GetProcAddress(_THIS, const char *proc); static int DC_GL_LoadLibrary(_THIS, const char *path); static int DC_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value); static void DC_GL_SwapBuffers(_THIS); +#endif /* DC driver bootstrap functions */