Skip to content
Permalink
Browse files

Updated for Dreamcast KOS June 2005 snapshot:

  • Loading branch information
slouken committed Mar 2, 2006
1 parent 5c5d1cd commit efc687fa24714314e8e878fa6f9c45a3e7b8eb9d
@@ -1,33 +1,27 @@
#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 \
src/audio/dc/aica.c \
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 @@ SRCS = \
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 = \
test/threadwin.c \
test/torturethread.c \

clean:
rm $(OBJS)

$(TARGET) : $(OBJS)
$(TARGET): $(OBJS)
$(AR) rcs $(TARGET) $(OBJS)

clean:
rm -f $(OBJS)
@@ -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
@@ -25,15 +25,23 @@

/* 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 */
#define HAVE_SYS_TYPES_H 1
#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
@@ -41,7 +41,7 @@
#undef __BSDI__
#define __BSDI__ 1
#endif
#if defined(DREAMCAST)
#if defined(_arch_dreamcast)
#undef __DREAMCAST__
#define __DREAMCAST__ 1
#endif
@@ -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"
@@ -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 @@ static inline unsigned AICA_FREQ(unsigned freq) {
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);
@@ -86,7 +86,7 @@ static int SDL_SYS_CDGetTOC(SDL_CD *cdrom)
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 @@ static int SDL_SYS_CDGetTOC(SDL_CD *cdrom)
/* 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);
@@ -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"
@@ -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 @@ void SDL_SYS_KillThread(SDL_Thread *thread)
{
thd_destroy(thread->handle);
}
#endif
@@ -113,7 +113,7 @@ static void keyboard_update(void)

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;
@@ -53,10 +53,12 @@ static int DC_FlipHWSurface(_THIS, SDL_Surface *surface);
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 */

0 comments on commit efc687f

Please sign in to comment.