WinRT: merged with latest, official, SDL 2.x sources (at rev. bea100d73d13)
|
@ -53,9 +53,11 @@ test/checkkeys
|
|||
test/loopwave
|
||||
test/testatomic
|
||||
test/testaudioinfo
|
||||
test/testautomation
|
||||
test/testdraw2
|
||||
test/testerror
|
||||
test/testfile
|
||||
test/testgamecontroller
|
||||
test/testgesture
|
||||
test/testgl2
|
||||
test/testgles
|
||||
|
|
3
CREDITS
|
@ -19,9 +19,6 @@ Thanks to everyone who made this possible, including:
|
|||
* Holmes Futrell for port of SDL to the iPhone and iPod Touch during the
|
||||
Google Summer of Code 2008
|
||||
|
||||
* Darren Alton for port of SDL to the Nintendo DS during the Google Summer
|
||||
of Code 2008
|
||||
|
||||
* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
|
||||
during the Google Summer of Code 2008
|
||||
|
||||
|
|
231
Makefile.ds
|
@ -1,231 +0,0 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# DATA is a list of directories containing data files
|
||||
# INCLUDES is a list of directories containing header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := src
|
||||
SOURCES := src
|
||||
DATA := data
|
||||
INCLUDES := include
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork \
|
||||
-D__NDS__ -DENABLE_NDS -DNO_SIGNAL_H -DDISABLE_THREADS -DPACKAGE=\"SDL\" \
|
||||
-DVERSION=\"2.0\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1
|
||||
|
||||
CFLAGS := -g -Wall -Os\
|
||||
-march=armv5te -mtune=arm946e-s \
|
||||
-fomit-frame-pointer -ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM9
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
|
||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
# Set to 0 to use a framer buffer, or 1 to use the GL like hardware
|
||||
# renderer. Alas, both cannot be used at the same time for lack of
|
||||
# display/texture memory.
|
||||
USE_HW_RENDERER := 1
|
||||
|
||||
ifeq ($(USE_HW_RENDERER),1)
|
||||
CFLAGS += -DUSE_HW_RENDERER
|
||||
else
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS) $(PORTLIBS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
CFILES := \
|
||||
SDL.c \
|
||||
SDL_assert.c \
|
||||
SDL_error.c \
|
||||
SDL_fatal.c \
|
||||
SDL_hints.c \
|
||||
SDL_log.c \
|
||||
atomic/SDL_atomic.c \
|
||||
atomic/SDL_spinlock.arm.c \
|
||||
audio/SDL_audio.c \
|
||||
audio/SDL_audiocvt.c \
|
||||
audio/SDL_audiodev.c \
|
||||
audio/SDL_audiotypecvt.c \
|
||||
audio/SDL_mixer.c \
|
||||
audio/SDL_wave.c \
|
||||
audio/nds/SDL_ndsaudio.c \
|
||||
cpuinfo/SDL_cpuinfo.c \
|
||||
events/SDL_events.c \
|
||||
events/SDL_keyboard.c \
|
||||
events/SDL_mouse.c \
|
||||
events/SDL_quit.c \
|
||||
events/SDL_touch.c \
|
||||
events/SDL_windowevents.c \
|
||||
events/nds/SDL_ndsgesture.c \
|
||||
file/SDL_rwops.c \
|
||||
haptic/SDL_haptic.c \
|
||||
haptic/nds/SDL_syshaptic.c \
|
||||
joystick/SDL_joystick.c \
|
||||
joystick/nds/SDL_sysjoystick.c \
|
||||
power/SDL_power.c \
|
||||
power/nds/SDL_syspower.c \
|
||||
render/SDL_render.c \
|
||||
render/SDL_yuv_sw.c \
|
||||
render/nds/SDL_ndsrender.c \
|
||||
render/nds/SDL_libgl2D.c \
|
||||
render/software/SDL_blendfillrect.c \
|
||||
render/software/SDL_blendline.c \
|
||||
render/software/SDL_blendpoint.c \
|
||||
render/software/SDL_drawline.c \
|
||||
render/software/SDL_drawpoint.c \
|
||||
render/software/SDL_render_sw.c \
|
||||
stdlib/SDL_getenv.c \
|
||||
stdlib/SDL_iconv.c \
|
||||
stdlib/SDL_malloc.c \
|
||||
stdlib/SDL_qsort.c \
|
||||
stdlib/SDL_stdlib.c \
|
||||
stdlib/SDL_string.c \
|
||||
thread/SDL_thread.c \
|
||||
thread/nds/SDL_syscond.c \
|
||||
thread/nds/SDL_sysmutex.c \
|
||||
thread/nds/SDL_syssem.c \
|
||||
thread/nds/SDL_systhread.c \
|
||||
timer/SDL_timer.c \
|
||||
timer/nds/SDL_systimer.c \
|
||||
video/SDL_RLEaccel.c \
|
||||
video/SDL_blit.c \
|
||||
video/SDL_blit_0.c \
|
||||
video/SDL_blit_1.c \
|
||||
video/SDL_blit_A.c \
|
||||
video/SDL_blit_N.c \
|
||||
video/SDL_blit_auto.c \
|
||||
video/SDL_blit_copy.c \
|
||||
video/SDL_blit_slow.c \
|
||||
video/SDL_bmp.c \
|
||||
video/SDL_clipboard.c \
|
||||
video/SDL_fillrect.c \
|
||||
video/SDL_pixels.c \
|
||||
video/SDL_rect.c \
|
||||
video/SDL_stretch.c \
|
||||
video/SDL_surface.c \
|
||||
video/SDL_video.c \
|
||||
video/nds/SDL_ndsevents.c \
|
||||
video/nds/SDL_ndsvideo.c \
|
||||
video/nds/SDL_ndswindow.c
|
||||
|
||||
|
||||
#CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
#SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
#BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(PORTLIBS)/include/SDL
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: arm_only $(BUILD) install nds_test
|
||||
|
||||
lib:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
$(BUILD): lib
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.ds -s
|
||||
|
||||
install: $(BUILD)
|
||||
@mkdir -p $(PORTLIBS)/include/SDL/
|
||||
@rsync -a $(OUTPUT) $(PORTLIBS)/lib/
|
||||
@rsync -a include/*.h $(PORTLIBS)/include/SDL/
|
||||
|
||||
nds_test:
|
||||
$(MAKE) -C test/nds-test-progs -s
|
||||
|
||||
tags:
|
||||
cd $(SOURCES); etags $(CFILES)
|
||||
|
||||
# This file must be compiled with the ARM instruction set, not
|
||||
# thumb. Use devkitpro way of doing things.
|
||||
arm_only: src/atomic/SDL_spinlock.arm.c
|
||||
src/atomic/SDL_spinlock.arm.c: src/atomic/SDL_spinlock.c
|
||||
@cp $< $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@cd src; rm -fr $(OFILES) $(OFILES:.o=.d) lib
|
||||
@rm -f $(OUTPUT)
|
||||
@make -C test/nds-test-progs -s clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
92
Makefile.psp
Normal file
|
@ -0,0 +1,92 @@
|
|||
TARGET_LIB = libSDL2.a
|
||||
OBJS= src/SDL.o \
|
||||
src/SDL_assert.o \
|
||||
src/SDL_error.o \
|
||||
src/SDL_fatal.o \
|
||||
src/SDL_hints.o \
|
||||
src/SDL_log.o \
|
||||
src/atomic/SDL_atomic.o \
|
||||
src/atomic/SDL_spinlock.o \
|
||||
src/audio/SDL_audio.o \
|
||||
src/audio/SDL_audiocvt.o \
|
||||
src/audio/SDL_audiodev.o \
|
||||
src/audio/SDL_audiotypecvt.o \
|
||||
src/audio/SDL_mixer.o \
|
||||
src/audio/SDL_wave.o \
|
||||
src/audio/psp/SDL_pspaudio.o \
|
||||
src/cpuinfo/SDL_cpuinfo.o \
|
||||
src/events/SDL_clipboardevents.o \
|
||||
src/events/SDL_dropevents.o \
|
||||
src/events/SDL_events.o \
|
||||
src/events/SDL_gesture.o \
|
||||
src/events/SDL_keyboard.o \
|
||||
src/events/SDL_mouse.o \
|
||||
src/events/SDL_quit.o \
|
||||
src/events/SDL_touch.o \
|
||||
src/events/SDL_windowevents.o \
|
||||
src/file/SDL_rwops.o \
|
||||
src/haptic/SDL_haptic.o \
|
||||
src/haptic/dummy/SDL_syshaptic.o \
|
||||
src/joystick/SDL_joystick.o \
|
||||
src/joystick/SDL_gamecontroller.o \
|
||||
src/joystick/psp/SDL_sysjoystick.o \
|
||||
src/power/SDL_power.o \
|
||||
src/power/psp/SDL_syspower.o \
|
||||
src/render/SDL_render.o \
|
||||
src/render/SDL_yuv_sw.o \
|
||||
src/render/psp/SDL_render_psp.o \
|
||||
src/render/software/SDL_blendfillrect.o \
|
||||
src/render/software/SDL_blendline.o \
|
||||
src/render/software/SDL_blendpoint.o \
|
||||
src/render/software/SDL_drawline.o \
|
||||
src/render/software/SDL_drawpoint.o \
|
||||
src/render/software/SDL_render_sw.o \
|
||||
src/render/software/SDL_rotate.o \
|
||||
src/stdlib/SDL_getenv.o \
|
||||
src/stdlib/SDL_iconv.o \
|
||||
src/stdlib/SDL_malloc.o \
|
||||
src/stdlib/SDL_qsort.o \
|
||||
src/stdlib/SDL_stdlib.o \
|
||||
src/stdlib/SDL_string.o \
|
||||
src/thread/SDL_thread.o \
|
||||
src/thread/psp/SDL_syssem.o \
|
||||
src/thread/psp/SDL_systhread.o \
|
||||
src/thread/psp/SDL_sysmutex.o \
|
||||
src/thread/psp/SDL_syscond.o \
|
||||
src/timer/SDL_timer.o \
|
||||
src/timer/psp/SDL_systimer.o \
|
||||
src/video/SDL_RLEaccel.o \
|
||||
src/video/SDL_blit.o \
|
||||
src/video/SDL_blit_0.o \
|
||||
src/video/SDL_blit_1.o \
|
||||
src/video/SDL_blit_A.o \
|
||||
src/video/SDL_blit_N.o \
|
||||
src/video/SDL_blit_auto.o \
|
||||
src/video/SDL_blit_copy.o \
|
||||
src/video/SDL_blit_slow.o \
|
||||
src/video/SDL_bmp.o \
|
||||
src/video/SDL_clipboard.o \
|
||||
src/video/SDL_fillrect.o \
|
||||
src/video/SDL_pixels.o \
|
||||
src/video/SDL_rect.o \
|
||||
src/video/SDL_stretch.o \
|
||||
src/video/SDL_surface.o \
|
||||
src/video/SDL_video.o \
|
||||
src/video/psp/SDL_pspevents.o \
|
||||
src/video/psp/SDL_pspvideo.o \
|
||||
src/video/psp/SDL_pspgl.o \
|
||||
src/video/psp/SDL_pspmouse.o \
|
||||
|
||||
INCDIR = ./include
|
||||
CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL
|
||||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
LIBDIR =
|
||||
LIBS = -lGL -lGLU -lglut -lz \
|
||||
-lpspvfpu -lpsphprm -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgum -lpspgu -lpspaudiolib -lpspaudio -lpsphttp -lpspssl -lpspwlan \
|
||||
-lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -lpspvram
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
2
README
|
@ -12,7 +12,7 @@ This is the Simple DirectMedia Layer, a general API that provides low
|
|||
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
|
||||
and 2D framebuffer across multiple platforms.
|
||||
|
||||
The current version supports Windows, Windows CE, Mac OS X, Linux, FreeBSD,
|
||||
The current version supports Windows, Mac OS X, Linux, FreeBSD,
|
||||
NetBSD, OpenBSD, BSD/OS, Solaris, iOS, and Android. The code contains
|
||||
support for other operating systems but those are not officially supported.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Please distribute this file with the SDL runtime environment:
|
||||
|
||||
The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
|
||||
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
|
||||
designed to make it easy to write multi-media software, such as games and
|
||||
emulators.
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ Simple Window Manager
|
|||
=====================
|
||||
|
||||
The driver has support for a very, very basic window manager you may
|
||||
want to use when runnning with "wm=default". Use
|
||||
want to use when running with "wm=default". Use
|
||||
|
||||
export SDL_DIRECTFB_WM=1
|
||||
|
||||
|
@ -62,10 +62,10 @@ you need to have the following font installed:
|
|||
|
||||
/usr/share/fonts/truetype/freefont/FreeSans.ttf
|
||||
|
||||
OPENGL Support
|
||||
OpenGL Support
|
||||
==============
|
||||
|
||||
The following instructions will give you *software* opengl. However this
|
||||
The following instructions will give you *software* OpenGL. However this
|
||||
works at least on all directfb supported platforms.
|
||||
|
||||
As of this writing 20100802 you need to pull Mesa from git and do the following:
|
||||
|
|
|
@ -56,7 +56,7 @@ usually is "TestGame". You might also want to use @PACKAGE@ to use the package
|
|||
name as specified in your configure.in file.
|
||||
|
||||
If your project builds more than one application, you will have to do a bit
|
||||
more. For each of your target applications, you need a seperate rule.
|
||||
more. For each of your target applications, you need a separate rule.
|
||||
|
||||
If you want the created bundles to be installed, you may want to add this
|
||||
rule to your Makefile.am:
|
||||
|
@ -75,13 +75,13 @@ the make rule accordingly.
|
|||
|
||||
But beware! That is only part of the story! With the above, you end up with
|
||||
a bare bone .app bundle, which is double clickable from the Finder. But
|
||||
there are some more things you should do before shipping yor product...
|
||||
there are some more things you should do before shipping your product...
|
||||
|
||||
1) The bundle right now probably is dynamically linked against SDL. That
|
||||
means that when you copy it to another computer, *it will not run*,
|
||||
unless you also install SDL on that other computer. A good solution
|
||||
for this dilemma is to static link against SDL. On OS X, you can
|
||||
achieve that by linkinag against the libraries listed by
|
||||
achieve that by linking against the libraries listed by
|
||||
sdl-config --static-libs
|
||||
instead of those listed by
|
||||
sdl-config --libs
|
||||
|
@ -120,7 +120,7 @@ normally from the Finder.
|
|||
- Building the Framework
|
||||
|
||||
The SDL Library is packaged as a framework bundle, an organized
|
||||
relocatable folder heirarchy of executible code, interface headers,
|
||||
relocatable folder hierarchy of executable code, interface headers,
|
||||
and additional resources. For practical purposes, you can think of a
|
||||
framework as a more user and system-friendly shared library, whose library
|
||||
file behaves more or less like a standard UNIX shared library.
|
||||
|
@ -166,7 +166,7 @@ following locations:
|
|||
- Running your app
|
||||
You can send command line args to your app by either invoking it from
|
||||
the command line (in *.app/Contents/MacOS) or by entering them in the
|
||||
"Executibles" panel of the target settings.
|
||||
"Executables" panel of the target settings.
|
||||
|
||||
- Implementation Notes
|
||||
Some things that may be of interest about how it all works...
|
||||
|
|
|
@ -11,7 +11,7 @@ Windows 7
|
|||
Mac OS X 10.4+
|
||||
Linux 2.6+
|
||||
iOS 3.1.3+
|
||||
Android 2.1+
|
||||
Android 2.3.3+
|
||||
|
||||
Unofficially supported platforms
|
||||
================================
|
||||
|
@ -24,9 +24,9 @@ Solaris
|
|||
|
||||
Platforms supported by volunteers
|
||||
=================================
|
||||
Haiku - maintained by Axel Dörfler <axeld@pinc-software.de>
|
||||
PSP - maintained by 527721088@qq.com
|
||||
Pandora - maintained by Scott Smith <pickle136@sbcglobal.net>
|
||||
|
||||
Platforms that need maintainers
|
||||
===============================
|
||||
Nintendo DS
|
||||
Haiku
|
||||
|
|
|
@ -26,12 +26,15 @@ There are two basic ways of building SDL at the moment:
|
|||
Add the top level include directory to the header search path, and then add
|
||||
the following sources to the project:
|
||||
src/*.c
|
||||
src/atomic/*.c
|
||||
src/audio/*.c
|
||||
src/cdrom/*.c
|
||||
src/cpuinfo/*.c
|
||||
src/events/*.c
|
||||
src/file/*.c
|
||||
src/haptic/*.c
|
||||
src/joystick/*.c
|
||||
src/power/*.c
|
||||
src/render/*.c
|
||||
src/stdlib/*.c
|
||||
src/thread/*.c
|
||||
src/timer/*.c
|
||||
|
@ -39,8 +42,9 @@ There are two basic ways of building SDL at the moment:
|
|||
src/audio/disk/*.c
|
||||
src/audio/dummy/*.c
|
||||
src/video/dummy/*.c
|
||||
src/haptic/dummy/*.c
|
||||
src/joystick/dummy/*.c
|
||||
src/cdrom/dummy/*.c
|
||||
src/main/dummy/*.c
|
||||
src/thread/generic/*.c
|
||||
src/timer/dummy/*.c
|
||||
src/loadso/dummy/*.c
|
||||
|
|
|
@ -4,12 +4,13 @@ Simple DirectMedia Layer for Android
|
|||
|
||||
Requirements:
|
||||
|
||||
Android SDK
|
||||
Android SDK (version 10 or later)
|
||||
http://developer.android.com/sdk/index.html
|
||||
|
||||
Android NDK r4 or later
|
||||
Android NDK r7 or later
|
||||
http://developer.android.com/sdk/ndk/index.html
|
||||
|
||||
Minimum API level supported by SDL: 10 (Android 2.3.3)
|
||||
|
||||
================================================================================
|
||||
How the port works
|
||||
|
@ -18,7 +19,7 @@ http://developer.android.com/sdk/ndk/index.html
|
|||
- Android applications are Java-based, optionally with parts written in C
|
||||
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
|
||||
the SDL library
|
||||
- This means that your application C code must be placed inside an android
|
||||
- This means that your application C code must be placed inside an Android
|
||||
Java project, along with some C support code that communicates with Java
|
||||
- This eventually produces a standard Android .apk package
|
||||
|
||||
|
@ -46,7 +47,8 @@ Instructions:
|
|||
|
||||
If you want to use the Eclipse IDE, skip to the Eclipse section below.
|
||||
|
||||
5. Edit <project>/local.properties to point to the Android SDK directory
|
||||
5. Create <project>/local.properties and use that to point to the Android SDK directory, by writing a line with the following form:
|
||||
sdk.dir=PATH_TO_ANDROID_SDK
|
||||
6. Run 'ant debug' in android/project. This compiles the .java and eventually
|
||||
creates a .apk with the native code embedded
|
||||
7. 'ant debug install' will push the apk to the device or emulator (if connected)
|
||||
|
@ -59,8 +61,8 @@ android-project/
|
|||
build.properties - empty
|
||||
build.xml - build description file, used by ant. The actual application name
|
||||
is specified here.
|
||||
default.properties - holds the target ABI for the application, can range between
|
||||
android-5 and android-16
|
||||
default.properties - holds the target ABI for the application, android-10 and up
|
||||
project.properties - holds the target ABI for the application, android-10 and up
|
||||
local.properties - holds the SDK path, you should change this to the path to your SDK
|
||||
jni/ - directory holding native code
|
||||
jni/Android.mk - Android makefile that can call recursively the Android.mk files
|
||||
|
@ -171,10 +173,10 @@ manually or quit the app (which is actually the kind of behaviour you'll see
|
|||
under iOS, if the OS can not restore your GL context it will just kill your app)
|
||||
|
||||
================================================================================
|
||||
Threads and the JAVA VM
|
||||
Threads and the Java VM
|
||||
================================================================================
|
||||
|
||||
For a quick tour on how Linux native threads interoperate with the JAVA VM, take
|
||||
For a quick tour on how Linux native threads interoperate with the Java VM, take
|
||||
a look here: http://developer.android.com/guide/practices/jni.html
|
||||
If you want to use threads in your SDL app, it's strongly recommended that you
|
||||
do so by creating them using SDL functions. This way, the required attach/detach
|
||||
|
@ -342,6 +344,38 @@ output file:
|
|||
When you're done instrumenting with valgrind, you can disable the wrapper:
|
||||
adb shell setprop wrap.org.libsdl.app ""
|
||||
|
||||
================================================================================
|
||||
Why is API level 10 the minimum required?
|
||||
================================================================================
|
||||
|
||||
API level 10 is required because SDL requires some functionality for running not
|
||||
available on older devices and some for building which is not in older NDK/SDKs.
|
||||
|
||||
Support for native OpenGL ES and ES2 applications was introduced in the NDK for
|
||||
API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which
|
||||
has since then been obsoleted, with the recommendation to developers to bump the
|
||||
required API level to 10.
|
||||
As of this writing, according to http://developer.android.com/about/dashboards/index.html
|
||||
about 90% of the Android devices accessing Google Play support API level 10 or
|
||||
higher (March 2013).
|
||||
|
||||
================================================================================
|
||||
A note regarding the use of the "dirty rectangles" rendering technique
|
||||
================================================================================
|
||||
|
||||
If your app uses a variation of the "dirty rectangles" rendering technique,
|
||||
where you only update a portion of the screen on each frame, you may notice a
|
||||
variety of visual glitches on Android, that are not present on other platforms.
|
||||
This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
|
||||
contexts, in particular the use of the eglSwapBuffers function. As stated in the
|
||||
documentation for the function "The contents of ancillary buffers are always
|
||||
undefined after calling eglSwapBuffers".
|
||||
Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
|
||||
is not possible for SDL as it requires EGL 1.4, available only on the API level
|
||||
17+, so the only workaround available on this platform is to redraw the entire
|
||||
screen each frame.
|
||||
|
||||
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
|
||||
|
||||
================================================================================
|
||||
Known issues
|
||||
|
|
64
README.ds
|
@ -1,64 +0,0 @@
|
|||
================================================================================
|
||||
Simple DirectMedia Layer for Nintendo DS
|
||||
================================================================================
|
||||
|
||||
-Requirements-
|
||||
* The devkitpro SDK available at http://devkitpro.org.
|
||||
Read the information at http://devkitpro.org/wiki/Getting_Started/devkitARM
|
||||
The necessary packages are devkitARM, libnds, libfat and default arm7.
|
||||
* Optionally, use a DS emulator, such as desmume (http://desmume.org/)
|
||||
to program and debug.
|
||||
|
||||
-Building SDL-
|
||||
|
||||
After setting the devkitpro environment, cd into your SDL directory and type:
|
||||
make -f Makefile.ds
|
||||
|
||||
This will compile and install the library and headers into the
|
||||
devkitpro's portlibs directory (../portlibs/arm/lib/ and
|
||||
../portlibs/arm/include/). Additionally it will compile several tests
|
||||
that you can run either on the DS or with desmume. For instance:
|
||||
desmume --cflash-path=test/ test/nds-test-progs/testsprite2/testsprite2.nds
|
||||
desmume --cflash-path=test/ test/nds-test-progs/testspriteminimal/testspriteminimal.nds
|
||||
desmume --cflash-path=test/ test/nds-test-progs/testscale/testscale.nds
|
||||
desmume test/nds-test-progs/general/general.nds
|
||||
|
||||
-Notes-
|
||||
* The renderer code is based on the gl like engine. It's not using the sprite engine.
|
||||
* The hardware renderer is using the parts of the libgl2d abstraction library that can be found at:
|
||||
http://rel.phatcode.net/junk.php?id=117
|
||||
Used with the author's permission.
|
||||
* The port is very basic and incomplete:
|
||||
- SDL currently has to be compiled for either framebuffer mode or renderer mode.
|
||||
See USE_HW_RENDERER in Makefile.ds.
|
||||
- some optional renderer functions are not implemented.
|
||||
- no sound
|
||||
|
||||
-Limitations-
|
||||
* in hardware renderer mode, don't load too many textures. The internal format is
|
||||
2 bytes per pixel. And there is only 256KB reserved for the textures. For instance,
|
||||
testscale won't display sample.bmp, unless it's resized to a smaller picture.
|
||||
* the screen size is 256 x 384. Anything else won't work.
|
||||
* there is no 8 bits/pixel mode because SDL 2.0 doesn't support palettes.
|
||||
|
||||
-Joystick mapping-
|
||||
The Joystick presented to SDL has 2 axes and 8 buttons
|
||||
|
||||
KEY | Code
|
||||
A | 0
|
||||
B | 1
|
||||
X | 2
|
||||
Y | 3
|
||||
L | 4
|
||||
R | 5
|
||||
select | 6
|
||||
start | 7
|
||||
|
||||
Left-right is axe 0.
|
||||
Up-down is axe 1.
|
||||
|
||||
-Mouse mapping-
|
||||
todo
|
||||
|
||||
-Examples-
|
||||
Due to memory limitations, to be able to successfully run the testscale example, sample.bmp must be resized to 256x105.
|
|
@ -16,7 +16,7 @@ Recording terminates as soon as a finger comes up. Recording is acknowledged by
|
|||
A SDL_DOLLARRECORD event is a dgesture with the following fields:
|
||||
|
||||
event.dgesture.touchId - the Id of the touch used to record the gesture.
|
||||
event.dgesture.gestureId - the unique id of the recoreded gesture.
|
||||
event.dgesture.gestureId - the unique id of the recorded gesture.
|
||||
|
||||
|
||||
Performing:
|
||||
|
@ -28,7 +28,7 @@ event.dgesture.gestureId - the unique id of the closest gesture to the performe
|
|||
event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
|
||||
event.dgesture.numFingers - the number of fingers used to draw the stroke.
|
||||
|
||||
Most programs will want to define an appropriate error threshold and check to be sure taht the error of a gesture is not abnormally high (an indicator that no gesture was performed).
|
||||
Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
|
||||
|
||||
|
||||
|
||||
|
@ -38,14 +38,14 @@ To save a template, call SDL_SaveDollarTemplate(gestureId, src) where gestureId
|
|||
|
||||
To save all currently loaded templates, call SDL_SaveAllDollarTemplates(src) where source is an SDL_RWops pointer to the file where the gesture will be stored.
|
||||
|
||||
Both functions return the number of gestures sucessfully saved.
|
||||
Both functions return the number of gestures successfully saved.
|
||||
|
||||
|
||||
Loading:
|
||||
--------
|
||||
To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
|
||||
|
||||
SDL_LoadDollarTemplates returns the number of templates sucessfully loaded.
|
||||
SDL_LoadDollarTemplates returns the number of templates successfully loaded.
|
||||
|
||||
|
||||
|
||||
|
@ -56,8 +56,8 @@ SDL provides simple support for pinch/rotate/swipe gestures.
|
|||
Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
|
||||
|
||||
event.mgesture.touchId - the Id of the touch on which the gesture was performed.
|
||||
event.mgesture.x - the normalized x cooridinate of the gesture. (0..1)
|
||||
event.mgesture.y - the normalized y cooridinate of the gesture. (0..1)
|
||||
event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
|
||||
event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
|
||||
event.mgesture.dTheta - the amount that the fingers rotated during this motion.
|
||||
event.mgesture.dDist - the amount that the fingers pinched during this motion.
|
||||
event.mgesture.numFingers - the number of fingers used in the gesture.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
SDL 2.0 with open pandora console support ( http://openpandora.org/ )
|
||||
=====================================================================
|
||||
|
||||
- A pandora specific video driver was writed to allow SDL 2.0 with OpenGL ES
|
||||
- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
|
||||
support to work on the pandora under the framebuffer. This driver do not have
|
||||
input support for now, so if you use it you will have to add your own control code.
|
||||
The video driver name is "pandora" so if you have problem running it from
|
||||
|
|
17
README.psp
Normal file
|
@ -0,0 +1,17 @@
|
|||
SDL port for the Sony PSP contributed by
|
||||
Captian Lex
|
||||
|
||||
Credit to
|
||||
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
|
||||
Geecko for his PSP GU lib "Glib2d"
|
||||
|
||||
Building
|
||||
--------
|
||||
To build for the PSP, make sure psp-config is in the path and run:
|
||||
make -f Makefile.psp
|
||||
|
||||
|
||||
|
||||
To Do
|
||||
------
|
||||
PSP Screen Keyboard
|
69
README.touch
|
@ -5,7 +5,7 @@ Linux:
|
|||
The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
|
||||
|
||||
Mac:
|
||||
The Mac and Iphone API's are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
|
||||
The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
|
||||
|
||||
iPhone:
|
||||
Works out of box.
|
||||
|
@ -21,18 +21,18 @@ Sent when a finger (or stylus) is placed on a touch device.
|
|||
Fields:
|
||||
event.tfinger.touchId - the Id of the touch device.
|
||||
event.tfinger.fingerId - the Id of the finger which just went down.
|
||||
event.tfinger.x - the x coordinate of the touch (0..touch.xres)
|
||||
event.tfinger.y - the y coordinate of the touch (0..touch.yres)
|
||||
event.tfinger.pressure - the pressure of the touch (0..touch.pressureres)
|
||||
event.tfinger.x - the x coordinate of the touch (0..1)
|
||||
event.tfinger.y - the y coordinate of the touch (0..1)
|
||||
event.tfinger.pressure - the pressure of the touch (0..1)
|
||||
|
||||
SDL_FINGERMOTION:
|
||||
Sent when a finger (or stylus) is moved on the touch device.
|
||||
Fields:
|
||||
Same as FINGERDOWN but with additional:
|
||||
event.tfginer.dx - change in x coordinate during this motion event.
|
||||
event.tfginer.dy - change in y coordinate during this motion event.
|
||||
event.tfinger.dx - change in x coordinate during this motion event.
|
||||
event.tfinger.dy - change in y coordinate during this motion event.
|
||||
|
||||
SDL_FINGERMOTION:
|
||||
SDL_FINGERUP:
|
||||
Sent when a finger (or stylus) is lifted from the touch device.
|
||||
Fields:
|
||||
Same as FINGERDOWN.
|
||||
|
@ -41,56 +41,38 @@ Same as FINGERDOWN.
|
|||
===========================================================================
|
||||
Functions
|
||||
===========================================================================
|
||||
SDL provides the ability to access the underlying Touch and Finger structures.
|
||||
SDL provides the ability to access the underlying Finger structures.
|
||||
These structures should _never_ be modified.
|
||||
|
||||
The following functions are included from SDL_Touch.h
|
||||
The following functions are included from SDL_touch.h
|
||||
|
||||
To get a SDL_Touch device call SDL_GetTouch(touchId).
|
||||
This returns an SDL_Touch*.
|
||||
IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouch will return null. Be sure to check for this!
|
||||
To get a SDL_TouchID call SDL_GetTouchDevice(index).
|
||||
This returns a SDL_TouchID.
|
||||
IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouchID will return 0. Be sure to check for this!
|
||||
|
||||
An SDL_Touch has the following fields:
|
||||
>xres,yres,pressures:
|
||||
The resolution at which x,y, and pressure values are reported. Currently these will always be equal to 2^15, but this may not always be the case.
|
||||
The number of touch devices can be queried with SDL_GetNumTouchDevices().
|
||||
|
||||
>pressure_max, pressure_min, x_max, x_min, y_max, y_min
|
||||
Which give, respectively, the maximum and minumum values that the touch digitizer can return for pressure, x coordiniate, and y coordinate AS REPORTED BY THE OPERATING SYSTEM.
|
||||
On Mac/iPhone systems _max will always be 0, and _min will always be 1.
|
||||
A SDL_Touch may be used to get pointers to SDL_Finger.
|
||||
|
||||
>native_xres,native_yres,native_pressureres:
|
||||
The native resolution of the touch device AS REPORTED BY THE OPERATING SYSTEM.
|
||||
On Mac/iPhone systems these will always be 1.
|
||||
SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
|
||||
|
||||
>num_fingers:
|
||||
The number of fingers currently down on the device.
|
||||
The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
|
||||
|
||||
>fingers:
|
||||
An array of pointers to the fingers which are on the device.
|
||||
|
||||
|
||||
The most common reason to access a touch device is to normalize inputs. This would be accomplished by code like the following:
|
||||
|
||||
SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId);
|
||||
if(inTouch == NULL) continue; //The touch has been removed
|
||||
|
||||
float x = ((float)event.tfinger.x)/inTouch->xres;
|
||||
float y = ((float)event.tfinger.y)/inTouch->yres;
|
||||
float x = event.tfinger.x;
|
||||
float y = event.tfinger.y;
|
||||
|
||||
|
||||
|
||||
To get an SDL_Finger, call SDL_GetFinger(touch,fingerId), where touch is a pointer to an SDL_Touch device, and fingerId is the id of the requested finger.
|
||||
This returns an SDL_Finger*, or null if the finger does not exist, or has been removed.
|
||||
An SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the FINGERUP event is polled.
|
||||
As a result, be very careful to check for null return values.
|
||||
To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger.
|
||||
This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed.
|
||||
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the FINGERUP event is polled.
|
||||
As a result, be very careful to check for NULL return values.
|
||||
|
||||
An SDL_Finger has the following fields:
|
||||
A SDL_Finger has the following fields:
|
||||
>x,y,pressure:
|
||||
The current coordinates of the touch.
|
||||
>xdelta,ydelta:
|
||||
The change in position resulting from the last finger motion.
|
||||
>last_x, last_y, last_pressure:
|
||||
The previous coordinates of the touch.
|
||||
>pressure:
|
||||
The pressure of the touch.
|
||||
|
||||
===========================================================================
|
||||
Notes
|
||||
|
@ -99,3 +81,4 @@ For a complete example see test/testgesture.c
|
|||
|
||||
Please direct questions/comments to:
|
||||
jim.tla+sdl_touch@gmail.com
|
||||
(original author, API was changed since)
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -123,6 +124,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -159,6 +161,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -170,6 +173,8 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\lib\x86</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -191,6 +196,7 @@
|
|||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -201,6 +207,9 @@
|
|||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\lib\x64</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -127,6 +128,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -163,6 +165,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -173,6 +176,9 @@
|
|||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\lib\x86</AdditionalLibraryDirectories>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -194,6 +200,7 @@
|
|||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -204,6 +211,9 @@
|
|||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\lib\x64</AdditionalLibraryDirectories>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -8,73 +8,26 @@ EndProject
|
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CE748C1F-3C21-4825-AA6A-F895A023F7E7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loopwave", "tests\loopwave\loopwave_VS2010.vcxproj", "{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testplatform", "tests\testplatform\testplatform_VS2010.vcxproj", "{26932B24-EFC6-4E3A-B277-ED653DA37968}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testfile", "tests\testfile\testfile_VS2010.vcxproj", "{CAE4F1D0-314F-4B10-805B-0EFD670133A0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgl2", "tests\testgl2\testgl2_VS2010.vcxproj", "{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "checkkeys", "tests\checkkeys\checkkeys_VS2010.vcxproj", "{26828762-C95D-4637-9CB1-7F0979523813}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2_VS2010.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testshape", "tests\testshape\testshape_VS2010.vcxproj", "{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdraw2", "tests\testdraw2\testdraw2_VS2010.vcxproj", "{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpower", "tests\testpower\testpower_VS2010.vcxproj", "{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2test", "SDLtest\SDLtest_VS2010.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testautomation", "tests\testautomation\testautomation_vs2010.vcxproj", "{FEE710DB-EC7B-4CCB-BD75-535D401A2FE0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -106,62 +59,72 @@ Global
|
|||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|x64.Build.0 = Debug|x64
|
||||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|Win32.Build.0 = Release|Win32
|
||||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|x64.ActiveCfg = Release|Win32
|
||||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|x64.ActiveCfg = Release|x64
|
||||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|x64.Build.0 = Release|x64
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|x64.Build.0 = Debug|x64
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|Win32.Build.0 = Release|Win32
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|x64.ActiveCfg = Release|Win32
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|x64.ActiveCfg = Release|x64
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|x64.Build.0 = Release|x64
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|x64.Build.0 = Debug|x64
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|Win32.Build.0 = Release|Win32
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|x64.ActiveCfg = Release|Win32
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|x64.ActiveCfg = Release|x64
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|x64.Build.0 = Release|x64
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|x64.Build.0 = Debug|x64
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|Win32.Build.0 = Release|Win32
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|x64.ActiveCfg = Release|Win32
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|x64.ActiveCfg = Release|x64
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|x64.Build.0 = Release|x64
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Debug|x64.Build.0 = Debug|x64
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Release|Win32.Build.0 = Release|Win32
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Release|x64.ActiveCfg = Release|Win32
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Release|x64.ActiveCfg = Release|x64
|
||||
{26828762-C95D-4637-9CB1-7F0979523813}.Release|x64.Build.0 = Release|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|x64.Build.0 = Debug|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Win32.Build.0 = Release|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|x64.ActiveCfg = Release|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|x64.ActiveCfg = Release|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|x64.Build.0 = Release|x64
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Debug|x64.Build.0 = Debug|x64
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Release|x64.ActiveCfg = Release|Win32
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Release|Win32.Build.0 = Release|Win32
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Release|x64.ActiveCfg = Release|x64
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F}.Release|x64.Build.0 = Release|x64
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|x64.Build.0 = Debug|x64
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|Win32.Build.0 = Release|Win32
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|x64.ActiveCfg = Release|Win32
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|x64.ActiveCfg = Release|x64
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|x64.Build.0 = Release|x64
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|x64.Build.0 = Debug|x64
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|Win32.Build.0 = Release|Win32
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|x64.ActiveCfg = Release|Win32
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|x64.ActiveCfg = Release|x64
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|x64.Build.0 = Release|x64
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
@ -183,15 +146,15 @@ Global
|
|||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{FEE710DB-EC7B-4CCB-BD75-535D401A2FE0} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{CAE4F1D0-314F-4B10-805B-0EFD670133A0} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{8B5CFB38-CCBA-40A8-AD7A-89C57B070884} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{26828762-C95D-4637-9CB1-7F0979523813} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C96635682} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{26932B24-EFC6-4E3A-B277-ED653DA37968} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{FEE710DB-EC7B-4CCB-BD75-535D401A2FE0} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{EDEA9D00-AF64-45DE-8F60-5957048F2F0F} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{26828762-C95D-4637-9CB1-7F0979523813} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -144,7 +144,6 @@
|
|||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/SDLmain.pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
|
|
|
@ -144,7 +144,6 @@
|
|||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/SDLtest.pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
|
|
|
@ -168,7 +168,6 @@
|
|||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Release/testplatform.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
|
|
|
@ -223,10 +223,7 @@
|
|||
<Library Include="..\..\SDLmain\$(Platform)\$(Configuration)\SDLmain.lib" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testpower.c">
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug/testpower.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\Debug/testpower.pch</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\test\testpower.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
0097E2A812F70C4D00724AC5 /* SDL_config_iphoneos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_iphoneos.h; sourceTree = "<group>"; };
|
||||
0097E2A912F70C4D00724AC5 /* SDL_config_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_macosx.h; sourceTree = "<group>"; };
|
||||
0097E2AA12F70C4D00724AC5 /* SDL_config_minimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_minimal.h; sourceTree = "<group>"; };
|
||||
0097E2AB12F70C4D00724AC5 /* SDL_config_nintendods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_nintendods.h; sourceTree = "<group>"; };
|
||||
0097E2AC12F70C4D00724AC5 /* SDL_config_pandora.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_pandora.h; sourceTree = "<group>"; };
|
||||
0097E2AD12F70C4D00724AC5 /* SDL_config_windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_windows.h; sourceTree = "<group>"; };
|
||||
0097E2AE12F70C4D00724AC5 /* SDL_config_wiz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_wiz.h; sourceTree = "<group>"; };
|
||||
|
@ -142,7 +141,6 @@
|
|||
0097E2A812F70C4D00724AC5 /* SDL_config_iphoneos.h */,
|
||||
0097E2A912F70C4D00724AC5 /* SDL_config_macosx.h */,
|
||||
0097E2AA12F70C4D00724AC5 /* SDL_config_minimal.h */,
|
||||
0097E2AB12F70C4D00724AC5 /* SDL_config_nintendods.h */,
|
||||
0097E2AC12F70C4D00724AC5 /* SDL_config_pandora.h */,
|
||||
0097E2AD12F70C4D00724AC5 /* SDL_config_windows.h */,
|
||||
0097E2AE12F70C4D00724AC5 /* SDL_config_wiz.h */,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
An example Java class can be found in README.android
|
||||
-->
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="SDLActivity"
|
||||
android:label="@string/app_name">
|
||||
|
@ -29,7 +29,7 @@
|
|||
</activity>
|
||||
</application>
|
||||
|
||||
<!-- Android 2.1 -->
|
||||
<!-- Android 2.3.3 -->
|
||||
<uses-sdk android:minSdkVersion="10" />
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
|
|
BIN
android-project/res/drawable-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 1.7 KiB |
BIN
android-project/res/drawable-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.5 KiB |
BIN
android-project/res/drawable-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
android-project/res/drawable-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
|
@ -509,7 +509,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||
int format, int width, int height) {
|
||||
Log.v("SDL", "surfaceChanged()");
|
||||
|
||||
int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default
|
||||
int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default
|
||||
switch (format) {
|
||||
case PixelFormat.A_8:
|
||||
Log.v("SDL", "pixel format A_8");
|
||||
|
@ -522,32 +522,32 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||
break;
|
||||
case PixelFormat.RGBA_4444:
|
||||
Log.v("SDL", "pixel format RGBA_4444");
|
||||
sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444
|
||||
sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444
|
||||
break;
|
||||
case PixelFormat.RGBA_5551:
|
||||
Log.v("SDL", "pixel format RGBA_5551");
|
||||
sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551
|
||||
sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551
|
||||
break;
|
||||
case PixelFormat.RGBA_8888:
|
||||
Log.v("SDL", "pixel format RGBA_8888");
|
||||
sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888
|
||||
sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888
|
||||
break;
|
||||
case PixelFormat.RGBX_8888:
|
||||
Log.v("SDL", "pixel format RGBX_8888");
|
||||
sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888
|
||||
sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888
|
||||
break;
|
||||
case PixelFormat.RGB_332:
|
||||
Log.v("SDL", "pixel format RGB_332");
|
||||
sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332
|
||||
sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332
|
||||
break;
|
||||
case PixelFormat.RGB_565:
|
||||
Log.v("SDL", "pixel format RGB_565");
|
||||
sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565
|
||||
sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565
|
||||
break;
|
||||
case PixelFormat.RGB_888:
|
||||
Log.v("SDL", "pixel format RGB_888");
|
||||
// Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
|
||||
sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888
|
||||
sdlFormat = 0x16161804; // SDL_PIXELFORMAT_RGB888
|
||||
break;
|
||||
default:
|
||||
Log.v("SDL", "pixel format unknown " + format);
|
||||
|
|
|
@ -10,11 +10,11 @@ header=$outdir/include/SDL_revision.h
|
|||
rev=`sh showrev.sh 2>/dev/null`
|
||||
if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then
|
||||
revnum=`echo $rev | sed 's,hg-\([0-9]*\).*,\1,'`
|
||||
echo "#define SDL_REVISION \"$rev\"" >$header.new
|
||||
echo "#define SDL_REVISION_NUMBER $revnum" >>$header.new
|
||||
echo "#define SDL_REVISION \"$rev\"" >"$header.new"
|
||||
echo "#define SDL_REVISION_NUMBER $revnum" >>"$header.new"
|
||||
if diff $header $header.new >/dev/null 2>&1; then
|
||||
rm $header.new
|
||||
rm "$header.new"
|
||||
else
|
||||
mv $header.new $header
|
||||
mv "$header.new" "$header"
|
||||
fi
|
||||
fi
|
||||
|
|
11
configure
vendored
|
@ -20263,7 +20263,7 @@ fi
|
|||
else
|
||||
set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
|
||||
NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
|
||||
set -- `directfb-config --version | sed 's/\./ /g'`
|
||||
set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
|
||||
HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
|
||||
if test $HAVE_VERSION -ge $NEED_VERSION; then
|
||||
DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
|
||||
|
@ -22324,6 +22324,15 @@ $as_echo "#define SDL_POWER_BEOS 1" >>confdefs.h
|
|||
# The iOS platform requires special setup.
|
||||
SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
|
||||
SOURCES="$SOURCES $srcdir/src/video/uikit/*.c"
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
|
||||
;;
|
||||
*-*-darwin* )
|
||||
# This could be either full "Mac OS X", or plain "Darwin" which is
|
||||
|
|
34
configure.in
|
@ -794,6 +794,14 @@ AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio suppor
|
|||
test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
|
||||
echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
|
||||
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
|
||||
|
||||
case "$host" in
|
||||
# On Solaris, pulseaudio must be linked deferred explicitly
|
||||
# to prevent undefined symbol failures.
|
||||
*-*-solaris*)
|
||||
PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
|
||||
esac
|
||||
else
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
|
||||
fi
|
||||
|
@ -1415,7 +1423,7 @@ AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=n
|
|||
else
|
||||
set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
|
||||
NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
|
||||
set -- `directfb-config --version | sed 's/\./ /g'`
|
||||
set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
|
||||
HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
|
||||
if test $HAVE_VERSION -ge $NEED_VERSION; then
|
||||
DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
|
||||
|
@ -1767,9 +1775,20 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]])
|
|||
pthread_cflags="-D_REENTRANT"
|
||||
pthread_lib="-pthread"
|
||||
;;
|
||||
*-*-solaris*)
|
||||
*-*-solaris2.9)
|
||||
# From Solaris 9+, posix4's preferred name is rt.
|
||||
pthread_cflags="-D_REENTRANT"
|
||||
pthread_lib="-lpthread -lposix4"
|
||||
pthread_lib="-lpthread -lrt"
|
||||
;;
|
||||
*-*-solaris2.10)
|
||||
# Solaris 10+ merged pthread into libc.
|
||||
pthread_cflags="-D_REENTRANT"
|
||||
pthread_lib="-lrt"
|
||||
;;
|
||||
*-*-solaris*)
|
||||
# Solaris 11+ merged rt into libc.
|
||||
pthread_cflags="-D_REENTRANT"
|
||||
pthread_lib=""
|
||||
;;
|
||||
*-*-sysv5*)
|
||||
pthread_cflags="-D_REENTRANT -Kthread"
|
||||
|
@ -2499,6 +2518,15 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
|||
# The iOS platform requires special setup.
|
||||
SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
|
||||
SOURCES="$SOURCES $srcdir/src/video/uikit/*.c"
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
|
||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
|
||||
;;
|
||||
*-*-darwin* )
|
||||
# This could be either full "Mac OS X", or plain "Darwin" which is
|
||||
|
|
|
@ -41,10 +41,9 @@
|
|||
* Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
||||
* Pike, Pliant, Python, Ruby, and Smalltalk.
|
||||
*
|
||||
* This library is distributed under GNU LGPL version 2, which can be
|
||||
* This library is distributed under the zlib license, which can be
|
||||
* found in the file "COPYING". This license allows you to use SDL
|
||||
* freely in commercial programs as long as you link with the dynamic
|
||||
* library.
|
||||
* freely for any purpose as long as you retain the copyright notice.
|
||||
*
|
||||
* The best way to learn how to use SDL is to check out the header files in
|
||||
* the "include" subdirectory and the programs in the "test" subdirectory.
|
||||
|
@ -73,7 +72,9 @@
|
|||
#include "SDL_endian.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_gamecontroller.h"
|
||||
#include "SDL_haptic.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_log.h"
|
||||
|
@ -112,7 +113,10 @@ extern "C" {
|
|||
#define SDL_INIT_HAPTIC 0x00001000
|
||||
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */
|
||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
|
||||
#define SDL_INIT_EVERYTHING 0x0000FFFF
|
||||
#define SDL_INIT_EVERYTHING ( \
|
||||
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | \
|
||||
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
|
||||
)
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -126,7 +126,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
|
|||
* The compiler barrier prevents the compiler from reordering
|
||||
* reads and writes to globally visible variables across the call.
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
void _ReadWriteBarrier(void);
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
||||
|
@ -134,7 +134,7 @@ void _ReadWriteBarrier(void);
|
|||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
||||
#else
|
||||
#define SDL_CompilerBarrier() \
|
||||
({ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); })
|
||||
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
|
||||
#endif
|
||||
|
||||
/* Platform specific optimized versions of the atomic functions,
|
||||
|
@ -196,9 +196,8 @@ typedef struct { int value; } SDL_atomic_t;
|
|||
* \note If you don't know what this function is for, you shouldn't use it!
|
||||
*/
|
||||
#ifndef SDL_AtomicCAS
|
||||
#define SDL_AtomicCAS SDL_AtomicCAS_
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
|
||||
#endif
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval);
|
||||
|
||||
/**
|
||||
* \brief Set an atomic variable to a value.
|
||||
|
@ -206,7 +205,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int
|
|||
* \return The previous value of the atomic variable.
|
||||
*/
|
||||
#ifndef SDL_AtomicSet
|
||||
static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||
SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||
{
|
||||
int value;
|
||||
do {
|
||||
|
@ -220,7 +219,7 @@ static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
|||
* \brief Get the value of an atomic variable
|
||||
*/
|
||||
#ifndef SDL_AtomicGet
|
||||
static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
|
||||
SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a)
|
||||
{
|
||||
int value = a->value;
|
||||
SDL_CompilerBarrier();
|
||||
|
@ -236,7 +235,7 @@ static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
|
|||
* \note This same style can be used for any number operation
|
||||
*/
|
||||
#ifndef SDL_AtomicAdd
|
||||
static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
||||
SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
||||
{
|
||||
int value;
|
||||
do {
|
||||
|
@ -271,9 +270,8 @@ static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
|||
* \note If you don't know what this function is for, you shouldn't use it!
|
||||
*/
|
||||
#ifndef SDL_AtomicCASPtr
|
||||
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval);
|
||||
#endif
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void *newval);
|
||||
|
||||
/**
|
||||
* \brief Set a pointer to a value atomically.
|
||||
|
@ -281,7 +279,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void
|
|||
* \return The previous value of the pointer.
|
||||
*/
|
||||
#ifndef SDL_AtomicSetPtr
|
||||
static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
|
||||
SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
|
||||
{
|
||||
void* value;
|
||||
do {
|
||||
|
@ -295,7 +293,7 @@ static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
|
|||
* \brief Get the value of a pointer atomically.
|
||||
*/
|
||||
#ifndef SDL_AtomicGetPtr
|
||||
static __inline__ void* SDL_AtomicGetPtr(void* *a)
|
||||
SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
|
||||
{
|
||||
void* value = *a;
|
||||
SDL_CompilerBarrier();
|
||||
|
|
|
@ -40,11 +40,6 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* \file SDL_bits.h
|
||||
*
|
||||
* Uses inline functions for compilers that support them, and static
|
||||
* functions for those that do not. Because these functions become
|
||||
* static for compilers that do not support inline functions, this
|
||||
* header should only be included in files that actually use them.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -54,10 +49,10 @@ extern "C" {
|
|||
*
|
||||
* \return Index of the most significant bit.
|
||||
*/
|
||||
static __inline__ Sint8
|
||||
SDL_FORCE_INLINE Sint8
|
||||
SDL_MostSignificantBitIndex32(Uint32 x)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
/* Count Leading Zeroes builtin in GCC.
|
||||
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
|
||||
*/
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "SDL_config_iphoneos.h"
|
||||
#elif defined(__ANDROID__)
|
||||
#include "SDL_config_android.h"
|
||||
#elif defined(__NINTENDODS__)
|
||||
#include "SDL_config_nintendods.h"
|
||||
#elif defined(__PSP__)
|
||||
#include "SDL_config_psp.h"
|
||||
#else
|
||||
/* This is a minimal configuration just to get SDL running on new platforms */
|
||||
#include "SDL_config_minimal.h"
|
||||
|
|
|
@ -195,7 +195,6 @@
|
|||
#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
|
||||
#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
|
||||
#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
|
||||
#cmakedefine SDL_AUDIO_DRIVER_NDS @SDL_AUDIO_DRIVER_NDS@
|
||||
#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
|
||||
#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
|
||||
#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
|
||||
|
@ -213,7 +212,6 @@
|
|||
#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
|
||||
#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
|
||||
#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
|
||||
#cmakedefine SDL_JOYSTICK_NDS @SDL_JOYSTICK_NDS@
|
||||
#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
|
||||
#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
|
||||
#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@
|
||||
|
@ -231,7 +229,6 @@
|
|||
|
||||
/* Enable various threading systems */
|
||||
#cmakedefine SDL_THREAD_BEOS @SDL_THREAD_BEOS@
|
||||
#cmakedefine SDL_THREAD_NDS @SDL_THREAD_NDS@
|
||||
#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@
|
||||
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@
|
||||
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
|
||||
|
@ -240,7 +237,6 @@
|
|||
/* Enable various timer systems */
|
||||
#cmakedefine SDL_TIMER_BEOS @SDL_TIMER_BEOS@
|
||||
#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@
|
||||
#cmakedefine SDL_TIMER_NDS @SDL_TIMER_NDS@
|
||||
#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@
|
||||
#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@
|
||||
#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
|
||||
|
@ -251,7 +247,6 @@
|
|||
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
|
||||
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
|
||||
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
|
||||
#cmakedefine SDL_VIDEO_DRIVER_NDS @SDL_VIDEO_DRIVER_NDS@
|
||||
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
|
||||
#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
|
||||
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
|
||||
|
@ -295,7 +290,6 @@
|
|||
#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
|
||||
#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
|
||||
#cmakedefine SDL_POWER_BEOS @SDL_POWER_BEOS@
|
||||
#cmakedefine SDL_POWER_NINTENDODS @SDL_POWER_NINTENDODS@
|
||||
#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
|
||||
|
||||
/* Enable assembly routines */
|
||||
|
|
|
@ -198,7 +198,6 @@
|
|||
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_NAS
|
||||
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_NDS
|
||||
#undef SDL_AUDIO_DRIVER_OSS
|
||||
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
|
||||
#undef SDL_AUDIO_DRIVER_PAUDIO
|
||||
|
@ -216,7 +215,6 @@
|
|||
#undef SDL_JOYSTICK_DUMMY
|
||||
#undef SDL_JOYSTICK_IOKIT
|
||||
#undef SDL_JOYSTICK_LINUX
|
||||
#undef SDL_JOYSTICK_NDS
|
||||
#undef SDL_JOYSTICK_WINMM
|
||||
#undef SDL_JOYSTICK_USBHID
|
||||
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
||||
|
@ -234,7 +232,6 @@
|
|||
|
||||
/* Enable various threading systems */
|
||||
#undef SDL_THREAD_BEOS
|
||||
#undef SDL_THREAD_NDS
|
||||
#undef SDL_THREAD_PTHREAD
|
||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
|
||||
|
@ -243,7 +240,6 @@
|
|||
/* Enable various timer systems */
|
||||
#undef SDL_TIMER_BEOS
|
||||
#undef SDL_TIMER_DUMMY
|
||||
#undef SDL_TIMER_NDS
|
||||
#undef SDL_TIMER_UNIX
|
||||
#undef SDL_TIMER_WINDOWS
|
||||
|
||||
|
@ -253,7 +249,6 @@
|
|||
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
||||
#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
|
||||
#undef SDL_VIDEO_DRIVER_DUMMY
|
||||
#undef SDL_VIDEO_DRIVER_NDS
|
||||
#undef SDL_VIDEO_DRIVER_WINDOWS
|
||||
#undef SDL_VIDEO_DRIVER_X11
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||
|
@ -297,7 +292,6 @@
|
|||
#undef SDL_POWER_WINDOWS
|
||||
#undef SDL_POWER_MACOSX
|
||||
#undef SDL_POWER_BEOS
|
||||
#undef SDL_POWER_NINTENDODS
|
||||
#undef SDL_POWER_HARDWIRED
|
||||
|
||||
/* Enable assembly routines */
|
||||
|
|
|
@ -19,40 +19,29 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_config_nintendods_h
|
||||
#define _SDL_config_nintendods_h
|
||||
#ifndef _SDL_config_psp_h
|
||||
#define _SDL_config_psp_h
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* This is a set of defines to configure the SDL features */
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
/* LiF: __PTRDIFF_TYPE__ was causing errors of conflicting typedefs with the
|
||||
<stdint.h> shipping with devkitARM. copied a similar ifdef from it. */
|
||||
#ifndef __PTRDIFF_TYPE__
|
||||
typedef unsigned long uintptr_t;
|
||||
#else
|
||||
typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
|
||||
#ifdef __GNUC__
|
||||
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
|
||||
#endif
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
#define SIZEOF_VOIDP 4
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
/* Useful headers */
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
|
@ -63,6 +52,8 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
|
|||
#define HAVE_GETENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_BCOPY 1
|
||||
|
@ -71,59 +62,75 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
|
|||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_INDEX 1
|
||||
#define HAVE_RINDEX 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRICMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
//#define HAVE_SYSCONF 1
|
||||
//#define HAVE_SIGACTION 1
|
||||
|
||||
/* DS isn't that sophisticated */
|
||||
|
||||
/* PSP isn't that sophisticated */
|
||||
#define LACKS_SYS_MMAN_H 1
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_NDS 1
|
||||
/*#define SDL_AUDIO_DRIVER_DUMMY 1 TODO: uncomment this later*/
|
||||
/* Enable the stub thread support (src/thread/psp/\*.c) */
|
||||
#define SDL_THREAD_PSP 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_NDS 1
|
||||
/*#define SDL_JOYSTICK_DUMMY 1 TODO: uncomment this later*/
|
||||
/* Enable the stub timer support (src/timer/psp/\*.c) */
|
||||
#define SDL_TIMERS_PSP 1
|
||||
|
||||
/* DS has no dynamic linking afaik */
|
||||
/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
|
||||
#define SDL_JOYSTICK_PSP 1
|
||||
|
||||
/* Enable the stub audio driver (src/audio/psp/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_PSP 1
|
||||
|
||||
/* PSP video dirver */
|
||||
#define SDL_VIDEO_DRIVER_PSP 1
|
||||
|
||||
/* PSP render dirver */
|
||||
#define SDL_VIDEO_RENDER_PSP 1
|
||||
|
||||
#define SDL_POWER_PSP 1
|
||||
|
||||
/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
|
||||
/* PSP can't load shared object (src/loadso/dummy/\*.c) */
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
/*#define SDL_THREAD_NDS 1*/
|
||||
#define SDL_THREADS_DISABLED 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#define SDL_TIMER_NDS 1
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_NDS 1
|
||||
#ifdef USE_HW_RENDERER
|
||||
#define SDL_VIDEO_RENDER_NDS 1
|
||||
#else
|
||||
#define SDL_VIDEO_RENDER_NDS 0
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_NINTENDODS 1
|
||||
|
||||
/* Enable haptic support */
|
||||
#define SDL_HAPTIC_NDS 1
|
||||
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
|
||||
#endif /* _SDL_config_nintendods_h */
|
||||
#endif /* _SDL_config_minimal_h */
|
|
@ -109,7 +109,7 @@ typedef unsigned int uintptr_t;
|
|||
//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
//#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
|
@ -123,14 +123,14 @@ typedef unsigned int uintptr_t;
|
|||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
//#define HAVE_COPYSIGN 1 // TODO, WinRT: consider using _copysign instead
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
//#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
|
|
|
@ -66,29 +66,24 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* \file SDL_endian.h
|
||||
*
|
||||
* Uses inline functions for compilers that support them, and static
|
||||
* functions for those that do not. Because these functions become
|
||||
* static for compilers that do not support inline functions, this
|
||||
* header should only be included in files that actually use them.
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(__i386__) && \
|
||||
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
|
||||
static __inline__ Uint16
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint16
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
static __inline__ Uint16
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
int result;
|
||||
|
@ -97,14 +92,14 @@ SDL_Swap16(Uint16 x)
|
|||
return (Uint16)result;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
|
||||
static __inline__ Uint16
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint16
|
||||
SDL_FORCE_INLINE Uint16
|
||||
SDL_Swap16(Uint16 x)
|
||||
{
|
||||
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
|
||||
|
@ -112,21 +107,21 @@ SDL_Swap16(Uint16 x)
|
|||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
static __inline__ Uint32
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswap %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint32
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswapl %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
static __inline__ Uint32
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
Uint32 result;
|
||||
|
@ -137,14 +132,14 @@ SDL_Swap32(Uint32 x)
|
|||
return result;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
|
||||
static __inline__ Uint32
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint32
|
||||
SDL_FORCE_INLINE Uint32
|
||||
SDL_Swap32(Uint32 x)
|
||||
{
|
||||
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
|
||||
|
@ -153,7 +148,7 @@ SDL_Swap32(Uint32 x)
|
|||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
static __inline__ Uint64
|
||||
SDL_FORCE_INLINE Uint64
|
||||
SDL_Swap64(Uint64 x)
|
||||
{
|
||||
union
|
||||
|
@ -171,14 +166,14 @@ SDL_Swap64(Uint64 x)
|
|||
return v.u;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint64
|
||||
SDL_FORCE_INLINE Uint64
|
||||
SDL_Swap64(Uint64 x)
|
||||
{
|
||||
__asm__("bswapq %0": "=r"(x):"0"(x));
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint64
|
||||
SDL_FORCE_INLINE Uint64
|
||||
SDL_Swap64(Uint64 x)
|
||||
{
|
||||
Uint32 hi, lo;
|
||||
|
@ -195,7 +190,7 @@ SDL_Swap64(Uint64 x)
|
|||
#endif
|
||||
|
||||
|
||||
static __inline__ float
|
||||
SDL_FORCE_INLINE float
|
||||
SDL_SwapFloat(float x)
|
||||
{
|
||||
union
|
||||
|
|
|
@ -39,7 +39,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* Public functions */
|
||||
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
|
||||
/* SDL_SetError() unconditionally returns -1. */
|
||||
extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
|
||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||
|
||||
|
@ -62,7 +63,8 @@ typedef enum
|
|||
SDL_UNSUPPORTED,
|
||||
SDL_LASTERROR
|
||||
} SDL_errorcode;
|
||||
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
|
||||
/* SDL_Error() unconditionally returns -1. */
|
||||
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
|
||||
/*@}*//*Internal error functions*/
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
|
|
|
@ -77,14 +77,6 @@ typedef enum
|
|||
SDL_MOUSEBUTTONUP, /**< Mouse button released */
|
||||
SDL_MOUSEWHEEL, /**< Mouse wheel motion */
|
||||
|
||||
/* Tablet or multiple mice input device events */
|
||||
SDL_INPUTMOTION = 0x500, /**< Input moved */
|
||||
SDL_INPUTBUTTONDOWN, /**< Input button pressed */
|
||||
SDL_INPUTBUTTONUP, /**< Input button released */
|
||||
SDL_INPUTWHEEL, /**< Input wheel motion */
|
||||
SDL_INPUTPROXIMITYIN, /**< Input pen entered proximity */
|
||||
SDL_INPUTPROXIMITYOUT, /**< Input pen left proximity */
|
||||
|
||||
/* Joystick events */
|
||||
SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
|
||||
SDL_JOYBALLMOTION, /**< Joystick trackball motion */
|
||||
|
@ -100,13 +92,12 @@ typedef enum
|
|||
SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
|
||||
SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
|
||||
SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
|
||||
SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
|
||||
|
||||
/* Touch events */
|
||||
SDL_FINGERDOWN = 0x700,
|
||||
SDL_FINGERUP,
|
||||
SDL_FINGERMOTION,
|
||||
SDL_TOUCHBUTTONDOWN,
|
||||
SDL_TOUCHBUTTONUP,
|
||||
|
||||
/* Gesture events */
|
||||
SDL_DOLLARGESTURE = 0x800,
|
||||
|
@ -130,6 +121,15 @@ typedef enum
|
|||
SDL_LASTEVENT = 0xFFFF
|
||||
} SDL_EventType;
|
||||
|
||||
/**
|
||||
* \brief Fields shared by every event
|
||||
*/
|
||||
typedef struct SDL_GenericEvent
|
||||
{
|
||||
Uint32 type;
|
||||
Uint32 timestamp;
|
||||
} SDL_GenericEvent;
|
||||
|
||||
/**
|
||||
* \brief Window state change event data (event.window.*)
|
||||
*/
|
||||
|
@ -142,8 +142,8 @@ typedef struct SDL_WindowEvent
|
|||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
Uint8 padding3;
|
||||
int data1; /**< event dependent data */
|
||||
int data2; /**< event dependent data */
|
||||
Sint32 data1; /**< event dependent data */
|
||||
Sint32 data2; /**< event dependent data */
|
||||
} SDL_WindowEvent;
|
||||
|
||||
/**
|
||||
|
@ -171,8 +171,8 @@ typedef struct SDL_TextEditingEvent
|
|||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with keyboard focus, if any */
|
||||
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
|
||||
int start; /**< The start cursor of selected editing text */
|
||||
int length; /**< The length of selected editing text */
|
||||
Sint32 start; /**< The start cursor of selected editing text */
|
||||
Sint32 length; /**< The length of selected editing text */
|
||||
} SDL_TextEditingEvent;
|
||||
|
||||
|
||||
|
@ -196,14 +196,15 @@ typedef struct SDL_MouseMotionEvent
|
|||
Uint32 type; /**< ::SDL_MOUSEMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
||||
Uint8 state; /**< The current button state */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
Uint8 padding3;
|
||||
int x; /**< X coordinate, relative to window */
|
||||
int y; /**< Y coordinate, relative to window */
|
||||
int xrel; /**< The relative motion in the X direction */
|
||||
int yrel; /**< The relative motion in the Y direction */
|
||||
Sint32 x; /**< X coordinate, relative to window */
|
||||
Sint32 y; /**< Y coordinate, relative to window */
|
||||
Sint32 xrel; /**< The relative motion in the X direction */
|
||||
Sint32 yrel; /**< The relative motion in the Y direction */
|
||||
} SDL_MouseMotionEvent;
|
||||
|
||||
/**
|
||||
|
@ -214,12 +215,13 @@ typedef struct SDL_MouseButtonEvent
|
|||
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
||||
Uint8 button; /**< The mouse button index */
|
||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
int x; /**< X coordinate, relative to window */
|
||||
int y; /**< Y coordinate, relative to window */
|
||||
Sint32 x; /**< X coordinate, relative to window */
|
||||
Sint32 y; /**< Y coordinate, relative to window */
|
||||
} SDL_MouseButtonEvent;
|
||||
|
||||
/**
|
||||
|
@ -230,8 +232,9 @@ typedef struct SDL_MouseWheelEvent
|
|||
Uint32 type; /**< ::SDL_MOUSEWHEEL */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||
int x; /**< The amount scrolled horizontally */
|
||||
int y; /**< The amount scrolled vertically */
|
||||
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
|
||||
Sint32 x; /**< The amount scrolled horizontally */
|
||||
Sint32 y; /**< The amount scrolled vertically */
|
||||
} SDL_MouseWheelEvent;
|
||||
|
||||
/**
|
||||
|
@ -241,11 +244,13 @@ typedef struct SDL_JoyAxisEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_JOYAXISMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint8 which; /**< The joystick instance id */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 axis; /**< The joystick axis index */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
int value; /**< The axis value (range: -32768 to 32767) */
|
||||
Uint8 padding3;
|
||||
Sint16 value; /**< The axis value (range: -32768 to 32767) */
|
||||
Uint16 padding4;
|
||||
} SDL_JoyAxisEvent;
|
||||
|
||||
/**
|
||||
|
@ -255,12 +260,13 @@ typedef struct SDL_JoyBallEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_JOYBALLMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint8 which; /**< The joystick instance id */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 ball; /**< The joystick trackball index */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
int xrel; /**< The relative motion in the X direction */
|
||||
int yrel; /**< The relative motion in the Y direction */
|
||||
Uint8 padding3;
|
||||
Sint16 xrel; /**< The relative motion in the X direction */
|
||||
Sint16 yrel; /**< The relative motion in the Y direction */
|
||||
} SDL_JoyBallEvent;
|
||||
|
||||
/**
|
||||
|
@ -270,7 +276,7 @@ typedef struct SDL_JoyHatEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_JOYHATMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint8 which; /**< The joystick instance id */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 hat; /**< The joystick hat index */
|
||||
Uint8 value; /**< The hat position value.
|
||||
* \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
|
||||
|
@ -280,6 +286,7 @@ typedef struct SDL_JoyHatEvent
|
|||
* Note that zero means the POV is centered.
|
||||
*/
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
} SDL_JoyHatEvent;
|
||||
|
||||
/**
|
||||
|
@ -289,10 +296,11 @@ typedef struct SDL_JoyButtonEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
|
||||
Uint32 timestamp;
|
||||
Uint8 which; /**< The joystick instance id */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 button; /**< The joystick button index */
|
||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
} SDL_JoyButtonEvent;
|
||||
|
||||
/**
|
||||
|
@ -302,7 +310,7 @@ typedef struct SDL_JoyDeviceEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
|
||||
Uint32 timestamp;
|
||||
Uint32 which; /**< The joystick device index for ADD, instance_id for REMOVE*/
|
||||
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
|
||||
} SDL_JoyDeviceEvent;
|
||||
|
||||
|
||||
|
@ -313,9 +321,13 @@ typedef struct SDL_ControllerAxisEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
|
||||
Uint32 timestamp;
|
||||
Uint8 which; /**< The joystick instance id */
|
||||
SDL_CONTROLLER_AXIS axis; /**< The joystick axis index */
|
||||
int value; /**< The axis value (range: -32768 to 32767) */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
Uint8 padding3;
|
||||
Sint16 value; /**< The axis value (range: -32768 to 32767) */
|
||||
Uint16 padding4;
|
||||
} SDL_ControllerAxisEvent;
|
||||
|
||||
|
||||
|
@ -326,9 +338,11 @@ typedef struct SDL_ControllerButtonEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
|
||||
Uint32 timestamp;
|
||||
Uint8 which; /**< The joystick instance id */
|
||||
SDL_CONTROLLER_BUTTON button; /**< The joystick button index */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
|
||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
} SDL_ControllerButtonEvent;
|
||||
|
||||
|
||||
|
@ -337,51 +351,29 @@ typedef struct SDL_ControllerButtonEvent
|
|||
*/
|
||||
typedef struct SDL_ControllerDeviceEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED or ::SDL_CONTROLLERDEVICEREMOVED */
|
||||
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
|
||||
Uint32 timestamp;
|
||||
Uint32 which; /**< The joystick device index for ADD, instance_id for REMOVE*/
|
||||
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
|
||||
} SDL_ControllerDeviceEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Touch finger motion/finger event structure (event.tfinger.*)
|
||||
* \brief Touch finger event structure (event.tfinger.*)
|
||||
*/
|
||||
typedef struct SDL_TouchFingerEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_FINGERMOTION OR
|
||||
SDL_FINGERDOWN OR SDL_FINGERUP*/
|
||||
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||
SDL_TouchID touchId; /**< The touch device id */
|
||||
SDL_FingerID fingerId;
|
||||
Uint8 state; /**< The current button state */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
Uint8 padding3;
|
||||
Uint16 x;
|
||||
Uint16 y;
|
||||
Sint16 dx;
|
||||
Sint16 dy;
|
||||
Uint16 pressure;
|
||||
float x; /**< Normalized in the range 0...1 */
|
||||
float y; /**< Normalized in the range 0...1 */
|
||||
float dx; /**< Normalized in the range 0...1 */
|
||||
float dy; /**< Normalized in the range 0...1 */
|
||||
float pressure; /**< Normalized in the range 0...1 */
|
||||
} SDL_TouchFingerEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Touch finger motion/finger event structure (event.tbutton.*)
|
||||
*/
|
||||
typedef struct SDL_TouchButtonEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||
SDL_TouchID touchId; /**< The touch device index */
|
||||
Uint8 state; /**< The current button state */
|
||||
Uint8 button; /**< The button changing state */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
} SDL_TouchButtonEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Multiple Finger Gesture Event (event.mgesture.*)
|
||||
*/
|
||||
|
@ -389,31 +381,27 @@ typedef struct SDL_MultiGestureEvent
|
|||
{
|
||||
Uint32 type; /**< ::SDL_MULTIGESTURE */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||
SDL_TouchID touchId; /**< The touch device index */
|
||||
float dTheta;
|
||||
float dDist;
|
||||
float x; /* currently 0...1. Change to screen coords? */
|
||||
float x;
|
||||
float y;
|
||||
Uint16 numFingers;
|
||||
Uint16 padding;
|
||||
} SDL_MultiGestureEvent;
|
||||
|
||||
|
||||
/* (event.dgesture.*) */
|
||||
typedef struct SDL_DollarGestureEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_DOLLARGESTURE */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||
SDL_TouchID touchId; /**< The touch device index */
|
||||
SDL_TouchID touchId; /**< The touch device id */
|
||||
SDL_GestureID gestureId;
|
||||
Uint32 numFingers;
|
||||
float error;
|
||||
/*
|
||||
//TODO: Enable to give location?
|
||||
float x; //currently 0...1. Change to screen coords?
|
||||
float y;
|
||||
*/
|
||||
float x; /**< Normalized center of gesture */
|
||||
float y; /**< Normalized center of gesture */
|
||||
} SDL_DollarGestureEvent;
|
||||
|
||||
|
||||
|
@ -448,7 +436,7 @@ typedef struct SDL_UserEvent
|
|||
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
|
||||
Uint32 timestamp;
|
||||
Uint32 windowID; /**< The associated window if any */
|
||||
int code; /**< User defined event code */
|
||||
Sint32 code; /**< User defined event code */
|
||||
void *data1; /**< User defined data pointer */
|
||||
void *data2; /**< User defined data pointer */
|
||||
} SDL_UserEvent;
|
||||
|
@ -476,6 +464,7 @@ typedef struct SDL_SysWMEvent
|
|||
typedef union SDL_Event
|
||||
{
|
||||
Uint32 type; /**< Event type, shared with all events */
|
||||
SDL_GenericEvent generic; /**< Generic event data */
|
||||
SDL_WindowEvent window; /**< Window event data */
|
||||
SDL_KeyboardEvent key; /**< Keyboard event data */
|
||||
SDL_TextEditingEvent edit; /**< Text editing event data */
|
||||
|
@ -488,16 +477,15 @@ typedef union SDL_Event
|
|||
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
|
||||
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
|
||||
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
|
||||
SDL_ControllerAxisEvent caxis; /**< Game Controller button event data */
|
||||
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
|
||||
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
|
||||
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
|
||||
SDL_QuitEvent quit; /**< Quit request event data */
|
||||
SDL_UserEvent user; /**< Custom event data */
|
||||
SDL_SysWMEvent syswm; /**< System dependent window event data */
|
||||
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
|
||||
SDL_TouchButtonEvent tbutton; /**< Touch button event data */
|
||||
SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */
|
||||
SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */
|
||||
SDL_MultiGestureEvent mgesture; /**< Gesture event data */
|
||||
SDL_DollarGestureEvent dgesture; /**< Gesture event data */
|
||||
SDL_DropEvent drop; /**< Drag and drop event data */
|
||||
|
||||
/* This is necessary for ABI compatibility between Visual C++ and GCC
|
||||
|
|
|
@ -59,25 +59,23 @@ typedef enum
|
|||
SDL_CONTROLLER_BINDTYPE_BUTTON,
|
||||
SDL_CONTROLLER_BINDTYPE_AXIS,
|
||||
SDL_CONTROLLER_BINDTYPE_HAT
|
||||
} SDL_CONTROLLER_BINDTYPE;
|
||||
/**
|
||||
* get the sdl joystick layer binding for this controller button/axis mapping
|
||||
*/
|
||||
struct _SDL_GameControllerHatBind
|
||||
{
|
||||
int hat;
|
||||
int hat_mask;
|
||||
};
|
||||
} SDL_GameControllerBindType;
|
||||
|
||||
typedef struct _SDL_GameControllerButtonBind
|
||||
/**
|
||||
* Get the SDL joystick layer binding for this controller button/axis mapping
|
||||
*/
|
||||
typedef struct SDL_GameControllerButtonBind
|
||||
{
|
||||
SDL_CONTROLLER_BINDTYPE m_eBindType;
|
||||
SDL_GameControllerBindType bindType;
|
||||
union
|
||||
{
|
||||
int button;
|
||||
int axis;
|
||||
struct _SDL_GameControllerHatBind hat;
|
||||
};
|
||||
struct {
|
||||
int hat;
|
||||
int hat_mask;
|
||||
} hat;
|
||||
} value;
|
||||
|
||||
} SDL_GameControllerButtonBind;
|
||||
|
||||
|
@ -92,7 +90,7 @@ typedef struct _SDL_GameControllerButtonBind
|
|||
* }
|
||||
* }
|
||||
*
|
||||
* Using the SDL_HINT_GAMECONTROLLERCONFIG hint you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
|
||||
* Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
|
||||
* guid,name,mappings
|
||||
*
|
||||
* Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
|
||||
|
@ -108,6 +106,26 @@ typedef struct _SDL_GameControllerButtonBind
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add or update an existing mapping configuration
|
||||
*
|
||||
* \return 1 if mapping is added, 0 if updated, -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
|
||||
|
||||
/**
|
||||
* Get a mapping string for a GUID
|
||||
*
|
||||
* \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid );
|
||||
|
||||
/**
|
||||
* Get a mapping string for an open GameController
|
||||
*
|
||||
* \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller );
|
||||
|
||||
/**
|
||||
* Is the joystick on this index supported by the game controller interface?
|
||||
|
@ -159,6 +177,15 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameCont
|
|||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
|
||||
|
||||
/**
|
||||
* Update the current state of the open game controllers.
|
||||
*
|
||||
* This is called automatically by the event loop if any game controller
|
||||
* events are enabled.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
|
||||
|
||||
|
||||
/**
|
||||
* The list of axii available from a controller
|
||||
*/
|
||||
|
@ -172,19 +199,24 @@ typedef enum
|
|||
SDL_CONTROLLER_AXIS_TRIGGERLEFT,
|
||||
SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
|
||||
SDL_CONTROLLER_AXIS_MAX
|
||||
} SDL_CONTROLLER_AXIS;
|
||||
} SDL_GameControllerAxis;
|
||||
|
||||
/**
|
||||
* turn this string into a axis mapping
|
||||
*/
|
||||
extern DECLSPEC SDL_CONTROLLER_AXIS SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
|
||||
extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
|
||||
|
||||
/**
|
||||
* get the sdl joystick layer binding for this controller button mapping
|
||||
* turn this axis enum into a string mapping
|
||||
*/
|
||||
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
|
||||
|
||||
/**
|
||||
* Get the SDL joystick layer binding for this controller button mapping
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
|
||||
SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
|
||||
SDL_CONTROLLER_AXIS button);
|
||||
SDL_GameControllerAxis axis);
|
||||
|
||||
/**
|
||||
* Get the current state of an axis control on a game controller.
|
||||
|
@ -195,7 +227,7 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
|
|||
*/
|
||||
extern DECLSPEC Sint16 SDLCALL
|
||||
SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
|
||||
SDL_CONTROLLER_AXIS axis);
|
||||
SDL_GameControllerAxis axis);
|
||||
|
||||
/**
|
||||
* The list of buttons available from a controller
|
||||
|
@ -219,20 +251,24 @@ typedef enum
|
|||
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_CONTROLLER_BUTTON_MAX
|
||||
} SDL_CONTROLLER_BUTTON;
|
||||
} SDL_GameControllerButton;
|
||||
|
||||
/**
|
||||
* turn this string into a button mapping
|
||||
*/
|
||||
extern DECLSPEC SDL_CONTROLLER_BUTTON SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
|
||||
|
||||
extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
|
||||
|
||||
/**
|
||||
* get the sdl joystick layer binding for this controller button mapping
|
||||
* turn this button enum into a string mapping
|
||||
*/
|
||||
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
|
||||
|
||||
/**
|
||||
* Get the SDL joystick layer binding for this controller button mapping
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
|
||||
SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
|
||||
SDL_CONTROLLER_BUTTON button);
|
||||
SDL_GameControllerButton button);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -241,7 +277,7 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
|
|||
* The button indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
|
||||
SDL_CONTROLLER_BUTTON button);
|
||||
SDL_GameControllerButton button);
|
||||
|
||||
/**
|
||||
* Close a controller previously opened with SDL_GameControllerOpen().
|
||||
|
|
|
@ -196,10 +196,23 @@ extern "C" {
|
|||
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
|
||||
|
||||
|
||||
/**
|
||||
* \brief A variable that lets you disable the detection and use of Xinput gamepad devices
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
* "0" - Disable XInput timer (only uses direct input)
|
||||
* "1" - Enable XInput timer (the default)
|
||||
*/
|
||||
#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
|
||||
|
||||
|
||||
/**
|
||||
* \brief A variable that lets you manually hint extra gamecontroller db entries
|
||||
*
|
||||
* The variable expected newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
|
||||
* The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
|
||||
*
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
* You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef struct {
|
|||
Uint8 data[16];
|
||||
} SDL_JoystickGUID;
|
||||
|
||||
typedef int SDL_JoystickID;
|
||||
typedef Sint32 SDL_JoystickID;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
@ -126,7 +126,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
|
|||
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
|
||||
|
||||
/**
|
||||
* Get the instance ID of an opened joystick.
|
||||
* Get the instance ID of an opened joystick or -1 if the joystick is invalid.
|
||||
*/
|
||||
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
|
||||
|
||||
|
|
|
@ -70,8 +70,15 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
|
|||
*
|
||||
* \return 0, or -1 on error.
|
||||
*/
|
||||
#define SDL_LockMutex(m) SDL_mutexP(m)
|
||||
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex);
|
||||
#define SDL_mutexP(m) SDL_LockMutex(m)
|
||||
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
* Try to lock the mutex
|
||||
*
|
||||
* \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
* Unlock the mutex.
|
||||
|
@ -81,8 +88,8 @@ extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex);
|
|||
* \warning It is an error to unlock a mutex that has not been locked by
|
||||
* the current thread, and doing so results in undefined behavior.
|
||||
*/
|
||||
#define SDL_UnlockMutex(m) SDL_mutexV(m)
|
||||
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex * mutex);
|
||||
#define SDL_mutexV(m) SDL_UnlockMutex(m)
|
||||
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
|
||||
|
||||
/**
|
||||
* Destroy a mutex.
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
#define NO_SDL_GLEXT 1
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__ /* !!! FIXME: temp compiler warning fix... */
|
||||
#define NO_SDL_GLEXT 1
|
||||
#endif
|
||||
|
||||
#ifdef __glext_h_
|
||||
/* Someone has already included glext.h */
|
||||
#define NO_SDL_GLEXT
|
||||
|
|
|
@ -256,7 +256,7 @@ typedef struct SDL_Color
|
|||
Uint8 r;
|
||||
Uint8 g;
|
||||
Uint8 b;
|
||||
Uint8 unused;
|
||||
Uint8 a;
|
||||
} SDL_Color;
|
||||
#define SDL_Colour SDL_Color
|
||||
|
||||
|
|
|
@ -138,12 +138,10 @@
|
|||
#endif /* if ! defined(WINAPI_FAMILY_PARTITION) ; else */
|
||||
#endif /* if defined(WIN32) || defined(_WIN32) */
|
||||
|
||||
#if defined(__NDS__)
|
||||
#undef __NINTENDODS__
|
||||
#define __NINTENDODS__ 1
|
||||
#if defined(__PSP__)
|
||||
#define __PSP__ 1
|
||||
#endif
|
||||
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -40,6 +40,14 @@ extern "C" {
|
|||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* RWops Types */
|
||||
#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */
|
||||
#define SDL_RWOPS_WINFILE 1 /* Win32 file */
|
||||
#define SDL_RWOPS_STDFILE 2 /* Stdio file */
|
||||
#define SDL_RWOPS_JNIFILE 3 /* Android asset */
|
||||
#define SDL_RWOPS_MEMORY 4 /* Memory stream */
|
||||
#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */
|
||||
|
||||
/**
|
||||
* This is the read/write operation structure -- very basic.
|
||||
*/
|
||||
|
@ -54,7 +62,7 @@ typedef struct SDL_RWops
|
|||
* Seek to \c offset relative to \c whence, one of stdio's whence values:
|
||||
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
|
||||
*
|
||||
* \return the final offset in the data stream.
|
||||
* \return the final offset in the data stream, or -1 on error.
|
||||
*/
|
||||
Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
|
||||
int whence);
|
||||
|
@ -130,6 +138,7 @@ typedef struct SDL_RWops
|
|||
struct
|
||||
{
|
||||
void *data1;
|
||||
int data2;
|
||||
} unknown;
|
||||
} hidden;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* SDL_Event structure.
|
||||
*
|
||||
* The values in this enumeration are based on the USB usage page standard:
|
||||
* http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
|
||||
* http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
|
@ -385,6 +385,9 @@ typedef enum
|
|||
SDL_SCANCODE_EJECT = 281,
|
||||
SDL_SCANCODE_SLEEP = 282,
|
||||
|
||||
SDL_SCANCODE_APP1 = 283,
|
||||
SDL_SCANCODE_APP2 = 284,
|
||||
|
||||
/*@}*//*Walther keys*/
|
||||
|
||||
/* Add any other keys here. */
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "SDL_config.h"
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
@ -182,14 +181,10 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
|||
enums having the size of an int must be enabled.
|
||||
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
|
||||
*/
|
||||
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
|
||||
#ifdef __MWERKS__
|
||||
#pragma enumsalwaysint on
|
||||
#endif
|
||||
|
||||
/** \cond */
|
||||
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
|
||||
#if !defined(__NINTENDODS__) && !defined(__ANDROID__)
|
||||
#if !defined(__ANDROID__)
|
||||
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -209,30 +204,6 @@ extern "C" {
|
|||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC
|
||||
#define SDL_malloc malloc
|
||||
#else
|
||||
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CALLOC
|
||||
#define SDL_calloc calloc
|
||||
#else
|
||||
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REALLOC
|
||||
#define SDL_realloc realloc
|
||||
#else
|
||||
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FREE
|
||||
#define SDL_free free
|
||||
#else
|
||||
extern DECLSPEC void SDLCALL SDL_free(void *mem);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ALLOCA) && !defined(alloca)
|
||||
# if defined(HAVE_ALLOCA_H)
|
||||
# include <alloca.h>
|
||||
|
@ -263,380 +234,460 @@ char *alloca();
|
|||
#define SDL_stack_free(data) SDL_free(data)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETENV
|
||||
#define SDL_getenv getenv
|
||||
#else
|
||||
|
||||
/* SDL stdinc inline functions:
|
||||
|
||||
The theory here is that by default we forcibly inline what we can, and your
|
||||
app will use the inline version by default. However we expose a non-inline
|
||||
version too, so the symbol is always available in the library even if your app
|
||||
bypassed the inline version. The SDL_*_inline versions aren't guaranteed to
|
||||
exist, so never call them directly; use SDL_* instead, and trust the system
|
||||
to give you the right thing.
|
||||
|
||||
The benefit here is that you can dlsym() these functions, which you
|
||||
couldn't if you had macros, you can link against a foreign build of SDL
|
||||
even if you configured differently, and you can drop the unconfigured SDL
|
||||
headers into a project without #defining HAVE_MALLOC (etc) and still link.
|
||||
*/
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
|
||||
#ifdef HAVE_MALLOC
|
||||
SDL_FORCE_INLINE void *SDL_malloc_inline(size_t size) { return malloc(size); }
|
||||
#define SDL_malloc SDL_malloc_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
|
||||
#ifdef HAVE_CALLOC
|
||||
SDL_FORCE_INLINE void *SDL_calloc_inline(size_t nmemb, size_t size) { return calloc(nmemb, size); }
|
||||
#define SDL_calloc SDL_calloc_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
|
||||
#ifdef HAVE_REALLOC
|
||||
SDL_FORCE_INLINE void *SDL_realloc_inline(void *mem, size_t size) { return realloc(mem, size); }
|
||||
#define SDL_realloc SDL_realloc_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC void SDLCALL SDL_free(void *mem);
|
||||
#ifdef HAVE_FREE
|
||||
SDL_FORCE_INLINE void SDL_free_inline(void *mem) { free(mem); }
|
||||
#define SDL_free SDL_free_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
|
||||
#ifdef HAVE_GETENV
|
||||
SDL_FORCE_INLINE char *SDL_getenv_inline(const char *name) { return getenv(name); }
|
||||
#define SDL_getenv SDL_getenv_inline
|
||||
#endif
|
||||
|
||||
/* SDL_putenv() has moved to SDL_compat. */
|
||||
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
|
||||
#ifdef HAVE_SETENV
|
||||
#define SDL_setenv setenv
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value,
|
||||
int overwrite);
|
||||
SDL_FORCE_INLINE int SDL_setenv_inline(const char *name, const char *value, int overwrite) { return setenv(name, value, overwrite); }
|
||||
#define SDL_setenv SDL_setenv_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
|
||||
#ifdef HAVE_QSORT
|
||||
#define SDL_qsort qsort
|
||||
#else
|
||||
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
|
||||
int (*compare) (const void *,
|
||||
const void *));
|
||||
SDL_FORCE_INLINE void SDL_qsort_inline(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { qsort(base, nmemb, size, compare); }
|
||||
#define SDL_qsort SDL_qsort_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_abs(int x);
|
||||
#ifdef HAVE_ABS
|
||||
#define SDL_abs abs
|
||||
SDL_FORCE_INLINE int SDL_abs_inline(int x) { return abs(x); }
|
||||
#else
|
||||
#define SDL_abs(X) ((X) < 0 ? -(X) : (X))
|
||||
SDL_FORCE_INLINE int SDL_abs_inline(int x) { return ((x) < 0 ? -(x) : (x)); }
|
||||
#endif
|
||||
#define SDL_abs SDL_abs_inline
|
||||
|
||||
/* !!! FIXME: these have side effects. You probably shouldn't use them. */
|
||||
/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
|
||||
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_isspace(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_toupper(int x);
|
||||
extern DECLSPEC int SDLCALL SDL_tolower(int x);
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#define SDL_isdigit(X) isdigit(X)
|
||||
#define SDL_isspace(X) isspace(X)
|
||||
#define SDL_toupper(X) toupper(X)
|
||||
#define SDL_tolower(X) tolower(X)
|
||||
SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return isdigit(x); }
|
||||
SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return isspace(x); }
|
||||
SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return toupper(x); }
|
||||
SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return tolower(x); }
|
||||
#else
|
||||
#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
|
||||
#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
|
||||
#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
|
||||
#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
|
||||
SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return ((x) >= '0') && ((x) <= '9'); }
|
||||
SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n'); }
|
||||
SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }
|
||||
SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }
|
||||
#endif
|
||||
#define SDL_isdigit SDL_isdigit_inline
|
||||
#define SDL_isspace SDL_isspace_inline
|
||||
#define SDL_toupper SDL_toupper_inline
|
||||
#define SDL_tolower SDL_tolower_inline
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
|
||||
#ifdef HAVE_MEMSET
|
||||
SDL_FORCE_INLINE void *SDL_memset_inline(void *dst, int c, size_t len) { return memset(dst, c, len); }
|
||||
#define SDL_memset SDL_memset_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMSET
|
||||
#define SDL_memset memset
|
||||
#else
|
||||
extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
|
||||
#endif
|
||||
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
||||
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
||||
|
||||
/* !!! FIXME: does this _really_ beat memset() on any modern platform? */
|
||||
SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t len)
|
||||
{
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memset4(dst, val, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; stosl\n\t" \
|
||||
: "=&D" (u0), "=&a" (u1), "=&c" (u2) \
|
||||
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memset4
|
||||
#define SDL_memset4(dst, val, len) \
|
||||
do { \
|
||||
unsigned _count = (len); \
|
||||
unsigned _n = (_count + 3) / 4; \
|
||||
Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
|
||||
Uint32 _val = (val); \
|
||||
if (len == 0) break; \
|
||||
switch (_count % 4) { \
|
||||
case 0: do { *_p++ = _val; \
|
||||
case 3: *_p++ = _val; \
|
||||
case 2: *_p++ = _val; \
|
||||
case 1: *_p++ = _val; \
|
||||
} while ( --_n ); \
|
||||
} \
|
||||
} while(0)
|
||||
int u0, u1, u2;
|
||||
__asm__ __volatile__ (
|
||||
"cld \n\t"
|
||||
"rep ; stosl \n\t"
|
||||
: "=&D" (u0), "=&a" (u1), "=&c" (u2)
|
||||
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len))
|
||||
: "memory"
|
||||
);
|
||||
/* !!! FIXME: amd64? */
|
||||
#else
|
||||
size_t _n = (len + 3) / 4;
|
||||
Uint32 *_p = SDL_static_cast(Uint32 *, dst);
|
||||
Uint32 _val = (val);
|
||||
if (len == 0)
|
||||
return;
|
||||
switch (len % 4)
|
||||
{
|
||||
case 0: do { *_p++ = _val;
|
||||
case 3: *_p++ = _val;
|
||||
case 2: *_p++ = _val;
|
||||
case 1: *_p++ = _val;
|
||||
} while ( --_n );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
|
||||
#if defined(__MACOSX__)
|
||||
#define SDL_memcpy memcpy
|
||||
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
|
||||
{
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
return memcpy(dst, src, len);
|
||||
}
|
||||
#define SDL_memcpy SDL_memcpy_inline
|
||||
#elif defined(__GNUC__) && defined(i386) && !defined(__WIN32__)
|
||||
#define SDL_memcpy(dst, src, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; movsl\n\t" \
|
||||
"testb $2,%b4\n\t" \
|
||||
"je 1f\n\t" \
|
||||
"movsw\n" \
|
||||
"1:\ttestb $1,%b4\n\t" \
|
||||
"je 2f\n\t" \
|
||||
"movsb\n" \
|
||||
"2:" \
|
||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
||||
: "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
|
||||
{
|
||||
/* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
|
||||
/* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
|
||||
/* !!! FIXME: amd64? */
|
||||
int u0, u1, u2;
|
||||
__asm__ __volatile__ (
|
||||
"cld \n\t"
|
||||
"rep ; movsl \n\t"
|
||||
"testb $2,%b4 \n\t"
|
||||
"je 1f \n\t"
|
||||
"movsw \n"
|
||||
"1:\ttestb $1,%b4 \n\t"
|
||||
"je 2f \n\t"
|
||||
"movsb \n"
|
||||
"2:"
|
||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2)
|
||||
: "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst), "2" (src)
|
||||
: "memory"
|
||||
);
|
||||
return dst;
|
||||
}
|
||||
#define SDL_memcpy SDL_memcpy_inline
|
||||
#elif defined(HAVE_MEMCPY)
|
||||
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
|
||||
{
|
||||
return memcpy(dst, src, len);
|
||||
}
|
||||
#define SDL_memcpy SDL_memcpy_inline
|
||||
#elif defined(HAVE_BCOPY) /* !!! FIXME: is there _really_ ever a time where you have bcopy and not memcpy? */
|
||||
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
|
||||
{
|
||||
bcopy(src, dst, len);
|
||||
return dst;
|
||||
}
|
||||
#define SDL_memcpy SDL_memcpy_inline
|
||||
#endif
|
||||
#ifndef SDL_memcpy
|
||||
#ifdef HAVE_MEMCPY
|
||||
#define SDL_memcpy memcpy
|
||||
#elif defined(HAVE_BCOPY)
|
||||
#define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
|
||||
|
||||
|
||||
SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords)
|
||||
{
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
/* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
|
||||
/* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
|
||||
int ecx, edi, esi;
|
||||
__asm__ __volatile__ (
|
||||
"cld \n\t"
|
||||
"rep ; movsl \n\t"
|
||||
: "=&c" (ecx), "=&D" (edi), "=&S" (esi)
|
||||
: "0" (SDL_static_cast(unsigned, dwords)), "1" (dst), "2" (src)
|
||||
: "memory"
|
||||
);
|
||||
return dst;
|
||||
#else
|
||||
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
|
||||
size_t len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
#if defined(__MACOSX__)
|
||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2)
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memcpy4(dst, src, len) \
|
||||
do { \
|
||||
int ecx, edi, esi; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; movsl" \
|
||||
: "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
|
||||
: "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memcpy4
|
||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2)
|
||||
return SDL_memcpy(dst, src, dwords * 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len);
|
||||
#ifdef HAVE_MEMMOVE
|
||||
#define SDL_memmove memmove
|
||||
#else
|
||||
extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src,
|
||||
size_t len);
|
||||
SDL_FORCE_INLINE void *SDL_memmove_inline(void *dst, const void *src, size_t len) { return memmove(dst, src, len); }
|
||||
#define SDL_memmove SDL_memmove_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
||||
#ifdef HAVE_MEMCMP
|
||||
#define SDL_memcmp memcmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2,
|
||||
size_t len);
|
||||
SDL_FORCE_INLINE int SDL_memcmp_inline(const void *s1, const void *s2, size_t len) { return memcmp(s1, s2, len); }
|
||||
#define SDL_memcmp SDL_memcmp_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
|
||||
#ifdef HAVE_STRLEN
|
||||
#define SDL_strlen strlen
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
|
||||
SDL_FORCE_INLINE size_t SDL_strlen_inline(const char *str) { return strlen(str); }
|
||||
#define SDL_strlen SDL_strlen_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
|
||||
#ifdef HAVE_WCSLEN
|
||||
#define SDL_wcslen wcslen
|
||||
#else
|
||||
#if !defined(wchar_t) && defined(__NINTENDODS__)
|
||||
#define wchar_t short /* TODO: figure out why libnds doesn't have this */
|
||||
#endif
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
|
||||
SDL_FORCE_INLINE size_t SDL_wcslen_inline(const wchar_t *wstr) { return wcslen(wstr); }
|
||||
#define SDL_wcslen SDL_wcslen_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WCSLCPY
|
||||
#define SDL_wcslcpy wcslcpy
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen);
|
||||
#ifdef HAVE_WCSLCPY
|
||||
SDL_FORCE_INLINE size_t SDL_wcslcpy_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcpy(dst, src, maxlen); }
|
||||
#define SDL_wcslcpy SDL_wcslcpy_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WCSLCAT
|
||||
#define SDL_wcslcat wcslcat
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen);
|
||||
#ifdef HAVE_WCSLCAT
|
||||
SDL_FORCE_INLINE size_t SDL_wcslcat_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcat(dst, src, maxlen); }
|
||||
#define SDL_wcslcat SDL_wcslcat_inline
|
||||
#endif
|
||||
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
|
||||
#ifdef HAVE_STRLCPY
|
||||
#define SDL_strlcpy strlcpy
|
||||
SDL_FORCE_INLINE size_t SDL_strlcpy_inline(char *dst, const char *src, size_t maxlen) { return strlcpy(dst, src, maxlen); }
|
||||
#define SDL_strlcpy SDL_strlcpy_inline
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
|
||||
size_t maxlen);
|
||||
#endif
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src,
|
||||
size_t dst_bytes);
|
||||
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes);
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
|
||||
#ifdef HAVE_STRLCAT
|
||||
#define SDL_strlcat strlcat
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
|
||||
size_t maxlen);
|
||||
SDL_FORCE_INLINE size_t SDL_strlcat_inline(char *dst, const char *src, size_t maxlen) { return strlcat(dst, src, maxlen); }
|
||||
#define SDL_strlcat SDL_strlcat_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
|
||||
#ifdef HAVE_STRDUP
|
||||
#define SDL_strdup strdup
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
|
||||
SDL_FORCE_INLINE char *SDL_strdup_inline(const char *str) { return strdup(str); }
|
||||
#define SDL_strdup SDL_strdup_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
|
||||
#ifdef HAVE__STRREV
|
||||
#define SDL_strrev _strrev
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
|
||||
SDL_FORCE_INLINE char *SDL_strrev_inline(char *str) { return _strrev(str); }
|
||||
#define SDL_strrev SDL_strrev_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
|
||||
#ifdef HAVE__STRUPR
|
||||
#define SDL_strupr _strupr
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
|
||||
SDL_FORCE_INLINE char *SDL_strupr_inline(char *str) { return _strupr(str); }
|
||||
#define SDL_strupr SDL_strupr_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
|
||||
#ifdef HAVE__STRLWR
|
||||
#define SDL_strlwr _strlwr
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
|
||||
SDL_FORCE_INLINE char *SDL_strlwr_inline(char *str) { return _strlwr(str); }
|
||||
#define SDL_strlwr SDL_strlwr_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
||||
#ifdef HAVE_STRCHR
|
||||
#define SDL_strchr strchr
|
||||
#elif defined(HAVE_INDEX)
|
||||
#define SDL_strchr index
|
||||
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) {
|
||||
#ifdef __cplusplus
|
||||
return const_cast<char*>(strchr(str, c));
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
|
||||
return (char*)strchr(str, c);
|
||||
#endif
|
||||
}
|
||||
#define SDL_strchr SDL_strchr_inline
|
||||
#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */
|
||||
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }
|
||||
#define SDL_strchr SDL_strchr_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
|
||||
#ifdef HAVE_STRRCHR
|
||||
#define SDL_strrchr strrchr
|
||||
#elif defined(HAVE_RINDEX)
|
||||
#define SDL_strrchr rindex
|
||||
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
|
||||
#ifdef __cplusplus
|
||||
return const_cast<char*>(strrchr(str, c));
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
|
||||
return (char*)strrchr(str, c);
|
||||
#endif
|
||||
}
|
||||
#define SDL_strrchr SDL_strrchr_inline
|
||||
#elif defined(HAVE_RINDEX) /* !!! FIXME: is there anywhere that has this but not strrchr? */
|
||||
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
|
||||
#ifdef __cplusplus
|
||||
return const_cast<char*>(rindex(str, c));
|
||||
#else
|
||||
return (char*)rindex(str, c);
|
||||
#endif
|
||||
}
|
||||
#define SDL_strrchr SDL_strrchr_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
||||
#ifdef HAVE_STRSTR
|
||||
#define SDL_strstr strstr
|
||||
SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) {
|
||||
#ifdef __cplusplus
|
||||
return const_cast<char*>(strstr(haystack, needle));
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack,
|
||||
const char *needle);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ITOA
|
||||
#define SDL_itoa itoa
|
||||
#else
|
||||
#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
|
||||
return (char*)strstr(haystack, needle);
|
||||
#endif
|
||||
}
|
||||
#define SDL_strstr SDL_strstr_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
|
||||
#ifdef HAVE__LTOA
|
||||
#define SDL_ltoa _ltoa
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix);
|
||||
SDL_FORCE_INLINE char *SDL_ltoa_inline(long value, char *str, int radix) { return _ltoa(value, str, radix); }
|
||||
#define SDL_ltoa SDL_ltoa_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__UITOA
|
||||
#define SDL_uitoa _uitoa
|
||||
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
|
||||
#ifdef HAVE_ITOA
|
||||
SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return itoa(value, str, radix); }
|
||||
#else
|
||||
#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
|
||||
SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return SDL_ltoa((long)value, str, radix); }
|
||||
#endif
|
||||
#define SDL_itoa SDL_itoa_inline
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
|
||||
#ifdef HAVE__ULTOA
|
||||
#define SDL_ultoa _ultoa
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
|
||||
int radix);
|
||||
SDL_FORCE_INLINE char *SDL_ultoa_inline(unsigned long value, char *str, int radix) { return _ultoa(value, str, radix); }
|
||||
#define SDL_ultoa SDL_ultoa_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
|
||||
#ifdef HAVE__UITOA
|
||||
SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return _uitoa(value, str, radix); }
|
||||
#else
|
||||
SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return SDL_ultoa((unsigned long)value, str, radix); }
|
||||
#endif
|
||||
#define SDL_uitoa SDL_uitoa_inline
|
||||
|
||||
|
||||
extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
|
||||
#ifdef HAVE_STRTOL
|
||||
#define SDL_strtol strtol
|
||||
#else
|
||||
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
|
||||
int base);
|
||||
SDL_FORCE_INLINE long SDL_strtol_inline(const char *str, char **endp, int base) { return strtol(str, endp, base); }
|
||||
#define SDL_strtol SDL_strtol_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
|
||||
#ifdef HAVE_STRTOUL
|
||||
#define SDL_strtoul strtoul
|
||||
#else
|
||||
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
|
||||
char **endp, int base);
|
||||
SDL_FORCE_INLINE unsigned long SDLCALL SDL_strtoul_inline(const char *str, char **endp, int base) { return strtoul(str, endp, base); }
|
||||
#define SDL_strtoul SDL_strtoul_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
|
||||
#ifdef HAVE__I64TOA
|
||||
#define SDL_lltoa _i64toa
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
|
||||
int radix);
|
||||
SDL_FORCE_INLINE char *SDL_lltoa_inline(Sint64 value, char *str, int radix) { return _i64toa(value, str, radix); }
|
||||
#define SDL_lltoa SDL_lltoa_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
|
||||
#ifdef HAVE__UI64TOA
|
||||
#define SDL_ulltoa _ui64toa
|
||||
#else
|
||||
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
|
||||
int radix);
|
||||
SDL_FORCE_INLINE char *SDL_ulltoa_inline(Uint64 value, char *str, int radix) { return _ui64toa(value, str, radix); }
|
||||
#define SDL_ulltoa SDL_ulltoa_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
|
||||
#ifdef HAVE_STRTOLL
|
||||
#define SDL_strtoll strtoll
|
||||
#else
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
|
||||
int base);
|
||||
SDL_FORCE_INLINE Sint64 SDL_strtoll_inline(const char *str, char **endp, int base) { return strtoll(str, endp, base); }
|
||||
#define SDL_strtoll SDL_strtoll_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
|
||||
#ifdef HAVE_STRTOULL
|
||||
#define SDL_strtoull strtoull
|
||||
#else
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
|
||||
int base);
|
||||
SDL_FORCE_INLINE Uint64 SDL_strtoull_inline(const char *str, char **endp, int base) { return strtoull(str, endp, base); }
|
||||
#define SDL_strtoull SDL_strtoull_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
|
||||
#ifdef HAVE_STRTOD
|
||||
#define SDL_strtod strtod
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
|
||||
SDL_FORCE_INLINE double SDL_strtod_inline(const char *str, char **endp) { return strtod(str, endp); }
|
||||
#define SDL_strtod SDL_strtod_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
|
||||
#ifdef HAVE_ATOI
|
||||
#define SDL_atoi atoi
|
||||
SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return atoi(str); }
|
||||
#else
|
||||
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
|
||||
SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return SDL_strtol(str, NULL, 0); }
|
||||
#endif
|
||||
#define SDL_atoi SDL_atoi_inline
|
||||
|
||||
extern DECLSPEC double SDLCALL SDL_atof(const char *str);
|
||||
#ifdef HAVE_ATOF
|
||||
#define SDL_atof atof
|
||||
SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return (double) atof(str); }
|
||||
#else
|
||||
#define SDL_atof(X) SDL_strtod(X, NULL)
|
||||
SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return SDL_strtod(str, NULL); }
|
||||
#endif
|
||||
#define SDL_atof SDL_atof_inline
|
||||
|
||||
|
||||
#ifdef HAVE_STRCMP
|
||||
#define SDL_strcmp strcmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
|
||||
#ifdef HAVE_STRCMP
|
||||
SDL_FORCE_INLINE int SDL_strcmp_inline(const char *str1, const char *str2) { return strcmp(str1, str2); }
|
||||
#define SDL_strcmp SDL_strcmp_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
|
||||
#ifdef HAVE_STRNCMP
|
||||
#define SDL_strncmp strncmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
|
||||
size_t maxlen);
|
||||
SDL_FORCE_INLINE int SDL_strncmp_inline(const char *str1, const char *str2, size_t maxlen) { return strncmp(str1, str2, maxlen); }
|
||||
#define SDL_strncmp SDL_strncmp_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
|
||||
#ifdef HAVE_STRCASECMP
|
||||
#define SDL_strcasecmp strcasecmp
|
||||
SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return strcasecmp(str1, str2); }
|
||||
#define SDL_strcasecmp SDL_strcasecmp_inline
|
||||
#elif defined(HAVE__STRICMP)
|
||||
#define SDL_strcasecmp _stricmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
|
||||
const char *str2);
|
||||
SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return _stricmp(str1, str2); }
|
||||
#define SDL_strcasecmp SDL_strcasecmp_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
|
||||
#ifdef HAVE_STRNCASECMP
|
||||
#define SDL_strncasecmp strncasecmp
|
||||
SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return strncasecmp(str1, str2, len); }
|
||||
#define SDL_strncasecmp SDL_strncasecmp_inline
|
||||
#elif defined(HAVE__STRNICMP)
|
||||
#define SDL_strncasecmp _strnicmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
|
||||
const char *str2, size_t maxlen);
|
||||
SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return _strnicmp(str1, str2, len); }
|
||||
#define SDL_strncasecmp SDL_strncasecmp_inline
|
||||
#endif
|
||||
|
||||
/* Not doing SDL_*_inline functions for these, because of the varargs. */
|
||||
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
|
||||
#ifdef HAVE_SSCANF
|
||||
#define SDL_sscanf sscanf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt,
|
||||
...);
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#define SDL_snprintf snprintf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
|
||||
const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
#define SDL_vsnprintf vsnprintf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
|
||||
const char *fmt, va_list ap);
|
||||
SDL_FORCE_INLINE int SDL_vsnprintf_inline(char *text, size_t maxlen, const char *fmt, va_list ap) { return vsnprintf(text, maxlen, fmt, ap); }
|
||||
#define SDL_vsnprintf SDL_vsnprintf_inline
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_M_PI
|
||||
|
@ -645,88 +696,94 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATAN
|
||||
#define SDL_atan atan
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_atan(double x);
|
||||
#ifdef HAVE_ATAN
|
||||
SDL_FORCE_INLINE double SDL_atan_inline(double x) { return atan(x); }
|
||||
#define SDL_atan SDL_atan_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
|
||||
#ifdef HAVE_ATAN2
|
||||
#define SDL_atan2 atan2
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_atan2(double y, double x);
|
||||
SDL_FORCE_INLINE double SDL_atan2_inline(double x, double y) { return atan2(x, y); }
|
||||
#define SDL_atan2 SDL_atan2_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC double SDLCALL SDL_ceil(double x);
|
||||
#ifdef HAVE_CEIL
|
||||
#define SDL_ceil ceil
|
||||
SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return ceil(x); }
|
||||
#else
|
||||
#define SDL_ceil(x) ((double)(int)((x)+0.5))
|
||||
SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return (double)(int)((x)+0.5); }
|
||||
#endif
|
||||
#define SDL_ceil SDL_ceil_inline
|
||||
|
||||
#ifdef HAVE_COPYSIGN
|
||||
#define SDL_copysign copysign
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
|
||||
#ifdef HAVE_COPYSIGN
|
||||
SDL_FORCE_INLINE double SDL_copysign_inline(double x, double y) { return copysign(x, y); }
|
||||
#define SDL_copysign SDL_copysign_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COS
|
||||
#define SDL_cos cos
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_cos(double x);
|
||||
#ifdef HAVE_COS
|
||||
SDL_FORCE_INLINE double SDL_cos_inline(double x) { return cos(x); }
|
||||
#define SDL_cos SDL_cos_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC float SDLCALL SDL_cosf(float x);
|
||||
#ifdef HAVE_COSF
|
||||
#define SDL_cosf cosf
|
||||
SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return cosf(x); }
|
||||
#else
|
||||
#define SDL_cosf(x) (float)SDL_cos((double)x)
|
||||
SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return (float)SDL_cos((double)x); }
|
||||
#endif
|
||||
#define SDL_cosf SDL_cosf_inline
|
||||
|
||||
#ifdef HAVE_FABS
|
||||
#define SDL_fabs fabs
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_fabs(double x);
|
||||
#ifdef HAVE_FABS
|
||||
SDL_FORCE_INLINE double SDL_fabs_inline(double x) { return fabs(x); }
|
||||
#define SDL_fabs SDL_fabs_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FLOOR
|
||||
#define SDL_floor floor
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_floor(double x);
|
||||
#ifdef HAVE_FLOOR
|
||||
SDL_FORCE_INLINE double SDL_floor_inline(double x) { return floor(x); }
|
||||
#define SDL_floor SDL_floor_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOG
|
||||
#define SDL_log log
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_log(double x);
|
||||
#ifdef HAVE_LOG
|
||||
SDL_FORCE_INLINE double SDL_log_inline(double x) { return log(x); }
|
||||
#define SDL_log SDL_log_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_POW
|
||||
#define SDL_pow pow
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
|
||||
#ifdef HAVE_POW
|
||||
SDL_FORCE_INLINE double SDL_pow_inline(double x, double y) { return pow(x, y); }
|
||||
#define SDL_pow SDL_pow_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SCALBN
|
||||
#define SDL_scalbn scalbn
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
|
||||
#ifdef HAVE_SCALBN
|
||||
SDL_FORCE_INLINE double SDL_scalbn_inline(double x, int n) { return scalbn(x, n); }
|
||||
#define SDL_scalbn SDL_scalbn_inline
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIN
|
||||
#define SDL_sin sin
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_sin(double x);
|
||||
#ifdef HAVE_SIN
|
||||
SDL_FORCE_INLINE double SDL_sin_inline(double x) { return sin(x); }
|
||||
#define SDL_sin SDL_sin_inline
|
||||
#endif
|
||||
|
||||
extern DECLSPEC float SDLCALL SDL_sinf(float x);
|
||||
#ifdef HAVE_SINF
|
||||
#define SDL_sinf sinf
|
||||
SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return sinf(x); }
|
||||
#else
|
||||
#define SDL_sinf(x) (float)SDL_sin((double)x)
|
||||
SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return (float)SDL_sin((double)x); }
|
||||
#endif
|
||||
#define SDL_sinf SDL_sinf_inline
|
||||
|
||||
#ifdef HAVE_SQRT
|
||||
#define SDL_sqrt sqrt
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
|
||||
#ifdef HAVE_SQRT
|
||||
SDL_FORCE_INLINE double SDL_sqrt_inline(double x) { return sqrt(x); }
|
||||
#define SDL_sqrt SDL_sqrt_inline
|
||||
#endif
|
||||
|
||||
/* The SDL implementation of iconv() returns these error codes */
|
||||
|
@ -735,16 +792,11 @@ extern DECLSPEC double SDLCALL SDL_sqrt(double x);
|
|||
#define SDL_ICONV_EILSEQ (size_t)-3
|
||||
#define SDL_ICONV_EINVAL (size_t)-4
|
||||
|
||||
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
|
||||
#define SDL_iconv_t iconv_t
|
||||
#define SDL_iconv_open iconv_open
|
||||
#define SDL_iconv_close iconv_close
|
||||
#else
|
||||
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
|
||||
typedef struct _SDL_iconv_t *SDL_iconv_t;
|
||||
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
|
||||
const char *fromcode);
|
||||
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
|
||||
#endif
|
||||
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
|
||||
size_t * inbytesleft, char **outbuf,
|
||||
size_t * outbytesleft);
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
#ifdef __NDS__
|
||||
#define DEFAULT_WINDOW_WIDTH 256
|
||||
#define DEFAULT_WINDOW_HEIGHT (2*192)
|
||||
#if defined(__PSP__)
|
||||
#define DEFAULT_WINDOW_WIDTH 480
|
||||
#define DEFAULT_WINDOW_HEIGHT 272
|
||||
#else
|
||||
#define DEFAULT_WINDOW_WIDTH 640
|
||||
#define DEFAULT_WINDOW_HEIGHT 480
|
||||
|
|
|
@ -53,11 +53,7 @@ typedef struct SDLTest_SurfaceImage_s {
|
|||
int width;
|
||||
int height;
|
||||
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
|
||||
#if (defined(__GNUC__) && (__GNUC__ <= 2))
|
||||
unsigned char pixel_data[0];
|
||||
#else
|
||||
unsigned char pixel_data[];
|
||||
#endif
|
||||
const char *pixel_data;
|
||||
} SDLTest_SurfaceImage_t;
|
||||
|
||||
/* Test images */
|
||||
|
|
|
@ -40,77 +40,42 @@ extern "C" {
|
|||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
typedef Sint64 SDL_TouchID;
|
||||
typedef Sint64 SDL_FingerID;
|
||||
|
||||
|
||||
struct SDL_Finger {
|
||||
typedef struct SDL_Finger
|
||||
{
|
||||
SDL_FingerID id;
|
||||
Uint16 x;
|
||||
Uint16 y;
|
||||
Uint16 pressure;
|
||||
Uint16 xdelta;
|
||||
Uint16 ydelta;
|
||||
Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */
|
||||
SDL_bool down;
|
||||
};
|
||||
|
||||
typedef struct SDL_Touch SDL_Touch;
|
||||
typedef struct SDL_Finger SDL_Finger;
|
||||
|
||||
|
||||
struct SDL_Touch {
|
||||
|
||||
/* Free the touch when it's time */
|
||||
void (*FreeTouch) (SDL_Touch * touch);
|
||||
|
||||
/* data common for tablets */
|
||||
float pressure_max, pressure_min;
|
||||
float x_max,x_min;
|
||||
float y_max,y_min;
|
||||
Uint16 xres,yres,pressureres;
|
||||
float native_xres,native_yres,native_pressureres;
|
||||
float tilt_x; /* for future use */
|
||||
float tilt_y; /* for future use */
|
||||
float rotation; /* for future use */
|
||||
|
||||
/* Data common to all touch */
|
||||
SDL_TouchID id;
|
||||
SDL_Window *focus;
|
||||
|
||||
char *name;
|
||||
Uint8 buttonstate;
|
||||
SDL_bool relative_mode;
|
||||
SDL_bool flush_motion;
|
||||
|
||||
int num_fingers;
|
||||
int max_fingers;
|
||||
SDL_Finger** fingers;
|
||||
|
||||
void *driverdata;
|
||||
};
|
||||
float x;
|
||||
float y;
|
||||
float pressure;
|
||||
} SDL_Finger;
|
||||
|
||||
/* Used as the device ID for mouse events simulated with touch input */
|
||||
#define SDL_TOUCH_MOUSEID ((Uint32)-1)
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* \brief Get the touch object at the given id.
|
||||
*
|
||||
*
|
||||
* \brief Get the number of registered touch devices.
|
||||
*/
|
||||
extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
|
||||
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices();
|
||||
|
||||
/**
|
||||
* \brief Get the finger object of the given touch, at the given id.
|
||||
*
|
||||
*
|
||||
* \brief Get the touch ID with the given index, or 0 if the index is invalid.
|
||||
*/
|
||||
extern
|
||||
DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
|
||||
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
|
||||
|
||||
/**
|
||||
* \brief Get the number of active fingers for a given touch device.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
|
||||
|
||||
/**
|
||||
* \brief Get the finger object of the given touch, with the given index.
|
||||
*/
|
||||
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -504,6 +504,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
|
|||
/**
|
||||
* \brief Get the position of a window.
|
||||
*
|
||||
* \param x Pointer to variable for storing the x position, may be NULL
|
||||
* \param y Pointer to variable for storing the y position, may be NULL
|
||||
*
|
||||
* \sa SDL_SetWindowPosition()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
|
||||
|
@ -512,6 +515,9 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
|
|||
/**
|
||||
* \brief Set the size of a window's client area.
|
||||
*
|
||||
* \param w The width of the window, must be >0
|
||||
* \param h The height of the window, must be >0
|
||||
*
|
||||
* \note You can't change the size of a fullscreen window, it automatically
|
||||
* matches the size of the display mode.
|
||||
*
|
||||
|
@ -523,6 +529,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
|
|||
/**
|
||||
* \brief Get the size of a window's client area.
|
||||
*
|
||||
* \param w Pointer to variable for storing the width, may be NULL
|
||||
* \param h Pointer to variable for storing the height, may be NULL
|
||||
*
|
||||
* \sa SDL_SetWindowSize()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
|
||||
|
@ -531,6 +540,9 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
|
|||
/**
|
||||
* \brief Set the minimum size of a window's client area.
|
||||
*
|
||||
* \param min_w The minimum width of the window, must be >0
|
||||
* \param min_h The minimum height of the window, must be >0
|
||||
*
|
||||
* \note You can't change the minimum size of a fullscreen window, it
|
||||
* automatically matches the size of the display mode.
|
||||
*
|
||||
|
@ -543,6 +555,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
|
|||
/**
|
||||
* \brief Get the minimum size of a window's client area.
|
||||
*
|
||||
* \param w Pointer to variable for storing the minimum width, may be NULL
|
||||
* \param h Pointer to variable for storing the minimum height, may be NULL
|
||||
*
|
||||
* \sa SDL_GetWindowMaximumSize()
|
||||
* \sa SDL_SetWindowMinimumSize()
|
||||
*/
|
||||
|
@ -552,6 +567,9 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
|
|||
/**
|
||||
* \brief Set the maximum size of a window's client area.
|
||||
*
|
||||
* \param max_w The maximum width of the window, must be >0
|
||||
* \param max_h The maximum height of the window, must be >0
|
||||
*
|
||||
* \note You can't change the maximum size of a fullscreen window, it
|
||||
* automatically matches the size of the display mode.
|
||||
*
|
||||
|
@ -564,6 +582,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
|
|||
/**
|
||||
* \brief Get the maximum size of a window's client area.
|
||||
*
|
||||
* \param w Pointer to variable for storing the maximum width, may be NULL
|
||||
* \param h Pointer to variable for storing the maximum height, may be NULL
|
||||
*
|
||||
* \sa SDL_GetWindowMinimumSize()
|
||||
* \sa SDL_SetWindowMaximumSize()
|
||||
*/
|
||||
|
@ -673,7 +694,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
|
|||
* \sa SDL_UpdateWindowSurfaceRect()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
|
||||
SDL_Rect * rects,
|
||||
const SDL_Rect * rects,
|
||||
int numrects);
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,6 +128,16 @@
|
|||
#define __inline__
|
||||
#endif
|
||||
|
||||
#ifndef SDL_FORCE_INLINE
|
||||
#if defined(_MSC_VER)
|
||||
#define SDL_FORCE_INLINE __forceinline
|
||||
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
|
||||
#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline
|
||||
#else
|
||||
#define SDL_FORCE_INLINE static __inline__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Apparently this is needed by several Windows compilers */
|
||||
#if !defined(__MACH__)
|
||||
#ifndef NULL
|
||||
|
|
57
src/SDL.c
|
@ -68,14 +68,9 @@ SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem)
|
|||
|
||||
/* Private helper to check if a system needs init. */
|
||||
static SDL_bool
|
||||
SDL_PrivateShouldInitSubsystem(Uint32 flags, Uint32 subsystem)
|
||||
SDL_PrivateShouldInitSubsystem(Uint32 subsystem)
|
||||
{
|
||||
int subsystem_index;
|
||||
if ((flags & subsystem) == 0) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
|
||||
int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
|
||||
SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
|
||||
return (SDL_SubsystemRefCount[subsystem_index] == 0);
|
||||
}
|
||||
|
@ -105,41 +100,44 @@ SDL_InitSubSystem(Uint32 flags)
|
|||
#endif
|
||||
|
||||
/* Initialize the timer subsystem */
|
||||
if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_TIMER)) {
|
||||
if ((flags & SDL_INIT_TIMER) ){
|
||||
#if !SDL_TIMERS_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
|
||||
if (SDL_TimerInit() < 0) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_TIMER);
|
||||
#else
|
||||
SDL_SetError("SDL not built with timer support");
|
||||
return (-1);
|
||||
return SDL_SetError("SDL not built with timer support");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Initialize the video/event subsystem */
|
||||
if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_VIDEO)) {
|
||||
if ((flags & SDL_INIT_VIDEO) ){
|
||||
#if !SDL_VIDEO_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
|
||||
if (SDL_VideoInit(NULL) < 0) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_VIDEO);
|
||||
#else
|
||||
SDL_SetError("SDL not built with video support");
|
||||
return (-1);
|
||||
return SDL_SetError("SDL not built with video support");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Initialize the audio subsystem */
|
||||
if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_AUDIO)) {
|
||||
if ((flags & SDL_INIT_AUDIO) ){
|
||||
#if !SDL_AUDIO_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) {
|
||||
if (SDL_AudioInit(NULL) < 0) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_AUDIO);
|
||||
#else
|
||||
SDL_SetError("SDL not built with audio support");
|
||||
return (-1);
|
||||
return SDL_SetError("SDL not built with audio support");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -149,40 +147,43 @@ SDL_InitSubSystem(Uint32 flags)
|
|||
}
|
||||
|
||||
/* Initialize the joystick subsystem */
|
||||
if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_JOYSTICK)) {
|
||||
if ((flags & SDL_INIT_JOYSTICK) ){
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
|
||||
if (SDL_JoystickInit() < 0) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_JOYSTICK);
|
||||
#else
|
||||
SDL_SetError("SDL not built with joystick support");
|
||||
return (-1);
|
||||
return SDL_SetError("SDL not built with joystick support");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_GAMECONTROLLER)) {
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER) ){
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
if (SDL_GameControllerInit() < 0) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER);
|
||||
#else
|
||||
SDL_SetError("SDL not built with joystick support");
|
||||
return (-1);
|
||||
return SDL_SetError("SDL not built with joystick support");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Initialize the haptic subsystem */
|
||||
if (SDL_PrivateShouldInitSubsystem(flags, SDL_INIT_HAPTIC)) {
|
||||
if ((flags & SDL_INIT_HAPTIC) ){
|
||||
#if !SDL_HAPTIC_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) {
|
||||
if (SDL_HapticInit() < 0) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC);
|
||||
#else
|
||||
SDL_SetError("SDL not built with haptic (force feedback) support");
|
||||
return (-1);
|
||||
return SDL_SetError("SDL not built with haptic (force feedback) support");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -383,8 +384,6 @@ SDL_GetPlatform()
|
|||
return "Mac OS X";
|
||||
#elif __NETBSD__
|
||||
return "NetBSD";
|
||||
#elif __NDS__
|
||||
return "Nintendo DS";
|
||||
#elif __OPENBSD__
|
||||
return "OpenBSD";
|
||||
#elif __OS2__
|
||||
|
@ -401,6 +400,8 @@ SDL_GetPlatform()
|
|||
return "Windows";
|
||||
#elif __IPHONEOS__
|
||||
return "iPhone OS";
|
||||
#elif __PSP__
|
||||
return "PlayStation Portable";
|
||||
#else
|
||||
return "Unknown (see SDL_platform.h)";
|
||||
#endif
|
||||
|
@ -429,4 +430,4 @@ _DllMainCRTStartup(HANDLE hModule,
|
|||
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
/* vi: set sts=4 ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -49,14 +49,14 @@ SDL_LookupString(const char *key)
|
|||
|
||||
/* Public functions */
|
||||
|
||||
void
|
||||
int
|
||||
SDL_SetError(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
SDL_error *error;
|
||||
|
||||
/* Ignore call if invalid format pointer was passed */
|
||||
if (fmt == NULL) return;
|
||||
if (fmt == NULL) return -1;
|
||||
|
||||
/* Copy in the key, mark error as valid */
|
||||
error = SDL_GetErrBuf();
|
||||
|
@ -112,6 +112,8 @@ SDL_SetError(const char *fmt, ...)
|
|||
|
||||
/* If we are in debug mode, print out an error message */
|
||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This function has a bit more overhead than most error functions
|
||||
|
@ -216,28 +218,22 @@ SDL_ClearError(void)
|
|||
}
|
||||
|
||||
/* Very common errors go here */
|
||||
void
|
||||
int
|
||||
SDL_Error(SDL_errorcode code)
|
||||
{
|
||||
switch (code) {
|
||||
case SDL_ENOMEM:
|
||||
SDL_SetError("Out of memory");
|
||||
break;
|
||||
return SDL_SetError("Out of memory");
|
||||
case SDL_EFREAD:
|
||||
SDL_SetError("Error reading from datastream");
|
||||
break;
|
||||
return SDL_SetError("Error reading from datastream");
|
||||
case SDL_EFWRITE:
|
||||
SDL_SetError("Error writing to datastream");
|
||||
break;
|
||||
return SDL_SetError("Error writing to datastream");
|
||||
case SDL_EFSEEK:
|
||||
SDL_SetError("Error seeking in datastream");
|
||||
break;
|
||||
return SDL_SetError("Error seeking in datastream");
|
||||
case SDL_UNSUPPORTED:
|
||||
SDL_SetError("That operation is not supported");
|
||||
break;
|
||||
return SDL_SetError("That operation is not supported");
|
||||
default:
|
||||
SDL_SetError("Unknown SDL error");
|
||||
break;
|
||||
return SDL_SetError("Unknown SDL error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -327,6 +327,20 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
|
|||
return;
|
||||
}
|
||||
}
|
||||
#elif defined(__PSP__)
|
||||
//Simple Log System for PSP
|
||||
{
|
||||
unsigned int length;
|
||||
char* output;
|
||||
FILE* pFile;
|
||||
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
|
||||
output = SDL_stack_alloc(char, length);
|
||||
SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
|
||||
pFile = fopen ("SDL_Log.txt", "a");
|
||||
fwrite (output, strlen (output), 1, pFile);
|
||||
SDL_stack_free(output);
|
||||
fclose (pFile);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_STDIO_H
|
||||
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
doesn't have that compiler. That way we always have a working set of
|
||||
atomic operations built into the library.
|
||||
*/
|
||||
#undef SDL_AtomicCAS
|
||||
#undef SDL_AtomicCASPtr
|
||||
|
||||
/*
|
||||
If any of the operations are not provided then we must emulate some
|
||||
|
@ -69,8 +71,8 @@ leaveLock(void *a)
|
|||
SDL_AtomicUnlock(&locks[index]);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
|
||||
DECLSPEC SDL_bool SDLCALL
|
||||
SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
|
||||
|
@ -84,8 +86,8 @@ SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
|
|||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCASPtr_(void **a, void *oldval, void *newval)
|
||||
DECLSPEC SDL_bool SDLCALL
|
||||
SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
|
||||
|
|
|
@ -41,13 +41,13 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
|
|||
/* Race condition on first lock... */
|
||||
_spinlock_mutex = SDL_CreateMutex();
|
||||
}
|
||||
SDL_mutexP(_spinlock_mutex);
|
||||
SDL_LockMutex(_spinlock_mutex);
|
||||
if (*lock == 0) {
|
||||
*lock = 1;
|
||||
SDL_mutexV(_spinlock_mutex);
|
||||
SDL_UnlockMutex(_spinlock_mutex);
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
SDL_mutexV(_spinlock_mutex);
|
||||
SDL_UnlockMutex(_spinlock_mutex);
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ extern AudioBootStrap DART_bootstrap;
|
|||
extern AudioBootStrap NDSAUD_bootstrap;
|
||||
extern AudioBootStrap FUSIONSOUND_bootstrap;
|
||||
extern AudioBootStrap ANDROIDAUD_bootstrap;
|
||||
|
||||
extern AudioBootStrap PSPAUD_bootstrap;
|
||||
|
||||
/* Available audio drivers */
|
||||
static const AudioBootStrap *const bootstrap[] = {
|
||||
|
@ -121,14 +121,14 @@ static const AudioBootStrap *const bootstrap[] = {
|
|||
#if SDL_AUDIO_DRIVER_DUMMY
|
||||
&DUMMYAUD_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_NDS
|
||||
&NDSAUD_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||
&FUSIONSOUND_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_ANDROID
|
||||
&ANDROIDAUD_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_PSP
|
||||
&PSPAUD_bootstrap,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
@ -191,7 +191,7 @@ SDL_AudioDeinitialize_Default(void)
|
|||
static int
|
||||
SDL_AudioOpenDevice_Default(_THIS, const char *devname, int iscapture)
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -200,7 +200,7 @@ SDL_AudioLockDevice_Default(SDL_AudioDevice * device)
|
|||
if (device->thread && (SDL_ThreadID() == device->threadid)) {
|
||||
return;
|
||||
}
|
||||
SDL_mutexP(device->mixer_lock);
|
||||
SDL_LockMutex(device->mixer_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -209,7 +209,7 @@ SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device)
|
|||
if (device->thread && (SDL_ThreadID() == device->threadid)) {
|
||||
return;
|
||||
}
|
||||
SDL_mutexV(device->mixer_lock);
|
||||
SDL_UnlockMutex(device->mixer_lock);
|
||||
}
|
||||
|
||||
|
||||
|
@ -407,9 +407,9 @@ SDL_RunAudio(void *devicep)
|
|||
}
|
||||
|
||||
/* Read from the callback into the _input_ stream */
|
||||
SDL_mutexP(device->mixer_lock);
|
||||
SDL_LockMutex(device->mixer_lock);
|
||||
(*fill) (udata, istream, istream_len);
|
||||
SDL_mutexV(device->mixer_lock);
|
||||
SDL_UnlockMutex(device->mixer_lock);
|
||||
|
||||
/* Convert the audio if necessary and write to the streamer */
|
||||
if (device->convert.needed) {
|
||||
|
@ -480,9 +480,9 @@ SDL_RunAudio(void *devicep)
|
|||
}
|
||||
}
|
||||
|
||||
SDL_mutexP(device->mixer_lock);
|
||||
SDL_LockMutex(device->mixer_lock);
|
||||
(*fill) (udata, stream, stream_len);
|
||||
SDL_mutexV(device->mixer_lock);
|
||||
SDL_UnlockMutex(device->mixer_lock);
|
||||
|
||||
/* Convert the audio if necessary */
|
||||
if (device->convert.needed) {
|
||||
|
@ -940,7 +940,7 @@ open_audio_device(const char *devname, int iscapture,
|
|||
((!iscapture) && (current_audio.outputDevices == NULL)) )
|
||||
SDL_GetNumAudioDevices(iscapture);
|
||||
|
||||
if (!current_audio.impl.OpenDevice(device, devname, iscapture)) {
|
||||
if (current_audio.impl.OpenDevice(device, devname, iscapture) < 0) {
|
||||
close_audio_device(device);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -970,28 +970,23 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
|||
|
||||
/* Sanity check target pointer */
|
||||
if (cvt == NULL) {
|
||||
SDL_InvalidParamError("cvt");
|
||||
return -1;
|
||||
return SDL_InvalidParamError("cvt");
|
||||
}
|
||||
|
||||
/* there are no unsigned types over 16 bits, so catch this up front. */
|
||||
if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) {
|
||||
SDL_SetError("Invalid source format");
|
||||
return -1;
|
||||
return SDL_SetError("Invalid source format");
|
||||
}
|
||||
if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) {
|
||||
SDL_SetError("Invalid destination format");
|
||||
return -1;
|
||||
return SDL_SetError("Invalid destination format");
|
||||
}
|
||||
|
||||
/* prevent possible divisions by zero, etc. */
|
||||
if ((src_channels == 0) || (dst_channels == 0)) {
|
||||
SDL_SetError("Source or destination channels is zero");
|
||||
return -1;
|
||||
return SDL_SetError("Source or destination channels is zero");
|
||||
}
|
||||
if ((src_rate == 0) || (dst_rate == 0)) {
|
||||
SDL_SetError("Source or destination rate is zero");
|
||||
return -1;
|
||||
return SDL_SetError("Source or destination rate is zero");
|
||||
}
|
||||
#ifdef DEBUG_CONVERT
|
||||
printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n",
|
||||
|
|
|
@ -134,8 +134,7 @@ MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
|
|||
MS_ADPCM_state.wavefmt.channels * sizeof(Sint16);
|
||||
*audio_buf = (Uint8 *) SDL_malloc(*audio_len);
|
||||
if (*audio_buf == NULL) {
|
||||
SDL_Error(SDL_ENOMEM);
|
||||
return (-1);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
decoded = *audio_buf;
|
||||
|
||||
|
@ -359,8 +358,7 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
|
|||
IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16);
|
||||
*audio_buf = (Uint8 *) SDL_malloc(*audio_len);
|
||||
if (*audio_buf == NULL) {
|
||||
SDL_Error(SDL_ENOMEM);
|
||||
return (-1);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
decoded = *audio_buf;
|
||||
|
||||
|
@ -620,14 +618,12 @@ ReadChunk(SDL_RWops * src, Chunk * chunk)
|
|||
chunk->length = SDL_ReadLE32(src);
|
||||
chunk->data = (Uint8 *) SDL_malloc(chunk->length);
|
||||
if (chunk->data == NULL) {
|
||||
SDL_Error(SDL_ENOMEM);
|
||||
return (-1);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) {
|
||||
SDL_Error(SDL_EFREAD);
|
||||
SDL_free(chunk->data);
|
||||
chunk->data = NULL;
|
||||
return (-1);
|
||||
return SDL_Error(SDL_EFREAD);
|
||||
}
|
||||
return (chunk->length);
|
||||
}
|
||||
|
|
|
@ -482,8 +482,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -495,9 +494,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't open audio device: %s",
|
||||
return SDL_SetError("ALSA: Couldn't open audio device: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
|
||||
this->hidden->pcm_handle = pcm_handle;
|
||||
|
@ -507,9 +505,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't get hardware config: %s",
|
||||
return SDL_SetError("ALSA: Couldn't get hardware config: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* SDL only uses interleaved sample output */
|
||||
|
@ -517,9 +514,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
SND_PCM_ACCESS_RW_INTERLEAVED);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't set interleaved access: %s",
|
||||
return SDL_SetError("ALSA: Couldn't set interleaved access: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try for a closest match on audio format */
|
||||
|
@ -572,8 +568,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("ALSA: Couldn't find any hardware audio formats");
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
|
||||
|
@ -585,8 +580,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't set audio channels");
|
||||
return 0;
|
||||
return SDL_SetError("ALSA: Couldn't set audio channels");
|
||||
}
|
||||
this->spec.channels = channels;
|
||||
}
|
||||
|
@ -597,9 +591,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
&rate, NULL);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't set audio frequency: %s",
|
||||
return SDL_SetError("ALSA: Couldn't set audio frequency: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
this->spec.freq = rate;
|
||||
|
||||
|
@ -609,8 +602,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
/* Failed to set desired buffer size, do the best you can... */
|
||||
if ( ALSA_set_period_size(this, hwparams, 1) < 0 ) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status));
|
||||
return(-1);
|
||||
return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status));
|
||||
}
|
||||
}
|
||||
/* Set the software parameters */
|
||||
|
@ -618,31 +610,27 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't get software config: %s",
|
||||
return SDL_SetError("ALSA: Couldn't get software config: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("Couldn't set minimum available samples: %s",
|
||||
return SDL_SetError("Couldn't set minimum available samples: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
status =
|
||||
ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("ALSA: Couldn't set start threshold: %s",
|
||||
return SDL_SetError("ALSA: Couldn't set start threshold: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
status = ALSA_snd_pcm_sw_params(pcm_handle, swparams);
|
||||
if (status < 0) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_SetError("Couldn't set software audio parameters: %s",
|
||||
return SDL_SetError("Couldn't set software audio parameters: %s",
|
||||
ALSA_snd_strerror(status));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Calculate the final parameters for this audio specification */
|
||||
|
@ -653,8 +641,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
ALSA_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
|
@ -662,7 +649,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
ALSA_snd_pcm_nonblock(pcm_handle, 0);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -42,21 +42,18 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (iscapture) {
|
||||
//TODO: implement capture
|
||||
SDL_SetError("Capture not supported on Android");
|
||||
return 0;
|
||||
return SDL_SetError("Capture not supported on Android");
|
||||
}
|
||||
|
||||
if (audioDevice != NULL) {
|
||||
SDL_SetError("Only one audio device at a time please!");
|
||||
return 0;
|
||||
return SDL_SetError("Only one audio device at a time please!");
|
||||
}
|
||||
|
||||
audioDevice = this;
|
||||
|
||||
this->hidden = SDL_malloc(sizeof(*(this->hidden)));
|
||||
if (!this->hidden) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -71,8 +68,7 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (test_format == 0) {
|
||||
// Didn't find a compatible format :(
|
||||
SDL_SetError("No compatible audio format!");
|
||||
return 0;
|
||||
return SDL_SetError("No compatible audio format!");
|
||||
}
|
||||
|
||||
if (this->spec.channels > 1) {
|
||||
|
@ -94,11 +90,10 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (this->spec.samples == 0) {
|
||||
// Init failed?
|
||||
SDL_SetError("Java-side initialization failed!");
|
||||
return 0;
|
||||
return SDL_SetError("Java-side initialization failed!");
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -241,8 +241,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -271,22 +270,19 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
if (format == 0) {
|
||||
ARTS_CloseDevice(this);
|
||||
SDL_SetError("Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't find any hardware audio formats");
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
|
||||
if ((rc = SDL_NAME(arts_init) ()) != 0) {
|
||||
ARTS_CloseDevice(this);
|
||||
SDL_SetError("Unable to initialize ARTS: %s",
|
||||
return SDL_SetError("Unable to initialize ARTS: %s",
|
||||
SDL_NAME(arts_error_text) (rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ARTS_Suspend()) {
|
||||
ARTS_CloseDevice(this);
|
||||
SDL_SetError("ARTS can not open audio device");
|
||||
return 0;
|
||||
return SDL_SetError("ARTS can not open audio device");
|
||||
}
|
||||
|
||||
this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq,
|
||||
|
@ -304,8 +300,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec);
|
||||
if ((0x01 << frag_spec) != this->spec.size) {
|
||||
ARTS_CloseDevice(this);
|
||||
SDL_SetError("Fragment size must be a power of two");
|
||||
return 0;
|
||||
return SDL_SetError("Fragment size must be a power of two");
|
||||
}
|
||||
frag_spec |= 0x00020000; /* two fragments, for low latency */
|
||||
|
||||
|
@ -326,8 +321,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
ARTS_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
|
@ -335,7 +329,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->parent = getpid();
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,18 +54,18 @@ FillSound(void *device, void *stream, size_t len,
|
|||
|
||||
if (!audio->paused) {
|
||||
if (audio->convert.needed) {
|
||||
SDL_mutexP(audio->mixer_lock);
|
||||
SDL_LockMutex(audio->mixer_lock);
|
||||
(*audio->spec.callback) (audio->spec.userdata,
|
||||
(Uint8 *) audio->convert.buf,
|
||||
audio->convert.len);
|
||||
SDL_mutexV(audio->mixer_lock);
|
||||
SDL_UnlockMutex(audio->mixer_lock);
|
||||
SDL_ConvertAudio(&audio->convert);
|
||||
SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt);
|
||||
} else {
|
||||
SDL_mutexP(audio->mixer_lock);
|
||||
SDL_LockMutex(audio->mixer_lock);
|
||||
(*audio->spec.callback) (audio->spec.userdata,
|
||||
(Uint8 *) stream, len);
|
||||
SDL_mutexV(audio->mixer_lock);
|
||||
SDL_UnlockMutex(audio->mixer_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +95,7 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
/* Initialize all variables that we clean on shutdown */
|
||||
_this->hidden = new SDL_PrivateAudioData;
|
||||
if (_this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(_this->hidden, 0, (sizeof *_this->hidden));
|
||||
|
||||
|
@ -153,8 +152,7 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||
BEOSAUDIO_CloseDevice(_this);
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return 0;
|
||||
return SDL_SetError("Unsupported audio format");
|
||||
}
|
||||
|
||||
/* Calculate the final parameters for this audio specification */
|
||||
|
@ -173,12 +171,11 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
_this->hidden->audio_obj->SetHasData(true);
|
||||
} else {
|
||||
BEOSAUDIO_CloseDevice(_this);
|
||||
SDL_SetError("Unable to start Be audio");
|
||||
return 0;
|
||||
return SDL_SetError("Unable to start Be audio");
|
||||
}
|
||||
|
||||
/* We're running! */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -239,8 +239,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
if (devname == NULL) {
|
||||
devname = SDL_GetAudioDeviceName(0, iscapture);
|
||||
if (devname == NULL) {
|
||||
SDL_SetError("No such audio device");
|
||||
return 0;
|
||||
return SDL_SetError("No such audio device");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,16 +247,14 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Open the audio device */
|
||||
this->hidden->audio_fd = open(devname, flags, 0);
|
||||
if (this->hidden->audio_fd < 0) {
|
||||
SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
|
||||
}
|
||||
|
||||
AUDIO_INITINFO(&info);
|
||||
|
@ -269,8 +266,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
info.mode = AUMODE_PLAY;
|
||||
if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) {
|
||||
BSDAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Couldn't put device into play mode");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't put device into play mode");
|
||||
}
|
||||
|
||||
AUDIO_INITINFO(&info);
|
||||
|
@ -312,8 +308,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!format) {
|
||||
BSDAUDIO_CloseDevice(this);
|
||||
SDL_SetError("No supported encoding for 0x%x", this->spec.format);
|
||||
return 0;
|
||||
return SDL_SetError("No supported encoding for 0x%x", this->spec.format);
|
||||
}
|
||||
|
||||
this->spec.format = format;
|
||||
|
@ -336,15 +331,14 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
BSDAUDIO_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
BSDAUDIO_Status(this);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -280,10 +280,10 @@ outputCallback(void *inRefCon,
|
|||
while (remaining > 0) {
|
||||
if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
|
||||
/* Generate the data */
|
||||
SDL_mutexP(this->mixer_lock);
|
||||
SDL_LockMutex(this->mixer_lock);
|
||||
(*this->spec.callback)(this->spec.userdata,
|
||||
this->hidden->buffer, this->hidden->bufferSize);
|
||||
SDL_mutexV(this->mixer_lock);
|
||||
SDL_UnlockMutex(this->mixer_lock);
|
||||
this->hidden->bufferOffset = 0;
|
||||
}
|
||||
|
||||
|
@ -469,8 +469,7 @@ COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return (0);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -511,8 +510,7 @@ COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||
COREAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return 0;
|
||||
return SDL_SetError("Unsupported audio format");
|
||||
}
|
||||
|
||||
strdesc.mBytesPerFrame =
|
||||
|
@ -522,10 +520,10 @@ COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!prepare_audiounit(this, devname, iscapture, &strdesc)) {
|
||||
COREAUDIO_CloseDevice(this);
|
||||
return 0; /* prepare_audiounit() will call SDL_SetError()... */
|
||||
return -1; /* prepare_audiounit() will call SDL_SetError()... */
|
||||
}
|
||||
|
||||
return 1; /* good to go. */
|
||||
return 0; /* good to go. */
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -95,7 +95,7 @@ utf16_to_utf8(const WCHAR *S)
|
|||
(SDL_wcslen(S)+1)*sizeof(WCHAR));
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
SetDSerror(const char *function, int code)
|
||||
{
|
||||
static const char *error;
|
||||
|
@ -145,8 +145,7 @@ SetDSerror(const char *function, int code)
|
|||
SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function,
|
||||
error);
|
||||
}
|
||||
SDL_SetError("%s", errbuf);
|
||||
return;
|
||||
return SDL_SetError("%s", errbuf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -364,8 +363,7 @@ CreateSecondary(_THIS, HWND focus, WAVEFORMATEX * wavefmt)
|
|||
DSSCL_NORMAL);
|
||||
}
|
||||
if (result != DS_OK) {
|
||||
SetDSerror("DirectSound SetCooperativeLevel", result);
|
||||
return (-1);
|
||||
return SetDSerror("DirectSound SetCooperativeLevel", result);
|
||||
}
|
||||
|
||||
/* Try to create the secondary buffer */
|
||||
|
@ -380,16 +378,14 @@ CreateSecondary(_THIS, HWND focus, WAVEFORMATEX * wavefmt)
|
|||
format.dwBufferBytes = numchunks * chunksize;
|
||||
if ((format.dwBufferBytes < DSBSIZE_MIN) ||
|
||||
(format.dwBufferBytes > DSBSIZE_MAX)) {
|
||||
SDL_SetError("Sound buffer size must be between %d and %d",
|
||||
return SDL_SetError("Sound buffer size must be between %d and %d",
|
||||
DSBSIZE_MIN / numchunks, DSBSIZE_MAX / numchunks);
|
||||
return (-1);
|
||||
}
|
||||
format.dwReserved = 0;
|
||||
format.lpwfxFormat = wavefmt;
|
||||
result = IDirectSound_CreateSoundBuffer(sndObj, &format, sndbuf, NULL);
|
||||
if (result != DS_OK) {
|
||||
SetDSerror("DirectSound CreateSoundBuffer", result);
|
||||
return (-1);
|
||||
return SetDSerror("DirectSound CreateSoundBuffer", result);
|
||||
}
|
||||
IDirectSoundBuffer_SetFormat(*sndbuf, wavefmt);
|
||||
|
||||
|
@ -452,8 +448,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
pDirectSoundEnumerateW(FindDevGUID, &devguid);
|
||||
|
||||
if (!devguid.found) {
|
||||
SDL_SetError("DirectSound: Requested device not found");
|
||||
return 0;
|
||||
return SDL_SetError("DirectSound: Requested device not found");
|
||||
}
|
||||
guid = &devguid.guid;
|
||||
}
|
||||
|
@ -462,8 +457,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -481,8 +475,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!valid_format) {
|
||||
DSOUND_CloseDevice(this);
|
||||
SDL_SetError("DirectSound: Unsupported audio format");
|
||||
return 0;
|
||||
return SDL_SetError("DirectSound: Unsupported audio format");
|
||||
}
|
||||
|
||||
SDL_memset(&waveformat, 0, sizeof(waveformat));
|
||||
|
@ -502,21 +495,20 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL);
|
||||
if (result != DS_OK) {
|
||||
DSOUND_CloseDevice(this);
|
||||
SetDSerror("DirectSoundCreate", result);
|
||||
return 0;
|
||||
return SetDSerror("DirectSoundCreate", result);
|
||||
}
|
||||
|
||||
/* Create the audio buffer to which we write */
|
||||
this->hidden->num_buffers = CreateSecondary(this, NULL, &waveformat);
|
||||
if (this->hidden->num_buffers < 0) {
|
||||
DSOUND_CloseDevice(this);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* The buffer will auto-start playing in DSOUND_WaitDevice() */
|
||||
this->hidden->mixlen = this->spec.size;
|
||||
|
||||
return 1; /* good to go. */
|
||||
return 0; /* good to go. */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,8 +110,7 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc(sizeof(*this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, sizeof(*this->hidden));
|
||||
|
||||
|
@ -119,14 +118,14 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->output = SDL_RWFromFile(fname, "wb");
|
||||
if (this->hidden->output == NULL) {
|
||||
DISKAUD_CloseDevice(this);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Allocate mixing buffer */
|
||||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
DISKAUD_CloseDevice(this);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
|
@ -141,7 +140,7 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
#endif
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -89,8 +89,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
if (devname == NULL) {
|
||||
devname = SDL_GetAudioDeviceName(0, iscapture);
|
||||
if (devname == NULL) {
|
||||
SDL_SetError("No such audio device");
|
||||
return 0;
|
||||
return SDL_SetError("No such audio device");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,8 +106,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -116,8 +114,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->audio_fd = open(devname, flags, 0);
|
||||
if (this->hidden->audio_fd < 0) {
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
|
||||
}
|
||||
this->hidden->mixbuf = NULL;
|
||||
|
||||
|
@ -128,8 +125,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
ctlflags &= ~O_NONBLOCK;
|
||||
if (fcntl(this->hidden->audio_fd, F_SETFL, ctlflags) < 0) {
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Couldn't set audio blocking mode");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't set audio blocking mode");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,8 +133,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) {
|
||||
perror("SNDCTL_DSP_GETFMTS");
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Couldn't get audio format list");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't get audio format list");
|
||||
}
|
||||
|
||||
/* Try for a closest match on audio format */
|
||||
|
@ -195,8 +190,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
if (format == 0) {
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't find any hardware audio formats");
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
|
||||
|
@ -206,8 +200,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
(value != format)) {
|
||||
perror("SNDCTL_DSP_SETFMT");
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Couldn't set audio format");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't set audio format");
|
||||
}
|
||||
|
||||
/* Set the number of channels of output */
|
||||
|
@ -215,8 +208,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0) {
|
||||
perror("SNDCTL_DSP_CHANNELS");
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Cannot set the number of channels");
|
||||
return 0;
|
||||
return SDL_SetError("Cannot set the number of channels");
|
||||
}
|
||||
this->spec.channels = value;
|
||||
|
||||
|
@ -225,8 +217,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 0) {
|
||||
perror("SNDCTL_DSP_SPEED");
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Couldn't set audio frequency");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't set audio frequency");
|
||||
}
|
||||
this->spec.freq = value;
|
||||
|
||||
|
@ -237,8 +228,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec);
|
||||
if ((0x01U << frag_spec) != this->spec.size) {
|
||||
DSP_CloseDevice(this);
|
||||
SDL_SetError("Fragment size must be a power of two");
|
||||
return 0;
|
||||
return SDL_SetError("Fragment size must be a power of two");
|
||||
}
|
||||
frag_spec |= 0x00020000; /* two fragments, for low latency */
|
||||
|
||||
|
@ -266,13 +256,12 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
DSP_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
static int
|
||||
DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
||||
{
|
||||
return 1; /* always succeeds. */
|
||||
return 0; /* always succeeds. */
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -228,8 +228,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
this->hidden->audio_fd = -1;
|
||||
|
@ -257,8 +256,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!found) {
|
||||
ESD_CloseDevice(this);
|
||||
SDL_SetError("Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't find any hardware audio formats");
|
||||
}
|
||||
|
||||
if (this->spec.channels == 1) {
|
||||
|
@ -277,8 +275,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (this->hidden->audio_fd < 0) {
|
||||
ESD_CloseDevice(this);
|
||||
SDL_SetError("Couldn't open ESD connection");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't open ESD connection");
|
||||
}
|
||||
|
||||
/* Calculate the final parameters for this audio specification */
|
||||
|
@ -292,8 +289,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
ESD_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
|
@ -301,7 +297,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->parent = getpid();
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -200,8 +200,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -243,8 +242,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (format == 0) {
|
||||
SDL_FS_CloseDevice(this);
|
||||
SDL_SetError("Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't find any hardware audio formats");
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
|
||||
|
@ -252,8 +250,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs);
|
||||
if (ret) {
|
||||
SDL_FS_CloseDevice(this);
|
||||
SDL_SetError("Unable to initialize FusionSound: %d", ret);
|
||||
return 0;
|
||||
return SDL_SetError("Unable to initialize FusionSound: %d", ret);
|
||||
}
|
||||
|
||||
this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels;
|
||||
|
@ -272,8 +269,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
&this->hidden->stream);
|
||||
if (ret) {
|
||||
SDL_FS_CloseDevice(this);
|
||||
SDL_SetError("Unable to create FusionSoundStream: %d", ret);
|
||||
return 0;
|
||||
return SDL_SetError("Unable to create FusionSoundStream: %d", ret);
|
||||
}
|
||||
|
||||
/* See what we got */
|
||||
|
@ -294,13 +290,12 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
SDL_FS_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -288,8 +288,7 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -304,24 +303,21 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
if (format == 0) {
|
||||
NAS_CloseDevice(this);
|
||||
SDL_SetError("NAS: Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("NAS: Couldn't find any hardware audio formats");
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
|
||||
this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
|
||||
if (this->hidden->aud == 0) {
|
||||
NAS_CloseDevice(this);
|
||||
SDL_SetError("NAS: Couldn't open connection to NAS server");
|
||||
return 0;
|
||||
return SDL_SetError("NAS: Couldn't open connection to NAS server");
|
||||
}
|
||||
|
||||
this->hidden->dev = find_device(this, this->spec.channels);
|
||||
if ((this->hidden->dev == AuNone)
|
||||
|| (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) {
|
||||
NAS_CloseDevice(this);
|
||||
SDL_SetError("NAS: Couldn't find a fitting device on NAS server");
|
||||
return 0;
|
||||
return SDL_SetError("NAS: Couldn't find a fitting device on NAS server");
|
||||
}
|
||||
|
||||
buffer_size = this->spec.freq;
|
||||
|
@ -354,13 +350,12 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
NAS_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_NDS
|
||||
|
||||
/* Output audio to NDS */
|
||||
|
||||
#include <nds.h>
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "SDL_ndsaudio.h"
|
||||
|
||||
static int
|
||||
NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
||||
{
|
||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
|
||||
int valid_datatype = 0;
|
||||
|
||||
this->hidden = SDL_malloc(sizeof(*(this->hidden)));
|
||||
if (!this->hidden) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
while ((!valid_datatype) && (test_format)) {
|
||||
this->spec.format = test_format;
|
||||
switch (test_format) {
|
||||
case AUDIO_S8:
|
||||
/*case AUDIO_S16LSB: */
|
||||
valid_datatype = 1;
|
||||
break;
|
||||
default:
|
||||
test_format = SDL_NextAudioFormat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* set the generic sound parameters */
|
||||
setGenericSound(22050, /* sample rate */
|
||||
127, /* volume */
|
||||
64, /* panning/balance */
|
||||
0); /* sound format */
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
NDSAUD_PlayDevice(_THIS)
|
||||
{
|
||||
#if 0
|
||||
playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);
|
||||
|
||||
// sound->data = this->hidden->mixbuf;/* pointer to raw audio data */
|
||||
// sound->len = this->hidden->mixlen; /* size of raw data pointed to above */
|
||||
// sound->rate = 22050; /* sample rate = 22050Hz */
|
||||
// sound->vol = 127; /* volume [0..127] for [min..max] */
|
||||
// sound->pan = 64; /* balance [0..127] for [left..right] */
|
||||
// sound->format = 0; /* 0 for 16-bit, 1 for 8-bit */
|
||||
// playSound(sound);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static Uint8 *
|
||||
NDSAUD_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return this->hidden->mixbuf; /* is this right? */
|
||||
}
|
||||
|
||||
static void
|
||||
NDSAUD_WaitDevice(_THIS)
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
static void
|
||||
NDSAUD_CloseDevice(_THIS)
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
static int
|
||||
NDSAUD_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
/* Set the function pointers */
|
||||
impl->OpenDevice = NDSAUD_OpenDevice;
|
||||
impl->PlayDevice = NDSAUD_PlayDevice;
|
||||
impl->WaitDevice = NDSAUD_WaitDevice;
|
||||
impl->GetDeviceBuf = NDSAUD_GetDeviceBuf;
|
||||
impl->CloseDevice = NDSAUD_CloseDevice;
|
||||
|
||||
/* and the capabilities */
|
||||
impl->HasCaptureSupport = 1;
|
||||
impl->OnlyHasDefaultOutputDevice = 1;
|
||||
impl->OnlyHasDefaultInputDevice = 1;
|
||||
|
||||
return 1; /* this audio target is available. */
|
||||
}
|
||||
|
||||
AudioBootStrap NDSAUD_bootstrap = {
|
||||
"nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1? */
|
||||
};
|
||||
|
||||
#endif /* SDL_AUDIO_DRIVER_NDS */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -264,8 +264,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -274,8 +273,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->audio_fd = fd;
|
||||
if (fd < 0) {
|
||||
PAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -284,8 +282,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
*/
|
||||
if (ioctl(fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
|
||||
PAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Couldn't get audio buffer information");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't get audio buffer information");
|
||||
}
|
||||
|
||||
if (this->spec.channels > 1)
|
||||
|
@ -399,8 +396,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
fprintf(stderr, "Couldn't find any hardware audio formats\n");
|
||||
#endif
|
||||
PAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't find any hardware audio formats");
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
|
||||
|
@ -458,8 +454,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (err != NULL) {
|
||||
PAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Paudio: %s", err);
|
||||
return 0;
|
||||
return SDL_SetError("Paudio: %s", err);
|
||||
}
|
||||
|
||||
/* Allocate mixing buffer */
|
||||
|
@ -467,8 +462,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
PAUDIO_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
|
@ -506,8 +500,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
#ifdef DEBUG_AUDIO
|
||||
fprintf(stderr, "Can't start audio play\n");
|
||||
#endif
|
||||
SDL_SetError("Can't start audio play");
|
||||
return 0;
|
||||
return SDL_SetError("Can't start audio play");
|
||||
}
|
||||
|
||||
/* Check to see if we need to use select() workaround */
|
||||
|
@ -518,7 +511,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
195
src/audio/psp/SDL_pspaudio.c
Normal file
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "../SDL_audiomem.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_audiodev_c.h"
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_pspaudio.h"
|
||||
|
||||
#include <pspaudio.h>
|
||||
#include <pspthreadman.h>
|
||||
|
||||
/* The tag name used by PSP audio */
|
||||
#define PSPAUD_DRIVER_NAME "psp"
|
||||
|
||||
static int
|
||||
PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
||||
{
|
||||
int format, mixlen, i;
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc(sizeof(*this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, sizeof(*this->hidden));
|
||||
switch (this->spec.format & 0xff) {
|
||||
case 8:
|
||||
case 16:
|
||||
this->spec.format = AUDIO_S16LSB;
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Unsupported audio format");
|
||||
}
|
||||
|
||||
/* The sample count must be a multiple of 64. */
|
||||
this->spec.samples = PSP_AUDIO_SAMPLE_ALIGN(this->spec.samples);
|
||||
this->spec.freq = 44100;
|
||||
|
||||
/* Update the fragment size as size in bytes. */
|
||||
// SDL_CalculateAudioSpec(this->spec); MOD
|
||||
switch (this->spec.format) {
|
||||
case AUDIO_U8:
|
||||
this->spec.silence = 0x80;
|
||||
break;
|
||||
default:
|
||||
this->spec.silence = 0x00;
|
||||
break;
|
||||
}
|
||||
this->spec.size = SDL_AUDIO_BITSIZE(this->spec.format) / 8;
|
||||
this->spec.size *= this->spec.channels;
|
||||
this->spec.size *= this->spec.samples;
|
||||
|
||||
//==========================================
|
||||
|
||||
/* Allocate the mixing buffer. Its size and starting address must
|
||||
be a multiple of 64 bytes. Our sample count is already a multiple of
|
||||
64, so spec->size should be a multiple of 64 as well. */
|
||||
mixlen = this->spec.size * NUM_BUFFERS;
|
||||
this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen);
|
||||
if (this->hidden->rawbuf == NULL) {
|
||||
return SDL_SetError("Couldn't allocate mixing buffer");
|
||||
}
|
||||
|
||||
/* Setup the hardware channel. */
|
||||
if (this->spec.channels == 1) {
|
||||
format = PSP_AUDIO_FORMAT_MONO;
|
||||
} else {
|
||||
format = PSP_AUDIO_FORMAT_STEREO;
|
||||
}
|
||||
this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format);
|
||||
if (this->hidden->channel < 0) {
|
||||
free(this->hidden->rawbuf);
|
||||
this->hidden->rawbuf = NULL;
|
||||
return SDL_SetError("Couldn't reserve hardware channel");
|
||||
}
|
||||
|
||||
memset(this->hidden->rawbuf, 0, mixlen);
|
||||
for (i = 0; i < NUM_BUFFERS; i++) {
|
||||
this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size];
|
||||
}
|
||||
|
||||
this->hidden->next_buffer = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void PSPAUD_PlayDevice(_THIS)
|
||||
{
|
||||
Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
|
||||
|
||||
if (this->spec.channels == 1) {
|
||||
sceAudioOutputBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, mixbuf);
|
||||
} else {
|
||||
sceAudioOutputPannedBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, mixbuf);
|
||||
}
|
||||
|
||||
this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
|
||||
}
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void PSPAUD_WaitDevice(_THIS)
|
||||
{
|
||||
/* Because we block when sending audio, there's no need for this function to do anything. */
|
||||
}
|
||||
static Uint8 *PSPAUD_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return this->hidden->mixbufs[this->hidden->next_buffer];
|
||||
}
|
||||
|
||||
static void PSPAUD_CloseDevice(_THIS)
|
||||
{
|
||||
if (this->hidden->channel >= 0) {
|
||||
sceAudioChRelease(this->hidden->channel);
|
||||
this->hidden->channel = -1;
|
||||
}
|
||||
|
||||
if (this->hidden->rawbuf != NULL) {
|
||||
free(this->hidden->rawbuf);
|
||||
this->hidden->rawbuf = NULL;
|
||||
}
|
||||
}
|
||||
static void PSPAUD_ThreadInit(_THIS)
|
||||
{
|
||||
/* Increase the priority of this audio thread by 1 to put it
|
||||
ahead of other SDL threads. */
|
||||
SceUID thid;
|
||||
SceKernelThreadInfo status;
|
||||
thid = sceKernelGetThreadId();
|
||||
status.size = sizeof(SceKernelThreadInfo);
|
||||
if (sceKernelReferThreadStatus(thid, &status) == 0) {
|
||||
sceKernelChangeThreadPriority(thid, status.currentPriority - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
PSPAUD_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
|
||||
// Set the function pointers
|
||||
impl->OpenDevice = PSPAUD_OpenDevice;
|
||||
impl->PlayDevice = PSPAUD_PlayDevice;
|
||||
impl->WaitDevice = PSPAUD_WaitDevice;
|
||||
impl->GetDeviceBuf = PSPAUD_GetDeviceBuf;
|
||||
impl->WaitDone = PSPAUD_WaitDevice;
|
||||
impl->CloseDevice = PSPAUD_CloseDevice;
|
||||
impl->ThreadInit = PSPAUD_ThreadInit;
|
||||
|
||||
//PSP audio device
|
||||
impl->OnlyHasDefaultOutputDevice = 1;
|
||||
/*
|
||||
impl->HasCaptureSupport = 1;
|
||||
|
||||
impl->OnlyHasDefaultInputDevice = 1;
|
||||
*/
|
||||
/*
|
||||
impl->DetectDevices = DSOUND_DetectDevices;
|
||||
impl->Deinitialize = DSOUND_Deinitialize;
|
||||
*/
|
||||
return 1; /* this audio target is available. */
|
||||
}
|
||||
|
||||
AudioBootStrap PSPAUD_bootstrap = {
|
||||
"psp", "PSP audio driver", PSPAUD_Init, 0
|
||||
};
|
||||
|
||||
/* SDL_AUDI*/
|
||||
|
||||
|
||||
|
|
@ -18,25 +18,28 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifndef _SDL_ndsaudio_h
|
||||
#define _SDL_ndsaudio_h
|
||||
#ifndef _SDL_pspaudio_h
|
||||
#define _SDL_pspaudio_h
|
||||
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include <nds/arm9/sound.h>
|
||||
|
||||
/* Hidden "this" pointer for the audio functions */
|
||||
/* Hidden "this" pointer for the video functions */
|
||||
#define _THIS SDL_AudioDevice *this
|
||||
|
||||
struct SDL_PrivateAudioData
|
||||
{
|
||||
/* The file descriptor for the audio device */
|
||||
Uint8 *mixbuf;
|
||||
Uint32 mixlen;
|
||||
Uint32 write_delay;
|
||||
Uint32 initial_calls;
|
||||
#define NUM_BUFFERS 2
|
||||
|
||||
struct SDL_PrivateAudioData {
|
||||
/* The hardware output channel. */
|
||||
int channel;
|
||||
/* The raw allocated mixing buffer. */
|
||||
Uint8 *rawbuf;
|
||||
/* Individual mixing buffers. */
|
||||
Uint8 *mixbufs[NUM_BUFFERS];
|
||||
/* Index of the next available mixing buffer. */
|
||||
int next_buffer;
|
||||
};
|
||||
|
||||
#endif /* _SDL_ndsaudio_h */
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
#endif /* _SDL_pspaudio_h */
|
||||
/* vim: ts=4 sw=4
|
||||
*/
|
|
@ -205,6 +205,27 @@ load_pulseaudio_syms(void)
|
|||
}
|
||||
|
||||
|
||||
/* Check to see if we can connect to PulseAudio */
|
||||
static SDL_bool
|
||||
CheckPulseAudioAvailable()
|
||||
{
|
||||
pa_simple *s;
|
||||
pa_sample_spec ss;
|
||||
|
||||
ss.format = PA_SAMPLE_S16NE;
|
||||
ss.channels = 1;
|
||||
ss.rate = 22050;
|
||||
|
||||
s = PULSEAUDIO_pa_simple_new(NULL, "SDL", PA_STREAM_PLAYBACK, NULL,
|
||||
"Test", &ss, NULL, NULL, NULL);
|
||||
if (s) {
|
||||
PULSEAUDIO_pa_simple_free(s);
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void
|
||||
PULSEAUDIO_WaitDevice(_THIS)
|
||||
|
@ -316,8 +337,7 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
h = this->hidden;
|
||||
|
@ -350,8 +370,7 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
if (paspec.format == PA_SAMPLE_INVALID) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't find any hardware audio formats");
|
||||
}
|
||||
this->spec.format = test_format;
|
||||
|
||||
|
@ -366,8 +385,7 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
h->mixbuf = (Uint8 *) SDL_AllocAudioMem(h->mixlen);
|
||||
if (h->mixbuf == NULL) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(h->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
|
@ -398,36 +416,31 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
/* Set up a new main loop */
|
||||
if (!(h->mainloop = PULSEAUDIO_pa_mainloop_new())) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("pa_mainloop_new() failed");
|
||||
return 0;
|
||||
return SDL_SetError("pa_mainloop_new() failed");
|
||||
}
|
||||
|
||||
h->mainloop_api = PULSEAUDIO_pa_mainloop_get_api(h->mainloop);
|
||||
h->context = PULSEAUDIO_pa_context_new(h->mainloop_api, NULL);
|
||||
if (!h->context) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("pa_context_new() failed");
|
||||
return 0;
|
||||
return SDL_SetError("pa_context_new() failed");
|
||||
}
|
||||
|
||||
/* Connect to the PulseAudio server */
|
||||
if (PULSEAUDIO_pa_context_connect(h->context, NULL, 0, NULL) < 0) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Could not setup connection to PulseAudio");
|
||||
return 0;
|
||||
return SDL_SetError("Could not setup connection to PulseAudio");
|
||||
}
|
||||
|
||||
do {
|
||||
if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("pa_mainloop_iterate() failed");
|
||||
return 0;
|
||||
return SDL_SetError("pa_mainloop_iterate() failed");
|
||||
}
|
||||
state = PULSEAUDIO_pa_context_get_state(h->context);
|
||||
if (!PA_CONTEXT_IS_GOOD(state)) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Could not connect to PulseAudio");
|
||||
return 0;
|
||||
return SDL_SetError("Could not connect to PulseAudio");
|
||||
}
|
||||
} while (state != PA_CONTEXT_READY);
|
||||
|
||||
|
@ -440,33 +453,29 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (h->stream == NULL) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Could not set up PulseAudio stream");
|
||||
return 0;
|
||||
return SDL_SetError("Could not set up PulseAudio stream");
|
||||
}
|
||||
|
||||
if (PULSEAUDIO_pa_stream_connect_playback(h->stream, NULL, &paattr, flags,
|
||||
NULL, NULL) < 0) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Could not connect PulseAudio stream");
|
||||
return 0;
|
||||
return SDL_SetError("Could not connect PulseAudio stream");
|
||||
}
|
||||
|
||||
do {
|
||||
if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("pa_mainloop_iterate() failed");
|
||||
return 0;
|
||||
return SDL_SetError("pa_mainloop_iterate() failed");
|
||||
}
|
||||
state = PULSEAUDIO_pa_stream_get_state(h->stream);
|
||||
if (!PA_STREAM_IS_GOOD(state)) {
|
||||
PULSEAUDIO_CloseDevice(this);
|
||||
SDL_SetError("Could not create to PulseAudio stream");
|
||||
return 0;
|
||||
return SDL_SetError("Could not create to PulseAudio stream");
|
||||
}
|
||||
} while (state != PA_STREAM_READY);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,7 +485,6 @@ PULSEAUDIO_Deinitialize(void)
|
|||
UnloadPulseAudioLibrary();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
|
@ -484,6 +492,11 @@ PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!CheckPulseAudioAvailable()) {
|
||||
UnloadPulseAudioLibrary();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set the function pointers */
|
||||
impl->OpenDevice = PULSEAUDIO_OpenDevice;
|
||||
impl->PlayDevice = PULSEAUDIO_PlayDevice;
|
||||
|
|
|
@ -83,10 +83,10 @@ uint32_t qsa_playback_devices;
|
|||
QSA_Device qsa_capture_device[QSA_MAX_DEVICES];
|
||||
uint32_t qsa_capture_devices;
|
||||
|
||||
static inline void
|
||||
static inline int
|
||||
QSA_SetError(const char *fn, int status)
|
||||
{
|
||||
SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
|
||||
return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
|
||||
}
|
||||
|
||||
/* card names check to apply the workarounds */
|
||||
|
@ -183,13 +183,13 @@ QSA_WaitDevice(_THIS)
|
|||
switch (selectret) {
|
||||
case -1:
|
||||
{
|
||||
SDL_SetError("QSA: select() failed: %s\n", strerror(errno));
|
||||
SDL_SetError("QSA: select() failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
SDL_SetError("QSA: timeout on buffer waiting occured\n");
|
||||
SDL_SetError("QSA: timeout on buffer waiting occured");
|
||||
this->hidden->timeout_on_wait = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ QSA_PlayDevice(_THIS)
|
|||
/* the audio device driver */
|
||||
if ((errno == EAGAIN) && (written == 0)) {
|
||||
if (this->hidden->timeout_on_wait != 0) {
|
||||
SDL_SetError("QSA: buffer playback timeout\n");
|
||||
SDL_SetError("QSA: buffer playback timeout");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -355,8 +355,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
(struct
|
||||
SDL_PrivateAudioData)));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData));
|
||||
|
||||
|
@ -384,8 +383,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
device++;
|
||||
if (device >= qsa_playback_devices) {
|
||||
QSA_CloseDevice(this);
|
||||
SDL_SetError("No such playback device");
|
||||
return 0;
|
||||
return SDL_SetError("No such playback device");
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
@ -409,8 +407,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
device++;
|
||||
if (device >= qsa_capture_devices) {
|
||||
QSA_CloseDevice(this);
|
||||
SDL_SetError("No such capture device");
|
||||
return 0;
|
||||
return SDL_SetError("No such capture device");
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
@ -448,8 +445,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
if (status < 0) {
|
||||
this->hidden->audio_handle = NULL;
|
||||
QSA_CloseDevice(this);
|
||||
QSA_SetError("snd_pcm_open", status);
|
||||
return 0;
|
||||
return QSA_SetError("snd_pcm_open", status);
|
||||
}
|
||||
|
||||
if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) {
|
||||
|
@ -459,8 +455,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
PLUGIN_DISABLE_MMAP);
|
||||
if (status < 0) {
|
||||
QSA_CloseDevice(this);
|
||||
QSA_SetError("snd_pcm_plugin_set_disable", status);
|
||||
return 0;
|
||||
return QSA_SetError("snd_pcm_plugin_set_disable", status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,8 +541,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
/* assumes test_format not 0 on success */
|
||||
if (test_format == 0) {
|
||||
QSA_CloseDevice(this);
|
||||
SDL_SetError("QSA: Couldn't find any hardware audio formats");
|
||||
return 0;
|
||||
return SDL_SetError("QSA: Couldn't find any hardware audio formats");
|
||||
}
|
||||
|
||||
this->spec.format = test_format;
|
||||
|
@ -565,8 +559,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams);
|
||||
if (status < 0) {
|
||||
QSA_CloseDevice(this);
|
||||
QSA_SetError("snd_pcm_channel_params", status);
|
||||
return 0;
|
||||
return QSA_SetError("snd_pcm_channel_params", status);
|
||||
}
|
||||
|
||||
/* Make sure channel is setup right one last time */
|
||||
|
@ -580,8 +573,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
/* Setup an audio channel */
|
||||
if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) {
|
||||
QSA_CloseDevice(this);
|
||||
SDL_SetError("QSA: Unable to setup channel\n");
|
||||
return 0;
|
||||
return SDL_SetError("QSA: Unable to setup channel");
|
||||
}
|
||||
|
||||
/* Calculate the final parameters for this audio specification */
|
||||
|
@ -604,8 +596,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
(Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len);
|
||||
if (this->hidden->pcm_buf == NULL) {
|
||||
QSA_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden->pcm_buf, this->spec.silence,
|
||||
this->hidden->pcm_len);
|
||||
|
@ -623,8 +614,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (this->hidden->audio_fd < 0) {
|
||||
QSA_CloseDevice(this);
|
||||
QSA_SetError("snd_pcm_file_descriptor", status);
|
||||
return 0;
|
||||
return QSA_SetError("snd_pcm_file_descriptor", status);
|
||||
}
|
||||
|
||||
/* Prepare an audio channel */
|
||||
|
@ -642,12 +632,11 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (status < 0) {
|
||||
QSA_CloseDevice(this);
|
||||
QSA_SetError("snd_pcm_plugin_prepare", status);
|
||||
return 0;
|
||||
return QSA_SetError("snd_pcm_plugin_prepare", status);
|
||||
}
|
||||
|
||||
/* We're really ready to rock and roll. :-) */
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -22,11 +22,6 @@
|
|||
|
||||
#if SDL_AUDIO_DRIVER_SUNAUDIO
|
||||
|
||||
/* I'm gambling no one uses this audio backend...we'll see who emails. :) */
|
||||
#error this code has not been updated for SDL 1.3.
|
||||
#error if no one emails icculus at icculus.org and tells him that this
|
||||
#error code is needed, this audio backend will eventually be removed from SDL.
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
#include <fcntl.h>
|
||||
|
@ -51,84 +46,21 @@
|
|||
#include "SDL_sunaudio.h"
|
||||
|
||||
/* Open the audio device for playback, and don't block if busy */
|
||||
#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK)
|
||||
|
||||
#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO)
|
||||
#define AUDIO_GETBUFINFO AUDIO_GETINFO
|
||||
#endif
|
||||
|
||||
/* Audio driver functions */
|
||||
static int DSP_OpenAudio(_THIS, SDL_AudioSpec * spec);
|
||||
static void DSP_WaitAudio(_THIS);
|
||||
static void DSP_PlayAudio(_THIS);
|
||||
static Uint8 *DSP_GetAudioBuf(_THIS);
|
||||
static void DSP_CloseAudio(_THIS);
|
||||
|
||||
static Uint8 snd2au(int sample);
|
||||
|
||||
/* Audio driver bootstrap functions */
|
||||
|
||||
static int
|
||||
Audio_Available(void)
|
||||
{
|
||||
int fd;
|
||||
int available;
|
||||
|
||||
available = 0;
|
||||
fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 1);
|
||||
if (fd >= 0) {
|
||||
available = 1;
|
||||
close(fd);
|
||||
}
|
||||
return (available);
|
||||
}
|
||||
|
||||
static void
|
||||
Audio_DeleteDevice(SDL_AudioDevice * device)
|
||||
SUNAUDIO_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
|
||||
{
|
||||
SDL_free(device->hidden);
|
||||
SDL_free(device);
|
||||
SDL_EnumUnixAudioDevices(iscapture, 1, (int (*)(int fd)) NULL, addfn);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *
|
||||
Audio_CreateDevice(int devindex)
|
||||
{
|
||||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if (this) {
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
}
|
||||
if ((this == NULL) || (this->hidden == NULL)) {
|
||||
SDL_OutOfMemory();
|
||||
if (this) {
|
||||
SDL_free(this);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
audio_fd = -1;
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = DSP_OpenAudio;
|
||||
this->WaitAudio = DSP_WaitAudio;
|
||||
this->PlayAudio = DSP_PlayAudio;
|
||||
this->GetAudioBuf = DSP_GetAudioBuf;
|
||||
this->CloseAudio = DSP_CloseAudio;
|
||||
|
||||
this->free = Audio_DeleteDevice;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
AudioBootStrap SUNAUDIO_bootstrap = {
|
||||
"audio", "UNIX /dev/audio interface",
|
||||
Audio_Available, Audio_CreateDevice, 0
|
||||
};
|
||||
|
||||
#ifdef DEBUG_AUDIO
|
||||
void
|
||||
CheckUnderflow(_THIS)
|
||||
|
@ -137,29 +69,29 @@ CheckUnderflow(_THIS)
|
|||
audio_info_t info;
|
||||
int left;
|
||||
|
||||
ioctl(audio_fd, AUDIO_GETBUFINFO, &info);
|
||||
left = (written - info.play.samples);
|
||||
if (written && (left == 0)) {
|
||||
ioctl(this->hidden->audio_fd, AUDIO_GETBUFINFO, &info);
|
||||
left = (this->hidden->written - info.play.samples);
|
||||
if (this->hidden->written && (left == 0)) {
|
||||
fprintf(stderr, "audio underflow!\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
DSP_WaitAudio(_THIS)
|
||||
static void
|
||||
SUNAUDIO_WaitDevice(_THIS)
|
||||
{
|
||||
#ifdef AUDIO_GETBUFINFO
|
||||
#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
|
||||
audio_info_t info;
|
||||
Sint32 left;
|
||||
|
||||
ioctl(audio_fd, AUDIO_GETBUFINFO, &info);
|
||||
left = (written - info.play.samples);
|
||||
if (left > fragsize) {
|
||||
ioctl(this->hidden->audio_fd, AUDIO_GETBUFINFO, &info);
|
||||
left = (this->hidden->written - info.play.samples);
|
||||
if (left > this->hidden->fragsize) {
|
||||
Sint32 sleepy;
|
||||
|
||||
sleepy = ((left - fragsize) / frequency);
|
||||
sleepy = ((left - this->hidden->fragsize) / this->hidden->frequency);
|
||||
sleepy -= SLEEP_FUDGE;
|
||||
if (sleepy > 0) {
|
||||
SDL_Delay(sleepy);
|
||||
|
@ -169,30 +101,30 @@ DSP_WaitAudio(_THIS)
|
|||
fd_set fdset;
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(audio_fd, &fdset);
|
||||
select(audio_fd + 1, NULL, &fdset, NULL, NULL);
|
||||
FD_SET(this->hidden->audio_fd, &fdset);
|
||||
select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
DSP_PlayAudio(_THIS)
|
||||
static void
|
||||
SUNAUDIO_PlayDevice(_THIS)
|
||||
{
|
||||
/* Write the audio data */
|
||||
if (ulaw_only) {
|
||||
if (this->hidden->ulaw_only) {
|
||||
/* Assuming that this->spec.freq >= 8000 Hz */
|
||||
int accum, incr, pos;
|
||||
Uint8 *aubuf;
|
||||
|
||||
accum = 0;
|
||||
incr = this->spec.freq / 8;
|
||||
aubuf = ulaw_buf;
|
||||
switch (audio_fmt & 0xFF) {
|
||||
aubuf = this->hidden->ulaw_buf;
|
||||
switch (this->hidden->audio_fmt & 0xFF) {
|
||||
case 8:
|
||||
{
|
||||
Uint8 *sndbuf;
|
||||
|
||||
sndbuf = mixbuf;
|
||||
for (pos = 0; pos < fragsize; ++pos) {
|
||||
sndbuf = this->hidden->mixbuf;
|
||||
for (pos = 0; pos < this->hidden->fragsize; ++pos) {
|
||||
*aubuf = snd2au((0x80 - *sndbuf) * 64);
|
||||
accum += incr;
|
||||
while (accum > 0) {
|
||||
|
@ -207,8 +139,8 @@ DSP_PlayAudio(_THIS)
|
|||
{
|
||||
Sint16 *sndbuf;
|
||||
|
||||
sndbuf = (Sint16 *) mixbuf;
|
||||
for (pos = 0; pos < fragsize; ++pos) {
|
||||
sndbuf = (Sint16 *) this->hidden->mixbuf;
|
||||
for (pos = 0; pos < this->hidden->fragsize; ++pos) {
|
||||
*aubuf = snd2au(*sndbuf / 4);
|
||||
accum += incr;
|
||||
while (accum > 0) {
|
||||
|
@ -223,63 +155,93 @@ DSP_PlayAudio(_THIS)
|
|||
#ifdef DEBUG_AUDIO
|
||||
CheckUnderflow(this);
|
||||
#endif
|
||||
if (write(audio_fd, ulaw_buf, fragsize) < 0) {
|
||||
if (write(this->hidden->audio_fd, this->hidden->ulaw_buf,
|
||||
this->hidden->fragsize) < 0) {
|
||||
/* Assume fatal error, for now */
|
||||
this->enabled = 0;
|
||||
}
|
||||
written += fragsize;
|
||||
this->hidden->written += this->hidden->fragsize;
|
||||
} else {
|
||||
#ifdef DEBUG_AUDIO
|
||||
CheckUnderflow(this);
|
||||
#endif
|
||||
if (write(audio_fd, mixbuf, this->spec.size) < 0) {
|
||||
if (write(this->hidden->audio_fd, this->hidden->mixbuf,
|
||||
this->spec.size) < 0) {
|
||||
/* Assume fatal error, for now */
|
||||
this->enabled = 0;
|
||||
}
|
||||
written += fragsize;
|
||||
this->hidden->written += this->hidden->fragsize;
|
||||
}
|
||||
}
|
||||
|
||||
Uint8 *
|
||||
DSP_GetAudioBuf(_THIS)
|
||||
static Uint8 *
|
||||
SUNAUDIO_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return (mixbuf);
|
||||
return (this->hidden->mixbuf);
|
||||
}
|
||||
|
||||
void
|
||||
DSP_CloseAudio(_THIS)
|
||||
static void
|
||||
SUNAUDIO_CloseDevice(_THIS)
|
||||
{
|
||||
if (mixbuf != NULL) {
|
||||
SDL_FreeAudioMem(mixbuf);
|
||||
mixbuf = NULL;
|
||||
if (this->hidden != NULL) {
|
||||
if (this->hidden->mixbuf != NULL) {
|
||||
SDL_FreeAudioMem(this->hidden->mixbuf);
|
||||
this->hidden->mixbuf = NULL;
|
||||
}
|
||||
if (ulaw_buf != NULL) {
|
||||
SDL_free(ulaw_buf);
|
||||
ulaw_buf = NULL;
|
||||
if (this->hidden->ulaw_buf != NULL) {
|
||||
SDL_free(this->hidden->ulaw_buf);
|
||||
this->hidden->ulaw_buf = NULL;
|
||||
}
|
||||
if (this->hidden->audio_fd >= 0) {
|
||||
close(this->hidden->audio_fd);
|
||||
this->hidden->audio_fd = -1;
|
||||
}
|
||||
SDL_free(this->hidden);
|
||||
this->hidden = NULL;
|
||||
}
|
||||
close(audio_fd);
|
||||
}
|
||||
|
||||
int
|
||||
DSP_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||
static int
|
||||
SUNAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
|
||||
{
|
||||
char audiodev[1024];
|
||||
const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
|
||||
SDL_AudioFormat format = 0;
|
||||
audio_info_t info;
|
||||
|
||||
/* We don't care what the devname is...we'll try to open anything. */
|
||||
/* ...but default to first name in the list... */
|
||||
if (devname == NULL) {
|
||||
devname = SDL_GetAudioDeviceName(0, iscapture);
|
||||
if (devname == NULL) {
|
||||
return SDL_SetError("No such audio device");
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
/* Open the audio device */
|
||||
this->hidden->audio_fd = open(devname, flags, 0);
|
||||
if (this->hidden->audio_fd < 0) {
|
||||
return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
|
||||
}
|
||||
|
||||
#ifdef AUDIO_SETINFO
|
||||
int enc;
|
||||
#endif
|
||||
int desired_freq = spec->freq;
|
||||
|
||||
/* Initialize our freeable variables, in case we fail */
|
||||
audio_fd = -1;
|
||||
mixbuf = NULL;
|
||||
ulaw_buf = NULL;
|
||||
int desired_freq = this->spec.freq;
|
||||
|
||||
/* Determine the audio parameters from the AudioSpec */
|
||||
switch (SDL_AUDIO_BITSIZE(spec->format)) {
|
||||
switch (SDL_AUDIO_BITSIZE(this->spec.format)) {
|
||||
|
||||
case 8:
|
||||
{ /* Unsigned 8 bit audio data */
|
||||
spec->format = AUDIO_U8;
|
||||
this->spec.format = AUDIO_U8;
|
||||
#ifdef AUDIO_SETINFO
|
||||
enc = AUDIO_ENCODING_LINEAR8;
|
||||
#endif
|
||||
|
@ -288,7 +250,7 @@ DSP_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
|||
|
||||
case 16:
|
||||
{ /* Signed 16 bit audio data */
|
||||
spec->format = AUDIO_S16SYS;
|
||||
this->spec.format = AUDIO_S16SYS;
|
||||
#ifdef AUDIO_SETINFO
|
||||
enc = AUDIO_ENCODING_LINEAR;
|
||||
#endif
|
||||
|
@ -298,44 +260,35 @@ DSP_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
|||
default:
|
||||
{
|
||||
/* !!! FIXME: fallback to conversion on unsupported types! */
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return (-1);
|
||||
return SDL_SetError("Unsupported audio format");
|
||||
}
|
||||
}
|
||||
audio_fmt = spec->format;
|
||||
this->hidden->audio_fmt = this->spec.format;
|
||||
|
||||
/* Open the audio device */
|
||||
audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 1);
|
||||
if (audio_fd < 0) {
|
||||
SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ulaw_only = 0; /* modern Suns do support linear audio */
|
||||
this->hidden->ulaw_only = 0; /* modern Suns do support linear audio */
|
||||
#ifdef AUDIO_SETINFO
|
||||
for (;;) {
|
||||
audio_info_t info;
|
||||
AUDIO_INITINFO(&info); /* init all fields to "no change" */
|
||||
|
||||
/* Try to set the requested settings */
|
||||
info.play.sample_rate = spec->freq;
|
||||
info.play.channels = spec->channels;
|
||||
info.play.sample_rate = this->spec.freq;
|
||||
info.play.channels = this->spec.channels;
|
||||
info.play.precision = (enc == AUDIO_ENCODING_ULAW)
|
||||
? 8 : spec->format & 0xff;
|
||||
? 8 : this->spec.format & 0xff;
|
||||
info.play.encoding = enc;
|
||||
if (ioctl(audio_fd, AUDIO_SETINFO, &info) == 0) {
|
||||
if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) {
|
||||
|
||||
/* Check to be sure we got what we wanted */
|
||||
if (ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) {
|
||||
SDL_SetError("Error getting audio parameters: %s",
|
||||
if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) {
|
||||
return SDL_SetError("Error getting audio parameters: %s",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (info.play.encoding == enc
|
||||
&& info.play.precision == (spec->format & 0xff)
|
||||
&& info.play.channels == spec->channels) {
|
||||
&& info.play.precision == (this->spec.format & 0xff)
|
||||
&& info.play.channels == this->spec.channels) {
|
||||
/* Yow! All seems to be well! */
|
||||
spec->freq = info.play.sample_rate;
|
||||
this->spec.freq = info.play.sample_rate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -344,63 +297,61 @@ DSP_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
|||
case AUDIO_ENCODING_LINEAR8:
|
||||
/* unsigned 8bit apparently not supported here */
|
||||
enc = AUDIO_ENCODING_LINEAR;
|
||||
spec->format = AUDIO_S16SYS;
|
||||
this->spec.format = AUDIO_S16SYS;
|
||||
break; /* try again */
|
||||
|
||||
case AUDIO_ENCODING_LINEAR:
|
||||
/* linear 16bit didn't work either, resort to µ-law */
|
||||
enc = AUDIO_ENCODING_ULAW;
|
||||
spec->channels = 1;
|
||||
spec->freq = 8000;
|
||||
spec->format = AUDIO_U8;
|
||||
ulaw_only = 1;
|
||||
this->spec.channels = 1;
|
||||
this->spec.freq = 8000;
|
||||
this->spec.format = AUDIO_U8;
|
||||
this->hidden->ulaw_only = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* oh well... */
|
||||
SDL_SetError("Error setting audio parameters: %s",
|
||||
return SDL_SetError("Error setting audio parameters: %s",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif /* AUDIO_SETINFO */
|
||||
written = 0;
|
||||
this->hidden->written = 0;
|
||||
|
||||
/* We can actually convert on-the-fly to U-Law */
|
||||
if (ulaw_only) {
|
||||
spec->freq = desired_freq;
|
||||
fragsize = (spec->samples * 1000) / (spec->freq / 8);
|
||||
frequency = 8;
|
||||
ulaw_buf = (Uint8 *) SDL_malloc(fragsize);
|
||||
if (ulaw_buf == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return (-1);
|
||||
if (this->hidden->ulaw_only) {
|
||||
this->spec.freq = desired_freq;
|
||||
this->hidden->fragsize = (this->spec.samples * 1000) /
|
||||
(this->spec.freq / 8);
|
||||
this->hidden->frequency = 8;
|
||||
this->hidden->ulaw_buf = (Uint8 *) SDL_malloc(this->hidden->fragsize);
|
||||
if (this->hidden->ulaw_buf == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
spec->channels = 1;
|
||||
this->spec.channels = 1;
|
||||
} else {
|
||||
fragsize = spec->samples;
|
||||
frequency = spec->freq / 1000;
|
||||
this->hidden->fragsize = this->spec.samples;
|
||||
this->hidden->frequency = this->spec.freq / 1000;
|
||||
}
|
||||
#ifdef DEBUG_AUDIO
|
||||
fprintf(stderr, "Audio device %s U-Law only\n",
|
||||
ulaw_only ? "is" : "is not");
|
||||
this->hidden->ulaw_only ? "is" : "is not");
|
||||
fprintf(stderr, "format=0x%x chan=%d freq=%d\n",
|
||||
spec->format, spec->channels, spec->freq);
|
||||
this->spec.format, this->spec.channels, this->spec.freq);
|
||||
#endif
|
||||
|
||||
/* Update the fragment size as size in bytes */
|
||||
SDL_CalculateAudioSpec(spec);
|
||||
SDL_CalculateAudioSpec(&this->spec);
|
||||
|
||||
/* Allocate mixing buffer */
|
||||
mixbuf = (Uint8 *) SDL_AllocAudioMem(spec->size);
|
||||
if (mixbuf == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return (-1);
|
||||
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->spec.size);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(mixbuf, spec->silence, spec->size);
|
||||
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
|
||||
|
||||
/* We're ready to rock and roll. :-) */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -456,6 +407,24 @@ snd2au(int sample)
|
|||
return (mask & sample);
|
||||
}
|
||||
|
||||
static int
|
||||
SUNAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
/* Set the function pointers */
|
||||
impl->DetectDevices = SUNAUDIO_DetectDevices;
|
||||
impl->OpenDevice = SUNAUDIO_OpenDevice;
|
||||
impl->PlayDevice = SUNAUDIO_PlayDevice;
|
||||
impl->WaitDevice = SUNAUDIO_WaitDevice;
|
||||
impl->GetDeviceBuf = SUNAUDIO_GetDeviceBuf;
|
||||
impl->CloseDevice = SUNAUDIO_CloseDevice;
|
||||
|
||||
return 1; /* this audio target is available. */
|
||||
}
|
||||
|
||||
AudioBootStrap SUNAUDIO_bootstrap = {
|
||||
"audio", "UNIX /dev/audio interface", SUNAUDIO_Init, 0
|
||||
};
|
||||
|
||||
#endif /* SDL_AUDIO_DRIVER_SUNAUDIO */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -42,16 +42,6 @@ struct SDL_PrivateAudioData
|
|||
int frequency; /* The audio frequency in KHz */
|
||||
};
|
||||
|
||||
/* Old variable names */
|
||||
#define audio_fd (this->hidden->audio_fd)
|
||||
#define audio_fmt (this->hidden->audio_fmt)
|
||||
#define mixbuf (this->hidden->mixbuf)
|
||||
#define ulaw_only (this->hidden->ulaw_only)
|
||||
#define ulaw_buf (this->hidden->ulaw_buf)
|
||||
#define written (this->hidden->written)
|
||||
#define fragsize (this->hidden->fragsize)
|
||||
#define frequency (this->hidden->frequency)
|
||||
|
||||
#endif /* _SDL_sunaudio_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -91,7 +91,7 @@ FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
|
|||
ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
SetMMerror(char *function, MMRESULT code)
|
||||
{
|
||||
size_t len;
|
||||
|
@ -105,7 +105,7 @@ SetMMerror(char *function, MMRESULT code)
|
|||
WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len,
|
||||
MAXERRORLENGTH - len, NULL, NULL);
|
||||
|
||||
SDL_SetError("%s", errbuf);
|
||||
return SDL_SetError("%s", errbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -234,8 +234,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
|
||||
if (devId == WAVE_MAPPER) {
|
||||
SDL_SetError("Requested device not found");
|
||||
return 0;
|
||||
return SDL_SetError("Requested device not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,8 +242,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -270,8 +268,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!valid_datatype) {
|
||||
WINMM_CloseDevice(this);
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return 0;
|
||||
return SDL_SetError("Unsupported audio format");
|
||||
}
|
||||
|
||||
/* Set basic WAVE format parameters */
|
||||
|
@ -309,8 +306,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (result != MMSYSERR_NOERROR) {
|
||||
WINMM_CloseDevice(this);
|
||||
SetMMerror("waveOutOpen()", result);
|
||||
return 0;
|
||||
return SetMMerror("waveOutOpen()", result);
|
||||
}
|
||||
#ifdef SOUND_DEBUG
|
||||
/* Check the sound device we retrieved */
|
||||
|
@ -321,8 +317,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
&caps, sizeof(caps));
|
||||
if (result != MMSYSERR_NOERROR) {
|
||||
WINMM_CloseDevice(this);
|
||||
SetMMerror("waveOutGetDevCaps()", result);
|
||||
return 0;
|
||||
return SetMMerror("waveOutGetDevCaps()", result);
|
||||
}
|
||||
printf("Audio device: %s\n", caps.szPname);
|
||||
}
|
||||
|
@ -333,8 +328,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
CreateSemaphore(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
|
||||
if (this->hidden->audio_sem == NULL) {
|
||||
WINMM_CloseDevice(this);
|
||||
SDL_SetError("Couldn't create semaphore");
|
||||
return 0;
|
||||
return SDL_SetError("Couldn't create semaphore");
|
||||
}
|
||||
|
||||
/* Create the sound buffers */
|
||||
|
@ -342,8 +336,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
(Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
WINMM_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < NUM_BUFFERS; ++i) {
|
||||
SDL_memset(&this->hidden->wavebuf[i], 0,
|
||||
|
@ -357,12 +350,11 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
sizeof(this->hidden->wavebuf[i]));
|
||||
if (result != MMSYSERR_NOERROR) {
|
||||
WINMM_CloseDevice(this);
|
||||
SetMMerror("waveOutPrepareHeader()", result);
|
||||
return 0;
|
||||
return SetMMerror("waveOutPrepareHeader()", result);
|
||||
}
|
||||
}
|
||||
|
||||
return 1; /* Ready to go! */
|
||||
return 0; /* Ready to go! */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -350,11 +350,9 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
#endif
|
||||
|
||||
if (iscapture) {
|
||||
SDL_SetError("XAudio2: capture devices unsupported.");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: capture devices unsupported.");
|
||||
} else if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) {
|
||||
SDL_SetError("XAudio2: XAudio2Create() failed.");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: XAudio2Create() failed.");
|
||||
}
|
||||
/*
|
||||
XAUDIO2_DEBUG_CONFIGURATION debugConfig;
|
||||
|
@ -374,8 +372,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) {
|
||||
IXAudio2_Release(ixa2);
|
||||
SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed.");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed.");
|
||||
}
|
||||
for (i = 0; i < devcount; i++) {
|
||||
XAUDIO2_DEVICE_DETAILS details;
|
||||
|
@ -399,8 +396,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (i == devcount) {
|
||||
IXAudio2_Release(ixa2);
|
||||
SDL_SetError("XAudio2: Requested device not found.");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: Requested device not found.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -410,8 +406,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
SDL_malloc((sizeof *this->hidden));
|
||||
if (this->hidden == NULL) {
|
||||
IXAudio2_Release(ixa2);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
|
@ -419,8 +414,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->semaphore = SDL_CreateSemaphore(1);
|
||||
if (this->hidden->semaphore == NULL) {
|
||||
XAUDIO2_CloseDevice(this);
|
||||
SDL_SetError("XAudio2: CreateSemaphore() failed!");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: CreateSemaphore() failed!");
|
||||
}
|
||||
|
||||
while ((!valid_format) && (test_format)) {
|
||||
|
@ -438,8 +432,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
|
||||
if (!valid_format) {
|
||||
XAUDIO2_CloseDevice(this);
|
||||
SDL_SetError("XAudio2: Unsupported audio format");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: Unsupported audio format");
|
||||
}
|
||||
|
||||
/* Update the fragment size as size in bytes */
|
||||
|
@ -450,8 +443,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->hidden->mixbuf = (Uint8 *) SDL_malloc(2 * this->hidden->mixlen);
|
||||
if (this->hidden->mixbuf == NULL) {
|
||||
XAUDIO2_CloseDevice(this);
|
||||
SDL_OutOfMemory();
|
||||
return 0;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
this->hidden->nextbuf = this->hidden->mixbuf;
|
||||
SDL_memset(this->hidden->mixbuf, 0, 2 * this->hidden->mixlen);
|
||||
|
@ -467,8 +459,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->spec.freq, 0, devId, NULL);
|
||||
if (result != S_OK) {
|
||||
XAUDIO2_CloseDevice(this);
|
||||
SDL_SetError("XAudio2: Couldn't create mastering voice");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: Couldn't create mastering voice");
|
||||
}
|
||||
|
||||
SDL_zero(waveformat);
|
||||
|
@ -503,8 +494,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
#endif
|
||||
if (result != S_OK) {
|
||||
XAUDIO2_CloseDevice(this);
|
||||
SDL_SetError("XAudio2: Couldn't create source voice");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: Couldn't create source voice");
|
||||
}
|
||||
this->hidden->source = source;
|
||||
|
||||
|
@ -512,18 +502,16 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
result = IXAudio2_StartEngine(ixa2);
|
||||
if (result != S_OK) {
|
||||
XAUDIO2_CloseDevice(this);
|
||||
SDL_SetError("XAudio2: Couldn't start engine");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: Couldn't start engine");
|
||||
}
|
||||
|
||||
result = IXAudio2SourceVoice_Start(source, 0, XAUDIO2_COMMIT_NOW);
|
||||
if (result != S_OK) {
|
||||
XAUDIO2_CloseDevice(this);
|
||||
SDL_SetError("XAudio2: Couldn't start source voice");
|
||||
return 0;
|
||||
return SDL_SetError("XAudio2: Couldn't start source voice");
|
||||
}
|
||||
|
||||
return 1; /* good to go. */
|
||||
return 0; /* good to go. */
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -509,7 +509,8 @@ extern "C" void Android_JNI_CloseAudioDevice()
|
|||
}
|
||||
|
||||
// Test for an exception and call SDL_SetError with its detail if one occurs
|
||||
static bool Android_JNI_ExceptionOccurred()
|
||||
// If optional parameter silent is truthy then SDL_SetError() is not called.
|
||||
static bool Android_JNI_ExceptionOccurred(bool silent = false)
|
||||
{
|
||||
SDL_assert(LocalReferenceHolder::IsActive());
|
||||
JNIEnv *mEnv = Android_JNI_GetEnv();
|
||||
|
@ -521,6 +522,7 @@ static bool Android_JNI_ExceptionOccurred()
|
|||
// Until this happens most JNI operations have undefined behaviour
|
||||
mEnv->ExceptionClear();
|
||||
|
||||
if (!silent) {
|
||||
jclass exceptionClass = mEnv->GetObjectClass(exception);
|
||||
jclass classClass = mEnv->FindClass("java/lang/Class");
|
||||
|
||||
|
@ -532,8 +534,7 @@ static bool Android_JNI_ExceptionOccurred()
|
|||
jstring exceptionMessage = (jstring)mEnv->CallObjectMethod(exception, mid);
|
||||
|
||||
if (exceptionMessage != NULL) {
|
||||
const char* exceptionMessageUTF8 = mEnv->GetStringUTFChars(
|
||||
exceptionMessage, 0);
|
||||
const char* exceptionMessageUTF8 = mEnv->GetStringUTFChars(exceptionMessage, 0);
|
||||
SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8);
|
||||
mEnv->ReleaseStringUTFChars(exceptionMessage, exceptionMessageUTF8);
|
||||
} else {
|
||||
|
@ -541,6 +542,7 @@ static bool Android_JNI_ExceptionOccurred()
|
|||
}
|
||||
|
||||
mEnv->ReleaseStringUTFChars(exceptionName, exceptionNameUTF8);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -588,19 +590,19 @@ static int Android_JNI_FileOpen(SDL_RWops* ctx)
|
|||
*/
|
||||
mid = mEnv->GetMethodID(mEnv->GetObjectClass(assetManager), "openFd", "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;");
|
||||
inputStream = mEnv->CallObjectMethod(assetManager, mid, fileNameJString);
|
||||
if (Android_JNI_ExceptionOccurred()) {
|
||||
if (Android_JNI_ExceptionOccurred(true)) {
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), "getStartOffset", "()J");
|
||||
ctx->hidden.androidio.offset = mEnv->CallLongMethod(inputStream, mid);
|
||||
if (Android_JNI_ExceptionOccurred()) {
|
||||
if (Android_JNI_ExceptionOccurred(true)) {
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), "getDeclaredLength", "()J");
|
||||
ctx->hidden.androidio.size = mEnv->CallLongMethod(inputStream, mid);
|
||||
if (Android_JNI_ExceptionOccurred()) {
|
||||
if (Android_JNI_ExceptionOccurred(true)) {
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
|
@ -778,8 +780,7 @@ static int Android_JNI_FileClose(SDL_RWops* ctx, bool release)
|
|||
JNIEnv *mEnv = Android_JNI_GetEnv();
|
||||
|
||||
if (!refs.init(mEnv)) {
|
||||
SDL_SetError("Failed to allocate enough JVM local references");
|
||||
return -1;
|
||||
return SDL_SetError("Failed to allocate enough JVM local references");
|
||||
}
|
||||
|
||||
if (ctx) {
|
||||
|
@ -842,8 +843,7 @@ extern "C" Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence
|
|||
offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset;
|
||||
break;
|
||||
default:
|
||||
SDL_SetError("Unknown value for 'whence'");
|
||||
return -1;
|
||||
return SDL_SetError("Unknown value for 'whence'");
|
||||
}
|
||||
whence = SEEK_SET;
|
||||
|
||||
|
@ -864,14 +864,12 @@ extern "C" Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence
|
|||
newPosition = ctx->hidden.androidio.size + offset;
|
||||
break;
|
||||
default:
|
||||
SDL_SetError("Unknown value for 'whence'");
|
||||
return -1;
|
||||
return SDL_SetError("Unknown value for 'whence'");
|
||||
}
|
||||
|
||||
/* Validate the new position */
|
||||
if (newPosition < 0) {
|
||||
SDL_Error(SDL_EFSEEK);
|
||||
return -1;
|
||||
return SDL_Error(SDL_EFSEEK);
|
||||
}
|
||||
if (newPosition > ctx->hidden.androidio.size) {
|
||||
newPosition = ctx->hidden.androidio.size;
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_windows.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
|
||||
|
||||
|
||||
/* Sets an error message based on GetLastError() */
|
||||
void
|
||||
int
|
||||
WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr)
|
||||
{
|
||||
TCHAR buffer[1024];
|
||||
|
@ -39,13 +39,14 @@ WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr)
|
|||
message = WIN_StringToUTF8(buffer);
|
||||
SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
|
||||
SDL_free(message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Sets an error message based on GetLastError() */
|
||||
void
|
||||
int
|
||||
WIN_SetError(const char *prefix)
|
||||
{
|
||||
WIN_SetErrorFromHRESULT(prefix, GetLastError());
|
||||
return WIN_SetErrorFromHRESULT(prefix, GetLastError());
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
/* Routines to convert from UTF8 to native Windows text */
|
||||
#if UNICODE
|
||||
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR))
|
||||
|
@ -47,10 +46,10 @@
|
|||
#endif
|
||||
|
||||
/* Sets an error message based on a given HRESULT */
|
||||
extern void WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
|
||||
extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
|
||||
|
||||
/* Sets an error message based on GetLastError() */
|
||||
extern void WIN_SetError(const char *prefix);
|
||||
/* Sets an error message based on GetLastError(). Always return -1. */
|
||||
extern int WIN_SetError(const char *prefix);
|
||||
|
||||
/* Wrap up the oddities of CoInitialize() into a common function. */
|
||||
extern HRESULT WIN_CoInitialize(void);
|
||||
|
|
|
@ -212,7 +212,7 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action,
|
|||
}
|
||||
/* Lock the event queue */
|
||||
used = 0;
|
||||
if (!SDL_EventQ.lock || SDL_mutexP(SDL_EventQ.lock) == 0) {
|
||||
if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) {
|
||||
if (action == SDL_ADDEVENT) {
|
||||
for (i = 0; i < numevents; ++i) {
|
||||
used += SDL_AddEvent(&events[i]);
|
||||
|
@ -242,10 +242,9 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action,
|
|||
}
|
||||
}
|
||||
}
|
||||
SDL_mutexV(SDL_EventQ.lock);
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
} else {
|
||||
SDL_SetError("Couldn't lock event queue");
|
||||
used = -1;
|
||||
return SDL_SetError("Couldn't lock event queue");
|
||||
}
|
||||
return (used);
|
||||
}
|
||||
|
@ -285,7 +284,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType)
|
|||
#endif
|
||||
|
||||
/* Lock the event queue */
|
||||
if (SDL_mutexP(SDL_EventQ.lock) == 0) {
|
||||
if (SDL_LockMutex(SDL_EventQ.lock) == 0) {
|
||||
int spot = SDL_EventQ.head;
|
||||
while (spot != SDL_EventQ.tail) {
|
||||
Uint32 type = SDL_EventQ.event[spot].type;
|
||||
|
@ -295,7 +294,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType)
|
|||
spot = (spot + 1) % MAXEVENTS;
|
||||
}
|
||||
}
|
||||
SDL_mutexV(SDL_EventQ.lock);
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,7 +364,7 @@ int
|
|||
SDL_PushEvent(SDL_Event * event)
|
||||
{
|
||||
SDL_EventWatcher *curr;
|
||||
event->window.timestamp = SDL_GetTicks();
|
||||
event->generic.timestamp = SDL_GetTicks();
|
||||
if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -446,7 +445,7 @@ SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
|
|||
void
|
||||
SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
|
||||
{
|
||||
if (SDL_mutexP(SDL_EventQ.lock) == 0) {
|
||||
if (SDL_LockMutex(SDL_EventQ.lock) == 0) {
|
||||
int spot;
|
||||
|
||||
spot = SDL_EventQ.head;
|
||||
|
@ -458,7 +457,7 @@ SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
|
|||
}
|
||||
}
|
||||
}
|
||||
SDL_mutexV(SDL_EventQ.lock);
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
}
|
||||
|
||||
Uint8
|
||||
|
|
|
@ -27,7 +27,10 @@
|
|||
#include "SDL_events_c.h"
|
||||
#include "SDL_gesture_c.h"
|
||||
|
||||
#if !defined(__PSP__)
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
@ -64,7 +67,6 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
SDL_TouchID id;
|
||||
SDL_FloatPoint res;
|
||||
SDL_FloatPoint centroid;
|
||||
SDL_DollarPath dollarPath;
|
||||
Uint16 numDownFingers;
|
||||
|
@ -156,8 +158,7 @@ int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src)
|
|||
}
|
||||
}
|
||||
}
|
||||
SDL_SetError("Unknown gestureId");
|
||||
return -1;
|
||||
return SDL_SetError("Unknown gestureId");
|
||||
}
|
||||
|
||||
//path is an already sampled set of points
|
||||
|
@ -174,8 +175,7 @@ static int SDL_AddDollarGesture_one(SDL_GestureTouch* inTouch, SDL_FloatPoint* p
|
|||
(index + 1) *
|
||||
sizeof(SDL_DollarTemplate));
|
||||
if (!dollarTemplate) {
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
inTouch->dollarTemplate = dollarTemplate;
|
||||
|
||||
|
@ -410,25 +410,20 @@ static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_Gestu
|
|||
return bestDiff;
|
||||
}
|
||||
|
||||
int SDL_GestureAddTouch(SDL_Touch* touch)
|
||||
int SDL_GestureAddTouch(SDL_TouchID touchId)
|
||||
{
|
||||
SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch,
|
||||
(SDL_numGestureTouches + 1) *
|
||||
sizeof(SDL_GestureTouch));
|
||||
|
||||
if (!gestureTouch) {
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_gestureTouch = gestureTouch;
|
||||
|
||||
SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres;
|
||||
SDL_gestureTouch[SDL_numGestureTouches].res.y = touch->yres;
|
||||
SDL_gestureTouch[SDL_numGestureTouches].numDownFingers = 0;
|
||||
|
||||
SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres;
|
||||
SDL_gestureTouch[SDL_numGestureTouches].id = touch->id;
|
||||
SDL_gestureTouch[SDL_numGestureTouches].id = touchId;
|
||||
|
||||
SDL_gestureTouch[SDL_numGestureTouches].numDollarTemplates = 0;
|
||||
|
||||
|
@ -468,11 +463,8 @@ static int SDL_SendGestureDollar(SDL_GestureTouch* touch,
|
|||
SDL_Event event;
|
||||
event.dgesture.type = SDL_DOLLARGESTURE;
|
||||
event.dgesture.touchId = touch->id;
|
||||
/*
|
||||
//TODO: Add this to give location of gesture?
|
||||
event.mgesture.x = touch->centroid.x;
|
||||
event.mgesture.y = touch->centroid.y;
|
||||
*/
|
||||
event.dgesture.gestureId = gestureId;
|
||||
event.dgesture.error = error;
|
||||
//A finger came up to trigger this event.
|
||||
|
@ -513,14 +505,8 @@ void SDL_GestureProcessEvent(SDL_Event* event)
|
|||
//Shouldn't be possible
|
||||
if (inTouch == NULL) return;
|
||||
|
||||
//printf("@ (%i,%i) with res: (%i,%i)\n",(int)event->tfinger.x,
|
||||
// (int)event->tfinger.y,
|
||||
// (int)inTouch->res.x,(int)inTouch->res.y);
|
||||
|
||||
|
||||
x = ((float)event->tfinger.x)/(float)inTouch->res.x;
|
||||
y = ((float)event->tfinger.y)/(float)inTouch->res.y;
|
||||
|
||||
x = event->tfinger.x;
|
||||
y = event->tfinger.y;
|
||||
|
||||
//Finger Up
|
||||
if (event->type == SDL_FINGERUP) {
|
||||
|
@ -569,9 +555,8 @@ void SDL_GestureProcessEvent(SDL_Event* event)
|
|||
}
|
||||
}
|
||||
else if (event->type == SDL_FINGERMOTION) {
|
||||
float dx = ((float)event->tfinger.dx)/(float)inTouch->res.x;
|
||||
float dy = ((float)event->tfinger.dy)/(float)inTouch->res.y;
|
||||
//printf("dx,dy: (%f,%f)\n",dx,dy);
|
||||
float dx = event->tfinger.dx;
|
||||
float dy = event->tfinger.dy;
|
||||
#ifdef ENABLE_DOLLAR
|
||||
SDL_DollarPath* path = &inTouch->dollarPath;
|
||||
if (path->numPoints < MAXPATHSIZE) {
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
#ifndef _SDL_gesture_c_h
|
||||
#define _SDL_gesture_c_h
|
||||
|
||||
extern int SDL_GestureAddTouch(SDL_TouchID touchId);
|
||||
|
||||
extern void SDL_GestureProcessEvent(SDL_Event* event);
|
||||
|
||||
extern int SDL_RecordGesture(SDL_TouchID touchId);
|
||||
|
||||
extern int SDL_GestureAddTouch(SDL_Touch* touch);
|
||||
|
||||
#endif /* _SDL_gesture_c_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|