Updated for Dreamcast KOS June 2005 snapshot:
authorSam Lantinga <slouken@libsdl.org>
Thu, 02 Mar 2006 13:16:02 +0000
changeset 146111134dc42da8
parent 1460 d79e6b0c2c19
child 1462 c17d82103614
Updated for Dreamcast KOS June 2005 snapshot:
http://cadcdev.sourceforge.net/svn/snapshots/
http://gamedev.allusion.net/softprj/kos/dcsetup.php
Makefile.dc
include/SDL_config.h.in
include/SDL_config_dreamcast.h
include/SDL_platform.h
src/audio/dc/SDL_dcaudio.c
src/audio/dc/aica.c
src/cdrom/dc/SDL_syscdrom.c
src/joystick/dc/SDL_sysjoystick.c
src/thread/dc/SDL_systhread.c
src/video/dc/SDL_dcevents.c
src/video/dc/SDL_dcvideo.c
     1.1 --- a/Makefile.dc	Thu Mar 02 07:46:24 2006 +0000
     1.2 +++ b/Makefile.dc	Thu Mar 02 13:16:02 2006 +0000
     1.3 @@ -1,20 +1,16 @@
     1.4  #GL=1
     1.5  
     1.6 -CC = sh-elf-gcc -ml -m4-single-only
     1.7 +CC = sh-elf-gcc
     1.8  AR = sh-elf-ar
     1.9 -KOS_BASE=/prog/kos-1.1.7
    1.10 -INCS = -I$(KOS_BASE)/libc/include -I$(KOS_BASE)/include -I$(KOS_BASE)/kernel/arch/dreamcast/include
    1.11 -DEFS =-DNO_SIGNAL_H -DENABLE_DC
    1.12  
    1.13  ifdef GL
    1.14 -DEFS += -DHAVE_OPENGL
    1.15 +DEFS += -DSDL_VIDEO_OPENGL=1
    1.16  TARGET = libSDL_gl.a
    1.17  else
    1.18  TARGET = libSDL.a
    1.19  endif
    1.20  
    1.21 -OPTFLAGS=-O2 -fomit-frame-pointer
    1.22 -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)
    1.23 +CFLAGS=$(KOS_CFLAGS) $(DEFS) -Iinclude
    1.24  
    1.25  SRCS = \
    1.26  	src/audio/dc/SDL_dcaudio.c \
    1.27 @@ -22,12 +18,10 @@
    1.28  	src/audio/SDL_audio.c \
    1.29  	src/audio/SDL_audiocvt.c \
    1.30  	src/audio/SDL_audiodev.c \
    1.31 -	src/audio/SDL_audiomem.c \
    1.32  	src/audio/SDL_mixer.c \
    1.33  	src/audio/SDL_wave.c \
    1.34  	src/cdrom/dc/SDL_syscdrom.c \
    1.35  	src/cdrom/SDL_cdrom.c \
    1.36 -	src/endian/SDL_endian.c \
    1.37  	src/events/SDL_active.c \
    1.38  	src/events/SDL_events.c \
    1.39  	src/events/SDL_expose.c \
    1.40 @@ -38,11 +32,15 @@
    1.41  	src/file/SDL_rwops.c \
    1.42  	src/joystick/dc/SDL_sysjoystick.c \
    1.43  	src/joystick/SDL_joystick.c \
    1.44 +	src/loadso/dummy/SDL_sysloadso.c \
    1.45  	src/SDL.c \
    1.46  	src/SDL_error.c \
    1.47  	src/SDL_fatal.c \
    1.48 -	src/SDL_getenv.c \
    1.49 -	src/SDL_loadso.c \
    1.50 +	src/stdlib/SDL_getenv.c \
    1.51 +	src/stdlib/SDL_malloc.c \
    1.52 +	src/stdlib/SDL_qsort.c \
    1.53 +	src/stdlib/SDL_stdlib.c \
    1.54 +	src/stdlib/SDL_string.c \
    1.55  	src/thread/dc/SDL_syscond.c \
    1.56  	src/thread/dc/SDL_sysmutex.c \
    1.57  	src/thread/dc/SDL_syssem.c \
    1.58 @@ -97,9 +95,8 @@
    1.59  	test/threadwin.c \
    1.60  	test/torturethread.c \
    1.61  
    1.62 -clean:
    1.63 -	rm $(OBJS)
    1.64 -
    1.65 -$(TARGET) : $(OBJS)
    1.66 +$(TARGET): $(OBJS)
    1.67  	$(AR) rcs $(TARGET) $(OBJS)
    1.68  
    1.69 +clean:
    1.70 +	rm -f $(OBJS)
     2.1 --- a/include/SDL_config.h.in	Thu Mar 02 07:46:24 2006 +0000
     2.2 +++ b/include/SDL_config.h.in	Thu Mar 02 13:16:02 2006 +0000
     2.3 @@ -106,9 +106,11 @@
     2.4  #undef HAVE__UITOA
     2.5  #undef HAVE__ULTOA
     2.6  #undef HAVE_STRTOL
     2.7 +#undef HAVE_STRTOUL
     2.8  #undef HAVE__I64TOA
     2.9  #undef HAVE__UI64TOA
    2.10  #undef HAVE_STRTOLL
    2.11 +#undef HAVE_STRTOULL
    2.12  #undef HAVE_STRTOD
    2.13  #undef HAVE_ATOI
    2.14  #undef HAVE_ATOF
     3.1 --- a/include/SDL_config_dreamcast.h	Thu Mar 02 07:46:24 2006 +0000
     3.2 +++ b/include/SDL_config_dreamcast.h	Thu Mar 02 13:16:02 2006 +0000
     3.3 @@ -25,6 +25,15 @@
     3.4  
     3.5  /* This is a set of defines to configure the SDL features */
     3.6  
     3.7 +typedef signed char int8_t;
     3.8 +typedef unsigned char uint8_t;
     3.9 +typedef signed short int16_t;
    3.10 +typedef unsigned short uint16_t;
    3.11 +typedef signed int int32_t;
    3.12 +typedef unsigned int uint32_t;
    3.13 +typedef signed long long int64_t;
    3.14 +typedef unsigned long long uint64_t;
    3.15 +typedef unsigned long uintptr_t;
    3.16  #define SDL_HAS_64BIT_TYPE	1
    3.17  
    3.18  /* Useful headers */
    3.19 @@ -32,8 +41,7 @@
    3.20  #define HAVE_STDIO_H	1
    3.21  #define STDC_HEADERS	1
    3.22  #define HAVE_STRING_H	1
    3.23 -#define HAVE_INTTYPES_H	1
    3.24 -#define HAVE_SIGNAL_H	1
    3.25 +#define HAVE_CTYPE_H	1
    3.26  
    3.27  /* C library functions */
    3.28  #define HAVE_MALLOC	1
    3.29 @@ -43,10 +51,31 @@
    3.30  #define HAVE_ALLOCA	1
    3.31  #define HAVE_GETENV	1
    3.32  #define HAVE_PUTENV	1
    3.33 +#define HAVE_QSORT	1
    3.34 +#define HAVE_ABS	1
    3.35 +#define HAVE_BCOPY	1
    3.36  #define HAVE_MEMSET	1
    3.37  #define HAVE_MEMCPY	1
    3.38  #define HAVE_MEMMOVE	1
    3.39  #define HAVE_MEMCMP	1
    3.40 +#define HAVE_STRLEN	1
    3.41 +#define HAVE_STRDUP	1
    3.42 +#define HAVE_INDEX	1
    3.43 +#define HAVE_RINDEX	1
    3.44 +#define HAVE_STRCHR	1
    3.45 +#define HAVE_STRRCHR	1
    3.46 +#define HAVE_STRSTR	1
    3.47 +#define HAVE_STRTOL	1
    3.48 +#define HAVE_STRTOD	1
    3.49 +#define HAVE_ATOI	1
    3.50 +#define HAVE_ATOF	1
    3.51 +#define HAVE_STRCMP	1
    3.52 +#define HAVE_STRNCMP	1
    3.53 +#define HAVE_STRICMP	1
    3.54 +#define HAVE_STRCASECMP	1
    3.55 +#define HAVE_SSCANF	1
    3.56 +#define HAVE_SNPRINTF	1
    3.57 +#define HAVE_VSNPRINTF	1
    3.58  
    3.59  /* Enable various audio drivers */
    3.60  #define SDL_AUDIO_DRIVER_DC	1
     4.1 --- a/include/SDL_platform.h	Thu Mar 02 07:46:24 2006 +0000
     4.2 +++ b/include/SDL_platform.h	Thu Mar 02 13:16:02 2006 +0000
     4.3 @@ -41,7 +41,7 @@
     4.4  #undef __BSDI__
     4.5  #define __BSDI__	1
     4.6  #endif
     4.7 -#if defined(DREAMCAST)
     4.8 +#if defined(_arch_dreamcast)
     4.9  #undef __DREAMCAST__
    4.10  #define __DREAMCAST__	1
    4.11  #endif
     5.1 --- a/src/audio/dc/SDL_dcaudio.c	Thu Mar 02 07:46:24 2006 +0000
     5.2 +++ b/src/audio/dc/SDL_dcaudio.c	Thu Mar 02 13:16:02 2006 +0000
     5.3 @@ -24,13 +24,6 @@
     5.4  
     5.5  /* Output dreamcast aica */
     5.6  
     5.7 -#include <unistd.h>
     5.8 -#include <sys/stat.h>
     5.9 -#include <sys/types.h>
    5.10 -#include <sys/stat.h>
    5.11 -#include <fcntl.h>
    5.12 -
    5.13 -
    5.14  #include "SDL_timer.h"
    5.15  #include "SDL_audio.h"
    5.16  #include "../SDL_audiomem.h"
     6.1 --- a/src/audio/dc/aica.c	Thu Mar 02 07:46:24 2006 +0000
     6.2 +++ b/src/audio/dc/aica.c	Thu Mar 02 13:16:02 2006 +0000
     6.3 @@ -6,6 +6,9 @@
     6.4   */
     6.5  #include "aica.h"
     6.6  
     6.7 +#include <arch/irq.h>
     6.8 +#include <dc/spu.h>
     6.9 +
    6.10  /* #define dc_snd_base ((volatile unsigned char *)0x00800000) */ /* arm side */
    6.11  #define dc_snd_base ((volatile unsigned char *)0xa0700000) /* dc side */
    6.12  
    6.13 @@ -37,7 +40,7 @@
    6.14  
    6.15  
    6.16  void aica_init() {
    6.17 -	int i, j, old;
    6.18 +	int i, j, old = 0;
    6.19  	
    6.20  	/* Initialize AICA channels */	
    6.21  	G2_LOCK(old);
    6.22 @@ -146,9 +149,10 @@
    6.23     This routine (and the similar ones) owe a lot to Marcus' sound example -- 
    6.24     I hadn't gotten quite this far into dissecting the individual regs yet. */
    6.25  void aica_play(int ch,int mode,unsigned long smpptr,int loopst,int loopend,int freq,int vol,int pan,int loopflag) {
    6.26 -	int i;
    6.27 +/*	int i;
    6.28 +*/
    6.29  	int val;
    6.30 -	int old;
    6.31 +	int old = 0;
    6.32  
    6.33  	/* Stop the channel (if it's already playing) */
    6.34  	aica_stop(ch);
     7.1 --- a/src/cdrom/dc/SDL_syscdrom.c	Thu Mar 02 07:46:24 2006 +0000
     7.2 +++ b/src/cdrom/dc/SDL_syscdrom.c	Thu Mar 02 13:16:02 2006 +0000
     7.3 @@ -86,7 +86,7 @@
     7.4  		cdrom->track[i].id = i+1;
     7.5  		cdrom->track[i].type = (TOC_CTRL(toc.entry[i])==TRACK_CDDA)?SDL_AUDIO_TRACK:SDL_DATA_TRACK;
     7.6  		cdrom->track[i].offset = TOC_LBA(entry)-150;
     7.7 -		cdrom->track[i].length = TOC_LBA((i+1<toc.last)?toc.entry[i+1]:toc.dunno)-TOC_LBA(entry);
     7.8 +		cdrom->track[i].length = TOC_LBA((i+1<toc.last)?toc.entry[i+1]:toc.leadout_sector)-TOC_LBA(entry);
     7.9  	}
    7.10  
    7.11  	return 0;
    7.12 @@ -95,7 +95,6 @@
    7.13  /* Get CD-ROM status */
    7.14  static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position)
    7.15  {
    7.16 -	CDstatus status;
    7.17  	int ret,dc_status,disc_type;
    7.18  
    7.19  	ret = cdrom_get_status(&dc_status,&disc_type);
     8.1 --- a/src/joystick/dc/SDL_sysjoystick.c	Thu Mar 02 07:46:24 2006 +0000
     8.2 +++ b/src/joystick/dc/SDL_sysjoystick.c	Thu Mar 02 13:16:02 2006 +0000
     8.3 @@ -21,8 +21,7 @@
     8.4  */
     8.5  #include "SDL_config.h"
     8.6  
     8.7 -/* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
     8.8 -
     8.9 +#include "SDL_events.h"
    8.10  #include "SDL_joystick.h"
    8.11  #include "../SDL_sysjoystick.h"
    8.12  #include "../SDL_joystick_c.h"
     9.1 --- a/src/thread/dc/SDL_systhread.c	Thu Mar 02 07:46:24 2006 +0000
     9.2 +++ b/src/thread/dc/SDL_systhread.c	Thu Mar 02 13:16:02 2006 +0000
     9.3 @@ -24,38 +24,11 @@
     9.4  /* Thread management routines for SDL */
     9.5  
     9.6  #include "SDL_thread.h"
     9.7 +#include "../SDL_thread_c.h"
     9.8  #include "../SDL_systhread.h"
     9.9  
    9.10  #include <kos/thread.h>
    9.11  
    9.12 -#if SDL_THREADS_DISABLED
    9.13 -int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
    9.14 -{
    9.15 -	SDL_SetError("Threads are not supported on this platform");
    9.16 -	return(-1);
    9.17 -}
    9.18 -
    9.19 -void SDL_SYS_SetupThread(void)
    9.20 -{
    9.21 -	return;
    9.22 -}
    9.23 -
    9.24 -Uint32 SDL_ThreadID(void)
    9.25 -{
    9.26 -	return(0);
    9.27 -}
    9.28 -
    9.29 -void SDL_SYS_WaitThread(SDL_Thread *thread)
    9.30 -{
    9.31 -	return;
    9.32 -}
    9.33 -
    9.34 -void SDL_SYS_KillThread(SDL_Thread *thread)
    9.35 -{
    9.36 -	return;
    9.37 -}
    9.38 -
    9.39 -#else
    9.40  int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
    9.41  {
    9.42  	thread->handle = thd_create(SDL_RunThread,args);
    9.43 @@ -85,4 +58,3 @@
    9.44  {
    9.45  	thd_destroy(thread->handle);
    9.46  }
    9.47 -#endif
    10.1 --- a/src/video/dc/SDL_dcevents.c	Thu Mar 02 07:46:24 2006 +0000
    10.2 +++ b/src/video/dc/SDL_dcevents.c	Thu Mar 02 13:16:02 2006 +0000
    10.3 @@ -113,7 +113,7 @@
    10.4  
    10.5  	maple_raddr(addr,&port,&unit);
    10.6  
    10.7 -	state = kbd_get_state(port,unit);
    10.8 +	state = maple_dev_state(port,unit);
    10.9  	if (!state) return;
   10.10  
   10.11  	shiftkeys = state->shift_keys ^ old_state.shift_keys;
    11.1 --- a/src/video/dc/SDL_dcvideo.c	Thu Mar 02 07:46:24 2006 +0000
    11.2 +++ b/src/video/dc/SDL_dcvideo.c	Thu Mar 02 13:16:02 2006 +0000
    11.3 @@ -53,10 +53,12 @@
    11.4  static void DC_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
    11.5  
    11.6  /* OpenGL */
    11.7 +#if SDL_VIDEO_OPENGL
    11.8  static void *DC_GL_GetProcAddress(_THIS, const char *proc);
    11.9  static int DC_GL_LoadLibrary(_THIS, const char *path);
   11.10  static int DC_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
   11.11  static void DC_GL_SwapBuffers(_THIS);
   11.12 +#endif
   11.13  
   11.14  /* DC driver bootstrap functions */
   11.15