Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdl1.2 for Vita with Vita-specific fixes and multi-controller support on VitaTV #5

Open
wants to merge 36 commits into
base: SDL12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9340285
1.2 stdlib: Updated qsort with licensing resolved (thanks, Gareth!).
icculus Feb 21, 2016
1e77527
Quick fix for qsort off-by-one error.
slouken Mar 11, 2016
eab8ce1
SDL_qsort in SDL 1.2 needs to use the system includes.
icculus Mar 30, 2016
8afc9a5
gcc-fat.sh: SDL 1.2 won't build with the Mac OS X 10.11 SDK with < 10…
icculus Mar 30, 2016
6a38357
1.2 stdlib: include SDL_config.h so we can see if HAVE_QSORT is actua…
icculus Mar 30, 2016
ec05d22
SDL 1.2 Windows: Fix other window positions/sizes when exiting fullsc…
slime73 May 23, 2016
d3486b6
1.2 mac: Apparently the magic -psn command line appears in post-10.9 …
icculus Sep 7, 2016
c7a603f
Merge pull request #2 from spurious/SDL12
Cpasjuste Oct 12, 2016
c82a26e
PSP2: add psp2 (ps vita) support
Cpasjuste Oct 12, 2016
33d5e7f
PSP2: clean tests
Cpasjuste Oct 12, 2016
189d935
PSP2: add custom hw scaling function
Cpasjuste Oct 14, 2016
9fdfb07
PSP2: oups!
Cpasjuste Oct 14, 2016
648036f
PSP2: fix SDL_VideoQuit
Cpasjuste Oct 16, 2016
e93e0d4
PSP2: fix SDL_SetVideoModeScaling
Cpasjuste Oct 16, 2016
cefbd25
PSP2: support for multiple audio freqs
Cpasjuste Oct 19, 2016
96ccfd4
PSP2: add custom vsync function
Cpasjuste Nov 14, 2016
1ad9e59
PSP2: fix for latest vitasdk
Cpasjuste Nov 16, 2016
9a39d23
added Bilinear scaling function for Vita that works well with the sha…
Dec 19, 2016
f52a92e
Merge pull request #3 from rsn8887/SDL12
Cpasjuste Dec 20, 2016
06e4d1d
psp2: introduced vita specific SDL_SetVideoModeBilinear(int enable_bi…
rsn8887 Dec 21, 2016
ed36206
Merge pull request #4 from rsn8887/SDL12
Cpasjuste Dec 21, 2016
7e8181f
Vita: - Vita TV second controller support
rsn8887 Jan 9, 2017
0577a87
Merge pull request #5 from rsn8887/SDL12
Cpasjuste Jan 9, 2017
4bcb8f8
Vita SDL12: - Full support for extra Vita TV controllers
rsn8887 Jan 11, 2017
03481fd
change from __PSP2__ to __vita__ define, rename Makefile.psp2
rsn8887 Dec 6, 2017
da0aa87
disable tests in Makefile.vita
rsn8887 Dec 6, 2017
dffdec7
VITA: use linear joystick response, fix joystick name
rsn8887 Dec 20, 2017
889767a
Vita: Add BT keyboard and mouse support
rsn8887 Dec 23, 2017
39d5687
VITA: fix repeated BT keyboard events
rsn8887 Dec 24, 2017
c40c62b
VITA: Fix Caps Lock and Num Lock BT keys
rsn8887 Dec 24, 2017
e7fd897
VITA: BT keyboard code cleanup
rsn8887 Jan 11, 2018
744dd94
VITA: Use the full range of analog stick motion
rsn8887 Jan 17, 2018
fd2e756
VITA: Support unicode keyboard events
rsn8887 Mar 21, 2018
8824a25
VITA: remove bluetooth keyboard and mouse lag
rsn8887 Apr 4, 2018
94b2699
VITA: Fix SDL_SetVideoModeScaling and SDL_SetVideoModeBilinear functions
rsn8887 May 17, 2018
b85a62b
VITA: Enable 64bit support (#5)
d3m3vilurr Jan 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Makefile.vita
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Makefile to build the SDL library

INCLUDE = -I./include
CFLAGS = -Wl,-q -g -O3 $(INCLUDE)

CC = arm-vita-eabi-gcc
AR = arm-vita-eabi-ar
RANLIB = arm-vita-eabi-ranlib

CONFIG_H = include/SDL_config.h
TARGET = libSDL.a
SOURCES = \
src/*.c \
src/audio/*.c \
src/cdrom/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
src/joystick/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/timer/*.c \
src/video/*.c \
src/audio/psp2/*.c \
src/video/psp2/*.c \
src/joystick/psp2/*.c \
src/cdrom/dummy/*.c \
src/thread/psp2/*.c \
src/timer/psp2/*.c \
src/loadso/dummy/*.c \

OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')

#all: $(TARGET)
# make -f Makefile.vita-test clean
# make -f Makefile.vita-test

$(TARGET): $(CONFIG_H) $(OBJECTS)
$(AR) crv $@ $^
$(RANLIB) $@

$(CONFIG_H):
cp $(CONFIG_H).default $(CONFIG_H)

clean:
rm -f $(TARGET) $(OBJECTS)
# make -f Makefile.vita-test clean

install: $(TARGET)
@cp $(TARGET) $(VITASDK)/arm-vita-eabi/lib
@mkdir -p "$(VITASDK)/arm-vita-eabi/include/SDL"
@cp include/*.h "$(VITASDK)/arm-vita-eabi/include/SDL"
@echo "Installed!"
40 changes: 40 additions & 0 deletions Makefile.vita-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
TITLE_ID = VSDL00009
TARGET = vitasdl
OBJS = test/testsprite.o

LIBS = ./libSDL.a -lpsp2shell -lvita2d -lSceDisplay_stub -lSceGxm_stub \
-lSceSysmodule_stub -lSceCtrl_stub -lScePgf_stub -lSceNetCtl_stub \
-lSceNet_stub -lScePower_stub -lSceCommonDialog_stub \
-lSceAudio_stub -lSceAppMgr_stub -lpng -ljpeg -lz -lm -lc

PREFIX = arm-vita-eabi
CC = $(PREFIX)-gcc
CFLAGS = -Wl,-q -Wall -O3 -Iinclude -I$(VITASDK)/arm-vita-eabi/include
ASFLAGS = $(CFLAGS)

all: $(TARGET).vpk

%.vpk: eboot.bin
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
vita-pack-vpk -s param.sfo -b eboot.bin $@

eboot.bin: $(TARGET).velf
vita-make-fself $< $@

%.velf: %.elf
vita-elf-create $< $@

$(TARGET).elf: $(OBJS)
$(CC) $(CFLAGS) $^ $(LIBS) -o $@

clean:
@rm -rf $(TARGET).vpk $(TARGET).velf $(TARGET).elf $(OBJS) \
eboot.bin param.sfo

vpksend: $(TARGET).vpk
curl -T $(TARGET).vpk ftp://$(PSVITAIP):1337/ux0:/
@echo "Sent."

send: eboot.bin
curl -T eboot.bin ftp://$(PSVITAIP):1337/ux0:/app/$(TITLE_ID)/
@echo "Sent."
12 changes: 6 additions & 6 deletions build-scripts/g++-fat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"

# Intel 32-bit compiler flags (10.6 runtime compatibility)
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.5 \
# Intel 32-bit compiler flags (10.7 runtime compatibility)
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.7 \
-I/usr/local/include"

GCC_LINK_X86="-mmacosx-version-min=10.5"
GCC_LINK_X86="-mmacosx-version-min=10.7"

# Intel 64-bit compiler flags (10.6 runtime compatibility)
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
# Intel 64-bit compiler flags (10.7 runtime compatibility)
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.7 \
-I/usr/local/include"

GCC_LINK_X64="-mmacosx-version-min=10.6"
GCC_LINK_X64="-mmacosx-version-min=10.7"

# Output both PowerPC and Intel object files
args="$*"
Expand Down
14 changes: 7 additions & 7 deletions build-scripts/gcc-fat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"

# Intel 32-bit compiler flags (10.5 runtime compatibility)
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \
# Intel 32-bit compiler flags (10.7 runtime compatibility)
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.7 \
-I/usr/local/include"

GCC_LINK_X86="-mmacosx-version-min=10.5"
GCC_LINK_X86="-mmacosx-version-min=10.7"

# Intel 64-bit compiler flags (10.6 runtime compatibility)
GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
# Intel 64-bit compiler flags (10.7 runtime compatibility)
GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.7 \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1070 \
-I/usr/local/include"

GCC_LINK_X64="-mmacosx-version-min=10.6"
GCC_LINK_X64="-mmacosx-version-min=10.7"

# Output both PowerPC and Intel object files
args="$*"
Expand Down
47 changes: 47 additions & 0 deletions include/SDL_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Sam Lantinga
slouken@libsdl.org
*/

#ifndef _SDL_config_h
#define _SDL_config_h

#include "SDL_platform.h"

/* Add any platform that doesn't build using the configure system */
#if defined(__DREAMCAST__)
#include "SDL_config_dreamcast.h"
#elif defined(__MACOS__)
#include "SDL_config_macos.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
#elif defined(__SYMBIAN32__)
#include "SDL_config_symbian.h" /* must be before win32! */
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#elif defined(__vita__)
#include "SDL_config_psp2.h"
#else
#include "SDL_config_minimal.h"
#endif /* platform config */

#endif /* _SDL_config_h */
2 changes: 2 additions & 0 deletions include/SDL_config.h.default
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#include "SDL_config_win32.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#elif defined(__vita__)
#include "SDL_config_psp2.h"
#else
#include "SDL_config_minimal.h"
#endif /* platform config */
Expand Down
155 changes: 155 additions & 0 deletions include/SDL_config_psp2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Sam Lantinga
slouken@libsdl.org
*/

#ifndef _SDL_config_minimal_h
#define _SDL_config_minimal_h

#include "SDL_platform.h"

/* This is the minimal configuration that can be used to build SDL */

#include <stdlib.h>
#include <stdarg.h>
#include <stdint.h>

#define __vita__ 1

#ifdef __cplusplus
extern "C" {
#endif
// custom ps vita hardware scaling
void SDL_SetVideoModeScaling(int x, int y, float w, float h);
void SDL_SetVideoModeBilinear(int enable_bilinear);
void SDL_SetVideoModeSync(int enable_vsync);
#ifdef __cplusplus
}
#endif

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef unsigned int size_t;

#define SDL_HAS_64BIT_TYPE 1

#define HAVE_GCC_ATOMICS 1

#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
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#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
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#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_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_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_ACOS 1
#define HAVE_ASIN 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_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
/* #define HAVE_SYSCONF 1 */
/* #define HAVE_SIGACTION 1 */

/* VITA isn't that sophisticated */
#define LACKS_SYS_MMAN_H 1

/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DISABLED 1

/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1

/* Enable the stub joystick driver (src/joystick/psp2/\*.c) */
#define SDL_JOYSTICK_PSP2 1

/* Enable the psp2 audio driver (src/audio/psp2/\*.c) */
#define SDL_AUDIO_DRIVER_PSP2 1

/* Enable the stub thread support (src/thread/psp2/\*.c) */
#define SDL_THREAD_PSP2 1

/* Enable the psp2 timer support (src/timer/psp2/\*.c) */
#define SDL_TIMER_PSP2 1

/* Enable the psp2 video driver (src/video/psp2/\*.c) */
#define SDL_VIDEO_DRIVER_PSP2 1

#endif /* _SDL_config_psp2_h */
2 changes: 2 additions & 0 deletions include/SDL_stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ typedef enum {
} SDL_DUMMY_ENUM;

#ifndef __NDS__
#ifndef __vita__
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#endif
#endif
/*@}*/

#include "begin_code.h"
Expand Down
3 changes: 3 additions & 0 deletions src/audio/SDL_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ static AudioBootStrap *bootstrap[] = {
#endif
#if SDL_AUDIO_DRIVER_EPOCAUDIO
&EPOCAudio_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_PSP2
&PSP2AUD_bootstrap,
#endif
NULL
};
Expand Down
3 changes: 3 additions & 0 deletions src/audio/SDL_sysaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ extern AudioBootStrap DART_bootstrap;
#if SDL_AUDIO_DRIVER_EPOCAUDIO
extern AudioBootStrap EPOCAudio_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_PSP2
extern AudioBootStrap PSP2AUD_bootstrap;
#endif

/* This is the current audio device */
extern SDL_AudioDevice *current_audio;
Expand Down
Loading