Removed Nintendo DS support since nobody has volunteered to maintain it for over a year.
authorSam Lantinga <slouken@libsdl.org>
Sun, 17 Mar 2013 09:44:58 -0700
changeset 701182bbfbbc720e
parent 7010 04649ef7439b
child 7012 504651b7d8df
Removed Nintendo DS support since nobody has volunteered to maintain it for over a year.
CREDITS
Makefile.ds
README.Platforms
README.ds
Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj
include/SDL_config.h
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_config_nintendods.h
include/SDL_platform.h
include/SDL_stdinc.h
include/SDL_test_common.h
src/SDL.c
src/audio/SDL_audio.c
src/audio/nds/SDL_ndsaudio.c
src/audio/nds/SDL_ndsaudio.h
src/events/nds/SDL_ndsgesture.c
src/file/SDL_rwops.c
src/haptic/nds/SDL_syshaptic.c
src/joystick/nds/SDL_sysjoystick.c
src/power/SDL_power.c
src/power/nds/SDL_syspower.c
src/render/SDL_render.c
src/render/SDL_sysrender.h
src/render/nds/SDL_libgl2D.c
src/render/nds/SDL_libgl2D.h
src/render/nds/SDL_ndsrender.c
src/test/SDL_test_common.c
src/thread/SDL_thread_c.h
src/thread/nds/SDL_syscond.c
src/thread/nds/SDL_syscond_c.h
src/thread/nds/SDL_sysmutex.c
src/thread/nds/SDL_sysmutex_c.h
src/thread/nds/SDL_syssem.c
src/thread/nds/SDL_syssem_c.h
src/thread/nds/SDL_systhread.c
src/thread/nds/SDL_systhread_c.h
src/timer/nds/SDL_systimer.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/nds/SDL_ndsevents.c
src/video/nds/SDL_ndsevents_c.h
src/video/nds/SDL_ndsvideo.c
src/video/nds/SDL_ndsvideo.h
src/video/nds/SDL_ndswindow.c
src/video/nds/SDL_ndswindow.h
test/nds-test-progs/Makefile
test/nds-test-progs/general/Makefile
test/nds-test-progs/general/source/main.c
test/nds-test-progs/testscale/Makefile
test/nds-test-progs/testsprite2/Makefile
test/nds-test-progs/testspriteminimal/Makefile
test/testspriteminimal.c
     1.1 --- a/CREDITS	Sun Mar 17 09:21:08 2013 -0700
     1.2 +++ b/CREDITS	Sun Mar 17 09:44:58 2013 -0700
     1.3 @@ -19,9 +19,6 @@
     1.4  * Holmes Futrell for port of SDL to the iPhone and iPod Touch during the
     1.5    Google Summer of Code 2008
     1.6  
     1.7 -* Darren Alton for port of SDL to the Nintendo DS during the Google Summer
     1.8 -  of Code 2008
     1.9 -
    1.10  * Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
    1.11    during the Google Summer of Code 2008
    1.12  
     2.1 --- a/Makefile.ds	Sun Mar 17 09:21:08 2013 -0700
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,231 +0,0 @@
     2.4 -#---------------------------------------------------------------------------------
     2.5 -.SUFFIXES:
     2.6 -#---------------------------------------------------------------------------------
     2.7 -
     2.8 -ifeq ($(strip $(DEVKITARM)),)
     2.9 -$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
    2.10 -endif
    2.11 -
    2.12 -include $(DEVKITARM)/ds_rules
    2.13 -
    2.14 -#---------------------------------------------------------------------------------
    2.15 -# TARGET is the name of the output
    2.16 -# BUILD is the directory where object files & intermediate files will be placed
    2.17 -# SOURCES is a list of directories containing source code
    2.18 -# DATA is a list of directories containing data files
    2.19 -# INCLUDES is a list of directories containing header files
    2.20 -#---------------------------------------------------------------------------------
    2.21 -TARGET		:=	$(shell basename $(CURDIR))
    2.22 -BUILD		:=	src
    2.23 -SOURCES		:=	src
    2.24 -DATA		:=	data
    2.25 -INCLUDES	:=	include
    2.26 -
    2.27 -#---------------------------------------------------------------------------------
    2.28 -# options for code generation
    2.29 -#---------------------------------------------------------------------------------
    2.30 -ARCH	:=	-mthumb -mthumb-interwork \
    2.31 -		-D__NDS__ -DENABLE_NDS -DNO_SIGNAL_H -DDISABLE_THREADS -DPACKAGE=\"SDL\" \
    2.32 -		 -DVERSION=\"2.0\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1  
    2.33 -
    2.34 -CFLAGS	:=	-g -Wall -Os\
    2.35 -		-march=armv5te -mtune=arm946e-s \
    2.36 -		-fomit-frame-pointer -ffast-math \
    2.37 -		$(ARCH)
    2.38 -
    2.39 -CFLAGS	+=	$(INCLUDE) -DARM9
    2.40 -CXXFLAGS	:= $(CFLAGS) -fno-rtti -fno-exceptions
    2.41 -
    2.42 -ASFLAGS	:=	-g $(ARCH) -march=armv5te -mtune=arm946e-s
    2.43 -LDFLAGS	=	-specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
    2.44 -
    2.45 -# Set to 0 to use a framer buffer, or 1 to use the GL like hardware
    2.46 -# renderer. Alas, both cannot be used at the same time for lack of
    2.47 -# display/texture memory.
    2.48 -USE_HW_RENDERER := 1
    2.49 -
    2.50 -ifeq ($(USE_HW_RENDERER),1)
    2.51 -CFLAGS += -DUSE_HW_RENDERER
    2.52 -else
    2.53 -endif
    2.54 -
    2.55 -#---------------------------------------------------------------------------------
    2.56 -# list of directories containing libraries, this must be the top level containing
    2.57 -# include and lib
    2.58 -#---------------------------------------------------------------------------------
    2.59 -LIBDIRS	:=	$(LIBNDS) $(PORTLIBS)
    2.60 -
    2.61 -#---------------------------------------------------------------------------------
    2.62 -# no real need to edit anything past this point unless you need to add additional
    2.63 -# rules for different file extensions
    2.64 -#---------------------------------------------------------------------------------
    2.65 -ifneq ($(BUILD),$(notdir $(CURDIR)))
    2.66 -#---------------------------------------------------------------------------------
    2.67 -
    2.68 -export OUTPUT	:=	$(CURDIR)/lib/lib$(TARGET).a
    2.69 -
    2.70 -export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
    2.71 -			$(foreach dir,$(DATA),$(CURDIR)/$(dir))
    2.72 -
    2.73 -export DEPSDIR	:=	$(CURDIR)/$(BUILD)
    2.74 -
    2.75 -CFILES		:=	\
    2.76 -			SDL.c \
    2.77 -			SDL_assert.c \
    2.78 -			SDL_error.c \
    2.79 -			SDL_fatal.c \
    2.80 -			SDL_hints.c \
    2.81 -			SDL_log.c \
    2.82 -			atomic/SDL_atomic.c \
    2.83 -			atomic/SDL_spinlock.arm.c \
    2.84 -			audio/SDL_audio.c \
    2.85 -			audio/SDL_audiocvt.c \
    2.86 -			audio/SDL_audiodev.c \
    2.87 -			audio/SDL_audiotypecvt.c \
    2.88 -			audio/SDL_mixer.c \
    2.89 -			audio/SDL_wave.c \
    2.90 -			audio/nds/SDL_ndsaudio.c \
    2.91 -			cpuinfo/SDL_cpuinfo.c \
    2.92 -			events/SDL_events.c \
    2.93 -			events/SDL_keyboard.c \
    2.94 -			events/SDL_mouse.c \
    2.95 -			events/SDL_quit.c \
    2.96 -			events/SDL_touch.c \
    2.97 -			events/SDL_windowevents.c \
    2.98 -			events/nds/SDL_ndsgesture.c \
    2.99 -			file/SDL_rwops.c \
   2.100 -			haptic/SDL_haptic.c \
   2.101 -			haptic/nds/SDL_syshaptic.c \
   2.102 -			joystick/SDL_joystick.c \
   2.103 -			joystick/nds/SDL_sysjoystick.c \
   2.104 -			power/SDL_power.c \
   2.105 -			power/nds/SDL_syspower.c \
   2.106 -			render/SDL_render.c \
   2.107 -			render/SDL_yuv_sw.c \
   2.108 -			render/nds/SDL_ndsrender.c \
   2.109 -			render/nds/SDL_libgl2D.c \
   2.110 -			render/software/SDL_blendfillrect.c \
   2.111 -			render/software/SDL_blendline.c \
   2.112 -			render/software/SDL_blendpoint.c \
   2.113 -			render/software/SDL_drawline.c \
   2.114 -			render/software/SDL_drawpoint.c \
   2.115 -			render/software/SDL_render_sw.c \
   2.116 -			stdlib/SDL_getenv.c \
   2.117 -			stdlib/SDL_iconv.c \
   2.118 -			stdlib/SDL_malloc.c \
   2.119 -			stdlib/SDL_qsort.c \
   2.120 -			stdlib/SDL_stdlib.c \
   2.121 -			stdlib/SDL_string.c \
   2.122 -			thread/SDL_thread.c \
   2.123 -			thread/nds/SDL_syscond.c \
   2.124 -			thread/nds/SDL_sysmutex.c \
   2.125 -			thread/nds/SDL_syssem.c \
   2.126 -			thread/nds/SDL_systhread.c \
   2.127 -			timer/SDL_timer.c \
   2.128 -			timer/nds/SDL_systimer.c \
   2.129 -			video/SDL_RLEaccel.c \
   2.130 -			video/SDL_blit.c \
   2.131 -			video/SDL_blit_0.c \
   2.132 -			video/SDL_blit_1.c \
   2.133 -			video/SDL_blit_A.c \
   2.134 -			video/SDL_blit_N.c \
   2.135 -			video/SDL_blit_auto.c \
   2.136 -			video/SDL_blit_copy.c \
   2.137 -			video/SDL_blit_slow.c \
   2.138 -			video/SDL_bmp.c \
   2.139 -			video/SDL_clipboard.c \
   2.140 -			video/SDL_fillrect.c \
   2.141 -			video/SDL_pixels.c \
   2.142 -			video/SDL_rect.c \
   2.143 -			video/SDL_stretch.c \
   2.144 -			video/SDL_surface.c \
   2.145 -			video/SDL_video.c \
   2.146 -			video/nds/SDL_ndsevents.c \
   2.147 -			video/nds/SDL_ndsvideo.c \
   2.148 -			video/nds/SDL_ndswindow.c
   2.149 -
   2.150 -
   2.151 -#CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
   2.152 -#SFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
   2.153 -#BINFILES	:=	$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
   2.154 -
   2.155 -#---------------------------------------------------------------------------------
   2.156 -# use CXX for linking C++ projects, CC for standard C
   2.157 -#---------------------------------------------------------------------------------
   2.158 -ifeq ($(strip $(CPPFILES)),)
   2.159 -#---------------------------------------------------------------------------------
   2.160 -	export LD	:=	$(CC)
   2.161 -#---------------------------------------------------------------------------------
   2.162 -else
   2.163 -#---------------------------------------------------------------------------------
   2.164 -	export LD	:=	$(CXX)
   2.165 -#---------------------------------------------------------------------------------
   2.166 -endif
   2.167 -#---------------------------------------------------------------------------------
   2.168 -
   2.169 -export OFILES	:=	$(addsuffix .o,$(BINFILES)) \
   2.170 -			$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
   2.171 -
   2.172 -export INCLUDE	:=	$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
   2.173 -			$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
   2.174 -			-I$(CURDIR)/$(BUILD) \
   2.175 -			-I$(PORTLIBS)/include/SDL
   2.176 -
   2.177 -.PHONY: $(BUILD) clean all
   2.178 -
   2.179 -#---------------------------------------------------------------------------------
   2.180 -all: arm_only $(BUILD) install nds_test
   2.181 -
   2.182 -lib:
   2.183 -	@[ -d $@ ] || mkdir -p $@
   2.184 -
   2.185 -$(BUILD): lib
   2.186 -	@[ -d $@ ] || mkdir -p $@
   2.187 -	@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.ds -s
   2.188 -
   2.189 -install: $(BUILD)
   2.190 -	@mkdir -p $(PORTLIBS)/include/SDL/
   2.191 -	@rsync -a $(OUTPUT) $(PORTLIBS)/lib/
   2.192 -	@rsync -a include/*.h $(PORTLIBS)/include/SDL/
   2.193 -
   2.194 -nds_test:
   2.195 -	$(MAKE) -C test/nds-test-progs -s
   2.196 -
   2.197 -tags:
   2.198 -	cd $(SOURCES); etags $(CFILES)
   2.199 -
   2.200 -# This file must be compiled with the ARM instruction set, not
   2.201 -# thumb. Use devkitpro way of doing things.
   2.202 -arm_only: src/atomic/SDL_spinlock.arm.c
   2.203 -src/atomic/SDL_spinlock.arm.c: src/atomic/SDL_spinlock.c
   2.204 -	@cp $< $@
   2.205 -
   2.206 -#---------------------------------------------------------------------------------
   2.207 -clean:
   2.208 -	@echo clean ...
   2.209 -	@cd src; rm -fr $(OFILES) $(OFILES:.o=.d) lib
   2.210 -	@rm -f $(OUTPUT)
   2.211 -	@make -C test/nds-test-progs -s clean
   2.212 -
   2.213 -#---------------------------------------------------------------------------------
   2.214 -else
   2.215 -
   2.216 -DEPENDS	:=	$(OFILES:.o=.d)
   2.217 -
   2.218 -#---------------------------------------------------------------------------------
   2.219 -# main targets
   2.220 -#---------------------------------------------------------------------------------
   2.221 -$(OUTPUT)	:	$(OFILES)
   2.222 -
   2.223 -#---------------------------------------------------------------------------------
   2.224 -%.bin.o	:	%.bin
   2.225 -#---------------------------------------------------------------------------------
   2.226 -	@echo $(notdir $<)
   2.227 -	@$(bin2o)
   2.228 -
   2.229 -
   2.230 --include $(DEPENDS)
   2.231 -
   2.232 -#---------------------------------------------------------------------------------------
   2.233 -endif
   2.234 -#---------------------------------------------------------------------------------------
     3.1 --- a/README.Platforms	Sun Mar 17 09:21:08 2013 -0700
     3.2 +++ b/README.Platforms	Sun Mar 17 09:44:58 2013 -0700
     3.3 @@ -29,5 +29,4 @@
     3.4  
     3.5  Platforms that need maintainers
     3.6  ===============================
     3.7 -Nintendo DS
     3.8  Haiku
     4.1 --- a/README.ds	Sun Mar 17 09:21:08 2013 -0700
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,64 +0,0 @@
     4.4 -================================================================================
     4.5 -Simple DirectMedia Layer for Nintendo DS
     4.6 -================================================================================
     4.7 -
     4.8 --Requirements-
     4.9 -* The devkitpro SDK available at http://devkitpro.org.
    4.10 -  Read the information at http://devkitpro.org/wiki/Getting_Started/devkitARM
    4.11 -  The necessary packages are devkitARM, libnds, libfat and default arm7.
    4.12 -* Optionally, use a DS emulator, such as desmume (http://desmume.org/)
    4.13 -  to program and debug.
    4.14 -
    4.15 --Building SDL-
    4.16 -
    4.17 -After setting the devkitpro environment, cd into your SDL directory and type:
    4.18 -  make -f Makefile.ds
    4.19 -
    4.20 -This will compile and install the library and headers into the
    4.21 -devkitpro's portlibs directory (../portlibs/arm/lib/ and
    4.22 -../portlibs/arm/include/). Additionally it will compile several tests
    4.23 -that you can run either on the DS or with desmume. For instance:
    4.24 -  desmume --cflash-path=test/ test/nds-test-progs/testsprite2/testsprite2.nds
    4.25 -  desmume --cflash-path=test/ test/nds-test-progs/testspriteminimal/testspriteminimal.nds
    4.26 -  desmume --cflash-path=test/ test/nds-test-progs/testscale/testscale.nds 
    4.27 -  desmume test/nds-test-progs/general/general.nds
    4.28 -
    4.29 --Notes-
    4.30 -* The renderer code is based on the gl like engine. It's not using the sprite engine.
    4.31 -* The hardware renderer is using the parts of the libgl2d abstraction library that can be found at:
    4.32 -    http://rel.phatcode.net/junk.php?id=117
    4.33 -  Used with the author's permission.
    4.34 -* The port is very basic and incomplete:
    4.35 -  - SDL currently has to be compiled for either framebuffer mode or renderer mode.
    4.36 -     See USE_HW_RENDERER in Makefile.ds.
    4.37 -  - some optional renderer functions are not implemented.
    4.38 -  - no sound
    4.39 -
    4.40 --Limitations-
    4.41 -* in hardware renderer mode, don't load too many textures. The internal format is
    4.42 -  2 bytes per pixel. And there is only 256KB reserved for the textures. For instance,
    4.43 -  testscale won't display sample.bmp, unless it's resized to a smaller picture.
    4.44 -* the screen size is 256 x 384. Anything else won't work.
    4.45 -* there is no 8 bits/pixel mode because SDL 2.0 doesn't support palettes.
    4.46 -
    4.47 --Joystick mapping-
    4.48 -The Joystick presented to SDL has 2 axes and 8 buttons
    4.49 -
    4.50 - KEY      | Code
    4.51 -  A       |   0
    4.52 -  B       |   1
    4.53 -  X       |   2
    4.54 -  Y       |   3
    4.55 -  L       |   4
    4.56 -  R       |   5
    4.57 -  select  |   6
    4.58 -  start   |   7
    4.59 -
    4.60 - Left-right is axe 0.
    4.61 - Up-down is axe 1.
    4.62 -
    4.63 --Mouse mapping-
    4.64 -todo
    4.65 -
    4.66 --Examples-
    4.67 -Due to memory limitations, to be able to successfully run the testscale example, sample.bmp must be resized to 256x105.
     5.1 --- a/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj	Sun Mar 17 09:21:08 2013 -0700
     5.2 +++ b/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj	Sun Mar 17 09:44:58 2013 -0700
     5.3 @@ -38,7 +38,6 @@
     5.4  		0097E2A812F70C4D00724AC5 /* SDL_config_iphoneos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_iphoneos.h; sourceTree = "<group>"; };
     5.5  		0097E2A912F70C4D00724AC5 /* SDL_config_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_macosx.h; sourceTree = "<group>"; };
     5.6  		0097E2AA12F70C4D00724AC5 /* SDL_config_minimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_minimal.h; sourceTree = "<group>"; };
     5.7 -		0097E2AB12F70C4D00724AC5 /* SDL_config_nintendods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_nintendods.h; sourceTree = "<group>"; };
     5.8  		0097E2AC12F70C4D00724AC5 /* SDL_config_pandora.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_pandora.h; sourceTree = "<group>"; };
     5.9  		0097E2AD12F70C4D00724AC5 /* SDL_config_windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_windows.h; sourceTree = "<group>"; };
    5.10  		0097E2AE12F70C4D00724AC5 /* SDL_config_wiz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_wiz.h; sourceTree = "<group>"; };
    5.11 @@ -142,7 +141,6 @@
    5.12  				0097E2A812F70C4D00724AC5 /* SDL_config_iphoneos.h */,
    5.13  				0097E2A912F70C4D00724AC5 /* SDL_config_macosx.h */,
    5.14  				0097E2AA12F70C4D00724AC5 /* SDL_config_minimal.h */,
    5.15 -				0097E2AB12F70C4D00724AC5 /* SDL_config_nintendods.h */,
    5.16  				0097E2AC12F70C4D00724AC5 /* SDL_config_pandora.h */,
    5.17  				0097E2AD12F70C4D00724AC5 /* SDL_config_windows.h */,
    5.18  				0097E2AE12F70C4D00724AC5 /* SDL_config_wiz.h */,
     6.1 --- a/include/SDL_config.h	Sun Mar 17 09:21:08 2013 -0700
     6.2 +++ b/include/SDL_config.h	Sun Mar 17 09:44:58 2013 -0700
     6.3 @@ -37,8 +37,6 @@
     6.4  #include "SDL_config_iphoneos.h"
     6.5  #elif defined(__ANDROID__)
     6.6  #include "SDL_config_android.h"
     6.7 -#elif defined(__NINTENDODS__)
     6.8 -#include "SDL_config_nintendods.h"
     6.9  #elif defined(__PSP__)
    6.10  #include "SDL_config_psp.h"
    6.11  #else
     7.1 --- a/include/SDL_config.h.cmake	Sun Mar 17 09:21:08 2013 -0700
     7.2 +++ b/include/SDL_config.h.cmake	Sun Mar 17 09:44:58 2013 -0700
     7.3 @@ -195,7 +195,6 @@
     7.4  #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
     7.5  #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
     7.6  #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
     7.7 -#cmakedefine SDL_AUDIO_DRIVER_NDS @SDL_AUDIO_DRIVER_NDS@
     7.8  #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
     7.9  #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
    7.10  #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
    7.11 @@ -213,7 +212,6 @@
    7.12  #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
    7.13  #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
    7.14  #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
    7.15 -#cmakedefine SDL_JOYSTICK_NDS @SDL_JOYSTICK_NDS@
    7.16  #cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
    7.17  #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
    7.18  #cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@
    7.19 @@ -231,7 +229,6 @@
    7.20  
    7.21  /* Enable various threading systems */
    7.22  #cmakedefine SDL_THREAD_BEOS @SDL_THREAD_BEOS@
    7.23 -#cmakedefine SDL_THREAD_NDS @SDL_THREAD_NDS@
    7.24  #cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@
    7.25  #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@
    7.26  #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
    7.27 @@ -240,7 +237,6 @@
    7.28  /* Enable various timer systems */
    7.29  #cmakedefine SDL_TIMER_BEOS @SDL_TIMER_BEOS@
    7.30  #cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@
    7.31 -#cmakedefine SDL_TIMER_NDS @SDL_TIMER_NDS@
    7.32  #cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@
    7.33  #cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@
    7.34  #cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
    7.35 @@ -251,7 +247,6 @@
    7.36  #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
    7.37  #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
    7.38  #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
    7.39 -#cmakedefine SDL_VIDEO_DRIVER_NDS @SDL_VIDEO_DRIVER_NDS@
    7.40  #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
    7.41  #cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
    7.42  #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
    7.43 @@ -295,7 +290,6 @@
    7.44  #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
    7.45  #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
    7.46  #cmakedefine SDL_POWER_BEOS @SDL_POWER_BEOS@
    7.47 -#cmakedefine SDL_POWER_NINTENDODS @SDL_POWER_NINTENDODS@
    7.48  #cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
    7.49  
    7.50  /* Enable assembly routines */
     8.1 --- a/include/SDL_config.h.in	Sun Mar 17 09:21:08 2013 -0700
     8.2 +++ b/include/SDL_config.h.in	Sun Mar 17 09:44:58 2013 -0700
     8.3 @@ -198,7 +198,6 @@
     8.4  #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
     8.5  #undef SDL_AUDIO_DRIVER_NAS
     8.6  #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
     8.7 -#undef SDL_AUDIO_DRIVER_NDS
     8.8  #undef SDL_AUDIO_DRIVER_OSS
     8.9  #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
    8.10  #undef SDL_AUDIO_DRIVER_PAUDIO
    8.11 @@ -216,7 +215,6 @@
    8.12  #undef SDL_JOYSTICK_DUMMY
    8.13  #undef SDL_JOYSTICK_IOKIT
    8.14  #undef SDL_JOYSTICK_LINUX
    8.15 -#undef SDL_JOYSTICK_NDS
    8.16  #undef SDL_JOYSTICK_WINMM
    8.17  #undef SDL_JOYSTICK_USBHID
    8.18  #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
    8.19 @@ -234,7 +232,6 @@
    8.20  
    8.21  /* Enable various threading systems */
    8.22  #undef SDL_THREAD_BEOS
    8.23 -#undef SDL_THREAD_NDS
    8.24  #undef SDL_THREAD_PTHREAD
    8.25  #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
    8.26  #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
    8.27 @@ -243,7 +240,6 @@
    8.28  /* Enable various timer systems */
    8.29  #undef SDL_TIMER_BEOS
    8.30  #undef SDL_TIMER_DUMMY
    8.31 -#undef SDL_TIMER_NDS
    8.32  #undef SDL_TIMER_UNIX
    8.33  #undef SDL_TIMER_WINDOWS
    8.34  
    8.35 @@ -253,7 +249,6 @@
    8.36  #undef SDL_VIDEO_DRIVER_DIRECTFB
    8.37  #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
    8.38  #undef SDL_VIDEO_DRIVER_DUMMY
    8.39 -#undef SDL_VIDEO_DRIVER_NDS
    8.40  #undef SDL_VIDEO_DRIVER_WINDOWS
    8.41  #undef SDL_VIDEO_DRIVER_X11
    8.42  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
    8.43 @@ -297,7 +292,6 @@
    8.44  #undef SDL_POWER_WINDOWS
    8.45  #undef SDL_POWER_MACOSX
    8.46  #undef SDL_POWER_BEOS
    8.47 -#undef SDL_POWER_NINTENDODS
    8.48  #undef SDL_POWER_HARDWIRED
    8.49  
    8.50  /* Enable assembly routines */
     9.1 --- a/include/SDL_config_nintendods.h	Sun Mar 17 09:21:08 2013 -0700
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,129 +0,0 @@
     9.4 -/*
     9.5 -  Simple DirectMedia Layer
     9.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     9.7 -
     9.8 -  This software is provided 'as-is', without any express or implied
     9.9 -  warranty.  In no event will the authors be held liable for any damages
    9.10 -  arising from the use of this software.
    9.11 -
    9.12 -  Permission is granted to anyone to use this software for any purpose,
    9.13 -  including commercial applications, and to alter it and redistribute it
    9.14 -  freely, subject to the following restrictions:
    9.15 -
    9.16 -  1. The origin of this software must not be misrepresented; you must not
    9.17 -     claim that you wrote the original software. If you use this software
    9.18 -     in a product, an acknowledgment in the product documentation would be
    9.19 -     appreciated but is not required.
    9.20 -  2. Altered source versions must be plainly marked as such, and must not be
    9.21 -     misrepresented as being the original software.
    9.22 -  3. This notice may not be removed or altered from any source distribution.
    9.23 -*/
    9.24 -
    9.25 -#ifndef _SDL_config_nintendods_h
    9.26 -#define _SDL_config_nintendods_h
    9.27 -
    9.28 -#include "SDL_platform.h"
    9.29 -
    9.30 -/* This is a set of defines to configure the SDL features */
    9.31 -
    9.32 -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
    9.33 -typedef signed char int8_t;
    9.34 -typedef unsigned char uint8_t;
    9.35 -typedef signed short int16_t;
    9.36 -typedef unsigned short uint16_t;
    9.37 -typedef signed int int32_t;
    9.38 -typedef unsigned int uint32_t;
    9.39 -typedef signed long long int64_t;
    9.40 -typedef unsigned long long uint64_t;
    9.41 -
    9.42 -/* LiF: __PTRDIFF_TYPE__ was causing errors of conflicting typedefs with the
    9.43 -   <stdint.h> shipping with devkitARM.  copied a similar ifdef from it. */
    9.44 -#ifndef __PTRDIFF_TYPE__
    9.45 -typedef unsigned long uintptr_t;
    9.46 -#else
    9.47 -typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
    9.48 -#endif
    9.49 -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
    9.50 -
    9.51 -#define SIZEOF_VOIDP 4
    9.52 -
    9.53 -/* Useful headers */
    9.54 -#define HAVE_SYS_TYPES_H	1
    9.55 -#define HAVE_STDIO_H	1
    9.56 -#define STDC_HEADERS	1
    9.57 -#define HAVE_STRING_H	1
    9.58 -#define HAVE_CTYPE_H	1
    9.59 -
    9.60 -/* C library functions */
    9.61 -#define HAVE_MALLOC	1
    9.62 -#define HAVE_CALLOC	1
    9.63 -#define HAVE_REALLOC	1
    9.64 -#define HAVE_FREE	1
    9.65 -#define HAVE_ALLOCA	1
    9.66 -#define HAVE_GETENV	1
    9.67 -#define HAVE_SETENV	1
    9.68 -#define HAVE_PUTENV	1
    9.69 -#define HAVE_QSORT	1
    9.70 -#define HAVE_ABS	1
    9.71 -#define HAVE_BCOPY	1
    9.72 -#define HAVE_MEMSET	1
    9.73 -#define HAVE_MEMCPY	1
    9.74 -#define HAVE_MEMMOVE	1
    9.75 -#define HAVE_MEMCMP	1
    9.76 -#define HAVE_STRLEN	1
    9.77 -#define HAVE_STRDUP	1
    9.78 -#define HAVE_INDEX	1
    9.79 -#define HAVE_RINDEX	1
    9.80 -#define HAVE_STRCHR	1
    9.81 -#define HAVE_STRRCHR	1
    9.82 -#define HAVE_STRSTR	1
    9.83 -#define HAVE_STRTOL	1
    9.84 -#define HAVE_STRTOD	1
    9.85 -#define HAVE_ATOI	1
    9.86 -#define HAVE_ATOF	1
    9.87 -#define HAVE_STRCMP	1
    9.88 -#define HAVE_STRNCMP	1
    9.89 -#define HAVE_STRICMP	1
    9.90 -#define HAVE_STRCASECMP	1
    9.91 -#define HAVE_SSCANF	1
    9.92 -#define HAVE_SNPRINTF	1
    9.93 -#define HAVE_VSNPRINTF	1
    9.94 -
    9.95 -/* DS isn't that sophisticated */
    9.96 -#define LACKS_SYS_MMAN_H 1
    9.97 -
    9.98 -/* Enable various audio drivers */
    9.99 -#define SDL_AUDIO_DRIVER_NDS	1
   9.100 -/*#define SDL_AUDIO_DRIVER_DUMMY	1 TODO: uncomment this later*/
   9.101 -
   9.102 -/* Enable various input drivers */
   9.103 -#define SDL_JOYSTICK_NDS	1
   9.104 -/*#define SDL_JOYSTICK_DUMMY	1 TODO: uncomment this later*/
   9.105 -
   9.106 -/* DS has no dynamic linking afaik */
   9.107 -#define SDL_LOADSO_DISABLED	1
   9.108 -
   9.109 -/* Enable various threading systems */
   9.110 -/*#define SDL_THREAD_NDS	1*/
   9.111 -#define SDL_THREADS_DISABLED	1
   9.112 -
   9.113 -/* Enable various timer systems */
   9.114 -#define SDL_TIMER_NDS	1
   9.115 -
   9.116 -/* Enable various video drivers */
   9.117 -#define SDL_VIDEO_DRIVER_NDS	1
   9.118 -#ifdef USE_HW_RENDERER
   9.119 -#define SDL_VIDEO_RENDER_NDS	1
   9.120 -#else
   9.121 -#define SDL_VIDEO_RENDER_NDS	0
   9.122 -#endif
   9.123 -
   9.124 -/* Enable system power support */
   9.125 -#define SDL_POWER_NINTENDODS 1
   9.126 -
   9.127 -/* Enable haptic support */
   9.128 -#define SDL_HAPTIC_NDS 1
   9.129 -
   9.130 -#define SDL_BYTEORDER   SDL_LIL_ENDIAN
   9.131 -
   9.132 -#endif /* _SDL_config_nintendods_h */
    10.1 --- a/include/SDL_platform.h	Sun Mar 17 09:21:08 2013 -0700
    10.2 +++ b/include/SDL_platform.h	Sun Mar 17 09:44:58 2013 -0700
    10.3 @@ -118,12 +118,6 @@
    10.4  #undef __WIN32__
    10.5  #define __WIN32__	1
    10.6  #endif
    10.7 -
    10.8 -#if defined(__NDS__)
    10.9 -#undef __NINTENDODS__
   10.10 -#define __NINTENDODS__	1
   10.11 -#endif
   10.12 -
   10.13  #if defined(__PSP__)
   10.14  #undef __PLAYSTATIONPORTABLE__
   10.15  #define __PLAYSTATIONPORTABLE__	1
    11.1 --- a/include/SDL_stdinc.h	Sun Mar 17 09:21:08 2013 -0700
    11.2 +++ b/include/SDL_stdinc.h	Sun Mar 17 09:44:58 2013 -0700
    11.3 @@ -178,7 +178,7 @@
    11.4  
    11.5  /** \cond */
    11.6  #ifndef DOXYGEN_SHOULD_IGNORE_THIS
    11.7 -#if !defined(__NINTENDODS__) && !defined(__ANDROID__) 
    11.8 +#if !defined(__ANDROID__) 
    11.9     /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
   11.10  typedef enum
   11.11  {
   11.12 @@ -190,10 +190,6 @@
   11.13  #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
   11.14  /** \endcond */
   11.15  
   11.16 -#if !defined(wchar_t) && defined(__NINTENDODS__)
   11.17 -#define wchar_t short           /* TODO: figure out why libnds doesn't have this */
   11.18 -#endif
   11.19 -
   11.20  #include "begin_code.h"
   11.21  /* Set up for C function definitions, even when using C++ */
   11.22  #ifdef __cplusplus
    12.1 --- a/include/SDL_test_common.h	Sun Mar 17 09:21:08 2013 -0700
    12.2 +++ b/include/SDL_test_common.h	Sun Mar 17 09:44:58 2013 -0700
    12.3 @@ -34,10 +34,7 @@
    12.4  
    12.5  #include "SDL.h"
    12.6  
    12.7 -#ifdef __NDS__
    12.8 -#define DEFAULT_WINDOW_WIDTH  256
    12.9 -#define DEFAULT_WINDOW_HEIGHT (2*192)
   12.10 -#elif defined(__PSP__)
   12.11 +#if defined(__PSP__)
   12.12  #define DEFAULT_WINDOW_WIDTH  480
   12.13  #define DEFAULT_WINDOW_HEIGHT 272
   12.14  #else
    13.1 --- a/src/SDL.c	Sun Mar 17 09:21:08 2013 -0700
    13.2 +++ b/src/SDL.c	Sun Mar 17 09:44:58 2013 -0700
    13.3 @@ -390,8 +390,6 @@
    13.4      return "Mac OS X";
    13.5  #elif __NETBSD__
    13.6      return "NetBSD";
    13.7 -#elif __NDS__
    13.8 -    return "Nintendo DS";
    13.9  #elif __OPENBSD__
   13.10      return "OpenBSD";
   13.11  #elif __OS2__
    14.1 --- a/src/audio/SDL_audio.c	Sun Mar 17 09:21:08 2013 -0700
    14.2 +++ b/src/audio/SDL_audio.c	Sun Mar 17 09:44:58 2013 -0700
    14.3 @@ -121,9 +121,6 @@
    14.4  #if SDL_AUDIO_DRIVER_DUMMY
    14.5      &DUMMYAUD_bootstrap,
    14.6  #endif
    14.7 -#if SDL_AUDIO_DRIVER_NDS
    14.8 -    &NDSAUD_bootstrap,
    14.9 -#endif
   14.10  #if SDL_AUDIO_DRIVER_FUSIONSOUND
   14.11      &FUSIONSOUND_bootstrap,
   14.12  #endif
    15.1 --- a/src/audio/nds/SDL_ndsaudio.c	Sun Mar 17 09:21:08 2013 -0700
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,129 +0,0 @@
    15.4 -/*
    15.5 -  Simple DirectMedia Layer
    15.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    15.7 -
    15.8 -  This software is provided 'as-is', without any express or implied
    15.9 -  warranty.  In no event will the authors be held liable for any damages
   15.10 -  arising from the use of this software.
   15.11 -
   15.12 -  Permission is granted to anyone to use this software for any purpose,
   15.13 -  including commercial applications, and to alter it and redistribute it
   15.14 -  freely, subject to the following restrictions:
   15.15 -
   15.16 -  1. The origin of this software must not be misrepresented; you must not
   15.17 -     claim that you wrote the original software. If you use this software
   15.18 -     in a product, an acknowledgment in the product documentation would be
   15.19 -     appreciated but is not required.
   15.20 -  2. Altered source versions must be plainly marked as such, and must not be
   15.21 -     misrepresented as being the original software.
   15.22 -  3. This notice may not be removed or altered from any source distribution.
   15.23 -*/
   15.24 -#include "SDL_config.h"
   15.25 -
   15.26 -#if SDL_AUDIO_DRIVER_NDS
   15.27 -
   15.28 -/* Output audio to NDS */
   15.29 -
   15.30 -#include <nds.h>
   15.31 -
   15.32 -#include "SDL_audio.h"
   15.33 -#include "../SDL_audio_c.h"
   15.34 -#include "SDL_ndsaudio.h"
   15.35 -
   15.36 -static int
   15.37 -NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture)
   15.38 -{
   15.39 -    SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
   15.40 -    int valid_datatype = 0;
   15.41 -
   15.42 -    this->hidden = SDL_malloc(sizeof(*(this->hidden)));
   15.43 -    if (!this->hidden) {
   15.44 -        SDL_OutOfMemory();
   15.45 -        return 0;
   15.46 -    }
   15.47 -    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
   15.48 -
   15.49 -    while ((!valid_datatype) && (test_format)) {
   15.50 -        this->spec.format = test_format;
   15.51 -        switch (test_format) {
   15.52 -        case AUDIO_S8:
   15.53 -            /*case AUDIO_S16LSB: */
   15.54 -            valid_datatype = 1;
   15.55 -            break;
   15.56 -        default:
   15.57 -            test_format = SDL_NextAudioFormat();
   15.58 -            break;
   15.59 -        }
   15.60 -    }
   15.61 -
   15.62 -#if 0
   15.63 -    /* set the generic sound parameters */
   15.64 -    setGenericSound(22050,      /* sample rate */
   15.65 -                    127,        /* volume */
   15.66 -                    64,         /* panning/balance */
   15.67 -                    0);         /* sound format */
   15.68 -#endif
   15.69 -
   15.70 -    return 1;
   15.71 -}
   15.72 -
   15.73 -static void
   15.74 -NDSAUD_PlayDevice(_THIS)
   15.75 -{
   15.76 -#if 0
   15.77 -    playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);
   15.78 -
   15.79 -//    sound->data = this->hidden->mixbuf;/* pointer to raw audio data */
   15.80 -//    sound->len = this->hidden->mixlen; /* size of raw data pointed to above */
   15.81 -//    sound->rate = 22050; /* sample rate = 22050Hz */
   15.82 -//    sound->vol = 127;    /* volume [0..127] for [min..max] */
   15.83 -//    sound->pan = 64;     /* balance [0..127] for [left..right] */
   15.84 -//    sound->format = 0;   /* 0 for 16-bit, 1 for 8-bit */
   15.85 -//    playSound(sound);
   15.86 -#endif
   15.87 -}
   15.88 -
   15.89 -
   15.90 -static Uint8 *
   15.91 -NDSAUD_GetDeviceBuf(_THIS)
   15.92 -{
   15.93 -    return this->hidden->mixbuf;        /* is this right? */
   15.94 -}
   15.95 -
   15.96 -static void
   15.97 -NDSAUD_WaitDevice(_THIS)
   15.98 -{
   15.99 -    /* stub */
  15.100 -}
  15.101 -
  15.102 -static void
  15.103 -NDSAUD_CloseDevice(_THIS)
  15.104 -{
  15.105 -    /* stub */
  15.106 -}
  15.107 -
  15.108 -static int
  15.109 -NDSAUD_Init(SDL_AudioDriverImpl * impl)
  15.110 -{
  15.111 -    /* Set the function pointers */
  15.112 -    impl->OpenDevice = NDSAUD_OpenDevice;
  15.113 -    impl->PlayDevice = NDSAUD_PlayDevice;
  15.114 -    impl->WaitDevice = NDSAUD_WaitDevice;
  15.115 -    impl->GetDeviceBuf = NDSAUD_GetDeviceBuf;
  15.116 -    impl->CloseDevice = NDSAUD_CloseDevice;
  15.117 -
  15.118 -    /* and the capabilities */
  15.119 -    impl->HasCaptureSupport = 1;
  15.120 -    impl->OnlyHasDefaultOutputDevice = 1;
  15.121 -    impl->OnlyHasDefaultInputDevice = 1;
  15.122 -
  15.123 -    return 1;   /* this audio target is available. */
  15.124 -}
  15.125 -
  15.126 -AudioBootStrap NDSAUD_bootstrap = {
  15.127 -    "nds", "SDL NDS audio driver", NDSAUD_Init, 0       /*1? */
  15.128 -};
  15.129 -
  15.130 -#endif /* SDL_AUDIO_DRIVER_NDS */
  15.131 -
  15.132 -/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/src/audio/nds/SDL_ndsaudio.h	Sun Mar 17 09:21:08 2013 -0700
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,42 +0,0 @@
    16.4 -/*
    16.5 -  Simple DirectMedia Layer
    16.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    16.7 -
    16.8 -  This software is provided 'as-is', without any express or implied
    16.9 -  warranty.  In no event will the authors be held liable for any damages
   16.10 -  arising from the use of this software.
   16.11 -
   16.12 -  Permission is granted to anyone to use this software for any purpose,
   16.13 -  including commercial applications, and to alter it and redistribute it
   16.14 -  freely, subject to the following restrictions:
   16.15 -
   16.16 -  1. The origin of this software must not be misrepresented; you must not
   16.17 -     claim that you wrote the original software. If you use this software
   16.18 -     in a product, an acknowledgment in the product documentation would be
   16.19 -     appreciated but is not required.
   16.20 -  2. Altered source versions must be plainly marked as such, and must not be
   16.21 -     misrepresented as being the original software.
   16.22 -  3. This notice may not be removed or altered from any source distribution.
   16.23 -*/
   16.24 -#include "SDL_config.h"
   16.25 -
   16.26 -#ifndef _SDL_ndsaudio_h
   16.27 -#define _SDL_ndsaudio_h
   16.28 -
   16.29 -#include "../SDL_sysaudio.h"
   16.30 -#include <nds/arm9/sound.h>
   16.31 -
   16.32 -/* Hidden "this" pointer for the audio functions */
   16.33 -#define _THIS	SDL_AudioDevice *this
   16.34 -
   16.35 -struct SDL_PrivateAudioData
   16.36 -{
   16.37 -    /* The file descriptor for the audio device */
   16.38 -    Uint8 *mixbuf;
   16.39 -    Uint32 mixlen;
   16.40 -    Uint32 write_delay;
   16.41 -    Uint32 initial_calls;
   16.42 -};
   16.43 -
   16.44 -#endif /* _SDL_ndsaudio_h */
   16.45 -/* vi: set ts=4 sw=4 expandtab: */
    17.1 --- a/src/events/nds/SDL_ndsgesture.c	Sun Mar 17 09:21:08 2013 -0700
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,41 +0,0 @@
    17.4 -/*
    17.5 -  Simple DirectMedia Layer
    17.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    17.7 -
    17.8 -  This software is provided 'as-is', without any express or implied
    17.9 -  warranty.  In no event will the authors be held liable for any damages
   17.10 -  arising from the use of this software.
   17.11 -
   17.12 -  Permission is granted to anyone to use this software for any purpose,
   17.13 -  including commercial applications, and to alter it and redistribute it
   17.14 -  freely, subject to the following restrictions:
   17.15 -
   17.16 -  1. The origin of this software must not be misrepresented; you must not
   17.17 -     claim that you wrote the original software. If you use this software
   17.18 -     in a product, an acknowledgment in the product documentation would be
   17.19 -     appreciated but is not required.
   17.20 -  2. Altered source versions must be plainly marked as such, and must not be
   17.21 -     misrepresented as being the original software.
   17.22 -  3. This notice may not be removed or altered from any source distribution.
   17.23 -*/
   17.24 -
   17.25 -#include "SDL_config.h"
   17.26 -
   17.27 -/* No supported under the NDS because of math operations. */
   17.28 -
   17.29 -#include "SDL_events.h"
   17.30 -#include "../SDL_events_c.h"
   17.31 -#include "../SDL_gesture_c.h"
   17.32 -
   17.33 -int SDL_GestureAddTouch(SDL_Touch* touch)
   17.34 -{  
   17.35 -	return 0;
   17.36 -}
   17.37 -
   17.38 -void SDL_GestureProcessEvent(SDL_Event* event)
   17.39 -{
   17.40 -	return;
   17.41 -}
   17.42 -
   17.43 -/* vi: set ts=4 sw=4 expandtab: */
   17.44 -  
    18.1 --- a/src/file/SDL_rwops.c	Sun Mar 17 09:21:08 2013 -0700
    18.2 +++ b/src/file/SDL_rwops.c	Sun Mar 17 09:44:58 2013 -0700
    18.3 @@ -37,11 +37,6 @@
    18.4  #include "../core/android/SDL_android.h"
    18.5  #endif
    18.6  
    18.7 -#ifdef __NDS__
    18.8 -/* include libfat headers for fatInitDefault(). */
    18.9 -#include <fat.h>
   18.10 -#endif /* __NDS__ */
   18.11 -
   18.12  #ifdef __WIN32__
   18.13  
   18.14  /* Functions to read/write Win32 API file pointers */
   18.15 @@ -556,13 +551,6 @@
   18.16  {
   18.17      SDL_RWops *rwops = NULL;
   18.18  
   18.19 -#if 0
   18.20 -/*#ifdef __NDS__*/
   18.21 -    /* set it up so we can use stdio file function */
   18.22 -    fatInitDefault();
   18.23 -    printf("called fatInitDefault()");
   18.24 -#endif /* __NDS__ */
   18.25 -
   18.26      rwops = SDL_AllocRW();
   18.27      if (rwops != NULL) {
   18.28          rwops->size = stdio_size;
    19.1 --- a/src/haptic/nds/SDL_syshaptic.c	Sun Mar 17 09:21:08 2013 -0700
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,330 +0,0 @@
    19.4 -/*
    19.5 -  Simple DirectMedia Layer
    19.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    19.7 -
    19.8 -  This software is provided 'as-is', without any express or implied
    19.9 -  warranty.  In no event will the authors be held liable for any damages
   19.10 -  arising from the use of this software.
   19.11 -
   19.12 -  Permission is granted to anyone to use this software for any purpose,
   19.13 -  including commercial applications, and to alter it and redistribute it
   19.14 -  freely, subject to the following restrictions:
   19.15 -
   19.16 -  1. The origin of this software must not be misrepresented; you must not
   19.17 -     claim that you wrote the original software. If you use this software
   19.18 -     in a product, an acknowledgment in the product documentation would be
   19.19 -     appreciated but is not required.
   19.20 -  2. Altered source versions must be plainly marked as such, and must not be
   19.21 -     misrepresented as being the original software.
   19.22 -  3. This notice may not be removed or altered from any source distribution.
   19.23 -*/
   19.24 -#include "SDL_config.h"
   19.25 -
   19.26 -#ifdef SDL_HAPTIC_NDS
   19.27 -
   19.28 -#include "SDL_haptic.h"
   19.29 -#include "../SDL_syshaptic.h"
   19.30 -#include "SDL_joystick.h"
   19.31 -#include <nds/memory.h>
   19.32 -#include <nds/arm9/rumble.h>
   19.33 -
   19.34 -#define MAX_HAPTICS  1
   19.35 -/* right now only the ezf3in1 (and maybe official rumble pak) are supported
   19.36 -   and there can only be one of those in at a time (in GBA slot.) */
   19.37 -
   19.38 -static SDL_Haptic *nds_haptic = NULL;
   19.39 -
   19.40 -struct haptic_hwdata
   19.41 -{
   19.42 -    enum
   19.43 -    { NONE, OFFICIAL, EZF3IN1 } type;
   19.44 -    int pos;
   19.45 -};
   19.46 -
   19.47 -
   19.48 -void
   19.49 -NDS_EZF_OpenNorWrite() 
   19.50 -{
   19.51 -    GBA_BUS[0x0FF0000] = 0xD200;
   19.52 -    GBA_BUS[0x0000000] = 0x1500;
   19.53 -    GBA_BUS[0x0010000] = 0xD200;
   19.54 -    GBA_BUS[0x0020000] = 0x1500;
   19.55 -    GBA_BUS[0x0E20000] = 0x1500;
   19.56 -    GBA_BUS[0x0FE0000] = 0x1500;
   19.57 -}
   19.58 -
   19.59 -void
   19.60 -NDS_EZF_CloseNorWrite() 
   19.61 -{
   19.62 -    GBA_BUS[0x0FF0000] = 0xD200;
   19.63 -    GBA_BUS[0x0000000] = 0x1500;
   19.64 -    GBA_BUS[0x0010000] = 0xD200;
   19.65 -    GBA_BUS[0x0020000] = 0x1500;
   19.66 -    GBA_BUS[0x0E20000] = 0xD200;
   19.67 -    GBA_BUS[0x0FE0000] = 0x1500;
   19.68 -}
   19.69 -
   19.70 -void
   19.71 -NDS_EZF_ChipReset()
   19.72 -{
   19.73 -    GBA_BUS[0x0000] = 0x00F0;
   19.74 -    GBA_BUS[0x1000] = 0x00F0;
   19.75 -} uint32 NDS_EZF_IsPresent() 
   19.76 -{
   19.77 -    vuint16 id1, id2;
   19.78 -
   19.79 -    NDS_EZF_OpenNorWrite();
   19.80 -
   19.81 -    GBA_BUS[0x0555] = 0x00AA;
   19.82 -    GBA_BUS[0x02AA] = 0x0055;
   19.83 -    GBA_BUS[0x0555] = 0x0090;
   19.84 -    GBA_BUS[0x1555] = 0x00AA;
   19.85 -    GBA_BUS[0x12AA] = 0x0055;
   19.86 -    GBA_BUS[0x1555] = 0x0090;
   19.87 -    id1 = GBA_BUS[0x0001];
   19.88 -    id2 = GBA_BUS[0x1001];
   19.89 -    if ((id1 != 0x227E) || (id2 != 0x227E)) {
   19.90 -        NDS_EZF_CloseNorWrite();
   19.91 -        return 0;
   19.92 -    }
   19.93 -    id1 = GBA_BUS[0x000E];
   19.94 -    id2 = GBA_BUS[0x100E];
   19.95 -
   19.96 -    NDS_EZF_CloseNorWrite();
   19.97 -    if (id1 == 0x2218 && id2 == 0x2218) {
   19.98 -        return 1;
   19.99 -    }
  19.100 -    return 0;
  19.101 -}
  19.102 -void
  19.103 -NDS_EZF_SetShake(u8 pos) 
  19.104 -{
  19.105 -    u16 data = ((pos % 3) | 0x00F0);
  19.106 -    GBA_BUS[0x0FF0000] = 0xD200;
  19.107 -    GBA_BUS[0x0000000] = 0x1500;
  19.108 -    GBA_BUS[0x0010000] = 0xD200;
  19.109 -    GBA_BUS[0x0020000] = 0x1500;
  19.110 -    GBA_BUS[0x0F10000] = data;
  19.111 -    GBA_BUS[0x0FE0000] = 0x1500;
  19.112 -
  19.113 -    GBA_BUS[0] = 0x0000;        /* write any value for vibration. */
  19.114 -    GBA_BUS[0] = 0x0002;
  19.115 -}
  19.116 -
  19.117 -static int
  19.118 -SDL_SYS_LogicError(void)
  19.119 -{
  19.120 -    SDL_SetError("Logic error: No haptic devices available.");
  19.121 -    return 0;
  19.122 -}
  19.123 -
  19.124 -
  19.125 -int
  19.126 -SDL_SYS_HapticInit(void)
  19.127 -{
  19.128 -    int ret = 0;
  19.129 -    if (isRumbleInserted()) {
  19.130 -        /* official rumble pak is present. */
  19.131 -        ret = 1;
  19.132 -        printf("debug: haptic present: nintendo\n");
  19.133 -    } else if (NDS_EZF_IsPresent()) {
  19.134 -        /* ezflash 3-in-1 pak is present. */
  19.135 -        ret = 1;
  19.136 -        printf("debug: haptic present: ezf3in1\n");
  19.137 -        NDS_EZF_ChipReset();
  19.138 -    } else {
  19.139 -        printf("debug: no haptic found\n");
  19.140 -    }
  19.141 -
  19.142 -    return ret;
  19.143 -}
  19.144 -
  19.145 -
  19.146 -const char *
  19.147 -SDL_SYS_HapticName(int index)
  19.148 -{
  19.149 -    if (nds_haptic) {
  19.150 -        switch (nds_haptic->hwdata->type) {
  19.151 -        case OFFICIAL:
  19.152 -            return "Nintendo DS Rumble Pak";
  19.153 -        case EZF3IN1:
  19.154 -            return "EZFlash 3-in-1 Rumble";
  19.155 -        default:
  19.156 -            return NULL;
  19.157 -        }
  19.158 -    }
  19.159 -    return NULL;
  19.160 -}
  19.161 -
  19.162 -
  19.163 -int
  19.164 -SDL_SYS_HapticOpen(SDL_Haptic * haptic)
  19.165 -{
  19.166 -    if (!haptic) {
  19.167 -        return -1;
  19.168 -    }
  19.169 -
  19.170 -    haptic->hwdata = SDL_malloc(sizeof(struct haptic_hwdata));
  19.171 -    if (!haptic->hwdata) {
  19.172 -        SDL_OutOfMemory();
  19.173 -        return -1;
  19.174 -    }
  19.175 -    nds_haptic = haptic;
  19.176 -
  19.177 -    haptic->supported = SDL_HAPTIC_CONSTANT;
  19.178 -
  19.179 -    /* determine what is here, if anything */
  19.180 -    haptic->hwdata->type = NONE;
  19.181 -    if (isRumbleInserted()) {
  19.182 -        /* official rumble pak is present. */
  19.183 -        haptic->hwdata->type = OFFICIAL;
  19.184 -    } else if (NDS_EZF_IsPresent()) {
  19.185 -        /* ezflash 3-in-1 pak is present. */
  19.186 -        haptic->hwdata->type = EZF3IN1;
  19.187 -        NDS_EZF_ChipReset();
  19.188 -    } else {
  19.189 -        /* no haptic present */
  19.190 -        SDL_SYS_LogicError();
  19.191 -        return -1;
  19.192 -    }
  19.193 -
  19.194 -    return 0;
  19.195 -}
  19.196 -
  19.197 -
  19.198 -int
  19.199 -SDL_SYS_HapticMouse(void)
  19.200 -{
  19.201 -    return -1;
  19.202 -}
  19.203 -
  19.204 -
  19.205 -int
  19.206 -SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
  19.207 -{
  19.208 -    return 0;
  19.209 -}
  19.210 -
  19.211 -
  19.212 -int
  19.213 -SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
  19.214 -{
  19.215 -    /*SDL_SYS_LogicError(); */
  19.216 -    return -1;
  19.217 -}
  19.218 -
  19.219 -
  19.220 -int
  19.221 -SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
  19.222 -{
  19.223 -    return 0;
  19.224 -}
  19.225 -
  19.226 -
  19.227 -void
  19.228 -SDL_SYS_HapticClose(SDL_Haptic * haptic)
  19.229 -{
  19.230 -    return;
  19.231 -}
  19.232 -
  19.233 -
  19.234 -void
  19.235 -SDL_SYS_HapticQuit(void)
  19.236 -{
  19.237 -    return;
  19.238 -}
  19.239 -
  19.240 -
  19.241 -int
  19.242 -SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
  19.243 -                        struct haptic_effect *effect, SDL_HapticEffect * base)
  19.244 -{
  19.245 -    SDL_SYS_LogicError();
  19.246 -    return -1;
  19.247 -}
  19.248 -
  19.249 -
  19.250 -int
  19.251 -SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
  19.252 -                           struct haptic_effect *effect,
  19.253 -                           SDL_HapticEffect * data)
  19.254 -{
  19.255 -    SDL_SYS_LogicError();
  19.256 -    return -1;
  19.257 -}
  19.258 -
  19.259 -
  19.260 -int
  19.261 -SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
  19.262 -                        Uint32 iterations)
  19.263 -{
  19.264 -    SDL_SYS_LogicError();
  19.265 -    return -1;
  19.266 -}
  19.267 -
  19.268 -
  19.269 -int
  19.270 -SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
  19.271 -{
  19.272 -    SDL_SYS_LogicError();
  19.273 -    return -1;
  19.274 -}
  19.275 -
  19.276 -
  19.277 -void
  19.278 -SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
  19.279 -{
  19.280 -    SDL_SYS_LogicError();
  19.281 -    return;
  19.282 -}
  19.283 -
  19.284 -
  19.285 -int
  19.286 -SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
  19.287 -                              struct haptic_effect *effect)
  19.288 -{
  19.289 -    SDL_SYS_LogicError();
  19.290 -    return -1;
  19.291 -}
  19.292 -
  19.293 -
  19.294 -int
  19.295 -SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
  19.296 -{
  19.297 -    SDL_SYS_LogicError();
  19.298 -    return -1;
  19.299 -}
  19.300 -
  19.301 -
  19.302 -int
  19.303 -SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
  19.304 -{
  19.305 -    SDL_SYS_LogicError();
  19.306 -    return -1;
  19.307 -}
  19.308 -
  19.309 -int
  19.310 -SDL_SYS_HapticPause(SDL_Haptic * haptic)
  19.311 -{
  19.312 -    SDL_SYS_LogicError();
  19.313 -    return -1;
  19.314 -}
  19.315 -
  19.316 -int
  19.317 -SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
  19.318 -{
  19.319 -    SDL_SYS_LogicError();
  19.320 -    return -1;
  19.321 -}
  19.322 -
  19.323 -int
  19.324 -SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
  19.325 -{
  19.326 -    SDL_SYS_LogicError();
  19.327 -    return -1;
  19.328 -}
  19.329 -
  19.330 -
  19.331 -
  19.332 -#endif /* SDL_HAPTIC_NDS */
  19.333 -/* vi: set ts=4 sw=4 expandtab: */
    20.1 --- a/src/joystick/nds/SDL_sysjoystick.c	Sun Mar 17 09:21:08 2013 -0700
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,209 +0,0 @@
    20.4 -/*
    20.5 -  Simple DirectMedia Layer
    20.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    20.7 -
    20.8 -  This software is provided 'as-is', without any express or implied
    20.9 -  warranty.  In no event will the authors be held liable for any damages
   20.10 -  arising from the use of this software.
   20.11 -
   20.12 -  Permission is granted to anyone to use this software for any purpose,
   20.13 -  including commercial applications, and to alter it and redistribute it
   20.14 -  freely, subject to the following restrictions:
   20.15 -
   20.16 -  1. The origin of this software must not be misrepresented; you must not
   20.17 -     claim that you wrote the original software. If you use this software
   20.18 -     in a product, an acknowledgment in the product documentation would be
   20.19 -     appreciated but is not required.
   20.20 -  2. Altered source versions must be plainly marked as such, and must not be
   20.21 -     misrepresented as being the original software.
   20.22 -  3. This notice may not be removed or altered from any source distribution.
   20.23 -*/
   20.24 -
   20.25 -#include "SDL_config.h"
   20.26 -
   20.27 -#ifdef SDL_JOYSTICK_NDS
   20.28 -
   20.29 -/* This is the system specific header for the SDL joystick API */
   20.30 -#include <nds.h>
   20.31 -#include <stdio.h>              /* For the definition of NULL */
   20.32 -
   20.33 -#include "SDL_error.h"
   20.34 -#include "SDL_events.h"
   20.35 -#include "SDL_joystick.h"
   20.36 -#include "../SDL_sysjoystick.h"
   20.37 -#include "../SDL_joystick_c.h"
   20.38 -
   20.39 -#include "../../video/nds/SDL_ndsevents_c.h"
   20.40 -
   20.41 -/* Function to scan the system for joysticks.
   20.42 - */
   20.43 -int
   20.44 -SDL_SYS_JoystickInit(void)
   20.45 -{
   20.46 -    return (1);
   20.47 -}
   20.48 -
   20.49 -int SDL_SYS_NumJoysticks()
   20.50 -{
   20.51 -    return 1;
   20.52 -}
   20.53 -
   20.54 -void SDL_SYS_JoystickDetect()
   20.55 -{
   20.56 -}
   20.57 -
   20.58 -SDL_bool SDL_SYS_JoystickNeedsPolling()
   20.59 -{
   20.60 -    return SDL_FALSE;
   20.61 -}
   20.62 -
   20.63 -/* Function to get the device-dependent name of a joystick */
   20.64 -const char *
   20.65 -SDL_SYS_JoystickNameForDeviceIndex(int device_index)
   20.66 -{
   20.67 -    return "NDS builtin joypad";
   20.68 -}
   20.69 -
   20.70 -/* Function to perform the mapping from device index to the instance id for this index */
   20.71 -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
   20.72 -{
   20.73 -    return device_index;
   20.74 -}
   20.75 -
   20.76 -/* Function to open a joystick for use.
   20.77 -   The joystick to open is specified by the index field of the joystick.
   20.78 -   This should fill the nbuttons and naxes fields of the joystick structure.
   20.79 -   It returns 0, or -1 if there is an error.
   20.80 - */
   20.81 -int
   20.82 -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
   20.83 -{
   20.84 -    joystick->nbuttons = 8;
   20.85 -    joystick->nhats = 0;
   20.86 -    joystick->nballs = 0;
   20.87 -    joystick->naxes = 2;
   20.88 -    return 0;
   20.89 -}
   20.90 -
   20.91 -/* Function to determine is this joystick is attached to the system right now */
   20.92 -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
   20.93 -{
   20.94 -    return SDL_TRUE;
   20.95 -}
   20.96 -
   20.97 -/* Function to update the state of a joystick - called as a device poll.
   20.98 - * This function shouldn't update the joystick structure directly,
   20.99 - * but instead should call SDL_PrivateJoystick*() to deliver events
  20.100 - * and update joystick device state.
  20.101 - */
  20.102 -    void
  20.103 -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
  20.104 -{
  20.105 -    u32 keysd, keysu;
  20.106 -    int magnitude = 16384;
  20.107 -    
  20.108 -        /*scanKeys(); - this is done in PumpEvents, because touch uses it too */ 
  20.109 -        keysd = keysDown();
  20.110 -    keysu = keysUp();
  20.111 -
  20.112 -    if ((keysd & KEY_UP)) {
  20.113 -        SDL_PrivateJoystickAxis(joystick, 1, -magnitude);
  20.114 -    }
  20.115 -    if ((keysd & KEY_DOWN)) {
  20.116 -        SDL_PrivateJoystickAxis(joystick, 1, magnitude);
  20.117 -    }
  20.118 -    if ((keysd & KEY_LEFT)) {
  20.119 -        SDL_PrivateJoystickAxis(joystick, 0, -magnitude);
  20.120 -    }
  20.121 -    if ((keysd & KEY_RIGHT)) {
  20.122 -        SDL_PrivateJoystickAxis(joystick, 0, magnitude);
  20.123 -    }
  20.124 -    if ((keysu & (KEY_UP | KEY_DOWN))) {
  20.125 -        SDL_PrivateJoystickAxis(joystick, 1, 0);
  20.126 -    }
  20.127 -    if ((keysu & (KEY_LEFT | KEY_RIGHT))) {
  20.128 -        SDL_PrivateJoystickAxis(joystick, 0, 0);
  20.129 -    }
  20.130 -    if ((keysd & KEY_A)) {
  20.131 -        SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED);
  20.132 -    }
  20.133 -    if ((keysd & KEY_B)) {
  20.134 -        SDL_PrivateJoystickButton(joystick, 1, SDL_PRESSED);
  20.135 -    }
  20.136 -    if ((keysd & KEY_X)) {
  20.137 -        SDL_PrivateJoystickButton(joystick, 2, SDL_PRESSED);
  20.138 -    }
  20.139 -    if ((keysd & KEY_Y)) {
  20.140 -        SDL_PrivateJoystickButton(joystick, 3, SDL_PRESSED);
  20.141 -    }
  20.142 -    if ((keysd & KEY_L)) {
  20.143 -        SDL_PrivateJoystickButton(joystick, 4, SDL_PRESSED);
  20.144 -    }
  20.145 -    if ((keysd & KEY_R)) {
  20.146 -        SDL_PrivateJoystickButton(joystick, 5, SDL_PRESSED);
  20.147 -    }
  20.148 -    if ((keysd & KEY_SELECT)) {
  20.149 -        SDL_PrivateJoystickButton(joystick, 6, SDL_PRESSED);
  20.150 -    }
  20.151 -    if ((keysd & KEY_START)) {
  20.152 -        SDL_PrivateJoystickButton(joystick, 7, SDL_PRESSED);
  20.153 -    }
  20.154 -    if ((keysu & KEY_A)) {
  20.155 -        SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED);
  20.156 -    }
  20.157 -    if ((keysu & KEY_B)) {
  20.158 -        SDL_PrivateJoystickButton(joystick, 1, SDL_RELEASED);
  20.159 -    }
  20.160 -    if ((keysu & KEY_X)) {
  20.161 -        SDL_PrivateJoystickButton(joystick, 2, SDL_RELEASED);
  20.162 -    }
  20.163 -    if ((keysu & KEY_Y)) {
  20.164 -        SDL_PrivateJoystickButton(joystick, 3, SDL_RELEASED);
  20.165 -    }
  20.166 -    if ((keysu & KEY_L)) {
  20.167 -        SDL_PrivateJoystickButton(joystick, 4, SDL_RELEASED);
  20.168 -    }
  20.169 -    if ((keysu & KEY_R)) {
  20.170 -        SDL_PrivateJoystickButton(joystick, 5, SDL_RELEASED);
  20.171 -    }
  20.172 -    if ((keysu & KEY_SELECT)) {
  20.173 -        SDL_PrivateJoystickButton(joystick, 6, SDL_RELEASED);
  20.174 -    }
  20.175 -    if ((keysu & KEY_START)) {
  20.176 -        SDL_PrivateJoystickButton(joystick, 7, SDL_RELEASED);
  20.177 -    }
  20.178 -}
  20.179 -
  20.180 -/* Function to close a joystick after use */
  20.181 -void
  20.182 -SDL_SYS_JoystickClose(SDL_Joystick * joystick)
  20.183 -{
  20.184 -}
  20.185 -
  20.186 -/* Function to perform any system-specific joystick related cleanup */
  20.187 -void
  20.188 -SDL_SYS_JoystickQuit(void)
  20.189 -{
  20.190 -}
  20.191 -
  20.192 -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
  20.193 -{
  20.194 -    SDL_JoystickGUID guid;
  20.195 -    // the GUID is just the first 16 chars of the name for now
  20.196 -    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
  20.197 -    SDL_zero( guid );
  20.198 -    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  20.199 -    return guid;
  20.200 -}
  20.201 -
  20.202 -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
  20.203 -{
  20.204 -    SDL_JoystickGUID guid;
  20.205 -    // the GUID is just the first 16 chars of the name for now
  20.206 -    const char *name = joystick->name;
  20.207 -    SDL_zero( guid );
  20.208 -    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  20.209 -    return guid;
  20.210 -}
  20.211 -
  20.212 -#endif /* SDL_JOYSTICK_NDS */
    21.1 --- a/src/power/SDL_power.c	Sun Mar 17 09:21:08 2013 -0700
    21.2 +++ b/src/power/SDL_power.c	Sun Mar 17 09:44:58 2013 -0700
    21.3 @@ -34,7 +34,6 @@
    21.4  SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *);
    21.5  SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *);
    21.6  SDL_bool SDL_GetPowerInfo_BeOS(SDL_PowerState *, int *, int *);
    21.7 -SDL_bool SDL_GetPowerInfo_NintendoDS(SDL_PowerState *, int *, int *);
    21.8  SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *);
    21.9  SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *);
   21.10  SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *);
   21.11 @@ -69,9 +68,6 @@
   21.12  #ifdef SDL_POWER_MACOSX         /* handles Mac OS X, Darwin. */
   21.13      SDL_GetPowerInfo_MacOSX,
   21.14  #endif
   21.15 -#ifdef SDL_POWER_NINTENDODS     /* handles Nintendo DS. */
   21.16 -    SDL_GetPowerInfo_NintendoDS,
   21.17 -#endif
   21.18  #ifdef SDL_POWER_BEOS           /* handles BeOS, Zeta, with euc.jp apm driver. */
   21.19      SDL_GetPowerInfo_BeOS,
   21.20  #endif
    22.1 --- a/src/power/nds/SDL_syspower.c	Sun Mar 17 09:21:08 2013 -0700
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,44 +0,0 @@
    22.4 -/*
    22.5 -  Simple DirectMedia Layer
    22.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    22.7 -
    22.8 -  This software is provided 'as-is', without any express or implied
    22.9 -  warranty.  In no event will the authors be held liable for any damages
   22.10 -  arising from the use of this software.
   22.11 -
   22.12 -  Permission is granted to anyone to use this software for any purpose,
   22.13 -  including commercial applications, and to alter it and redistribute it
   22.14 -  freely, subject to the following restrictions:
   22.15 -
   22.16 -  1. The origin of this software must not be misrepresented; you must not
   22.17 -     claim that you wrote the original software. If you use this software
   22.18 -     in a product, an acknowledgment in the product documentation would be
   22.19 -     appreciated but is not required.
   22.20 -  2. Altered source versions must be plainly marked as such, and must not be
   22.21 -     misrepresented as being the original software.
   22.22 -  3. This notice may not be removed or altered from any source distribution.
   22.23 -*/
   22.24 -#include "SDL_config.h"
   22.25 -
   22.26 -#ifndef SDL_POWER_DISABLED
   22.27 -#if SDL_POWER_NINTENDODS
   22.28 -
   22.29 -#include "SDL_power.h"
   22.30 -
   22.31 -SDL_bool
   22.32 -SDL_GetPowerInfo_NintendoDS(SDL_PowerState * state, int *seconds,
   22.33 -                            int *percent)
   22.34 -{
   22.35 -    /* !!! FIXME: write me. */
   22.36 -
   22.37 -    *state = SDL_POWERSTATE_UNKNOWN;
   22.38 -    *percent = -1;
   22.39 -    *seconds = -1;
   22.40 -
   22.41 -    return SDL_TRUE;            /* always the definitive answer on Nintendo DS. */
   22.42 -}
   22.43 -
   22.44 -#endif /* SDL_POWER_NINTENDODS */
   22.45 -#endif /* SDL_POWER_DISABLED */
   22.46 -
   22.47 -/* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/render/SDL_render.c	Sun Mar 17 09:21:08 2013 -0700
    23.2 +++ b/src/render/SDL_render.c	Sun Mar 17 09:44:58 2013 -0700
    23.3 @@ -61,9 +61,6 @@
    23.4  #if SDL_VIDEO_RENDER_DIRECTFB
    23.5      &DirectFB_RenderDriver,
    23.6  #endif
    23.7 -#if SDL_VIDEO_RENDER_NDS
    23.8 -    &NDS_RenderDriver,
    23.9 -#endif
   23.10  #if SDL_VIDEO_RENDER_PSP
   23.11      &PSP_RenderDriver,
   23.12  #endif
    24.1 --- a/src/render/SDL_sysrender.h	Sun Mar 17 09:21:08 2013 -0700
    24.2 +++ b/src/render/SDL_sysrender.h	Sun Mar 17 09:44:58 2013 -0700
    24.3 @@ -173,9 +173,6 @@
    24.4  #if SDL_VIDEO_RENDER_DIRECTFB
    24.5  extern SDL_RenderDriver DirectFB_RenderDriver;
    24.6  #endif
    24.7 -#if SDL_VIDEO_RENDER_NDS
    24.8 -extern SDL_RenderDriver NDS_RenderDriver;
    24.9 -#endif
   24.10  #if SDL_VIDEO_RENDER_PSP
   24.11  extern SDL_RenderDriver PSP_RenderDriver;
   24.12  #endif
    25.1 --- a/src/render/nds/SDL_libgl2D.c	Sun Mar 17 09:21:08 2013 -0700
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,315 +0,0 @@
    25.4 -/*
    25.5 - * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D,
    25.6 - * with permission of the original author. The following is mostly his
    25.7 - * code/comments.
    25.8 - *
    25.9 - *
   25.10 - *	Easy GL2D
   25.11 - *
   25.12 - *	Relminator 2010 
   25.13 - *	Richard Eric M. Lope BSN RN
   25.14 - *
   25.15 - *	http://rel.betterwebber.com
   25.16 - *
   25.17 - *	A very small and simple DS rendering lib using the 3d core to render 2D stuff
   25.18 - */
   25.19 -#include "SDL_config.h"
   25.20 -
   25.21 -#if SDL_VIDEO_RENDER_NDS
   25.22 -
   25.23 -#include "SDL_libgl2D.h"
   25.24 -
   25.25 -/*
   25.26 - * Our static global variable used for Depth values since we cannot
   25.27 - * disable depth testing in the DS hardware This value is incremented
   25.28 - * for every draw call. */
   25.29 -v16 g_depth;
   25.30 -int gCurrentTexture;
   25.31 -
   25.32 -/*
   25.33 - * !!! PRIVATE !!!  Set orthographic projection at 1:1 correspondence
   25.34 - * to screen coords glOrtho expects f32 values but if we use the
   25.35 - * standard f32 values, we need to rescale either every vert or the
   25.36 - * modelview matrix by the same amount to make it work.  That's gonna
   25.37 - * give us lots of overflows and headaches.  So we "scale down" and
   25.38 - * use an all integer value.
   25.39 - */
   25.40 -void SetOrtho(void)		
   25.41 -{
   25.42 -	glMatrixMode(GL_PROJECTION); // set matrixmode to projection
   25.43 -	glLoadIdentity();			   // reset
   25.44 -	glOrthof32(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1 << 12, 1 << 12);  // downscale projection matrix
   25.45 -}
   25.46 -
   25.47 -/*
   25.48 - * Initializes GL in 2D mode Also initializes GL in 3d mode so that we
   25.49 - * could combine 2D and 3D later Almost a direct copy from the DS
   25.50 - * example files
   25.51 - */
   25.52 -void glScreen2D(void)
   25.53 -{
   25.54 -	// initialize gl
   25.55 -	glInit();
   25.56 -	
   25.57 -	// enable textures
   25.58 -	glEnable(GL_TEXTURE_2D);
   25.59 -	
   25.60 -	// enable antialiasing
   25.61 -	glEnable(GL_ANTIALIAS);
   25.62 -		
   25.63 -	// setup the rear plane
   25.64 -	glClearColor(0, 0, 0, 31); // BG must be opaque for AA to work
   25.65 -	glClearPolyID(63); // BG must have a unique polygon ID for AA to work
   25.66 -	
   25.67 -	glClearDepth(GL_MAX_DEPTH);
   25.68 -
   25.69 -	// this should work the same as the normal gl call
   25.70 -	glViewport(0,0,255,191);
   25.71 -
   25.72 -	// any floating point gl call is being converted to fixed prior to being implemented
   25.73 -	glMatrixMode(GL_PROJECTION);
   25.74 -	glLoadIdentity();
   25.75 -	gluPerspective(70, 256.0 / 192.0, 1, 200);
   25.76 -
   25.77 -	gluLookAt(	0.0, 0.0, 1.0,		//camera possition 
   25.78 -				0.0, 0.0, 0.0,		//look at
   25.79 -				0.0, 1.0, 0.0);		//up
   25.80 -
   25.81 -	glMaterialf(GL_AMBIENT, RGB15(31,31,31));
   25.82 -	glMaterialf(GL_DIFFUSE, RGB15(31,31,31));
   25.83 -	glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31));
   25.84 -	glMaterialf(GL_EMISSION, RGB15(31,31,31));
   25.85 -
   25.86 -	// ds uses a table for shinyness..this generates a half-ass one
   25.87 -	glMaterialShinyness();
   25.88 -
   25.89 -	// not a real gl function and will likely change
   25.90 -	glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK);
   25.91 -}
   25.92 -
   25.93 -/*
   25.94 - * Sets up OpenGL for 2d rendering Call this before drawing any of
   25.95 - * GL2D's drawing or sprite functions.
   25.96 - */
   25.97 -void glBegin2D(void)
   25.98 -{
   25.99 -	// save 3d perpective projection matrix
  25.100 -	glMatrixMode(GL_PROJECTION);   
  25.101 -    glPushMatrix();
  25.102 -	
  25.103 -	// save 3d modelview matrix for safety
  25.104 -	glMatrixMode(GL_MODELVIEW);
  25.105 -    glPushMatrix();
  25.106 -	
  25.107 -	
  25.108 -	// what?!! No glDisable(GL_DEPTH_TEST)?!!!!!!
  25.109 -	glEnable(GL_BLEND);
  25.110 -	glEnable(GL_TEXTURE_2D);
  25.111 -	glDisable(GL_ANTIALIAS);	// disable AA
  25.112 -	glDisable(GL_OUTLINE);	// disable edge-marking
  25.113 -
  25.114 -	glColor(0x7FFF);			// max color
  25.115 -	
  25.116 -	glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);  // no culling
  25.117 -
  25.118 -	SetOrtho();
  25.119 -	
  25.120 -	glMatrixMode(GL_TEXTURE);	// reset texture matrix just in case we did some funky stuff with it
  25.121 -	glLoadIdentity();
  25.122 -	
  25.123 -	glMatrixMode(GL_MODELVIEW); // reset modelview matrix. No need to scale up by << 12
  25.124 -	glLoadIdentity();
  25.125 -
  25.126 -	gCurrentTexture = 0;		// set current texture to 0 
  25.127 -	g_depth = 0; // set depth to 0. We need this var since we cannot disable depth testing
  25.128 -}
  25.129 -
  25.130 -/*
  25.131 - * Issue this after drawing 2d so that we don't mess the matrix stack.
  25.132 - * The complement of glBegin2D.
  25.133 - */
  25.134 -void glEnd2D(void)
  25.135 -{
  25.136 -	// restore 3d matrices and set current matrix to modelview
  25.137 -	glMatrixMode(GL_PROJECTION);    
  25.138 -    glPopMatrix(1);
  25.139 -	glMatrixMode(GL_MODELVIEW);
  25.140 -    glPopMatrix(1);
  25.141 -}
  25.142 -
  25.143 -/*
  25.144 - * Draws a pixel
  25.145 - * Parameters:
  25.146 - *   x,y 	-> First coordinate of the line 
  25.147 - *   color 	-> RGB15/ARGB16 color 
  25.148 - */
  25.149 -void glPutPixel(int x, int y, int color)
  25.150 -{
  25.151 -	glBindTexture(0, 0);
  25.152 -	glColor(color);
  25.153 -	glBegin(GL_TRIANGLES);
  25.154 -		gxVertex3i(x, y, g_depth);
  25.155 -		gxVertex2i(x, y);
  25.156 -		gxVertex2i(x, y);
  25.157 -	glEnd();
  25.158 -	glColor(0x7FFF);
  25.159 -	g_depth++;
  25.160 -	gCurrentTexture = 0;
  25.161 -}
  25.162 -
  25.163 -/*
  25.164 - * Draws a line
  25.165 - * Parameters:
  25.166 - *   x1,y1 	-> First coordinate of the line 
  25.167 - *   x2,y2 	-> Second coordinate of the line 
  25.168 - *   color 	-> RGB15/ARGB16 color
  25.169 - */
  25.170 -void glLine(int x1, int y1, int x2, int y2, int color)
  25.171 -{
  25.172 -	x2++;
  25.173 -	y2++;
  25.174 -	
  25.175 -	glBindTexture(0, 0);
  25.176 -	glColor(color);
  25.177 -	glBegin(GL_TRIANGLES);
  25.178 -		gxVertex3i(x1, y1, g_depth);
  25.179 -		gxVertex2i(x2, y2);
  25.180 -		gxVertex2i(x2, y2);
  25.181 -	glEnd();
  25.182 -	glColor(0x7FFF);
  25.183 -	g_depth++;
  25.184 -	gCurrentTexture = 0;
  25.185 -}
  25.186 -
  25.187 -/*
  25.188 - * Draws a Filled Box
  25.189 - * Parameters:
  25.190 - *   x1,y1 	-> Top-left corner of the box 
  25.191 - *   x2,y2 	-> Bottom-Right corner of the box 
  25.192 - *   color 	-> RGB15/ARGB16 color 
  25.193 -*/
  25.194 -void glBoxFilled(int x1, int y1, int x2, int y2, int color)
  25.195 -{
  25.196 -	x2++;
  25.197 -	y2++;
  25.198 -	
  25.199 -	glBindTexture(0, 0);
  25.200 -	glColor(color);
  25.201 -	glBegin(GL_QUADS);
  25.202 -		gxVertex3i(x1, y1, g_depth); // use 3i for first vertex so that we increment HW depth
  25.203 -		gxVertex2i(x1, y2); // no need for 3 vertices as 2i would share last depth call
  25.204 -		gxVertex2i(x2, y2);
  25.205 -		gxVertex2i(x2, y1);
  25.206 -	glEnd();
  25.207 -	glColor(0x7FFF);
  25.208 -	g_depth++;
  25.209 -	gCurrentTexture = 0;
  25.210 -}
  25.211 -
  25.212 -/*
  25.213 - *
  25.214 - * Create a tile.
  25.215 - * Very rigid and prone to human error.
  25.216 - *
  25.217 - * Parameters:
  25.218 - *   *sprite 		 -> pointer to a glImage
  25.219 - *   texture_width   -> width/height of the texture;
  25.220 - *   texture_height  ->  valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d)
  25.221 - *   sprite_width
  25.222 - *   sprite_height   -> width/height of the picture in the texture.
  25.223 - *   type 		     -> The format of the texture (see glTexImage2d)
  25.224 - *   param 		     -> parameters for the texture (see glTexImage2d)
  25.225 - */
  25.226 -int glLoadTile(glImage              *sprite,
  25.227 -			   int                  texture_width,
  25.228 -			   int                  texture_height,
  25.229 -			   int                  sprite_width,
  25.230 -			   int                  sprite_height,
  25.231 -			   GL_TEXTURE_TYPE_ENUM type,
  25.232 -			   int 	                param,
  25.233 -			   int					pallette_width,
  25.234 -			   const u16			*palette,
  25.235 -			   const uint8          *texture)
  25.236 -{
  25.237 -	int textureID;
  25.238 -
  25.239 -	glGenTextures(1, &textureID);
  25.240 -	glBindTexture(0, textureID);
  25.241 -	glTexImage2D(0, 0, type, texture_width, texture_height, 0, param, texture);
  25.242 -	glColorTableEXT(0, 0, pallette_width, 0, 0, palette);
  25.243 -
  25.244 -	sprite->width 			= sprite_width;
  25.245 -	sprite->height 			= sprite_height;
  25.246 -	sprite->textureID 		= textureID;
  25.247 -	
  25.248 -	return textureID;
  25.249 -}
  25.250 -
  25.251 -/*
  25.252 - * I made this since the scale wrappers are either the vectorized mode
  25.253 - * or does not permit you to scale only the axis you want to
  25.254 - * scale. Needed for sprite scaling.
  25.255 - */
  25.256 -static inline void gxScalef32(s32 x, s32 y, s32 z)
  25.257 -{
  25.258 -	MATRIX_SCALE = x;
  25.259 -	MATRIX_SCALE = y;
  25.260 -	MATRIX_SCALE = z;
  25.261 -}
  25.262 -
  25.263 -/*
  25.264 - * I this made for future naming conflicts.
  25.265 - */
  25.266 -static inline void gxTranslate3f32(int32 x, int32 y, int32 z) 
  25.267 -{
  25.268 -	MATRIX_TRANSLATE = x;
  25.269 -	MATRIX_TRANSLATE = y;
  25.270 -	MATRIX_TRANSLATE = z;
  25.271 -}
  25.272 -
  25.273 -/*
  25.274 - * Draws an axis exclusive scaled sprite
  25.275 - * Parameters:
  25.276 - *   x 			-> x position of the sprite
  25.277 - *   y 			-> y position of the sprite
  25.278 - *   scaleX   	-> 20.12 FP X axis scale value (1 << 12 is normal)
  25.279 - *   scaleY   	-> 20.12 FP Y axis scale value (1 << 12 is normal)
  25.280 - *   flipmode 	-> mode for flipping (see GL_FLIP_MODE enum)
  25.281 - *   *spr 		-> pointer to a glImage
  25.282 - */
  25.283 -void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr)
  25.284 -{
  25.285 -	const int x1 = 0;
  25.286 -	const int y1 = 0;
  25.287 -	const int x2 = spr->width;
  25.288 -	const int y2 = spr->height;
  25.289 -	const int u1 = ((flipmode & GL_FLIP_H) ? spr->width-1  : 0);
  25.290 - 	const int u2 = ((flipmode & GL_FLIP_H) ? 0 : spr->width-1);
  25.291 -	const int v1 = ((flipmode & GL_FLIP_V) ? spr->height-1 : 0);
  25.292 -	const int v2 = ((flipmode & GL_FLIP_V) ? 0 : spr->height-1);
  25.293 - 
  25.294 -    if (spr->textureID != gCurrentTexture)
  25.295 -    {
  25.296 -        glBindTexture(GL_TEXTURE_2D, spr->textureID);
  25.297 -        gCurrentTexture = spr->textureID;
  25.298 -    }
  25.299 -
  25.300 -	glPushMatrix();
  25.301 -
  25.302 -		gxTranslate3f32(x, y, 0);
  25.303 -		gxScalef32(scaleX, scaleY, 1 << 12);
  25.304 -
  25.305 -		glBegin(GL_QUADS);
  25.306 -			
  25.307 -			gxTexcoord2i(u1, v1); gxVertex3i(x1, y1, g_depth);	
  25.308 -			gxTexcoord2i(u1, v2); gxVertex2i(x1, y2);
  25.309 -			gxTexcoord2i(u2, v2); gxVertex2i(x2, y2);
  25.310 -			gxTexcoord2i(u2, v1); gxVertex2i(x2, y1);
  25.311 -			
  25.312 -		glEnd();
  25.313 -	
  25.314 -	glPopMatrix(1);
  25.315 -	g_depth++;
  25.316 -}
  25.317 -
  25.318 -#endif /* SDL_VIDEO_RENDER_NDS */
    26.1 --- a/src/render/nds/SDL_libgl2D.h	Sun Mar 17 09:21:08 2013 -0700
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,154 +0,0 @@
    26.4 -/*
    26.5 - * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D,
    26.6 - * with permission of the original author. The following is mostly his
    26.7 - * code/comments.
    26.8 - *
    26.9 - *
   26.10 - *	Easy GL2D
   26.11 - *
   26.12 - *	Relminator 2010 
   26.13 - *	Richard Eric M. Lope BSN RN
   26.14 - *
   26.15 - *	http://rel.betterwebber.com
   26.16 - *
   26.17 - *	A very small and simple DS rendering lib using the 3d core to render 2D stuff
   26.18 - */
   26.19 -#include "SDL_config.h"
   26.20 -
   26.21 -#if SDL_VIDEO_RENDER_NDS
   26.22 -
   26.23 -#include <nds/arm9/videoGL.h>
   26.24 -
   26.25 -/* LibGL extension(s) */
   26.26 -static inline void gxTexcoord2i(t16 u, t16 v)
   26.27 -{
   26.28 -	GFX_TEX_COORD = (v << 20) | ((u << 4) & 0xFFFF);
   26.29 -}
   26.30 -
   26.31 -static inline void gxVertex3i(v16 x, v16 y, v16 z)
   26.32 -{
   26.33 -	GFX_VERTEX16 = (y << 16) | (x & 0xFFFF);
   26.34 -	GFX_VERTEX16 = ((uint32)(uint16)z);
   26.35 -}
   26.36 -
   26.37 -static inline void gxVertex2i(v16 x, v16 y)
   26.38 -{
   26.39 -	GFX_VERTEX_XY = (y << 16) | (x & 0xFFFF);	
   26.40 -}
   26.41 -
   26.42 -/*
   26.43 - * Enums selecting flipping mode.
   26.44 - *
   26.45 - *	These enums are bits for flipping the sprites.
   26.46 - *	You can "|" (or) GL_FLIP_V and GL_FLIP_H to flip 
   26.47 - *	both ways.
   26.48 - */
   26.49 -typedef enum
   26.50 -{
   26.51 -	GL_FLIP_NONE 	= (1 << 0), /* No flipping */
   26.52 -	GL_FLIP_V 		= (1 << 1), /* Sprite is rendered vertically flipped */
   26.53 -	GL_FLIP_H 		= (1 << 2), /* Sprite is rendered horizontally flipped */
   26.54 -} GL_FLIP_MODE;
   26.55 -
   26.56 -/* Struct for out GL-Based Images. */
   26.57 -typedef struct 
   26.58 -{
   26.59 -	int		width;		/* Width of the Sprite */      			
   26.60 -	int 	height;		/* Height of the Sprite */	
   26.61 -	int		textureID;  /* Texture handle (used in glDeleteTextures())
   26.62 -						   The texture handle in VRAM (returned by glGenTextures())
   26.63 -						   ie. This references the actual texture stored in VRAM. */
   26.64 -} glImage;
   26.65 -
   26.66 -extern v16 g_depth;
   26.67 -extern int gCurrentTexture;
   26.68 -
   26.69 -/*
   26.70 - * Draws an Axis Exclusive Scaled Sprite
   26.71 - * Parameters:
   26.72 - *   x X position of the sprite.
   26.73 - *   y Y position of the sprite.
   26.74 - *   scaleX 20.12 fixed-point X-Axis scale value (1 << 12 is normal).
   26.75 - *   scaleY 20.12 fixed-point Y-Axis scale value (1 << 12 is normal).
   26.76 - *   flipmode mode for flipping (see GL_FLIP_MODE enum).
   26.77 - *   *spr pointer to a glImage. 
   26.78 -*/
   26.79 -void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr);
   26.80 -
   26.81 -/* Initializes our Tileset (like glInitSpriteset()) but without the use of Texture Packer auto-generated files.
   26.82 - * Can only be used when tiles in a tilset are of the same dimensions.
   26.83 - * Parameters:
   26.84 - *   *sprite Pointer to an array of glImage.
   26.85 - *   tile_wid Width of each tile in the texture.
   26.86 - *   tile_hei Height of each tile in the texture.
   26.87 - *   bmp_wid Width of of the texture or tileset.
   26.88 - *   bmp_hei height of of the texture or tileset.
   26.89 - *   type The format of the texture (see glTexImage2d()).
   26.90 - *   sizeX The horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()).
   26.91 - *   sizeY The vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()).
   26.92 - *   param parameters for the texture (see glTexImage2d()). 
   26.93 - *   pallette_width Length of the palette. Valid values are <b>4, 16, 32, 256</b> (if <b>0</b>, then palette is removed from currently bound texture). 
   26.94 - *   *palette Pointer to the palette data to load (if NULL, then palette is removed from currently bound texture).
   26.95 - *   *texture Pointer to the texture data to load.
   26.96 -*/
   26.97 -int glLoadTile(glImage              *sprite,
   26.98 -			   int                  texture_width,
   26.99 -			   int                  texture_height,
  26.100 -			   int                  sprite_width,
  26.101 -			   int                  sprite_height,
  26.102 -			   GL_TEXTURE_TYPE_ENUM type,
  26.103 -			   int 	                param,
  26.104 -			   int					pallette_width,
  26.105 -			   const u16			*palette,
  26.106 -			   const uint8          *texture);
  26.107 -
  26.108 -/* Initializes GL in 2D mode */
  26.109 -void glScreen2D(void);
  26.110 -
  26.111 -/* 
  26.112 - * Sets up OpenGL for 2d rendering. 
  26.113 - *
  26.114 - * Call this before drawing any of GL2D's drawing or sprite functions.
  26.115 - */
  26.116 -void glBegin2D(void);
  26.117 -
  26.118 -/*
  26.119 - * Issue this after drawing 2d so that we don't mess the matrix stack.
  26.120 - *
  26.121 - * The complement of glBegin2D().
  26.122 - */
  26.123 -void glEnd2D(void);
  26.124 -
  26.125 -/*
  26.126 - * Draws a Pixel
  26.127 - *   x X position of the pixel.
  26.128 - *   y Y position of the pixel.
  26.129 - *   color RGB15/ARGB16 color.
  26.130 - */
  26.131 -void glPutPixel(int x, int y, int color);
  26.132 -
  26.133 -/*
  26.134 - * Draws a Line
  26.135 - *   x1,y1 Top-Left coordinate of the line.
  26.136 - *   x2,y2 Bottom-Right coordinate of the line.
  26.137 - *   color RGB15/ARGB16 color.
  26.138 - */
  26.139 -void glLine(int x1, int y1, int x2, int y2, int color);
  26.140 -
  26.141 -/* 
  26.142 - * Draws a Box
  26.143 - *   x1,y1 Top-Left coordinate of the box.
  26.144 - *   x2,y2 Bottom-Right coordinate of the box.
  26.145 - *   color RGB15/ARGB16 color.
  26.146 -*/
  26.147 -void glBox(int x1, int y1, int x2, int y2, int color);
  26.148 -
  26.149 -/*
  26.150 - * Draws a Filled Box
  26.151 - *   x1,y1 Top-Left coordinate of the box.
  26.152 - *   x2,y2 Bottom-Right coordinate of the box.
  26.153 - *   color RGB15/ARGB16 color.
  26.154 - */
  26.155 -void glBoxFilled(int x1, int y1, int x2, int y2, int color);
  26.156 -
  26.157 -#endif /* SDL_VIDEO_RENDER_NDS */
    27.1 --- a/src/render/nds/SDL_ndsrender.c	Sun Mar 17 09:21:08 2013 -0700
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,418 +0,0 @@
    27.4 -/*
    27.5 -  Simple DirectMedia Layer
    27.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    27.7 -
    27.8 -  This software is provided 'as-is', without any express or implied
    27.9 -  warranty.  In no event will the authors be held liable for any damages
   27.10 -  arising from the use of this software.
   27.11 -
   27.12 -  Permission is granted to anyone to use this software for any purpose,
   27.13 -  including commercial applications, and to alter it and redistribute it
   27.14 -  freely, subject to the following restrictions:
   27.15 -
   27.16 -  1. The origin of this software must not be misrepresented; you must not
   27.17 -     claim that you wrote the original software. If you use this software
   27.18 -     in a product, an acknowledgment in the product documentation would be
   27.19 -     appreciated but is not required.
   27.20 -  2. Altered source versions must be plainly marked as such, and must not be
   27.21 -     misrepresented as being the original software.
   27.22 -  3. This notice may not be removed or altered from any source distribution.
   27.23 -*/
   27.24 -#include "SDL_config.h"
   27.25 -
   27.26 -#if SDL_VIDEO_RENDER_NDS
   27.27 -
   27.28 -#include <stdio.h>
   27.29 -#include <stdlib.h>
   27.30 -#include <nds.h>
   27.31 -
   27.32 -#include "SDL_libgl2D.h"
   27.33 -
   27.34 -#include "SDL_video.h"
   27.35 -#include "../../video/SDL_sysvideo.h"
   27.36 -#include "SDL_render.h"
   27.37 -#include "../SDL_sysrender.h"
   27.38 -#include "SDL_log.h"
   27.39 -
   27.40 -/* Draws a partial sprite. Based on glSprite. */
   27.41 -static void glSpritePartial(const SDL_Rect * srcrect, int x, int y, int flipmode, const glImage *spr)
   27.42 -{
   27.43 -	int x1 = x;
   27.44 -	int y1 = y;
   27.45 -	int x2 = x + srcrect->w;
   27.46 -	int y2 = y + srcrect->h;
   27.47 -
   27.48 -	int	u1 = srcrect->x + ((flipmode & GL_FLIP_H) ? spr->width-1  : 0);
   27.49 - 	int	u2 = srcrect->x + ((flipmode & GL_FLIP_H) ? 0 : srcrect->h);
   27.50 -	int v1 = srcrect->y + ((flipmode & GL_FLIP_V) ? spr->height-1 : 0);
   27.51 - 	int v2 = srcrect->y + ((flipmode & GL_FLIP_V) ? 0 : srcrect->h);
   27.52 -
   27.53 -    if (spr->textureID != gCurrentTexture) {
   27.54 -        glBindTexture(GL_TEXTURE_2D, spr->textureID);
   27.55 -        gCurrentTexture = spr->textureID;
   27.56 -    }
   27.57 -
   27.58 -	glBegin(GL_QUADS);
   27.59 -		
   27.60 -		gxTexcoord2i(u1, v1); gxVertex3i(x1, y1, g_depth);	
   27.61 -		gxTexcoord2i(u1, v2); gxVertex2i(x1, y2);
   27.62 -		gxTexcoord2i(u2, v2); gxVertex2i(x2, y2);
   27.63 -		gxTexcoord2i(u2, v1); gxVertex2i(x2, y1);
   27.64 -		
   27.65 -	glEnd();
   27.66 -	
   27.67 -	g_depth++;
   27.68 -}
   27.69 -
   27.70 -/* SDL NDS renderer implementation */
   27.71 -
   27.72 -extern SDL_RenderDriver NDS_RenderDriver;
   27.73 -
   27.74 -typedef struct
   27.75 -{
   27.76 -	/* Whether current 3D engine is on the main or sub screen. */
   27.77 -	int is_sub;
   27.78 -} NDS_RenderData;
   27.79 -
   27.80 -typedef struct
   27.81 -{
   27.82 -	glImage image[1];
   27.83 -} NDS_TextureData;
   27.84 -
   27.85 -static int NDS_UpdateViewport(SDL_Renderer *renderer)
   27.86 -{
   27.87 -	/* Nothing to do. */
   27.88 -	return 0;
   27.89 -}
   27.90 -
   27.91 -static int
   27.92 -NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
   27.93 -               const SDL_Rect * srcrect, const SDL_Rect * dstrect)
   27.94 -{
   27.95 -    NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
   27.96 -    NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
   27.97 -	int dest_y;
   27.98 -
   27.99 -	if (data->is_sub) {
  27.100 -		dest_y = dstrect->y;
  27.101 -	} else {
  27.102 -		dest_y = dstrect->y-SCREEN_HEIGHT;
  27.103 -	}
  27.104 -
  27.105 -	if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
  27.106 -		/* No scaling */
  27.107 -		glSpritePartial(srcrect, dstrect->x, dest_y, GL_FLIP_NONE, txdat->image);
  27.108 -	} else {
  27.109 -		/* Convert the scaling proportion into a 20.12 value. */
  27.110 -		s32 scale_w = divf32(dstrect->w << 12, texture->w << 12);
  27.111 -		s32 scale_h = divf32(dstrect->h << 12, texture->h << 12);
  27.112 -
  27.113 -		glSpriteScaleXY(dstrect->x, dest_y, scale_w, scale_h, GL_FLIP_NONE, txdat->image);
  27.114 -	}
  27.115 -
  27.116 -    return 0;
  27.117 -}
  27.118 -
  27.119 -static int NDS_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
  27.120 -{
  27.121 -    NDS_TextureData *txdat = NULL;
  27.122 -    int i;
  27.123 -
  27.124 -	SDL_Log("NDS_CreateTexture: NDS_CreateTexture.\n");
  27.125 -
  27.126 -	/* Sanity checks. */
  27.127 -	for (i=0; i<NDS_RenderDriver.info.num_texture_formats; i++) {
  27.128 -		if (texture->format == NDS_RenderDriver.info.texture_formats[i])
  27.129 -			break;
  27.130 -	}
  27.131 -	if (i == NDS_RenderDriver.info.num_texture_formats) {
  27.132 -		SDL_SetError("Unsupported texture format (%x)", texture->format);
  27.133 -		return -1;
  27.134 -	}
  27.135 -
  27.136 -	if (texture->w > NDS_RenderDriver.info.max_texture_width) {
  27.137 -		SDL_SetError("Texture too large (%d)", texture->w);
  27.138 -		return -1;
  27.139 -	}
  27.140 -
  27.141 -	if (texture->h > NDS_RenderDriver.info.max_texture_height) {
  27.142 -		SDL_SetError("Texture too tall (%d)", texture->h);
  27.143 -		return -1;
  27.144 -	}
  27.145 -
  27.146 -	texture->driverdata = SDL_calloc(1, sizeof(NDS_TextureData));
  27.147 -	txdat = (NDS_TextureData *) texture->driverdata;
  27.148 -	if (!txdat) {
  27.149 -		SDL_OutOfMemory();
  27.150 -		return -1;
  27.151 -	}
  27.152 -
  27.153 -    return 0;
  27.154 -}
  27.155 -
  27.156 -static void
  27.157 -NDS_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
  27.158 -{
  27.159 -    NDS_TextureData *txdat = texture->driverdata;
  27.160 -
  27.161 -    /* free anything else allocated for texture */
  27.162 -    SDL_free(txdat);
  27.163 -}
  27.164 -
  27.165 -/* size is no more than 512. */
  27.166 -static int get_gltexture_size(unsigned int size)
  27.167 -{
  27.168 -	if (size > 256)
  27.169 -		return TEXTURE_SIZE_512;
  27.170 -	else if (size > 128)
  27.171 -		return TEXTURE_SIZE_256;
  27.172 -	else if (size > 64)
  27.173 -		return TEXTURE_SIZE_128;
  27.174 -	else if (size > 32)
  27.175 -		return TEXTURE_SIZE_64;
  27.176 -	else if (size > 16)
  27.177 -		return TEXTURE_SIZE_32;
  27.178 -	else if (size > 8)
  27.179 -		return TEXTURE_SIZE_16;
  27.180 -	else
  27.181 -		return TEXTURE_SIZE_8;
  27.182 -}
  27.183 -
  27.184 -static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
  27.185 -							 const SDL_Rect * rect, const void *pixels, int pitch)
  27.186 -{
  27.187 -    NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
  27.188 -	char *new_pixels = NULL;
  27.189 -	const int gl_w = get_gltexture_size(rect->w);
  27.190 -	const int gl_h = get_gltexture_size(rect->h);
  27.191 -	const int w = 1 << (3+gl_w);	/* Texture sizes must be a power of 2. */
  27.192 -	const int h = 1 << (3+gl_h);	/* Texture sizes must be a power of 2. */
  27.193 -
  27.194 -	if (w != rect->w || h != rect->h) {
  27.195 -		/* Allocate a temporary surface and copy pixels into it while
  27.196 -		 * enlarging the pitch. */
  27.197 -		const char *src;
  27.198 -		char *dst;
  27.199 -		int new_pitch = 2 * w;
  27.200 -		int i;
  27.201 -
  27.202 -		new_pixels = malloc(2 * w * h);
  27.203 -		if (!new_pixels)
  27.204 -			return SDL_ENOMEM;
  27.205 -
  27.206 -		src = pixels;
  27.207 -		dst = new_pixels;
  27.208 -		for (i=0; i<rect->h; i++) {
  27.209 -			memcpy(dst, src, pitch);
  27.210 -			src += pitch;
  27.211 -			dst += new_pitch;
  27.212 -		}
  27.213 -	}
  27.214 -
  27.215 -	glLoadTile(txdat->image,
  27.216 -				  gl_w, gl_h,
  27.217 -				  rect->w, rect->h,
  27.218 -				  texture->format == SDL_PIXELFORMAT_ABGR1555 ? GL_RGBA : GL_RGB,
  27.219 -				  TEXGEN_OFF, 0, NULL,
  27.220 -				  new_pixels? new_pixels : pixels);
  27.221 -
  27.222 -	if (new_pixels)
  27.223 -		free(new_pixels);
  27.224 -
  27.225 -    return 0;
  27.226 -}
  27.227 -
  27.228 -static int NDS_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
  27.229 -						   const SDL_Rect *rect, void **pixels, int *pitch)
  27.230 -{
  27.231 -	SDL_Log("enter %s (todo)\n", __func__);
  27.232 -
  27.233 -    return 0;
  27.234 -}
  27.235 -
  27.236 -static void NDS_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
  27.237 -{
  27.238 -	SDL_Log("enter %s\n", __func__);
  27.239 -    /* stub! */
  27.240 -}
  27.241 -
  27.242 -static int NDS_RenderClear(SDL_Renderer *renderer)
  27.243 -{
  27.244 -    glClearColor(renderer->r >> 3,
  27.245 -                 renderer->g >> 3,
  27.246 -                 renderer->b >> 3,
  27.247 -                 renderer->a >> 3);
  27.248 -
  27.249 -	return 0;
  27.250 -}
  27.251 -
  27.252 -static void NDS_RenderPresent(SDL_Renderer * renderer)
  27.253 -{
  27.254 -    NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
  27.255 -
  27.256 -	glEnd2D();
  27.257 -		
  27.258 -	glFlush(0);
  27.259 -
  27.260 -	swiWaitForVBlank();
  27.261 -
  27.262 -	/* wait for capture unit to be ready */
  27.263 -	while(REG_DISPCAPCNT & DCAP_ENABLE);
  27.264 -
  27.265 -	/* 3D engine can only work on one screen at a time. */
  27.266 -	data->is_sub = !data->is_sub;
  27.267 -	if (data->is_sub) {
  27.268 -		lcdMainOnBottom();
  27.269 -		vramSetBankC(VRAM_C_LCD);
  27.270 -		vramSetBankD(VRAM_D_SUB_SPRITE);
  27.271 -		REG_DISPCAPCNT = DCAP_BANK(2) | DCAP_ENABLE | DCAP_SIZE(3);
  27.272 -	} else {
  27.273 -		lcdMainOnTop();
  27.274 -		vramSetBankD(VRAM_D_LCD);
  27.275 -		vramSetBankC(VRAM_C_SUB_BG);
  27.276 -		REG_DISPCAPCNT = DCAP_BANK(3) | DCAP_ENABLE | DCAP_SIZE(3);
  27.277 -	}
  27.278 -
  27.279 -	glBegin2D();
  27.280 -}
  27.281 -
  27.282 -static int NDS_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points,
  27.283 -								int count)
  27.284 -{
  27.285 -    NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
  27.286 -	int i;
  27.287 -	int color = RGB15(renderer->r >> 3,
  27.288 -					  renderer->g >> 3,
  27.289 -					  renderer->b >> 3);
  27.290 -
  27.291 -	for (i=0; i < count; i++) {
  27.292 -		if (data->is_sub) {
  27.293 -			glPutPixel(points[i].x, points[i].y, color);
  27.294 -		} else {
  27.295 -			glPutPixel(points[i].x, points[i].y - SCREEN_HEIGHT, color);
  27.296 -		}
  27.297 -	}
  27.298 -
  27.299 -	return 0;
  27.300 -}
  27.301 -
  27.302 -static int NDS_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points,
  27.303 -							   int count)
  27.304 -{
  27.305 -    NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
  27.306 -	int i;
  27.307 -	int color = RGB15(renderer->r >> 3,
  27.308 -					  renderer->g >> 3,
  27.309 -					  renderer->b >> 3);
  27.310 -
  27.311 -	for (i=0; i < count-1; i++) {
  27.312 -		if (data->is_sub) {
  27.313 -			glLine(points[i].x, points[i].y, points[i+1].x, points[i+1].y, color);
  27.314 -		} else {
  27.315 -			glLine(points[i].x, points[i].y - SCREEN_HEIGHT, 
  27.316 -				   points[i+1].x, points[i+1].y - SCREEN_HEIGHT, color);
  27.317 -		}
  27.318 -	}
  27.319 -
  27.320 -	return 0;
  27.321 -}
  27.322 -
  27.323 -static int NDS_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects,
  27.324 -							   int count)
  27.325 -{
  27.326 -    NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
  27.327 -	int i;
  27.328 -	int color = RGB15(renderer->r >> 3,
  27.329 -					  renderer->g >> 3,
  27.330 -					  renderer->b >> 3);
  27.331 -
  27.332 -	for (i=0; i<count; i++) {
  27.333 -		if (data->is_sub) {
  27.334 -			glBoxFilled(rects[i].x, rects[i].y, 
  27.335 -						rects[i].x + rects[i].w,
  27.336 -						rects[i].y + rects[i].h, color);
  27.337 -	} else {
  27.338 -			glBoxFilled(rects[i].x, rects[i].y - SCREEN_HEIGHT,
  27.339 -						rects[i].x + rects[i].w,
  27.340 -						rects[i].y + rects[i].h - SCREEN_HEIGHT,
  27.341 -						color);
  27.342 -		}
  27.343 -	}
  27.344 -
  27.345 -	return 0;
  27.346 -}
  27.347 -
  27.348 -static SDL_Renderer *
  27.349 -NDS_CreateRenderer(SDL_Window * window, Uint32 flags)
  27.350 -{
  27.351 -    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
  27.352 -    SDL_DisplayMode *displayMode = &display->current_mode;
  27.353 -    SDL_Renderer *renderer;
  27.354 -    NDS_RenderData *data;
  27.355 -    int bpp;
  27.356 -    Uint32 Rmask, Gmask, Bmask, Amask;
  27.357 -
  27.358 -	if (displayMode->format != SDL_PIXELFORMAT_ABGR1555) {
  27.359 -		SDL_SetError("Unsupported pixel format (%x)", displayMode->format);
  27.360 -		return NULL;
  27.361 -	}
  27.362 -
  27.363 -    if (!SDL_PixelFormatEnumToMasks(displayMode->format, &bpp,
  27.364 -                                    &Rmask, &Gmask, &Bmask, &Amask)) {
  27.365 -        SDL_SetError("Unknown display format");
  27.366 -        return NULL;
  27.367 -    }
  27.368 -
  27.369 -    renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
  27.370 -    if (!renderer) {
  27.371 -        SDL_OutOfMemory();
  27.372 -        return NULL;
  27.373 -    }
  27.374 -
  27.375 -    data = (NDS_RenderData *) SDL_calloc(1, sizeof(*data));
  27.376 -    if (!data) {
  27.377 -        SDL_free(renderer);
  27.378 -        SDL_OutOfMemory();
  27.379 -        return NULL;
  27.380 -    }
  27.381 -
  27.382 -    renderer->info = NDS_RenderDriver.info;
  27.383 -    renderer->info.flags = SDL_RENDERER_ACCELERATED;
  27.384 -
  27.385 -	renderer->CreateTexture = NDS_CreateTexture;
  27.386 -	renderer->UpdateTexture = NDS_UpdateTexture;
  27.387 -	renderer->LockTexture = NDS_LockTexture;
  27.388 -	renderer->UnlockTexture = NDS_UnlockTexture;
  27.389 -	renderer->UpdateViewport = NDS_UpdateViewport;
  27.390 -	renderer->RenderClear = NDS_RenderClear;
  27.391 -	renderer->RenderDrawPoints = NDS_RenderDrawPoints;
  27.392 -	renderer->RenderDrawLines = NDS_RenderDrawLines;
  27.393 -	renderer->RenderFillRects = NDS_RenderFillRects;
  27.394 -	renderer->RenderCopy = NDS_RenderCopy;
  27.395 -	/* renderer->RenderReadPixels = NDS_RenderReadPixels; - todo ? */
  27.396 -	renderer->RenderPresent = NDS_RenderPresent;
  27.397 -	renderer->DestroyTexture = NDS_DestroyTexture;
  27.398 -	/* renderer->DestroyRenderer = NDS_DestroyRenderer; - todo ? */
  27.399 -
  27.400 -	renderer->driverdata = data;
  27.401 -
  27.402 -    return renderer;
  27.403 -}
  27.404 -
  27.405 -SDL_RenderDriver NDS_RenderDriver = {
  27.406 -	.CreateRenderer = NDS_CreateRenderer,
  27.407 -    .info = {
  27.408 -		.name = "nds",
  27.409 -		.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC,
  27.410 -		.num_texture_formats = 2,
  27.411 -		.texture_formats = { [0] = SDL_PIXELFORMAT_ABGR1555,
  27.412 -							 [1] = SDL_PIXELFORMAT_BGR555,
  27.413 -		},
  27.414 -		.max_texture_width = 512,
  27.415 -		.max_texture_height = 512,
  27.416 -     }
  27.417 -};
  27.418 -
  27.419 -#endif /* SDL_VIDEO_RENDER_NDS */
  27.420 -
  27.421 -/* vi: set ts=4 sw=4 expandtab: */
    28.1 --- a/src/test/SDL_test_common.c	Sun Mar 17 09:21:08 2013 -0700
    28.2 +++ b/src/test/SDL_test_common.c	Sun Mar 17 09:44:58 2013 -0700
    28.3 @@ -44,11 +44,7 @@
    28.4      /* Initialize some defaults */
    28.5      state->argv = argv;
    28.6      state->flags = flags;
    28.7 -#ifdef __NDS__
    28.8 -    state->window_title = "";
    28.9 -#else
   28.10      state->window_title = argv[0];
   28.11 -#endif
   28.12      state->window_flags = 0;
   28.13      state->window_x = SDL_WINDOWPOS_UNDEFINED;
   28.14      state->window_y = SDL_WINDOWPOS_UNDEFINED;
   28.15 @@ -87,10 +83,6 @@
   28.16  {
   28.17      char **argv = state->argv;
   28.18  
   28.19 -#ifdef __NDS__
   28.20 -    return 0;
   28.21 -#endif
   28.22 -
   28.23      if (SDL_strcasecmp(argv[index], "--video") == 0) {
   28.24          ++index;
   28.25          if (!argv[index]) {
    29.1 --- a/src/thread/SDL_thread_c.h	Sun Mar 17 09:21:08 2013 -0700
    29.2 +++ b/src/thread/SDL_thread_c.h	Sun Mar 17 09:44:58 2013 -0700
    29.3 @@ -34,8 +34,6 @@
    29.4  #include "pthread/SDL_systhread_c.h"
    29.5  #elif SDL_THREAD_WINDOWS
    29.6  #include "windows/SDL_systhread_c.h"
    29.7 -#elif SDL_THREAD_NDS
    29.8 -#include "nds/SDL_systhread_c.h"
    29.9  #elif SDL_THREAD_PSP
   29.10  #include "psp/SDL_systhread_c.h"
   29.11  #else
    30.1 --- a/src/thread/nds/SDL_syscond.c	Sun Mar 17 09:21:08 2013 -0700
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,230 +0,0 @@
    30.4 -/*
    30.5 -  Simple DirectMedia Layer
    30.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    30.7 -
    30.8 -  This software is provided 'as-is', without any express or implied
    30.9 -  warranty.  In no event will the authors be held liable for any damages
   30.10 -  arising from the use of this software.
   30.11 -
   30.12 -  Permission is granted to anyone to use this software for any purpose,
   30.13 -  including commercial applications, and to alter it and redistribute it
   30.14 -  freely, subject to the following restrictions:
   30.15 -
   30.16 -  1. The origin of this software must not be misrepresented; you must not
   30.17 -     claim that you wrote the original software. If you use this software
   30.18 -     in a product, an acknowledgment in the product documentation would be
   30.19 -     appreciated but is not required.
   30.20 -  2. Altered source versions must be plainly marked as such, and must not be
   30.21 -     misrepresented as being the original software.
   30.22 -  3. This notice may not be removed or altered from any source distribution.
   30.23 -*/
   30.24 -
   30.25 -#ifdef SAVE_RCSID
   30.26 -static char rcsid =
   30.27 -    "@(#) $Id: SDL_syscond.c,v 1.2 2001/04/26 16:50:18 hercules Exp $";
   30.28 -#endif
   30.29 -
   30.30 -/* An implementation of condition variables using semaphores and mutexes */
   30.31 -/*
   30.32 -   This implementation borrows heavily from the BeOS condition variable
   30.33 -   implementation, written by Christopher Tate and Owen Smith.  Thanks!
   30.34 - */
   30.35 -
   30.36 -#include <stdio.h>
   30.37 -#include <stdlib.h>
   30.38 -
   30.39 -#include "SDL_error.h"
   30.40 -#include "SDL_thread.h"
   30.41 -
   30.42 -struct SDL_cond
   30.43 -{
   30.44 -    SDL_mutex *lock;
   30.45 -    int waiting;
   30.46 -    int signals;
   30.47 -    SDL_sem *wait_sem;
   30.48 -    SDL_sem *wait_done;
   30.49 -};
   30.50 -
   30.51 -/* Create a condition variable */
   30.52 -SDL_cond *
   30.53 -SDL_CreateCond(void)
   30.54 -{
   30.55 -    SDL_cond *cond;
   30.56 -
   30.57 -    cond = (SDL_cond *) malloc(sizeof(SDL_cond));
   30.58 -    if (cond) {
   30.59 -        cond->lock = SDL_CreateMutex();
   30.60 -        cond->wait_sem = SDL_CreateSemaphore(0);
   30.61 -        cond->wait_done = SDL_CreateSemaphore(0);
   30.62 -        cond->waiting = cond->signals = 0;
   30.63 -        if (!cond->lock || !cond->wait_sem || !cond->wait_done) {
   30.64 -            SDL_DestroyCond(cond);
   30.65 -            cond = NULL;
   30.66 -        }
   30.67 -    } else {
   30.68 -        SDL_OutOfMemory();
   30.69 -    }
   30.70 -    return (cond);
   30.71 -}
   30.72 -
   30.73 -/* Destroy a condition variable */
   30.74 -void
   30.75 -SDL_DestroyCond(SDL_cond * cond)
   30.76 -{
   30.77 -    if (cond) {
   30.78 -        if (cond->wait_sem) {
   30.79 -            SDL_DestroySemaphore(cond->wait_sem);
   30.80 -        }
   30.81 -        if (cond->wait_done) {
   30.82 -            SDL_DestroySemaphore(cond->wait_done);
   30.83 -        }
   30.84 -        if (cond->lock) {
   30.85 -            SDL_DestroyMutex(cond->lock);
   30.86 -        }
   30.87 -        free(cond);
   30.88 -    }
   30.89 -}
   30.90 -
   30.91 -/* Restart one of the threads that are waiting on the condition variable */
   30.92 -int
   30.93 -SDL_CondSignal(SDL_cond * cond)
   30.94 -{
   30.95 -    if (!cond) {
   30.96 -        SDL_SetError("Passed a NULL condition variable");
   30.97 -        return -1;
   30.98 -    }
   30.99 -
  30.100 -    /* If there are waiting threads not already signalled, then
  30.101 -       signal the condition and wait for the thread to respond.
  30.102 -     */
  30.103 -    SDL_LockMutex(cond->lock);
  30.104 -    if (cond->waiting > cond->signals) {
  30.105 -        ++cond->signals;
  30.106 -        SDL_SemPost(cond->wait_sem);
  30.107 -        SDL_UnlockMutex(cond->lock);
  30.108 -        SDL_SemWait(cond->wait_done);
  30.109 -    } else {
  30.110 -        SDL_UnlockMutex(cond->lock);
  30.111 -    }
  30.112 -
  30.113 -    return 0;
  30.114 -}
  30.115 -
  30.116 -/* Restart all threads that are waiting on the condition variable */
  30.117 -int
  30.118 -SDL_CondBroadcast(SDL_cond * cond)
  30.119 -{
  30.120 -    if (!cond) {
  30.121 -        SDL_SetError("Passed a NULL condition variable");
  30.122 -        return -1;
  30.123 -    }
  30.124 -
  30.125 -    /* If there are waiting threads not already signalled, then
  30.126 -       signal the condition and wait for the thread to respond.
  30.127 -     */
  30.128 -    SDL_LockMutex(cond->lock);
  30.129 -    if (cond->waiting > cond->signals) {
  30.130 -        int i, num_waiting;
  30.131 -
  30.132 -        num_waiting = (cond->waiting - cond->signals);
  30.133 -        cond->signals = cond->waiting;
  30.134 -        for (i = 0; i < num_waiting; ++i) {
  30.135 -            SDL_SemPost(cond->wait_sem);
  30.136 -        }
  30.137 -        /* Now all released threads are blocked here, waiting for us.
  30.138 -           Collect them all (and win fabulous prizes!) :-)
  30.139 -         */
  30.140 -        SDL_UnlockMutex(cond->lock);
  30.141 -        for (i = 0; i < num_waiting; ++i) {
  30.142 -            SDL_SemWait(cond->wait_done);
  30.143 -        }
  30.144 -    } else {
  30.145 -        SDL_UnlockMutex(cond->lock);
  30.146 -    }
  30.147 -
  30.148 -    return 0;
  30.149 -}
  30.150 -
  30.151 -/* Wait on the condition variable for at most 'ms' milliseconds.
  30.152 -   The mutex must be locked before entering this function!
  30.153 -   The mutex is unlocked during the wait, and locked again after the wait.
  30.154 -
  30.155 -Typical use:
  30.156 -
  30.157 -Thread A:
  30.158 -	SDL_LockMutex(lock);
  30.159 -	while ( ! condition ) {
  30.160 -		SDL_CondWait(cond);
  30.161 -	}
  30.162 -	SDL_UnlockMutex(lock);
  30.163 -
  30.164 -Thread B:
  30.165 -	SDL_LockMutex(lock);
  30.166 -	...
  30.167 -	condition = true;
  30.168 -	...
  30.169 -	SDL_UnlockMutex(lock);
  30.170 - */
  30.171 -int
  30.172 -SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
  30.173 -{
  30.174 -    int retval;
  30.175 -
  30.176 -    if (!cond) {
  30.177 -        SDL_SetError("Passed a NULL condition variable");
  30.178 -        return -1;
  30.179 -    }
  30.180 -
  30.181 -    /* Obtain the protection mutex, and increment the number of waiters.
  30.182 -       This allows the signal mechanism to only perform a signal if there
  30.183 -       are waiting threads.
  30.184 -     */
  30.185 -    SDL_LockMutex(cond->lock);
  30.186 -    ++cond->waiting;
  30.187 -    SDL_UnlockMutex(cond->lock);
  30.188 -
  30.189 -    /* Unlock the mutex, as is required by condition variable semantics */
  30.190 -    SDL_UnlockMutex(mutex);
  30.191 -
  30.192 -    /* Wait for a signal */
  30.193 -    if (ms == SDL_MUTEX_MAXWAIT) {
  30.194 -        retval = SDL_SemWait(cond->wait_sem);
  30.195 -    } else {
  30.196 -        retval = SDL_SemWaitTimeout(cond->wait_sem, ms);
  30.197 -    }
  30.198 -
  30.199 -    /* Let the signaler know we have completed the wait, otherwise
  30.200 -       the signaler can race ahead and get the condition semaphore
  30.201 -       if we are stopped between the mutex unlock and semaphore wait,
  30.202 -       giving a deadlock.  See the following URL for details:
  30.203 -       http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue40.html
  30.204 -     */
  30.205 -    SDL_LockMutex(cond->lock);
  30.206 -    if (cond->signals > 0) {
  30.207 -        /* If we timed out, we need to eat a condition signal */
  30.208 -        if (retval > 0) {
  30.209 -            SDL_SemWait(cond->wait_sem);
  30.210 -        }
  30.211 -        /* We always notify the signal thread that we are done */
  30.212 -        SDL_SemPost(cond->wait_done);
  30.213 -
  30.214 -        /* Signal handshake complete */
  30.215 -        --cond->signals;
  30.216 -    }
  30.217 -    --cond->waiting;
  30.218 -    SDL_UnlockMutex(cond->lock);
  30.219 -
  30.220 -    /* Lock the mutex, as is required by condition variable semantics */
  30.221 -    SDL_LockMutex(mutex);
  30.222 -
  30.223 -    return retval;
  30.224 -}
  30.225 -
  30.226 -/* Wait on the condition variable forever */
  30.227 -int
  30.228 -SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex)
  30.229 -{
  30.230 -    return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT);
  30.231 -}
  30.232 -
  30.233 -/* vi: set ts=4 sw=4 expandtab: */
    31.1 --- a/src/thread/nds/SDL_syscond_c.h	Sun Mar 17 09:21:08 2013 -0700
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,25 +0,0 @@
    31.4 -/*
    31.5 -  Simple DirectMedia Layer
    31.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    31.7 -
    31.8 -  This software is provided 'as-is', without any express or implied
    31.9 -  warranty.  In no event will the authors be held liable for any damages
   31.10 -  arising from the use of this software.
   31.11 -
   31.12 -  Permission is granted to anyone to use this software for any purpose,
   31.13 -  including commercial applications, and to alter it and redistribute it
   31.14 -  freely, subject to the following restrictions:
   31.15 -
   31.16 -  1. The origin of this software must not be misrepresented; you must not
   31.17 -     claim that you wrote the original software. If you use this software
   31.18 -     in a product, an acknowledgment in the product documentation would be
   31.19 -     appreciated but is not required.
   31.20 -  2. Altered source versions must be plainly marked as such, and must not be
   31.21 -     misrepresented as being the original software.
   31.22 -  3. This notice may not be removed or altered from any source distribution.
   31.23 -*/
   31.24 -
   31.25 -#ifdef SAVE_RCSID
   31.26 -static char rcsid =
   31.27 -    "@(#) $Id: SDL_syscond_c.h,v 1.2 2001/04/26 16:50:18 hercules Exp $";
   31.28 -#endif
    32.1 --- a/src/thread/nds/SDL_sysmutex.c	Sun Mar 17 09:21:08 2013 -0700
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,177 +0,0 @@
    32.4 -/*
    32.5 -  Simple DirectMedia Layer
    32.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    32.7 -
    32.8 -  This software is provided 'as-is', without any express or implied
    32.9 -  warranty.  In no event will the authors be held liable for any damages
   32.10 -  arising from the use of this software.
   32.11 -
   32.12 -  Permission is granted to anyone to use this software for any purpose,
   32.13 -  including commercial applications, and to alter it and redistribute it
   32.14 -  freely, subject to the following restrictions:
   32.15 -
   32.16 -  1. The origin of this software must not be misrepresented; you must not
   32.17 -     claim that you wrote the original software. If you use this software
   32.18 -     in a product, an acknowledgment in the product documentation would be
   32.19 -     appreciated but is not required.
   32.20 -  2. Altered source versions must be plainly marked as such, and must not be
   32.21 -     misrepresented as being the original software.
   32.22 -  3. This notice may not be removed or altered from any source distribution.
   32.23 -*/
   32.24 -
   32.25 -#ifdef SAVE_RCSID
   32.26 -static char rcsid =
   32.27 -    "@(#) $Id: SDL_sysmutex.c,v 1.2 2001/04/26 16:50:18 hercules Exp $";
   32.28 -#endif
   32.29 -
   32.30 -/* An implementation of mutexes using semaphores */
   32.31 -
   32.32 -#include <stdio.h>
   32.33 -#include <stdlib.h>
   32.34 -
   32.35 -#include "SDL_error.h"
   32.36 -#include "SDL_thread.h"
   32.37 -#include "SDL_systhread_c.h"
   32.38 -
   32.39 -
   32.40 -struct SDL_mutex
   32.41 -{
   32.42 -    int recursive;
   32.43 -    SDL_threadID owner;
   32.44 -    SDL_sem *sem;
   32.45 -};
   32.46 -
   32.47 -/* Create a mutex */
   32.48 -SDL_mutex *
   32.49 -SDL_CreateMutex(void)
   32.50 -{
   32.51 -    SDL_mutex *mutex;
   32.52 -
   32.53 -    /* Allocate mutex memory */
   32.54 -    mutex = (SDL_mutex *) malloc(sizeof(*mutex));
   32.55 -    if (mutex) {
   32.56 -        /* Create the mutex semaphore, with initial value 1 */
   32.57 -        mutex->sem = SDL_CreateSemaphore(1);
   32.58 -        mutex->recursive = 0;
   32.59 -        mutex->owner = 0;
   32.60 -        if (!mutex->sem) {
   32.61 -            free(mutex);
   32.62 -            mutex = NULL;
   32.63 -        }
   32.64 -    } else {
   32.65 -        SDL_OutOfMemory();
   32.66 -    }
   32.67 -    return mutex;
   32.68 -}
   32.69 -
   32.70 -/* Free the mutex */
   32.71 -void
   32.72 -SDL_DestroyMutex(SDL_mutex * mutex)
   32.73 -{
   32.74 -    if (mutex) {
   32.75 -        if (mutex->sem) {
   32.76 -            SDL_DestroySemaphore(mutex->sem);
   32.77 -        }
   32.78 -        free(mutex);
   32.79 -    }
   32.80 -}
   32.81 -
   32.82 -/* Lock the mutex */
   32.83 -int
   32.84 -SDL_LockMutex(SDL_mutex * mutex)
   32.85 -{
   32.86 -#ifdef DISABLE_THREADS
   32.87 -    return 0;
   32.88 -#else
   32.89 -    SDL_threadID this_thread;
   32.90 -
   32.91 -    if (mutex == NULL) {
   32.92 -        SDL_SetError("Passed a NULL mutex");
   32.93 -        return -1;
   32.94 -    }
   32.95 -
   32.96 -    this_thread = SDL_ThreadID();
   32.97 -    if (mutex->owner == this_thread) {
   32.98 -        ++mutex->recursive;
   32.99 -    } else {
  32.100 -        /* The order of operations is important.
  32.101 -           We set the locking thread id after we obtain the lock
  32.102 -           so unlocks from other threads will fail.
  32.103 -         */
  32.104 -        SDL_SemWait(mutex->sem);
  32.105 -        mutex->owner = this_thread;
  32.106 -        mutex->recursive = 0;
  32.107 -    }
  32.108 -
  32.109 -    return 0;
  32.110 -#endif /* DISABLE_THREADS */
  32.111 -}
  32.112 -
  32.113 -/* Try Lock the mutex */
  32.114 -int
  32.115 -SDL_TryLockMutex(SDL_mutex * mutex)
  32.116 -{
  32.117 -#ifdef DISABLE_THREADS
  32.118 -    return 0;
  32.119 -#else
  32.120 -    int retval = 0;
  32.121 -    SDL_threadID this_thread;
  32.122 -
  32.123 -    if (mutex == NULL) {
  32.124 -        SDL_SetError("Passed a NULL mutex");
  32.125 -        return -1;
  32.126 -    }
  32.127 -
  32.128 -    this_thread = SDL_ThreadID();
  32.129 -    if (mutex->owner == this_thread) {
  32.130 -        ++mutex->recursive;
  32.131 -    } else {
  32.132 -        /* The order of operations is important.
  32.133 -         We set the locking thread id after we obtain the lock
  32.134 -         so unlocks from other threads will fail.
  32.135 -         */
  32.136 -        retval = SDL_SemTryWait(mutex->sem);
  32.137 -        if (ret == 0) {
  32.138 -            mutex->owner = this_thread;
  32.139 -            mutex->recursive = 0;
  32.140 -        }
  32.141 -    }
  32.142 -
  32.143 -    return retval;
  32.144 -#endif /* DISABLE_THREADS */
  32.145 -}
  32.146 -
  32.147 -/* Unlock the mutex */
  32.148 -int
  32.149 -SDL_UnlockMutex(SDL_mutex * mutex)
  32.150 -{
  32.151 -#ifdef DISABLE_THREADS
  32.152 -    return 0;
  32.153 -#else
  32.154 -    if (mutex == NULL) {
  32.155 -        SDL_SetError("Passed a NULL mutex");
  32.156 -        return -1;
  32.157 -    }
  32.158 -
  32.159 -    /* If we don't own the mutex, we can't unlock it */
  32.160 -    if (SDL_ThreadID() != mutex->owner) {
  32.161 -        SDL_SetError("mutex not owned by this thread");
  32.162 -        return -1;
  32.163 -    }
  32.164 -
  32.165 -    if (mutex->recursive) {
  32.166 -        --mutex->recursive;
  32.167 -    } else {
  32.168 -        /* The order of operations is important.
  32.169 -           First reset the owner so another thread doesn't lock
  32.170 -           the mutex and set the ownership before we reset it,
  32.171 -           then release the lock semaphore.
  32.172 -         */
  32.173 -        mutex->owner = 0;
  32.174 -        SDL_SemPost(mutex->sem);
  32.175 -    }
  32.176 -    return 0;
  32.177 -#endif /* DISABLE_THREADS */
  32.178 -}
  32.179 -
  32.180 -/* vi: set ts=4 sw=4 expandtab: */
    33.1 --- a/src/thread/nds/SDL_sysmutex_c.h	Sun Mar 17 09:21:08 2013 -0700
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,25 +0,0 @@
    33.4 -/*
    33.5 -  Simple DirectMedia Layer
    33.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    33.7 -
    33.8 -  This software is provided 'as-is', without any express or implied
    33.9 -  warranty.  In no event will the authors be held liable for any damages
   33.10 -  arising from the use of this software.
   33.11 -
   33.12 -  Permission is granted to anyone to use this software for any purpose,
   33.13 -  including commercial applications, and to alter it and redistribute it
   33.14 -  freely, subject to the following restrictions:
   33.15 -
   33.16 -  1. The origin of this software must not be misrepresented; you must not
   33.17 -     claim that you wrote the original software. If you use this software
   33.18 -     in a product, an acknowledgment in the product documentation would be
   33.19 -     appreciated but is not required.
   33.20 -  2. Altered source versions must be plainly marked as such, and must not be
   33.21 -     misrepresented as being the original software.
   33.22 -  3. This notice may not be removed or altered from any source distribution.
   33.23 -*/
   33.24 -
   33.25 -#ifdef SAVE_RCSID
   33.26 -static char rcsid =
   33.27 -    "@(#) $Id: SDL_sysmutex_c.h,v 1.2 2001/04/26 16:50:18 hercules Exp $";
   33.28 -#endif
    34.1 --- a/src/thread/nds/SDL_syssem.c	Sun Mar 17 09:21:08 2013 -0700
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,229 +0,0 @@
    34.4 -/*
    34.5 -  Simple DirectMedia Layer
    34.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    34.7 -
    34.8 -  This software is provided 'as-is', without any express or implied
    34.9 -  warranty.  In no event will the authors be held liable for any damages
   34.10 -  arising from the use of this software.
   34.11 -
   34.12 -  Permission is granted to anyone to use this software for any purpose,
   34.13 -  including commercial applications, and to alter it and redistribute it
   34.14 -  freely, subject to the following restrictions:
   34.15 -
   34.16 -  1. The origin of this software must not be misrepresented; you must not
   34.17 -     claim that you wrote the original software. If you use this software
   34.18 -     in a product, an acknowledgment in the product documentation would be
   34.19 -     appreciated but is not required.
   34.20 -  2. Altered source versions must be plainly marked as such, and must not be
   34.21 -     misrepresented as being the original software.
   34.22 -  3. This notice may not be removed or altered from any source distribution.
   34.23 -*/
   34.24 -
   34.25 -#ifdef SAVE_RCSID
   34.26 -static char rcsid =
   34.27 -    "@(#) $Id: SDL_syssem.c,v 1.2 2001/04/26 16:50:18 hercules Exp $";
   34.28 -#endif
   34.29 -
   34.30 -/* An implementation of semaphores using mutexes and condition variables */
   34.31 -
   34.32 -#include <stdlib.h>
   34.33 -
   34.34 -#include "SDL_error.h"
   34.35 -#include "SDL_timer.h"
   34.36 -#include "SDL_thread.h"
   34.37 -#include "SDL_systhread_c.h"
   34.38 -
   34.39 -
   34.40 -#ifdef DISABLE_THREADS
   34.41 -
   34.42 -SDL_sem *
   34.43 -SDL_CreateSemaphore(Uint32 initial_value)
   34.44 -{
   34.45 -    SDL_SetError("SDL not configured with thread support");
   34.46 -    return (SDL_sem *) 0;
   34.47 -}
   34.48 -
   34.49 -void
   34.50 -SDL_DestroySemaphore(SDL_sem * sem)
   34.51 -{
   34.52 -    return;
   34.53 -}
   34.54 -
   34.55 -int
   34.56 -SDL_SemTryWait(SDL_sem * sem)
   34.57 -{
   34.58 -    SDL_SetError("SDL not configured with thread support");
   34.59 -    return -1;
   34.60 -}
   34.61 -
   34.62 -int
   34.63 -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
   34.64 -{
   34.65 -    SDL_SetError("SDL not configured with thread support");
   34.66 -    return -1;
   34.67 -}
   34.68 -
   34.69 -int
   34.70 -SDL_SemWait(SDL_sem * sem)
   34.71 -{
   34.72 -    SDL_SetError("SDL not configured with thread support");
   34.73 -    return -1;
   34.74 -}
   34.75 -
   34.76 -Uint32
   34.77 -SDL_SemValue(SDL_sem * sem)
   34.78 -{
   34.79 -    return 0;
   34.80 -}
   34.81 -
   34.82 -int
   34.83 -SDL_SemPost(SDL_sem * sem)
   34.84 -{
   34.85 -    SDL_SetError("SDL not configured with thread support");
   34.86 -    return -1;
   34.87 -}
   34.88 -
   34.89 -#else
   34.90 -
   34.91 -struct SDL_semaphore
   34.92 -{
   34.93 -    Uint32 count;
   34.94 -    Uint32 waiters_count;
   34.95 -    SDL_mutex *count_lock;
   34.96 -    SDL_cond *count_nonzero;
   34.97 -};
   34.98 -
   34.99 -SDL_sem *
  34.100 -SDL_CreateSemaphore(Uint32 initial_value)
  34.101 -{
  34.102 -    SDL_sem *sem;
  34.103 -
  34.104 -    sem = (SDL_sem *) malloc(sizeof(*sem));
  34.105 -    if (!sem) {
  34.106 -        SDL_OutOfMemory();
  34.107 -        return (0);
  34.108 -    }
  34.109 -    sem->count = initial_value;
  34.110 -    sem->waiters_count = 0;
  34.111 -
  34.112 -    sem->count_lock = SDL_CreateMutex();
  34.113 -    sem->count_nonzero = SDL_CreateCond();
  34.114 -    if (!sem->count_lock || !sem->count_nonzero) {
  34.115 -        SDL_DestroySemaphore(sem);
  34.116 -        return (0);
  34.117 -    }
  34.118 -
  34.119 -    return (sem);
  34.120 -}
  34.121 -
  34.122 -/* WARNING:
  34.123 -   You cannot call this function when another thread is using the semaphore.
  34.124 -*/
  34.125 -void
  34.126 -SDL_DestroySemaphore(SDL_sem * sem)
  34.127 -{
  34.128 -    if (sem) {
  34.129 -        sem->count = 0xFFFFFFFF;
  34.130 -        while (sem->waiters_count > 0) {
  34.131 -            SDL_CondSignal(sem->count_nonzero);
  34.132 -            SDL_Delay(10);
  34.133 -        }
  34.134 -        SDL_DestroyCond(sem->count_nonzero);
  34.135 -        SDL_LockMutex(sem->count_lock);
  34.136 -        SDL_UnlockMutex(sem->count_lock);
  34.137 -        SDL_DestroyMutex(sem->count_lock);
  34.138 -        free(sem);
  34.139 -    }
  34.140 -}
  34.141 -
  34.142 -int
  34.143 -SDL_SemTryWait(SDL_sem * sem)
  34.144 -{
  34.145 -    int retval;
  34.146 -
  34.147 -    if (!sem) {
  34.148 -        SDL_SetError("Passed a NULL semaphore");
  34.149 -        return -1;
  34.150 -    }
  34.151 -
  34.152 -    retval = SDL_MUTEX_TIMEDOUT;
  34.153 -    SDL_LockMutex(sem->count_lock);
  34.154 -    if (sem->count > 0) {
  34.155 -        --sem->count;
  34.156 -        retval = 0;
  34.157 -    }
  34.158 -    SDL_UnlockMutex(sem->count_lock);
  34.159 -
  34.160 -    return retval;
  34.161 -}
  34.162 -
  34.163 -int
  34.164 -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
  34.165 -{
  34.166 -    int retval;
  34.167 -
  34.168 -    if (!sem) {
  34.169 -        SDL_SetError("Passed a NULL semaphore");
  34.170 -        return -1;
  34.171 -    }
  34.172 -
  34.173 -    /* A timeout of 0 is an easy case */
  34.174 -    if (timeout == 0) {
  34.175 -        return SDL_SemTryWait(sem);
  34.176 -    }
  34.177 -
  34.178 -    SDL_LockMutex(sem->count_lock);
  34.179 -    ++sem->waiters_count;
  34.180 -    retval = 0;
  34.181 -    while ((sem->count == 0) && (retval != SDL_MUTEX_TIMEDOUT)) {
  34.182 -        retval = SDL_CondWaitTimeout(sem->count_nonzero,
  34.183 -                                     sem->count_lock, timeout);
  34.184 -    }
  34.185 -    --sem->waiters_count;
  34.186 -    --sem->count;
  34.187 -    SDL_UnlockMutex(sem->count_lock);
  34.188 -
  34.189 -    return retval;
  34.190 -}
  34.191 -
  34.192 -int
  34.193 -SDL_SemWait(SDL_sem * sem)
  34.194 -{
  34.195 -    return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
  34.196 -}
  34.197 -
  34.198 -Uint32
  34.199 -SDL_SemValue(SDL_sem * sem)
  34.200 -{
  34.201 -    Uint32 value;
  34.202 -
  34.203 -    value = 0;
  34.204 -    if (sem) {
  34.205 -        SDL_LockMutex(sem->count_lock);
  34.206 -        value = sem->count;
  34.207 -        SDL_UnlockMutex(sem->count_lock);
  34.208 -    }
  34.209 -    return value;
  34.210 -}
  34.211 -
  34.212 -int
  34.213 -SDL_SemPost(SDL_sem * sem)
  34.214 -{
  34.215 -    if (!sem) {
  34.216 -        SDL_SetError("Passed a NULL semaphore");
  34.217 -        return -1;
  34.218 -    }
  34.219 -
  34.220 -    SDL_LockMutex(sem->count_lock);
  34.221 -    if (sem->waiters_count > 0) {
  34.222 -        SDL_CondSignal(sem->count_nonzero);
  34.223 -    }
  34.224 -    ++sem->count;
  34.225 -    SDL_UnlockMutex(sem->count_lock);
  34.226 -
  34.227 -    return 0;
  34.228 -}
  34.229 -
  34.230 -#endif /* DISABLE_THREADS */
  34.231 -
  34.232 -/* vi: set ts=4 sw=4 expandtab: */
    35.1 --- a/src/thread/nds/SDL_syssem_c.h	Sun Mar 17 09:21:08 2013 -0700
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,25 +0,0 @@
    35.4 -/*
    35.5 -  Simple DirectMedia Layer
    35.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    35.7 -
    35.8 -  This software is provided 'as-is', without any express or implied
    35.9 -  warranty.  In no event will the authors be held liable for any damages
   35.10 -  arising from the use of this software.
   35.11 -
   35.12 -  Permission is granted to anyone to use this software for any purpose,
   35.13 -  including commercial applications, and to alter it and redistribute it
   35.14 -  freely, subject to the following restrictions:
   35.15 -
   35.16 -  1. The origin of this software must not be misrepresented; you must not
   35.17 -     claim that you wrote the original software. If you use this software
   35.18 -     in a product, an acknowledgment in the product documentation would be
   35.19 -     appreciated but is not required.
   35.20 -  2. Altered source versions must be plainly marked as such, and must not be
   35.21 -     misrepresented as being the original software.
   35.22 -  3. This notice may not be removed or altered from any source distribution.
   35.23 -*/
   35.24 -
   35.25 -#ifdef SAVE_RCSID
   35.26 -static char rcsid =
   35.27 -    "@(#) $Id: SDL_syssem_c.h,v 1.2 2001/04/26 16:50:18 hercules Exp $";
   35.28 -#endif
    36.1 --- a/src/thread/nds/SDL_systhread.c	Sun Mar 17 09:21:08 2013 -0700
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,64 +0,0 @@
    36.4 -/*
    36.5 -  Simple DirectMedia Layer
    36.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    36.7 -
    36.8 -  This software is provided 'as-is', without any express or implied
    36.9 -  warranty.  In no event will the authors be held liable for any damages
   36.10 -  arising from the use of this software.
   36.11 -
   36.12 -  Permission is granted to anyone to use this software for any purpose,
   36.13 -  including commercial applications, and to alter it and redistribute it
   36.14 -  freely, subject to the following restrictions:
   36.15 -
   36.16 -  1. The origin of this software must not be misrepresented; you must not
   36.17 -     claim that you wrote the original software. If you use this software
   36.18 -     in a product, an acknowledgment in the product documentation would be
   36.19 -     appreciated but is not required.
   36.20 -  2. Altered source versions must be plainly marked as such, and must not be
   36.21 -     misrepresented as being the original software.
   36.22 -  3. This notice may not be removed or altered from any source distribution.
   36.23 -*/
   36.24 -
   36.25 -#ifdef SAVE_RCSID
   36.26 -static char rcsid =
   36.27 -    "@(#) $Id: SDL_systhread.c,v 1.2 2001/04/26 16:50:18 hercules Exp $";
   36.28 -#endif
   36.29 -
   36.30 -/* Thread management routines for SDL */
   36.31 -
   36.32 -#include "SDL_error.h"
   36.33 -#include "SDL_thread.h"
   36.34 -#include "../SDL_systhread.h"
   36.35 -
   36.36 -int
   36.37 -SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
   36.38 -{
   36.39 -    SDL_SetError("Threads are not supported on this platform");
   36.40 -    return (-1);
   36.41 -}
   36.42 -
   36.43 -void
   36.44 -SDL_SYS_SetupThread(const char *name)
   36.45 -{
   36.46 -    return;
   36.47 -}
   36.48 -
   36.49 -SDL_threadID
   36.50 -SDL_ThreadID(void)
   36.51 -{
   36.52 -    return (0);
   36.53 -}
   36.54 -
   36.55 -void
   36.56 -SDL_SYS_WaitThread(SDL_Thread * thread)
   36.57 -{
   36.58 -    return;
   36.59 -}
   36.60 -
   36.61 -int
   36.62 -SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
   36.63 -{
   36.64 -    return (0);
   36.65 -}
   36.66 -
   36.67 -/* vi: set ts=4 sw=4 expandtab: */
    37.1 --- a/src/thread/nds/SDL_systhread_c.h	Sun Mar 17 09:21:08 2013 -0700
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,27 +0,0 @@
    37.4 -/*
    37.5 -  Simple DirectMedia Layer
    37.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    37.7 -
    37.8 -  This software is provided 'as-is', without any express or implied
    37.9 -  warranty.  In no event will the authors be held liable for any damages
   37.10 -  arising from the use of this software.
   37.11 -
   37.12 -  Permission is granted to anyone to use this software for any purpose,
   37.13 -  including commercial applications, and to alter it and redistribute it
   37.14 -  freely, subject to the following restrictions:
   37.15 -
   37.16 -  1. The origin of this software must not be misrepresented; you must not
   37.17 -     claim that you wrote the original software. If you use this software
   37.18 -     in a product, an acknowledgment in the product documentation would be
   37.19 -     appreciated but is not required.
   37.20 -  2. Altered source versions must be plainly marked as such, and must not be
   37.21 -     misrepresented as being the original software.
   37.22 -  3. This notice may not be removed or altered from any source distribution.
   37.23 -*/
   37.24 -
   37.25 -/* Stub until we implement threads on this platform */
   37.26 -typedef int SYS_ThreadHandle;
   37.27 -
   37.28 -#ifndef DISABLE_THREADS
   37.29 -#define DISABLE_THREADS
   37.30 -#endif
    38.1 --- a/src/timer/nds/SDL_systimer.c	Sun Mar 17 09:21:08 2013 -0700
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,78 +0,0 @@
    38.4 -/*
    38.5 -  Simple DirectMedia Layer
    38.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    38.7 -
    38.8 -  This software is provided 'as-is', without any express or implied
    38.9 -  warranty.  In no event will the authors be held liable for any damages
   38.10 -  arising from the use of this software.
   38.11 -
   38.12 -  Permission is granted to anyone to use this software for any purpose,
   38.13 -  including commercial applications, and to alter it and redistribute it
   38.14 -  freely, subject to the following restrictions:
   38.15 -
   38.16 -  1. The origin of this software must not be misrepresented; you must not
   38.17 -     claim that you wrote the original software. If you use this software
   38.18 -     in a product, an acknowledgment in the product documentation would be
   38.19 -     appreciated but is not required.
   38.20 -  2. Altered source versions must be plainly marked as such, and must not be
   38.21 -     misrepresented as being the original software.
   38.22 -  3. This notice may not be removed or altered from any source distribution.
   38.23 -*/
   38.24 -#include "SDL_config.h"
   38.25 -
   38.26 -#ifdef SDL_TIMER_NDS
   38.27 -
   38.28 -#include <nds.h>
   38.29 -#include <nds/timers.h>
   38.30 -
   38.31 -#include "SDL_timer.h"
   38.32 -
   38.33 -/* Will wrap after 49 days. Shouldn't be an issue. */
   38.34 -static volatile Uint32 timer_ticks;
   38.35 -
   38.36 -static void
   38.37 -NDS_TimerInterrupt(void)
   38.38 -{
   38.39 -    timer_ticks++;
   38.40 -}
   38.41 -
   38.42 -void
   38.43 -SDL_StartTicks(void)
   38.44 -{
   38.45 -    timer_ticks = 0;
   38.46 -
   38.47 -	/* Set timer 2 to fire every ms. */
   38.48 -	timerStart(2, ClockDivider_1024, TIMER_FREQ_1024(1000), NDS_TimerInterrupt);
   38.49 -}
   38.50 -
   38.51 -Uint32
   38.52 -SDL_GetTicks(void)
   38.53 -{
   38.54 -    return timer_ticks;
   38.55 -}
   38.56 -
   38.57 -Uint64
   38.58 -SDL_GetPerformanceCounter(void)
   38.59 -{
   38.60 -    return SDL_GetTicks();
   38.61 -}
   38.62 -
   38.63 -Uint64
   38.64 -SDL_GetPerformanceFrequency(void)
   38.65 -{
   38.66 -    return 1000;
   38.67 -}
   38.68 -
   38.69 -void
   38.70 -SDL_Delay(Uint32 ms)
   38.71 -{
   38.72 -    Uint32 start = SDL_GetTicks();
   38.73 -    while (1) {
   38.74 -        if ((SDL_GetTicks() - start) >= ms)
   38.75 -            break;
   38.76 -    }
   38.77 -}
   38.78 -
   38.79 -#endif /* SDL_TIMER_NDS */
   38.80 -
   38.81 -/* vi: set ts=4 sw=4 expandtab: */
    39.1 --- a/src/video/SDL_sysvideo.h	Sun Mar 17 09:21:08 2013 -0700
    39.2 +++ b/src/video/SDL_sysvideo.h	Sun Mar 17 09:44:58 2013 -0700
    39.3 @@ -341,9 +341,6 @@
    39.4  #if SDL_VIDEO_DRIVER_PANDORA
    39.5  extern VideoBootStrap PND_bootstrap;
    39.6  #endif
    39.7 -#if SDL_VIDEO_DRIVER_NDS
    39.8 -extern VideoBootStrap NDS_bootstrap;
    39.9 -#endif
   39.10  #if SDL_VIDEO_DRIVER_UIKIT
   39.11  extern VideoBootStrap UIKIT_bootstrap;
   39.12  #endif
    40.1 --- a/src/video/SDL_video.c	Sun Mar 17 09:21:08 2013 -0700
    40.2 +++ b/src/video/SDL_video.c	Sun Mar 17 09:44:58 2013 -0700
    40.3 @@ -69,9 +69,6 @@
    40.4  #if SDL_VIDEO_DRIVER_PANDORA
    40.5      &PND_bootstrap,
    40.6  #endif
    40.7 -#if SDL_VIDEO_DRIVER_NDS
    40.8 -    &NDS_bootstrap,
    40.9 -#endif
   40.10  #if SDL_VIDEO_DRIVER_UIKIT
   40.11      &UIKIT_bootstrap,
   40.12  #endif
    41.1 --- a/src/video/nds/SDL_ndsevents.c	Sun Mar 17 09:21:08 2013 -0700
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,54 +0,0 @@
    41.4 -/*
    41.5 -  Simple DirectMedia Layer
    41.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    41.7 -
    41.8 -  This software is provided 'as-is', without any express or implied
    41.9 -  warranty.  In no event will the authors be held liable for any damages
   41.10 -  arising from the use of this software.
   41.11 -
   41.12 -  Permission is granted to anyone to use this software for any purpose,
   41.13 -  including commercial applications, and to alter it and redistribute it
   41.14 -  freely, subject to the following restrictions:
   41.15 -
   41.16 -  1. The origin of this software must not be misrepresented; you must not
   41.17 -     claim that you wrote the original software. If you use this software
   41.18 -     in a product, an acknowledgment in the product documentation would be
   41.19 -     appreciated but is not required.
   41.20 -  2. Altered source versions must be plainly marked as such, and must not be
   41.21 -     misrepresented as being the original software.
   41.22 -  3. This notice may not be removed or altered from any source distribution.
   41.23 -*/
   41.24 -#include "SDL_config.h"
   41.25 -
   41.26 -#if SDL_VIDEO_DRIVER_NDS
   41.27 -
   41.28 -#include <stdio.h>
   41.29 -#include <stdlib.h>
   41.30 -#include <nds.h>
   41.31 -
   41.32 -#include "../../events/SDL_events_c.h"
   41.33 -
   41.34 -#include "SDL_ndsvideo.h"
   41.35 -#include "SDL_ndsevents_c.h"
   41.36 -
   41.37 -void
   41.38 -NDS_PumpEvents(_THIS)
   41.39 -{
   41.40 -    scanKeys();
   41.41 -    /* TODO: defer click-age */
   41.42 -    if (keysDown() & KEY_TOUCH) {
   41.43 -        SDL_SendMouseButton(NULL, 0, SDL_PRESSED, 0);
   41.44 -    } else if (keysUp() & KEY_TOUCH) {
   41.45 -        SDL_SendMouseButton(NULL, 0, SDL_RELEASED, 0);
   41.46 -    }
   41.47 -    if (keysHeld() & KEY_TOUCH) {
   41.48 -		touchPosition t;
   41.49 -
   41.50 -		touchRead(&t);
   41.51 -        SDL_SendMouseMotion(NULL, 0, 0, t.px, t.py);
   41.52 -    }
   41.53 -}
   41.54 -
   41.55 -#endif /* SDL_VIDEO_DRIVER_NDS */
   41.56 -
   41.57 -/* vi: set ts=4 sw=4 expandtab: */
    42.1 --- a/src/video/nds/SDL_ndsevents_c.h	Sun Mar 17 09:21:08 2013 -0700
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,27 +0,0 @@
    42.4 -/*
    42.5 -  Simple DirectMedia Layer
    42.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    42.7 -
    42.8 -  This software is provided 'as-is', without any express or implied
    42.9 -  warranty.  In no event will the authors be held liable for any damages
   42.10 -  arising from the use of this software.
   42.11 -
   42.12 -  Permission is granted to anyone to use this software for any purpose,
   42.13 -  including commercial applications, and to alter it and redistribute it
   42.14 -  freely, subject to the following restrictions:
   42.15 -
   42.16 -  1. The origin of this software must not be misrepresented; you must not
   42.17 -     claim that you wrote the original software. If you use this software
   42.18 -     in a product, an acknowledgment in the product documentation would be
   42.19 -     appreciated but is not required.
   42.20 -  2. Altered source versions must be plainly marked as such, and must not be
   42.21 -     misrepresented as being the original software.
   42.22 -  3. This notice may not be removed or altered from any source distribution.
   42.23 -*/
   42.24 -#include "SDL_config.h"
   42.25 -
   42.26 -#include "SDL_ndsvideo.h"
   42.27 -
   42.28 -extern void NDS_PumpEvents(_THIS);
   42.29 -
   42.30 -/* vi: set ts=4 sw=4 expandtab: */
    43.1 --- a/src/video/nds/SDL_ndsvideo.c	Sun Mar 17 09:21:08 2013 -0700
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,401 +0,0 @@
    43.4 -/*
    43.5 -  Simple DirectMedia Layer
    43.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    43.7 -
    43.8 -  This software is provided 'as-is', without any express or implied
    43.9 -  warranty.  In no event will the authors be held liable for any damages
   43.10 -  arising from the use of this software.
   43.11 -
   43.12 -  Permission is granted to anyone to use this software for any purpose,
   43.13 -  including commercial applications, and to alter it and redistribute it
   43.14 -  freely, subject to the following restrictions:
   43.15 -
   43.16 -  1. The origin of this software must not be misrepresented; you must not
   43.17 -     claim that you wrote the original software. If you use this software
   43.18 -     in a product, an acknowledgment in the product documentation would be
   43.19 -     appreciated but is not required.
   43.20 -  2. Altered source versions must be plainly marked as such, and must not be
   43.21 -     misrepresented as being the original software.
   43.22 -  3. This notice may not be removed or altered from any source distribution.
   43.23 -*/
   43.24 -#include "SDL_config.h"
   43.25 -
   43.26 -#if SDL_VIDEO_DRIVER_NDS
   43.27 -
   43.28 -/* SDL Nintendo DS video driver implementation */
   43.29 -
   43.30 -#include <stdio.h>
   43.31 -#include <stdlib.h>
   43.32 -#include <nds.h>
   43.33 -#include <fat.h>
   43.34 -
   43.35 -#include "SDL_video.h"
   43.36 -#include "SDL_ndsvideo.h"
   43.37 -#include "SDL_ndsevents_c.h"
   43.38 -#include "../../render/SDL_sysrender.h"
   43.39 -#include "../../render/nds/SDL_libgl2D.h"
   43.40 -#include "SDL_log.h"
   43.41 -
   43.42 -#define NDSVID_DRIVER_NAME "nds"
   43.43 -
   43.44 -static SDL_DisplayMode display_modes[] =
   43.45 -{
   43.46 -	/* Only one screen */
   43.47 -	{
   43.48 -		.format = SDL_PIXELFORMAT_ABGR1555,
   43.49 -		.w = SCREEN_WIDTH,
   43.50 -		.h = SCREEN_HEIGHT,
   43.51 -		.refresh_rate = 60,
   43.52 -	},
   43.53 -
   43.54 -	/* Aggregated display (two screens) with no gap. */
   43.55 -	{
   43.56 -		.format = SDL_PIXELFORMAT_ABGR1555,
   43.57 -		.w = SCREEN_WIDTH,
   43.58 -		.h = 2*SCREEN_HEIGHT+SCREEN_GAP,
   43.59 -		.refresh_rate = 60,
   43.60 -	},
   43.61 -
   43.62 -	/* Aggregated display (two screens) with a gap. */
   43.63 -	{
   43.64 -		.format = SDL_PIXELFORMAT_ABGR1555,
   43.65 -		.w = SCREEN_WIDTH,
   43.66 -		.h = 2*SCREEN_HEIGHT,
   43.67 -		.refresh_rate = 60,
   43.68 -	},
   43.69 -
   43.70 -	/* Last entry */
   43.71 -	{
   43.72 -		.w = 0,
   43.73 -	}
   43.74 -};
   43.75 -
   43.76 -/* This function must not be optimized nor inlined, else the pointer
   43.77 - * to the message will be in the wrong register, and the emulator won't
   43.78 - * find the string. */
   43.79 -__attribute__ ((noinline, optimize (0)))
   43.80 -static void NDS_DebugOutput2(const char* message) 
   43.81 -{
   43.82 -#ifdef __thumb__
   43.83 -	asm volatile ("swi #0xfc");
   43.84 -#else
   43.85 -	asm volatile ("swi #0xfc0000");
   43.86 -#endif
   43.87 -}
   43.88 -
   43.89 -static void NDS_DebugOutput(void *userdata, int category, SDL_LogPriority priority, const char *message)
   43.90 -{
   43.91 -	NDS_DebugOutput2(message);
   43.92 -}
   43.93 -
   43.94 -/* SDL NDS driver bootstrap functions */
   43.95 -static int NDS_Available(void)
   43.96 -{
   43.97 -    return 1;                 /* always here */
   43.98 -}
   43.99 -
  43.100 -#ifndef USE_HW_RENDERER
  43.101 -static int NDS_CreateWindowFramebuffer(_THIS, SDL_Window *window,
  43.102 -									   Uint32 *format, void **pixels,
  43.103 -									   int *pitch)
  43.104 -{
  43.105 -	struct NDS_WindowData *wdata;
  43.106 -    int bpp;
  43.107 -    Uint32 Rmask, Gmask, Bmask, Amask;
  43.108 -	const SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
  43.109 -	const SDL_DisplayMode *mode = display->driverdata;
  43.110 -	const Uint32 fmt = mode->format;
  43.111 -
  43.112 -	if (fmt != SDL_PIXELFORMAT_ABGR1555) {
  43.113 -		SDL_SetError("Unsupported pixel format (%x)", fmt);
  43.114 -		return -1;
  43.115 -	}
  43.116 -
  43.117 -    if (!SDL_PixelFormatEnumToMasks
  43.118 -        (fmt, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
  43.119 -        SDL_SetError("Unknown texture format");
  43.120 -        return -1;
  43.121 -    }
  43.122 -
  43.123 -	wdata = SDL_calloc(1, sizeof(struct NDS_WindowData));
  43.124 -	if (!wdata) {
  43.125 -		SDL_OutOfMemory();
  43.126 -		return -1;
  43.127 -	}
  43.128 -
  43.129 -	if (bpp == 8) {
  43.130 -		wdata->pixels_length = (SCREEN_HEIGHT+SCREEN_GAP+SCREEN_HEIGHT)*SCREEN_WIDTH;
  43.131 -	} else {
  43.132 -		wdata->pixels_length = (SCREEN_HEIGHT+SCREEN_GAP+SCREEN_HEIGHT)*SCREEN_WIDTH*2;
  43.133 -	}
  43.134 -	wdata->pixels = SDL_calloc(1, wdata->pixels_length);
  43.135 -	if (!wdata->pixels) {
  43.136 -		SDL_free(wdata);
  43.137 -		SDL_SetError("Not enough memory");
  43.138 -        return -1;
  43.139 -    }
  43.140 -
  43.141 -	if (bpp == 8) {
  43.142 -		wdata->main.bg_id = bgInit(2, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
  43.143 -		wdata->sub.bg_id = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
  43.144 -
  43.145 -		wdata->main.length = SCREEN_HEIGHT*SCREEN_WIDTH;
  43.146 -		wdata->main.pixels = wdata->pixels;
  43.147 -
  43.148 -		wdata->sub.length = SCREEN_HEIGHT*SCREEN_WIDTH;
  43.149 -		wdata->sub.pixels = (u8 *)wdata->pixels + wdata->main.length;	/* or ...+SCREEN_GAP */
  43.150 -			
  43.151 -	} else {
  43.152 -		wdata->main.bg_id = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
  43.153 -		wdata->sub.bg_id = bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
  43.154 -
  43.155 -		wdata->main.length = SCREEN_HEIGHT*SCREEN_WIDTH*2;
  43.156 -		wdata->main.pixels = wdata->pixels;
  43.157 -
  43.158 -		wdata->sub.length = SCREEN_HEIGHT*SCREEN_WIDTH*2;
  43.159 -		wdata->sub.pixels = (u8 *)wdata->pixels + wdata->main.length;	/* or ...+SCREEN_GAP */
  43.160 -	}
  43.161 -
  43.162 -	wdata->pitch = (window->w) * ((bpp+1) / 8);
  43.163 -	wdata->bpp = bpp;
  43.164 -	wdata->rotate = 0;
  43.165 -	wdata->scale.x = 0x100;
  43.166 -	wdata->scale.y = 0x100;
  43.167 -	wdata->scroll.x = 0;
  43.168 -	wdata->scroll.y = 0;
  43.169 -
  43.170 -	wdata->main.vram_pixels = bgGetGfxPtr(wdata->main.bg_id);
  43.171 -	wdata->sub.vram_pixels = bgGetGfxPtr(wdata->sub.bg_id);
  43.172 -
  43.173 -#if 0
  43.174 -	bgSetCenter(wdata->main.bg_id, 0, 0);
  43.175 -	bgSetRotateScale(wdata->main.bg_id, wdata->rotate, wdata->scale.x,
  43.176 -					 wdata->scale.y);
  43.177 -	bgSetScroll(wdata->main.bg_id, wdata->scroll.x, wdata->scroll.y);
  43.178 -#endif
  43.179 -
  43.180 -#if 0
  43.181 -	bgSetCenter(wdata->sub.bg_id, 0, 0);
  43.182 -	bgSetRotateScale(wdata->sub.bg_id, wdata->rotate, wdata->scale.x,
  43.183 -					 wdata->scale.y);
  43.184 -	bgSetScroll(wdata->sub.bg_id, wdata->scroll.x, wdata->scroll.y);
  43.185 -#endif
  43.186 -
  43.187 -	bgUpdate();
  43.188 -
  43.189 -	*format = fmt;
  43.190 -	*pixels = wdata->pixels;
  43.191 -	*pitch = wdata->pitch;
  43.192 -
  43.193 -	window->driverdata = wdata;
  43.194 -
  43.195 -	return 0;
  43.196 -}
  43.197 -
  43.198 -static int NDS_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
  43.199 -									   SDL_Rect * rects, int numrects)
  43.200 -{
  43.201 -	struct NDS_WindowData *wdata = window->driverdata;
  43.202 -
  43.203 -	/* Copy everything. TODO: use rects/numrects. */
  43.204 -	DC_FlushRange(wdata->pixels, wdata->pixels_length);
  43.205 -
  43.206 -	swiWaitForVBlank();
  43.207 -
  43.208 -	dmaCopy(wdata->main.pixels, wdata->main.vram_pixels, wdata->main.length);
  43.209 -	dmaCopy(wdata->sub.pixels, wdata->sub.vram_pixels, wdata->sub.length);
  43.210 -
  43.211 -    return 0;
  43.212 -}
  43.213 -
  43.214 -static void NDS_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
  43.215 -{
  43.216 -    struct NDS_WindowData *wdata = window->driverdata;
  43.217 -
  43.218 -    SDL_free(wdata->pixels);
  43.219 -    SDL_free(wdata);
  43.220 -}
  43.221 -#endif
  43.222 -
  43.223 -#ifdef USE_HW_RENDERER
  43.224 -/* Set up a 2D layer construced of bitmap sprites. This holds the
  43.225 - * image when rendering to the top screen. From libnds example. 
  43.226 - */
  43.227 -static void initSubSprites(void)
  43.228 -{
  43.229 -    oamInit(&oamSub, SpriteMapping_Bmp_2D_256, false);
  43.230 - 
  43.231 -    int x = 0;
  43.232 -    int y = 0;
  43.233 - 
  43.234 -    int id = 0;
  43.235 -
  43.236 -    //set up a 4x3 grid of 64x64 sprites to cover the screen
  43.237 -    for(y = 0; y < 3; y++)
  43.238 -    for(x = 0; x < 4; x++)
  43.239 -    {
  43.240 -        oamSub.oamMemory[id].attribute[0] = ATTR0_BMP | ATTR0_SQUARE | (64 * y);
  43.241 -        oamSub.oamMemory[id].attribute[1] = ATTR1_SIZE_64 | (64 * x);
  43.242 -        oamSub.oamMemory[id].attribute[2] = ATTR2_ALPHA(1) | (8 * 32 * y) | (8 * x);
  43.243 -        id++;
  43.244 -    }
  43.245 - 
  43.246 -    swiWaitForVBlank();
  43.247 - 
  43.248 -    oamUpdate(&oamSub);
  43.249 -}
  43.250 -#endif
  43.251 -
  43.252 -static int NDS_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
  43.253 -{
  43.254 -	display->driverdata = mode->driverdata;
  43.255 -
  43.256 -    powerOn(POWER_ALL_2D);
  43.257 -
  43.258 -#ifdef USE_HW_RENDERER
  43.259 -
  43.260 -	videoSetMode(MODE_5_3D);
  43.261 -	videoSetModeSub(MODE_5_2D);
  43.262 -
  43.263 -	/* initialize gl2d */
  43.264 -	glScreen2D();
  43.265 -	glBegin2D();
  43.266 -	
  43.267 -	vramSetBankA(VRAM_A_TEXTURE);
  43.268 -	vramSetBankB(VRAM_B_TEXTURE );
  43.269 -	vramSetBankC(VRAM_C_SUB_BG_0x06200000);
  43.270 -	vramSetBankE(VRAM_E_TEX_PALETTE);
  43.271 -
  43.272 -    // sub sprites hold the bottom image when 3D directed to top
  43.273 -    initSubSprites();
  43.274 - 
  43.275 -    // sub background holds the top image when 3D directed to bottom
  43.276 -    bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
  43.277 -#else
  43.278 -
  43.279 -	/* Select mode 5 for both screens. Can do Extended Rotation
  43.280 -	 * Background on both (BG 2 and 3). */
  43.281 -	videoSetMode(MODE_5_2D);
  43.282 -	videoSetModeSub(MODE_5_2D);
  43.283 -
  43.284 -	vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
  43.285 -	vramSetBankB(VRAM_B_TEXTURE );
  43.286 -	vramSetBankC(VRAM_C_SUB_BG_0x06200000);
  43.287 -	vramSetBankE(VRAM_E_TEX_PALETTE);
  43.288 -
  43.289 -#endif
  43.290 -
  43.291 -    return 0;
  43.292 -}
  43.293 -
  43.294 -void NDS_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
  43.295 -{
  43.296 -    SDL_DisplayMode *mode;
  43.297 -
  43.298 -	for (mode = display_modes; mode->w; mode++) {
  43.299 -		mode->driverdata = mode; /* point back to self */
  43.300 -		SDL_AddDisplayMode(display, mode);
  43.301 -	}
  43.302 -}
  43.303 -
  43.304 -static int NDS_VideoInit(_THIS)
  43.305 -{
  43.306 -	SDL_VideoDisplay display;
  43.307 -    SDL_DisplayMode mode;
  43.308 -
  43.309 -	SDL_zero(mode);
  43.310 -
  43.311 -    mode.format = SDL_PIXELFORMAT_UNKNOWN; // should be SDL_PIXELFORMAT_ABGR1555;
  43.312 -    mode.w = SCREEN_WIDTH;
  43.313 -    mode.h = 2*SCREEN_HEIGHT+SCREEN_GAP;
  43.314 -    mode.refresh_rate = 60;
  43.315 -
  43.316 -	SDL_zero(display);
  43.317 -
  43.318 -	display.desktop_mode = mode;
  43.319 -
  43.320 -	SDL_AddVideoDisplay(&display);
  43.321 -
  43.322 -    return 0;
  43.323 -}
  43.324 -
  43.325 -static void NDS_VideoQuit(_THIS)
  43.326 -{
  43.327 -    videoSetMode(DISPLAY_SCREEN_OFF);
  43.328 -    videoSetModeSub(DISPLAY_SCREEN_OFF);
  43.329 -    vramSetBankA(VRAM_A_LCD);
  43.330 -    vramSetBankB(VRAM_B_LCD);
  43.331 -    vramSetBankC(VRAM_C_LCD);
  43.332 -    vramSetBankD(VRAM_D_LCD);
  43.333 -    vramSetBankE(VRAM_E_LCD);
  43.334 -    vramSetBankF(VRAM_F_LCD);
  43.335 -    vramSetBankG(VRAM_G_LCD);
  43.336 -    vramSetBankH(VRAM_H_LCD);
  43.337 -    vramSetBankI(VRAM_I_LCD);
  43.338 -}
  43.339 -
  43.340 -static void NDS_DeleteDevice(SDL_VideoDevice * device)
  43.341 -{
  43.342 -    SDL_free(device);
  43.343 -}
  43.344 -
  43.345 -static SDL_VideoDevice *NDS_CreateDevice(int devindex)
  43.346 -{
  43.347 -    SDL_VideoDevice *device;
  43.348 -
  43.349 -    fatInitDefault();
  43.350 -
  43.351 -    /* Initialize all variables that we clean on shutdown */
  43.352 -    device = SDL_calloc(1, sizeof(SDL_VideoDevice));
  43.353 -    if (!device) {
  43.354 -        SDL_OutOfMemory();
  43.355 -        return NULL;
  43.356 -    }
  43.357 -
  43.358 -	device->driverdata = SDL_calloc(1, sizeof(SDL_VideoDevice));
  43.359 -    if (!device) {
  43.360 -		SDL_free(device);
  43.361 -        SDL_OutOfMemory();
  43.362 -        return NULL;
  43.363 -    }
  43.364 -
  43.365 -    /* Set the function pointers */
  43.366 -    device->VideoInit = NDS_VideoInit;
  43.367 -    device->VideoQuit = NDS_VideoQuit;
  43.368 -	device->GetDisplayModes = NDS_GetDisplayModes;
  43.369 -    device->SetDisplayMode = NDS_SetDisplayMode;
  43.370 -    device->CreateWindow = NDS_CreateWindow;
  43.371 -#ifndef USE_HW_RENDERER
  43.372 -	device->CreateWindowFramebuffer = NDS_CreateWindowFramebuffer;
  43.373 -	device->UpdateWindowFramebuffer = NDS_UpdateWindowFramebuffer;
  43.374 -	device->DestroyWindowFramebuffer = NDS_DestroyWindowFramebuffer;
  43.375 -#endif
  43.376 -    device->PumpEvents = NDS_PumpEvents;
  43.377 -    device->free = NDS_DeleteDevice;
  43.378 -
  43.379 -	/* Set the debug output. Use only under an emulator. Will crash the DS. */
  43.380 -#if 0
  43.381 -	SDL_LogSetOutputFunction(NDS_DebugOutput, NULL);
  43.382 -#endif
  43.383 -
  43.384 -    return device;
  43.385 -}
  43.386 -
  43.387 -VideoBootStrap NDS_bootstrap = {
  43.388 -    NDSVID_DRIVER_NAME, "SDL NDS video driver",
  43.389 -    NDS_Available, NDS_CreateDevice
  43.390 -};
  43.391 -
  43.392 -double SDLCALL SDL_pow(double x, double y)
  43.393 -{
  43.394 -	static int once = 1;
  43.395 -	if (once) {
  43.396 -		SDL_Log("SDL_pow called but not supported on this platform");
  43.397 -		once = 0;
  43.398 -	}
  43.399 -	return 0;
  43.400 -}
  43.401 -
  43.402 -#endif /* SDL_VIDEO_DRIVER_NDS */
  43.403 -
  43.404 -/* vi: set ts=4 sw=4 expandtab: */
    44.1 --- a/src/video/nds/SDL_ndsvideo.h	Sun Mar 17 09:21:08 2013 -0700
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,59 +0,0 @@
    44.4 -/*
    44.5 -  Simple DirectMedia Layer
    44.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    44.7 -
    44.8 -  This software is provided 'as-is', without any express or implied
    44.9 -  warranty.  In no event will the authors be held liable for any damages
   44.10 -  arising from the use of this software.
   44.11 -
   44.12 -  Permission is granted to anyone to use this software for any purpose,
   44.13 -  including commercial applications, and to alter it and redistribute it
   44.14 -  freely, subject to the following restrictions:
   44.15 -
   44.16 -  1. The origin of this software must not be misrepresented; you must not
   44.17 -     claim that you wrote the original software. If you use this software
   44.18 -     in a product, an acknowledgment in the product documentation would be
   44.19 -     appreciated but is not required.
   44.20 -  2. Altered source versions must be plainly marked as such, and must not be
   44.21 -     misrepresented as being the original software.
   44.22 -  3. This notice may not be removed or altered from any source distribution.
   44.23 -*/
   44.24 -#include "SDL_config.h"
   44.25 -
   44.26 -#ifndef _SDL_ndsvideo_h
   44.27 -#define _SDL_ndsvideo_h
   44.28 -
   44.29 -#include "../SDL_sysvideo.h"
   44.30 -
   44.31 -#include "SDL_ndswindow.h"
   44.32 -
   44.33 -#define SCREEN_GAP 92			/* line-equivalent gap between the 2 screens  */
   44.34 -
   44.35 -/* Per Window information. */
   44.36 -struct NDS_WindowData {
   44.37 -	struct {
   44.38 -		int bg_id;
   44.39 -		void *vram_pixels;           /* where the pixel data is stored (a pointer into VRAM) */
   44.40 -		void *pixels;				 /* area in user frame buffer */
   44.41 -		int length;
   44.42 -	} main, sub;
   44.43 -
   44.44 -    int pitch, bpp;             /* useful information about the texture */
   44.45 -    struct {
   44.46 -        int x, y;
   44.47 -    } scale;                    /* x/y stretch (24.8 fixed point) */
   44.48 -
   44.49 -    struct {
   44.50 -        int x, y;
   44.51 -    } scroll;                   /* x/y offset */
   44.52 -    int rotate;                 /* -32768 to 32767, texture rotation */
   44.53 -
   44.54 -	/* user frame buffer - todo: better way to do double buffering */
   44.55 -	void *pixels;
   44.56 -	int pixels_length;
   44.57 -};
   44.58 -
   44.59 -
   44.60 -#endif /* _SDL_ndsvideo_h */
   44.61 -
   44.62 -/* vi: set ts=4 sw=4 expandtab: */
    45.1 --- a/src/video/nds/SDL_ndswindow.c	Sun Mar 17 09:21:08 2013 -0700
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,37 +0,0 @@
    45.4 -/*
    45.5 -  Simple DirectMedia Layer
    45.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    45.7 -
    45.8 -  This software is provided 'as-is', without any express or implied
    45.9 -  warranty.  In no event will the authors be held liable for any damages
   45.10 -  arising from the use of this software.
   45.11 -
   45.12 -  Permission is granted to anyone to use this software for any purpose,
   45.13 -  including commercial applications, and to alter it and redistribute it
   45.14 -  freely, subject to the following restrictions:
   45.15 -
   45.16 -  1. The origin of this software must not be misrepresented; you must not
   45.17 -     claim that you wrote the original software. If you use this software
   45.18 -     in a product, an acknowledgment in the product documentation would be
   45.19 -     appreciated but is not required.
   45.20 -  2. Altered source versions must be plainly marked as such, and must not be
   45.21 -     misrepresented as being the original software.
   45.22 -  3. This notice may not be removed or altered from any source distribution.
   45.23 -*/
   45.24 -#include "SDL_config.h"
   45.25 -
   45.26 -#if SDL_VIDEO_DRIVER_NDS
   45.27 -
   45.28 -#include "SDL_ndsvideo.h"
   45.29 -
   45.30 -
   45.31 -int NDS_CreateWindow(_THIS, SDL_Window * window)
   45.32 -{
   45.33 -    /* Nintendo DS windows are always fullscreen */
   45.34 -    window->flags |= SDL_WINDOW_FULLSCREEN;
   45.35 -    return 0;
   45.36 -}
   45.37 -
   45.38 -#endif /* SDL_VIDEO_DRIVER_NDS */
   45.39 -
   45.40 -/* vi: set ts=4 sw=4 expandtab: */
    46.1 --- a/src/video/nds/SDL_ndswindow.h	Sun Mar 17 09:21:08 2013 -0700
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,30 +0,0 @@
    46.4 -/*
    46.5 -  Simple DirectMedia Layer
    46.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    46.7 -
    46.8 -  This software is provided 'as-is', without any express or implied
    46.9 -  warranty.  In no event will the authors be held liable for any damages
   46.10 -  arising from the use of this software.
   46.11 -
   46.12 -  Permission is granted to anyone to use this software for any purpose,
   46.13 -  including commercial applications, and to alter it and redistribute it
   46.14 -  freely, subject to the following restrictions:
   46.15 -
   46.16 -  1. The origin of this software must not be misrepresented; you must not
   46.17 -     claim that you wrote the original software. If you use this software
   46.18 -     in a product, an acknowledgment in the product documentation would be
   46.19 -     appreciated but is not required.
   46.20 -  2. Altered source versions must be plainly marked as such, and must not be
   46.21 -     misrepresented as being the original software.
   46.22 -  3. This notice may not be removed or altered from any source distribution.
   46.23 -*/
   46.24 -#include "SDL_config.h"
   46.25 -
   46.26 -#ifndef _SDL_ndswindow_h
   46.27 -#define _SDL_ndswindow_h
   46.28 -
   46.29 -extern int NDS_CreateWindow(_THIS, SDL_Window * window);
   46.30 -
   46.31 -#endif /* _SDL_ndswindow_h */
   46.32 -
   46.33 -/* vi: set ts=4 sw=4 expandtab: */
    47.1 --- a/test/nds-test-progs/Makefile	Sun Mar 17 09:21:08 2013 -0700
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,7 +0,0 @@
    47.4 -SUBDIRS:= $(shell ls | egrep -v '^(CVS)$$')
    47.5 -
    47.6 -all:
    47.7 -	for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
    47.8 -
    47.9 -clean:
   47.10 -	for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
    48.1 --- a/test/nds-test-progs/general/Makefile	Sun Mar 17 09:21:08 2013 -0700
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,131 +0,0 @@
    48.4 -#---------------------------------------------------------------------------------
    48.5 -.SUFFIXES:
    48.6 -#---------------------------------------------------------------------------------
    48.7 -
    48.8 -ifeq ($(strip $(DEVKITARM)),)
    48.9 -$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
   48.10 -endif
   48.11 -
   48.12 -include $(DEVKITARM)/ds_rules
   48.13 -
   48.14 -#---------------------------------------------------------------------------------
   48.15 -# TARGET is the name of the output
   48.16 -# BUILD is the directory where object files & intermediate files will be placed
   48.17 -# SOURCES is a list of directories containing source code
   48.18 -# INCLUDES is a list of directories containing extra header files
   48.19 -#---------------------------------------------------------------------------------
   48.20 -TARGET		:=	$(shell basename $(CURDIR))
   48.21 -BUILD		:=	build
   48.22 -SOURCES		:=	source
   48.23 -DATA		:=	data  
   48.24 -INCLUDES	:=	include
   48.25 -
   48.26 -#---------------------------------------------------------------------------------
   48.27 -# options for code generation
   48.28 -#---------------------------------------------------------------------------------
   48.29 -ARCH	:=	-mthumb -mthumb-interwork
   48.30 -
   48.31 -# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
   48.32 -# *insists* it has a FPU or VFP, and it won't take no for an answer!
   48.33 -CFLAGS	:=	-save-temps -g -Wall -O0\
   48.34 -			-mcpu=arm9tdmi -mtune=arm9tdmi \
   48.35 -			$(ARCH)
   48.36 -
   48.37 -CFLAGS	+=	$(INCLUDE) -DARM9 -D__NDS__
   48.38 -CXXFLAGS	:= $(CFLAGS) -fno-rtti -fno-exceptions -fno-exceptions -fno-rtti
   48.39 -
   48.40 -ASFLAGS	:=	-g $(ARCH)
   48.41 -LDFLAGS	=	-specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)
   48.42 -
   48.43 -#---------------------------------------------------------------------------------
   48.44 -# any extra libraries we wish to link with the project
   48.45 -#---------------------------------------------------------------------------------
   48.46 -LIBS	:= -lSDL -lfat -lnds9
   48.47 -
   48.48 -
   48.49 -#---------------------------------------------------------------------------------
   48.50 -# list of directories containing libraries, this must be the top level containing
   48.51 -# include and lib
   48.52 -#---------------------------------------------------------------------------------
   48.53 -LIBDIRS	:=	$(LIBNDS) $(PORTLIBS)
   48.54 -
   48.55 -#---------------------------------------------------------------------------------
   48.56 -# no real need to edit anything past this point unless you need to add additional
   48.57 -# rules for different file extensions
   48.58 -#---------------------------------------------------------------------------------
   48.59 -ifneq ($(BUILD),$(notdir $(CURDIR)))
   48.60 -#---------------------------------------------------------------------------------
   48.61 -
   48.62 -export OUTPUT	:=	$(CURDIR)/$(TARGET)
   48.63 -
   48.64 -export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
   48.65 -					$(foreach dir,$(DATA),$(CURDIR)/$(dir))
   48.66 -
   48.67 -export DEPSDIR	:=	$(CURDIR)/$(BUILD)
   48.68 -
   48.69 -CFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
   48.70 -CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
   48.71 -SFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
   48.72 -BINFILES	:=	$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
   48.73 -
   48.74 -#---------------------------------------------------------------------------------
   48.75 -# use CXX for linking C++ projects, CC for standard C
   48.76 -#---------------------------------------------------------------------------------
   48.77 -ifeq ($(strip $(CPPFILES)),)
   48.78 -#---------------------------------------------------------------------------------
   48.79 -	export LD	:=	$(CC)
   48.80 -#---------------------------------------------------------------------------------
   48.81 -else
   48.82 -#---------------------------------------------------------------------------------
   48.83 -	export LD	:=	$(CXX)
   48.84 -#---------------------------------------------------------------------------------
   48.85 -endif
   48.86 -#---------------------------------------------------------------------------------
   48.87 -
   48.88 -export OFILES	:=	$(addsuffix .o,$(BINFILES)) \
   48.89 -					$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
   48.90 -
   48.91 -export INCLUDE	:=	$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
   48.92 -					$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
   48.93 -					-I$(CURDIR)/$(BUILD)
   48.94 -
   48.95 -export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib)
   48.96 -
   48.97 -.PHONY: $(BUILD) clean
   48.98 -
   48.99 -#---------------------------------------------------------------------------------
  48.100 -$(BUILD):
  48.101 -	@[ -d $@ ] || mkdir -p $@
  48.102 -	@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
  48.103 -
  48.104 -#---------------------------------------------------------------------------------
  48.105 -clean:
  48.106 -	@echo clean ...
  48.107 -	@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba 
  48.108 -
  48.109 -
  48.110 -#---------------------------------------------------------------------------------
  48.111 -else
  48.112 -
  48.113 -DEPENDS	:=	$(OFILES:.o=.d)
  48.114 -
  48.115 -#---------------------------------------------------------------------------------
  48.116 -# main targets
  48.117 -#---------------------------------------------------------------------------------
  48.118 -$(OUTPUT).ds.gba	: 	$(OUTPUT).nds
  48.119 -$(OUTPUT).nds	: 	$(OUTPUT).arm9
  48.120 -$(OUTPUT).arm9	:	$(OUTPUT).elf
  48.121 -$(OUTPUT).elf	:	$(OFILES)
  48.122 -
  48.123 -#---------------------------------------------------------------------------------
  48.124 -%.pcx.o	:	%.pcx
  48.125 -#---------------------------------------------------------------------------------
  48.126 -	@echo $(notdir $<)
  48.127 -	@$(bin2o)
  48.128 -
  48.129 -
  48.130 --include $(DEPENDS)
  48.131 -
  48.132 -#---------------------------------------------------------------------------------------
  48.133 -endif
  48.134 -#---------------------------------------------------------------------------------------
    49.1 --- a/test/nds-test-progs/general/source/main.c	Sun Mar 17 09:21:08 2013 -0700
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,89 +0,0 @@
    49.4 -/*
    49.5 - * Really basic sample for the NDS.
    49.6 - *
    49.7 - * Fills a rectangle increasingly smaller of random color every time a
    49.8 - * button (a, b, x, y) is pressed.
    49.9 - *
   49.10 - * The behaviour whether SDL is compiled with HW support or not (see
   49.11 - * USE_HW_RENDERER in Makefile.ds).
   49.12 - *
   49.13 - * In framebuffer mode, the old rectangles stay because the screen has
   49.14 - * not been cleared.
   49.15 - *
   49.16 - * In accelerated mode, old the last rectangle is visible.
   49.17 - *
   49.18 - * No text is displayed.
   49.19 - */
   49.20 -
   49.21 -#include <SDL/SDL.h>
   49.22 -#if defined(NDS) || defined(__NDS__) || defined (__NDS)
   49.23 -#include <nds.h>
   49.24 -#include <fat.h>
   49.25 -#else
   49.26 -#define consoleDemoInit()
   49.27 -#define fatInitDefault()
   49.28 -#define RGB15(r,g,b) SDL_MapRGB(screen->format,((r)<<3),((g)<<3),((b)<<3))
   49.29 -#endif
   49.30 -
   49.31 -int main(void)
   49.32 -{
   49.33 -	SDL_Window *window;
   49.34 -	SDL_Renderer *renderer;
   49.35 -    SDL_Joystick *stick;
   49.36 -    SDL_Event event;
   49.37 -    SDL_Rect rect = { 0, 0, 256, 192 };
   49.38 -    int i;
   49.39 -
   49.40 -    consoleDemoInit();
   49.41 -    puts("Hello world!  Initializing FAT...");
   49.42 -
   49.43 -    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
   49.44 -        puts("# error initializing SDL");
   49.45 -        puts(SDL_GetError());
   49.46 -        return 1;
   49.47 -    }
   49.48 -    puts("* initialized SDL");
   49.49 -
   49.50 -    if (SDL_CreateWindowAndRenderer(256, 192, SDL_RENDERER_ACCELERATED, &window, &renderer) < 0 &&
   49.51 -		SDL_CreateWindowAndRenderer(256, 192, SDL_RENDERER_SOFTWARE, &window, &renderer) < 0) {
   49.52 -        exit(1);
   49.53 -    }
   49.54 -
   49.55 -    stick = SDL_JoystickOpen(0);
   49.56 -    if (stick == NULL) {
   49.57 -        puts("# error opening joystick");
   49.58 -        puts(SDL_GetError());
   49.59 -    }
   49.60 -    puts("* opened joystick");
   49.61 -
   49.62 -    SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
   49.63 -    SDL_RenderFillRect(renderer, &rect);
   49.64 -    SDL_RenderPresent(renderer);
   49.65 -
   49.66 -    while (1)
   49.67 -        while (SDL_PollEvent(&event))
   49.68 -            switch (event.type) {
   49.69 -            case SDL_JOYBUTTONDOWN:
   49.70 -				
   49.71 -				SDL_SetRenderDrawColor(renderer, rand(), rand(), rand(), SDL_ALPHA_OPAQUE);
   49.72 -				SDL_RenderFillRect(renderer, &rect);
   49.73 -				SDL_RenderPresent(renderer);
   49.74 -                if (rect.w > 8) {
   49.75 -                    rect.x += 4;
   49.76 -                    rect.y += 3;
   49.77 -                    rect.w -= 8;
   49.78 -                    rect.h -= 6;
   49.79 -                }
   49.80 -				/*
   49.81 -				  printf("button %d pressed at %d ticks\n",
   49.82 -				  event.jbutton.button, SDL_GetTicks()); 
   49.83 -				*/
   49.84 -                break;
   49.85 -            case SDL_QUIT:
   49.86 -                SDL_Quit();
   49.87 -                return 0;
   49.88 -            default:
   49.89 -                break;
   49.90 -            }
   49.91 -    return 0;
   49.92 -}
    50.1 --- a/test/nds-test-progs/testscale/Makefile	Sun Mar 17 09:21:08 2013 -0700
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,147 +0,0 @@
    50.4 -#---------------------------------------------------------------------------------
    50.5 -.SUFFIXES:
    50.6 -#---------------------------------------------------------------------------------
    50.7 -
    50.8 -ifeq ($(strip $(DEVKITARM)),)
    50.9 -$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
   50.10 -endif
   50.11 -
   50.12 -include $(DEVKITARM)/ds_rules
   50.13 -
   50.14 -#---------------------------------------------------------------------------------
   50.15 -# TARGET is the name of the output
   50.16 -# BUILD is the directory where object files & intermediate files will be placed
   50.17 -# SOURCES is a list of directories containing source code
   50.18 -# INCLUDES is a list of directories containing extra header files
   50.19 -# DATA is a list of directories containing binary files embedded using bin2o
   50.20 -# GRAPHICS is a list of directories containing image files to be converted with grit
   50.21 -#---------------------------------------------------------------------------------
   50.22 -TARGET		:=	$(shell basename $(CURDIR))
   50.23 -BUILD		:=	build
   50.24 -SOURCES		:=	source
   50.25 -INCLUDES	:=	include ../..
   50.26 -DATA		:=	data  
   50.27 -GRAPHICS	:=	gfx  
   50.28 -
   50.29 -#---------------------------------------------------------------------------------
   50.30 -# options for code generation
   50.31 -#---------------------------------------------------------------------------------
   50.32 -ARCH	:=	-mthumb -mthumb-interwork -march=armv5te -mtune=arm946e-s
   50.33 -
   50.34 -CFLAGS	:=	-g -Wall -O2\
   50.35 -		-fomit-frame-pointer\
   50.36 -		-ffast-math \
   50.37 -		$(ARCH)
   50.38 -
   50.39 -CFLAGS	+=	$(INCLUDE) -DARM9 -D__NDS__
   50.40 -CXXFLAGS	:= $(CFLAGS) -fno-rtti -fno-exceptions
   50.41 -
   50.42 -ASFLAGS	:=	-g $(ARCH)
   50.43 -LDFLAGS	=	-specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
   50.44 -
   50.45 -#---------------------------------------------------------------------------------
   50.46 -# any extra libraries we wish to link with the project (order is important)
   50.47 -#---------------------------------------------------------------------------------
   50.48 -LIBS	:= 	-lSDL -lfat -lnds9
   50.49 -
   50.50 -
   50.51 -#---------------------------------------------------------------------------------
   50.52 -# list of directories containing libraries, this must be the top level containing
   50.53 -# include and lib
   50.54 -#---------------------------------------------------------------------------------
   50.55 -LIBDIRS	:=	$(LIBNDS) $(PORTLIBS)
   50.56 -
   50.57 -#---------------------------------------------------------------------------------
   50.58 -# no real need to edit anything past this point unless you need to add additional
   50.59 -# rules for different file extensions
   50.60 -#---------------------------------------------------------------------------------
   50.61 -ifneq ($(BUILD),$(notdir $(CURDIR)))
   50.62 -#---------------------------------------------------------------------------------
   50.63 -
   50.64 -export OUTPUT	:=	$(CURDIR)/$(TARGET)
   50.65 -
   50.66 -export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
   50.67 -					$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
   50.68 -					$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
   50.69 -
   50.70 -export DEPSDIR	:=	$(CURDIR)/$(BUILD)
   50.71 -
   50.72 -CFILES		:=	../../../common.c ../../../testscale.c
   50.73 -
   50.74 -#---------------------------------------------------------------------------------
   50.75 -# use CXX for linking C++ projects, CC for standard C
   50.76 -#---------------------------------------------------------------------------------
   50.77 -ifeq ($(strip $(CPPFILES)),)
   50.78 -#---------------------------------------------------------------------------------
   50.79 -	export LD	:=	$(CC)
   50.80 -#---------------------------------------------------------------------------------
   50.81 -else
   50.82 -#---------------------------------------------------------------------------------
   50.83 -	export LD	:=	$(CXX)
   50.84 -#---------------------------------------------------------------------------------
   50.85 -endif
   50.86 -#---------------------------------------------------------------------------------
   50.87 -
   50.88 -export OFILES	:=	$(addsuffix .o,$(BINFILES)) \
   50.89 -					$(PNGFILES:.png=.o) \
   50.90 -					$(BMPFILES:.bmp=.o) \
   50.91 -					$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
   50.92 -
   50.93 -export INCLUDE	:=	$(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
   50.94 -					$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
   50.95 -					-I$(CURDIR)/$(BUILD) \
   50.96 -					-I$(PORTLIBS)/include/SDL
   50.97 -
   50.98 -export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib)
   50.99 -
  50.100 -.PHONY: $(BUILD) clean
  50.101 -
  50.102 -#---------------------------------------------------------------------------------
  50.103 -$(BUILD):
  50.104 -	@[ -d $@ ] || mkdir -p $@
  50.105 -	@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
  50.106 -
  50.107 -#---------------------------------------------------------------------------------
  50.108 -clean:
  50.109 -	@echo clean ...
  50.110 -	@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
  50.111 -
  50.112 -#---------------------------------------------------------------------------------
  50.113 -else
  50.114 -
  50.115 -DEPENDS :=  $(OFILES:.o=.d)
  50.116 -
  50.117 -#---------------------------------------------------------------------------------
  50.118 -# main targets
  50.119 -#---------------------------------------------------------------------------------
  50.120 -$(OUTPUT).nds	: 	$(OUTPUT).elf
  50.121 -$(OUTPUT).elf	:	$(OFILES)
  50.122 -
  50.123 -#---------------------------------------------------------------------------------
  50.124 -%.bin.o	:	%.bin
  50.125 -#---------------------------------------------------------------------------------
  50.126 -	@echo $(notdir $<)
  50.127 -	$(bin2o)
  50.128 -
  50.129 -#---------------------------------------------------------------------------------
  50.130 -# This rule creates assembly source files using grit
  50.131 -# grit takes an image file and a .grit describing how the file is to be processed
  50.132 -# add additional rules like this for each image extension
  50.133 -# you use in the graphics folders
  50.134 -#---------------------------------------------------------------------------------
  50.135 -%.s %.h	: %.bmp %.grit
  50.136 -#---------------------------------------------------------------------------------
  50.137 -	grit $< -fts -o$*
  50.138 -
  50.139 -
  50.140 -#---------------------------------------------------------------------------------
  50.141 -%.s %.h : %.png %.grit
  50.142 -#---------------------------------------------------------------------------------
  50.143 -	grit $< -fts -o$*
  50.144 -
  50.145 -
  50.146 --include $(DEPENDS)
  50.147 -
  50.148 -#---------------------------------------------------------------------------------------
  50.149 -endif
  50.150 -#---------------------------------------------------------------------------------------
    51.1 --- a/test/nds-test-progs/testsprite2/Makefile	Sun Mar 17 09:21:08 2013 -0700
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,152 +0,0 @@
    51.4 -#---------------------------------------------------------------------------------
    51.5 -.SUFFIXES:
    51.6 -#---------------------------------------------------------------------------------
    51.7 -
    51.8 -ifeq ($(strip $(DEVKITARM)),)
    51.9 -$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
   51.10 -endif
   51.11 -
   51.12 -include $(DEVKITARM)/ds_rules
   51.13 -
   51.14 -#---------------------------------------------------------------------------------
   51.15 -# TARGET is the name of the output
   51.16 -# BUILD is the directory where object files & intermediate files will be placed
   51.17 -# SOURCES is a list of directories containing source code
   51.18 -# INCLUDES is a list of directories containing extra header files
   51.19 -# DATA is a list of directories containing binary files embedded using bin2o
   51.20 -# GRAPHICS is a list of directories containing image files to be converted with grit
   51.21 -#---------------------------------------------------------------------------------
   51.22 -TARGET		:=	$(shell basename $(CURDIR))
   51.23 -BUILD		:=	build
   51.24 -SOURCES		:=	source
   51.25 -INCLUDES	:=	include ../..
   51.26 -DATA		:=	data  
   51.27 -GRAPHICS	:=	gfx  
   51.28 -
   51.29 -#---------------------------------------------------------------------------------
   51.30 -# options for code generation
   51.31 -#---------------------------------------------------------------------------------
   51.32 -ARCH	:=	-mthumb -mthumb-interwork -march=armv5te -mtune=arm946e-s
   51.33 -
   51.34 -CFLAGS	:=	-g -Wall -O2\
   51.35 -		-fomit-frame-pointer\
   51.36 -		-ffast-math \
   51.37 -		$(ARCH)
   51.38 -
   51.39 -CFLAGS	+=	$(INCLUDE) -DARM9 -D__NDS__
   51.40 -CXXFLAGS	:= $(CFLAGS) -fno-rtti -fno-exceptions
   51.41 -
   51.42 -ASFLAGS	:=	-g $(ARCH)
   51.43 -LDFLAGS	=	-specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
   51.44 -
   51.45 -#---------------------------------------------------------------------------------
   51.46 -# any extra libraries we wish to link with the project (order is important)
   51.47 -#---------------------------------------------------------------------------------
   51.48 -LIBS	:= 	-lSDL -lfat -lnds9
   51.49 -
   51.50 -
   51.51 -#---------------------------------------------------------------------------------
   51.52 -# list of directories containing libraries, this must be the top level containing
   51.53 -# include and lib
   51.54 -#---------------------------------------------------------------------------------
   51.55 -LIBDIRS	:=	$(LIBNDS) $(PORTLIBS)
   51.56 - 
   51.57 -#---------------------------------------------------------------------------------
   51.58 -# no real need to edit anything past this point unless you need to add additional
   51.59 -# rules for different file extensions
   51.60 -#---------------------------------------------------------------------------------
   51.61 -ifneq ($(BUILD),$(notdir $(CURDIR)))
   51.62 -#---------------------------------------------------------------------------------
   51.63 -
   51.64 -export OUTPUT	:=	$(CURDIR)/$(TARGET)
   51.65 -
   51.66 -export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
   51.67 -					$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
   51.68 -					$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
   51.69 -
   51.70 -export DEPSDIR	:=	$(CURDIR)/$(BUILD)
   51.71 -
   51.72 -CFILES		:=	../../../common.c ../../../testsprite2.c
   51.73 -CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
   51.74 -SFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
   51.75 -PNGFILES	:=	$(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
   51.76 -BMPFILES    :=  $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
   51.77 -BINFILES	:=	$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
   51.78 - 
   51.79 -#---------------------------------------------------------------------------------
   51.80 -# use CXX for linking C++ projects, CC for standard C
   51.81 -#---------------------------------------------------------------------------------
   51.82 -ifeq ($(strip $(CPPFILES)),)
   51.83 -#---------------------------------------------------------------------------------
   51.84 -	export LD	:=	$(CC)
   51.85 -#---------------------------------------------------------------------------------
   51.86 -else
   51.87 -#---------------------------------------------------------------------------------
   51.88 -	export LD	:=	$(CXX)
   51.89 -#---------------------------------------------------------------------------------
   51.90 -endif
   51.91 -#---------------------------------------------------------------------------------
   51.92 -
   51.93 -export OFILES	:=	$(addsuffix .o,$(BINFILES)) \
   51.94 -					$(PNGFILES:.png=.o) \
   51.95 -					$(BMPFILES:.bmp=.o) \
   51.96 -					$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
   51.97 -
   51.98 -export INCLUDE	:=	$(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
   51.99 -					$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
  51.100 -					-I$(CURDIR)/$(BUILD) \
  51.101 -					-I$(PORTLIBS)/include/SDL
  51.102 -
  51.103 -export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib)
  51.104 -
  51.105 -.PHONY: $(BUILD) clean
  51.106 -
  51.107 -#---------------------------------------------------------------------------------
  51.108 -$(BUILD):
  51.109 -	@[ -d $@ ] || mkdir -p $@
  51.110 -	@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
  51.111 - 
  51.112 -#---------------------------------------------------------------------------------
  51.113 -clean:
  51.114 -	@echo clean ...
  51.115 -	@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
  51.116 -
  51.117 -#---------------------------------------------------------------------------------
  51.118 -else
  51.119 -
  51.120 -DEPENDS :=  $(OFILES:.o=.d)
  51.121 - 
  51.122 -#---------------------------------------------------------------------------------
  51.123 -# main targets
  51.124 -#---------------------------------------------------------------------------------
  51.125 -$(OUTPUT).nds	: 	$(OUTPUT).elf
  51.126 -$(OUTPUT).elf	:	$(OFILES)
  51.127 - 
  51.128 -#---------------------------------------------------------------------------------
  51.129 -%.bin.o	:	%.bin
  51.130 -#---------------------------------------------------------------------------------
  51.131 -	@echo $(notdir $<)
  51.132 -	$(bin2o)
  51.133 -
  51.134 -#---------------------------------------------------------------------------------
  51.135 -# This rule creates assembly source files using grit
  51.136 -# grit takes an image file and a .grit describing how the file is to be processed
  51.137 -# add additional rules like this for each image extension
  51.138 -# you use in the graphics folders
  51.139 -#---------------------------------------------------------------------------------
  51.140 -%.s %.h	: %.bmp %.grit
  51.141 -#---------------------------------------------------------------------------------
  51.142 -	grit $< -fts -o$*
  51.143 -
  51.144 -
  51.145 -#---------------------------------------------------------------------------------
  51.146 -%.s %.h : %.png %.grit
  51.147 -#---------------------------------------------------------------------------------
  51.148 -	grit $< -fts -o$*
  51.149 -
  51.150 -
  51.151 --include $(DEPENDS)
  51.152 -
  51.153 -#---------------------------------------------------------------------------------------
  51.154 -endif
  51.155 -#---------------------------------------------------------------------------------------
    52.1 --- a/test/nds-test-progs/testspriteminimal/Makefile	Sun Mar 17 09:21:08 2013 -0700
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,147 +0,0 @@
    52.4 -#---------------------------------------------------------------------------------
    52.5 -.SUFFIXES:
    52.6 -#---------------------------------------------------------------------------------
    52.7 -
    52.8 -ifeq ($(strip $(DEVKITARM)),)
    52.9 -$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
   52.10 -endif
   52.11 -
   52.12 -include $(DEVKITARM)/ds_rules
   52.13 -
   52.14 -#---------------------------------------------------------------------------------
   52.15 -# TARGET is the name of the output
   52.16 -# BUILD is the directory where object files & intermediate files will be placed
   52.17 -# SOURCES is a list of directories containing source code
   52.18 -# INCLUDES is a list of directories containing extra header files
   52.19 -# DATA is a list of directories containing binary files embedded using bin2o
   52.20 -# GRAPHICS is a list of directories containing image files to be converted with grit
   52.21 -#---------------------------------------------------------------------------------
   52.22 -TARGET		:=	$(shell basename $(CURDIR))
   52.23 -BUILD		:=	build
   52.24 -SOURCES		:=	source
   52.25 -INCLUDES	:=	include
   52.26 -DATA		:=	data  
   52.27 -GRAPHICS	:=	gfx  
   52.28 -
   52.29 -#---------------------------------------------------------------------------------
   52.30 -# options for code generation
   52.31 -#---------------------------------------------------------------------------------
   52.32 -ARCH	:=	-mthumb -mthumb-interwork -march=armv5te -mtune=arm946e-s
   52.33 -
   52.34 -CFLAGS	:=	-g -Wall -O2\
   52.35 -		-fomit-frame-pointer\
   52.36 -		-ffast-math \
   52.37 -		$(ARCH)
   52.38 -
   52.39 -CFLAGS	+=	$(INCLUDE) -DARM9 -D__NDS__
   52.40 -CXXFLAGS	:= $(CFLAGS) -fno-rtti -fno-exceptions
   52.41 -
   52.42 -ASFLAGS	:=	-g $(ARCH)
   52.43 -LDFLAGS	=	-specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
   52.44 -
   52.45 -#---------------------------------------------------------------------------------
   52.46 -# any extra libraries we wish to link with the project (order is important)
   52.47 -#---------------------------------------------------------------------------------
   52.48 -LIBS	:= 	-lSDL -lfat -lnds9
   52.49 -
   52.50 -
   52.51 -#---------------------------------------------------------------------------------
   52.52 -# list of directories containing libraries, this must be the top level containing
   52.53 -# include and lib
   52.54 -#---------------------------------------------------------------------------------
   52.55 -LIBDIRS	:=	$(LIBNDS) $(PORTLIBS)
   52.56 -
   52.57 -#---------------------------------------------------------------------------------
   52.58 -# no real need to edit anything past this point unless you need to add additional
   52.59 -# rules for different file extensions
   52.60 -#---------------------------------------------------------------------------------
   52.61 -ifneq ($(BUILD),$(notdir $(CURDIR)))
   52.62 -#---------------------------------------------------------------------------------
   52.63 -
   52.64 -export OUTPUT	:=	$(CURDIR)/$(TARGET)
   52.65 -
   52.66 -export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
   52.67 -					$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
   52.68 -					$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
   52.69 -
   52.70 -export DEPSDIR	:=	$(CURDIR)/$(BUILD)
   52.71 -
   52.72 -CFILES		:=	../../../testspriteminimal.c
   52.73 -
   52.74 -#---------------------------------------------------------------------------------
   52.75 -# use CXX for linking C++ projects, CC for standard C
   52.76 -#---------------------------------------------------------------------------------
   52.77 -ifeq ($(strip $(CPPFILES)),)
   52.78 -#---------------------------------------------------------------------------------
   52.79 -	export LD	:=	$(CC)
   52.80 -#---------------------------------------------------------------------------------
   52.81 -else
   52.82 -#---------------------------------------------------------------------------------
   52.83 -	export LD	:=	$(CXX)
   52.84 -#---------------------------------------------------------------------------------
   52.85 -endif
   52.86 -#---------------------------------------------------------------------------------
   52.87 -
   52.88 -export OFILES	:=	$(addsuffix .o,$(BINFILES)) \
   52.89 -					$(PNGFILES:.png=.o) \
   52.90 -					$(BMPFILES:.bmp=.o) \
   52.91 -					$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
   52.92 -
   52.93 -export INCLUDE	:=	$(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
   52.94 -					$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
   52.95 -					-I$(CURDIR)/$(BUILD) \
   52.96 -					-I$(PORTLIBS)/include/SDL
   52.97 -
   52.98 -export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib)
   52.99 -
  52.100 -.PHONY: $(BUILD) clean
  52.101 -
  52.102 -#---------------------------------------------------------------------------------
  52.103 -$(BUILD):
  52.104 -	@[ -d $@ ] || mkdir -p $@
  52.105 -	@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
  52.106 -
  52.107 -#---------------------------------------------------------------------------------
  52.108 -clean:
  52.109 -	@echo clean ...
  52.110 -	@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
  52.111 -
  52.112 -#---------------------------------------------------------------------------------
  52.113 -else
  52.114 -
  52.115 -DEPENDS :=  $(OFILES:.o=.d)
  52.116 -
  52.117 -#---------------------------------------------------------------------------------
  52.118 -# main targets
  52.119 -#---------------------------------------------------------------------------------
  52.120 -$(OUTPUT).nds	: 	$(OUTPUT).elf
  52.121 -$(OUTPUT).elf	:	$(OFILES)
  52.122 -
  52.123 -#---------------------------------------------------------------------------------
  52.124 -%.bin.o	:	%.bin
  52.125 -#---------------------------------------------------------------------------------
  52.126 -	@echo $(notdir $<)
  52.127 -	$(bin2o)
  52.128 -
  52.129 -#---------------------------------------------------------------------------------
  52.130 -# This rule creates assembly source files using grit
  52.131 -# grit takes an image file and a .grit describing how the file is to be processed
  52.132 -# add additional rules like this for each image extension
  52.133 -# you use in the graphics folders
  52.134 -#---------------------------------------------------------------------------------
  52.135 -%.s %.h	: %.bmp %.grit
  52.136 -#---------------------------------------------------------------------------------
  52.137 -	grit $< -fts -o$*
  52.138 -
  52.139 -
  52.140 -#---------------------------------------------------------------------------------
  52.141 -%.s %.h : %.png %.grit
  52.142 -#---------------------------------------------------------------------------------
  52.143 -	grit $< -fts -o$*
  52.144 -
  52.145 -
  52.146 --include $(DEPENDS)
  52.147 -
  52.148 -#---------------------------------------------------------------------------------------
  52.149 -endif
  52.150 -#---------------------------------------------------------------------------------------
    53.1 --- a/test/testspriteminimal.c	Sun Mar 17 09:21:08 2013 -0700
    53.2 +++ b/test/testspriteminimal.c	Sun Mar 17 09:44:58 2013 -0700
    53.3 @@ -17,13 +17,8 @@
    53.4  
    53.5  #include "SDL.h"
    53.6  
    53.7 -#ifdef __NDS__
    53.8 -#define WINDOW_WIDTH    256
    53.9 -#define WINDOW_HEIGHT   (2*192)
   53.10 -#else
   53.11  #define WINDOW_WIDTH    640
   53.12  #define WINDOW_HEIGHT   480
   53.13 -#endif
   53.14  #define NUM_SPRITES     100
   53.15  #define MAX_SPEED       1
   53.16