changeset 1461:11134dc42da8

Updated for Dreamcast KOS June 2005 snapshot: http://cadcdev.sourceforge.net/svn/snapshots/ http://gamedev.allusion.net/softprj/kos/dcsetup.php
author Sam Lantinga <slouken@libsdl.org>
date Thu, 02 Mar 2006 13:16:02 +0000
parents d79e6b0c2c19
children c17d82103614
files 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
diffstat 11 files changed, 59 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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
--- 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
--- 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
--- 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 <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-
 #include "SDL_timer.h"
 #include "SDL_audio.h"
 #include "../SDL_audiomem.h"
--- 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 <arch/irq.h>
+#include <dc/spu.h>
+
 /* #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);
--- 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+1<toc.last)?toc.entry[i+1]:toc.dunno)-TOC_LBA(entry);
+		cdrom->track[i].length = TOC_LBA((i+1<toc.last)?toc.entry[i+1]:toc.leadout_sector)-TOC_LBA(entry);
 	}
 
 	return 0;
@@ -95,7 +95,6 @@
 /* Get CD-ROM status */
 static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position)
 {
-	CDstatus status;
 	int ret,dc_status,disc_type;
 
 	ret = cdrom_get_status(&dc_status,&disc_type);
--- a/src/joystick/dc/SDL_sysjoystick.c	Thu Mar 02 07:46:24 2006 +0000
+++ b/src/joystick/dc/SDL_sysjoystick.c	Thu Mar 02 13:16:02 2006 +0000
@@ -21,8 +21,7 @@
 */
 #include "SDL_config.h"
 
-/* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
-
+#include "SDL_events.h"
 #include "SDL_joystick.h"
 #include "../SDL_sysjoystick.h"
 #include "../SDL_joystick_c.h"
--- a/src/thread/dc/SDL_systhread.c	Thu Mar 02 07:46:24 2006 +0000
+++ b/src/thread/dc/SDL_systhread.c	Thu Mar 02 13:16:02 2006 +0000
@@ -24,38 +24,11 @@
 /* Thread management routines for SDL */
 
 #include "SDL_thread.h"
+#include "../SDL_thread_c.h"
 #include "../SDL_systhread.h"
 
 #include <kos/thread.h>
 
-#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
--- 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;
--- 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 */