VITASDK compatibility
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
diff --git a/Makefile.vita.dolce b/Makefile.vita.dolce
index 4e2a643..cea5843 100644
--- a/Makefile.vita.dolce
+++ b/Makefile.vita.dolce
@@ -42,7 +42,7 @@ PREFIX = arm-dolce-eabi
CC = $(PREFIX)-gcc
AR = $(PREFIX)-ar
CFLAGS = -g -Wl,-q -Wall -O3 -Iinclude \
- -D__VITA__ -D__ARM_ARCH=7 -D__ARM_ARCH_7A__ \
+ -D__VITA__ -DDOLCEVITA -D__ARM_ARCH=7 -D__ARM_ARCH_7A__ \
-mfpu=neon -mcpu=cortex-a9 -mfloat-abi=hard
ASFLAGS = $(CFLAGS)
diff --git a/Makefile.vita.vita b/Makefile.vita.vita
new file mode 100644
index 0000000..0d294d0
--- /dev/null
+++ b/Makefile.vita.vita
@@ -0,0 +1,59 @@
+# Based on port by xerpi
+# Makefile to build the SDL library
+
+TARGET_LIB = libSDL2.a
+
+SOURCES = \
+ src/*.c \
+ src/atomic/*.c \
+ src/audio/*.c \
+ src/audio/vita/*.c \
+ src/cpuinfo/*.c \
+ src/events/*.c \
+ src/file/*.c \
+ src/haptic/*.c \
+ src/haptic/dummy/*.c \
+ src/joystick/*.c \
+ src/joystick/vita/*.c \
+ src/loadso/dummy/*.c \
+ src/power/*.c \
+ src/power/vita/*.c \
+ src/filesystem/vita/*.c \
+ src/render/*.c \
+ src/render/software/*.c \
+ src/render/vitagxm/*.c \
+ src/sensor/*.c \
+ src/sensor/vita/*.c \
+ src/stdlib/*.c \
+ src/thread/*.c \
+ src/thread/generic/SDL_systls.c \
+ src/thread/vita/*.c \
+ src/timer/*.c \
+ src/timer/vita/*.c \
+ src/video/*.c \
+ src/video/vita/*.c \
+ src/video/yuv2rgb/*.c \
+ src/video/arm/*.S \
+
+OBJS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g' | sed -e 's,\.S,\.o,g')
+
+PREFIX = arm-vita-eabi
+CC = $(PREFIX)-gcc
+AR = $(PREFIX)-ar
+CFLAGS = -g -Wl,-q -Wall -O3 -Iinclude \
+ -D__VITA__ -DSCE_OK=0 -D__ARM_ARCH=7 -D__ARM_ARCH_7A__ \
+ -mfpu=neon -mcpu=cortex-a9 -mfloat-abi=hard
+ASFLAGS = $(CFLAGS)
+
+$(TARGET_LIB): $(OBJS)
+ $(AR) rcs $@ $^
+
+clean:
+ @rm -f $(TARGET_LIB) $(OBJS)
+
+install: $(TARGET_LIB)
+ @mkdir -p "$(DESTDIR)$(VITASDK)/arm-vita-eabi/lib"
+ @cp $(TARGET_LIB) $(DESTDIR)$(VITASDK)/arm-vita-eabi/lib
+ @mkdir -p "$(DESTDIR)$(VITASDK)/arm-vita-eabi/include/SDL2"
+ @cp include/*.h "$(DESTDIR)$(VITASDK)/arm-vita-eabi/include/SDL2"
+ @echo "Installed!"
diff --git a/include/SDL_config_vita.h b/include/SDL_config_vita.h
index dee71f5..2b9d624 100644
--- a/include/SDL_config_vita.h
+++ b/include/SDL_config_vita.h
@@ -142,16 +142,11 @@
#define SDL_FILESYSTEM_VITA 1
#define SDL_SENSOR_VITA 1
-//#if defined(_VITA_GLES2_)
+#if defined(DOLCEVITA)
#define SDL_VIDEO_RENDER_VITA_GLES2 1
-//#else
- #define SDL_VIDEO_RENDER_VITA_GXM 1
-//#endif
-
-#if defined(SDL_VIDEO_RENDER_VITA_GLES2) || defined(SDL_VIDEO_RENDER_VITA_GXM)
#define SDL_VIDEO_OPENGL_ES2 1
#endif
-
+#define SDL_VIDEO_RENDER_VITA_GXM 1
/* VITA doesn't have haptic device (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index c3a03b2..d286e68 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -366,7 +366,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
-#if !defined(__ANDROID__)
+#if !defined(__ANDROID__) && !defined(__VITA__)
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum
{
diff --git a/src/filesystem/vita/SDL_sysfilesystem.c b/src/filesystem/vita/SDL_sysfilesystem.c
index 3d21604..b382bc9 100644
--- a/src/filesystem/vita/SDL_sysfilesystem.c
+++ b/src/filesystem/vita/SDL_sysfilesystem.c
@@ -29,7 +29,11 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
+#if DOLCEVITA
#include <psp2/kernel/iofilemgr.h>
+#else
+#include <psp2/io/stat.h>
+#endif
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
diff --git a/src/sensor/vita/SDL_vitasensor.c b/src/sensor/vita/SDL_vitasensor.c
index 85f941d..da65552 100644
--- a/src/sensor/vita/SDL_vitasensor.c
+++ b/src/sensor/vita/SDL_vitasensor.c
@@ -28,7 +28,13 @@
#include "SDL_vitasensor.h"
#include "../SDL_syssensor.h"
#include <psp2/motion.h>
+#if DOLCEVITA
#include <psp2/error.h>
+#endif
+
+#if !defined(SCE_MOTION_MAX_NUM_STATES)
+#define SCE_MOTION_MAX_NUM_STATES 64
+#endif
typedef struct
{
diff --git a/src/video/vita/SDL_vitagl.c b/src/video/vita/SDL_vitagl.c
index d8ee86f..777d18b 100644
--- a/src/video/vita/SDL_vitagl.c
+++ b/src/video/vita/SDL_vitagl.c
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
-#if SDL_VIDEO_DRIVER_VITA
+#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_OPENGL_ES2
#include <stdlib.h>
#include <string.h>
diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c
index 8bc1ee7..ca69368 100644
--- a/src/video/vita/SDL_vitavideo.c
+++ b/src/video/vita/SDL_vitavideo.c
@@ -37,8 +37,9 @@
#include "SDL_vitatouch.h"
#include "SDL_vitakeyboard.h"
#include "SDL_vitamouse_c.h"
+#if SDLVIDEO_OPENGL_ES2
#include "SDL_vitagl_c.h"
-
+#endif
#include <psp2/ime_dialog.h>
SDL_Window *Vita_Window;
@@ -66,8 +67,9 @@ VITA_Create()
{
SDL_VideoDevice *device;
SDL_VideoData *phdata;
+#if SDLVIDEO_OPENGL_ES2
SDL_GLDriverData *gldata;
-
+#endif
/* Initialize SDL_VideoDevice structure */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
if (device == NULL) {
@@ -82,6 +84,7 @@ VITA_Create()
SDL_free(device);
return NULL;
}
+#if SDLVIDEO_OPENGL_ES2
gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
if (gldata == NULL) {
@@ -92,6 +95,7 @@ VITA_Create()
}
device->gl_data = gldata;
phdata->egl_initialized = SDL_TRUE;
+#endif
phdata->ime_active = SDL_FALSE;
device->driverdata = phdata;
@@ -123,6 +127,7 @@ VITA_Create()
device->DestroyWindow = VITA_DestroyWindow;
device->GetWindowWMInfo = VITA_GetWindowWMInfo;
+#if SDL_VIDEO_OPENGL_ES2
device->GL_LoadLibrary = VITA_GL_LoadLibrary;
device->GL_GetProcAddress = VITA_GL_GetProcAddress;
device->GL_UnloadLibrary = VITA_GL_UnloadLibrary;
@@ -132,6 +137,7 @@ VITA_Create()
device->GL_GetSwapInterval = VITA_GL_GetSwapInterval;
device->GL_SwapWindow = VITA_GL_SwapWindow;
device->GL_DeleteContext = VITA_GL_DeleteContext;
+#endif
device->HasScreenKeyboardSupport = VITA_HasScreenKeyboardSupport;
device->ShowScreenKeyboard = VITA_ShowScreenKeyboard;
@@ -321,6 +327,10 @@ SDL_bool VITA_HasScreenKeyboardSupport(_THIS)
return SDL_TRUE;
}
+#if !defined(SCE_IME_LANGUAGE_ENGLISH_US)
+#define SCE_IME_LANGUAGE_ENGLISH_US SCE_IME_LANGUAGE_ENGLISH
+#endif
+
void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
{
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;