summaryrefslogtreecommitdiff
path: root/source/3rd-party/SDL2/src/video/psp
diff options
context:
space:
mode:
Diffstat (limited to 'source/3rd-party/SDL2/src/video/psp')
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspevents.c290
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspevents_c.h31
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspgl.c210
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspgl_c.h54
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspmouse.c41
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspmouse_c.h24
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.c333
-rw-r--r--source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.h102
8 files changed, 1085 insertions, 0 deletions
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspevents.c b/source/3rd-party/SDL2/src/video/psp/SDL_pspevents.c
new file mode 100644
index 0000000..14277b3
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspevents.c
@@ -0,0 +1,290 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+/* Being a null driver, there's no event stream. We just define stubs for
+ most of the API. */
+
+#include "SDL.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/SDL_keyboard_c.h"
+#include "SDL_pspvideo.h"
+#include "SDL_pspevents_c.h"
+#include "SDL_keyboard.h"
+#include "../../thread/SDL_systhread.h"
+#include <psphprm.h>
+
+#ifdef PSPIRKEYB
+#include <pspirkeyb.h>
+#include <pspirkeyb_rawkeys.h>
+
+#define IRKBD_CONFIG_FILE NULL /* this will take ms0:/seplugins/pspirkeyb.ini */
+
+static int irkbd_ready = 0;
+static SDL_Keycode keymap[256];
+#endif
+
+static enum PspHprmKeys hprm = 0;
+static SDL_sem *event_sem = NULL;
+static SDL_Thread *thread = NULL;
+static int running = 0;
+static struct {
+ enum PspHprmKeys id;
+ SDL_Keycode sym;
+} keymap_psp[] = {
+ { PSP_HPRM_PLAYPAUSE, SDLK_F10 },
+ { PSP_HPRM_FORWARD, SDLK_F11 },
+ { PSP_HPRM_BACK, SDLK_F12 },
+ { PSP_HPRM_VOL_UP, SDLK_F13 },
+ { PSP_HPRM_VOL_DOWN, SDLK_F14 },
+ { PSP_HPRM_HOLD, SDLK_F15 }
+};
+
+int EventUpdate(void *data)
+{
+ while (running) {
+ SDL_SemWait(event_sem);
+ sceHprmPeekCurrentKey(&hprm);
+ SDL_SemPost(event_sem);
+ /* Delay 1/60th of a second */
+ sceKernelDelayThread(1000000 / 60);
+ }
+ return 0;
+}
+
+void PSP_PumpEvents(_THIS)
+{
+ int i;
+ enum PspHprmKeys keys;
+ enum PspHprmKeys changed;
+ static enum PspHprmKeys old_keys = 0;
+ SDL_Keysym sym;
+
+ SDL_SemWait(event_sem);
+ keys = hprm;
+ SDL_SemPost(event_sem);
+
+ /* HPRM Keyboard */
+ changed = old_keys ^ keys;
+ old_keys = keys;
+ if(changed) {
+ for(i=0; i<sizeof(keymap_psp)/sizeof(keymap_psp[0]); i++) {
+ if(changed & keymap_psp[i].id) {
+ sym.scancode = keymap_psp[i].id;
+ sym.sym = keymap_psp[i].sym;
+
+ /* out of date
+ SDL_PrivateKeyboard((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED,
+ &sym);
+ */
+ SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap_psp[i].sym));
+ }
+ }
+ }
+
+#ifdef PSPIRKEYB
+ if (irkbd_ready) {
+ unsigned char buffer[255];
+ int i, length, count;
+ SIrKeybScanCodeData *scanData;
+
+ if(pspIrKeybReadinput(buffer, &length) >= 0) {
+ if((length % sizeof(SIrKeybScanCodeData)) == 0){
+ count = length / sizeof(SIrKeybScanCodeData);
+ for( i=0; i < count; i++ ) {
+ unsigned char raw, pressed;
+ scanData=(SIrKeybScanCodeData*) buffer+i;
+ raw = scanData->raw;
+ pressed = scanData->pressed;
+ sym.scancode = raw;
+ sym.sym = keymap[raw];
+ /* not tested */
+ /* SDL_PrivateKeyboard(pressed?SDL_PRESSED:SDL_RELEASED, &sym); */
+ SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap[raw]));
+
+ }
+ }
+ }
+ }
+#endif
+ sceKernelDelayThread(0);
+
+ return;
+}
+
+void PSP_InitOSKeymap(_THIS)
+{
+#ifdef PSPIRKEYB
+ int i;
+ for (i=0; i<SDL_TABLESIZE(keymap); ++i)
+ keymap[i] = SDLK_UNKNOWN;
+
+ keymap[KEY_ESC] = SDLK_ESCAPE;
+
+ keymap[KEY_F1] = SDLK_F1;
+ keymap[KEY_F2] = SDLK_F2;
+ keymap[KEY_F3] = SDLK_F3;
+ keymap[KEY_F4] = SDLK_F4;
+ keymap[KEY_F5] = SDLK_F5;
+ keymap[KEY_F6] = SDLK_F6;
+ keymap[KEY_F7] = SDLK_F7;
+ keymap[KEY_F8] = SDLK_F8;
+ keymap[KEY_F9] = SDLK_F9;
+ keymap[KEY_F10] = SDLK_F10;
+ keymap[KEY_F11] = SDLK_F11;
+ keymap[KEY_F12] = SDLK_F12;
+ keymap[KEY_F13] = SDLK_PRINT;
+ keymap[KEY_F14] = SDLK_PAUSE;
+
+ keymap[KEY_GRAVE] = SDLK_BACKQUOTE;
+ keymap[KEY_1] = SDLK_1;
+ keymap[KEY_2] = SDLK_2;
+ keymap[KEY_3] = SDLK_3;
+ keymap[KEY_4] = SDLK_4;
+ keymap[KEY_5] = SDLK_5;
+ keymap[KEY_6] = SDLK_6;
+ keymap[KEY_7] = SDLK_7;
+ keymap[KEY_8] = SDLK_8;
+ keymap[KEY_9] = SDLK_9;
+ keymap[KEY_0] = SDLK_0;
+ keymap[KEY_MINUS] = SDLK_MINUS;
+ keymap[KEY_EQUAL] = SDLK_EQUALS;
+ keymap[KEY_BACKSPACE] = SDLK_BACKSPACE;
+
+ keymap[KEY_TAB] = SDLK_TAB;
+ keymap[KEY_Q] = SDLK_q;
+ keymap[KEY_W] = SDLK_w;
+ keymap[KEY_E] = SDLK_e;
+ keymap[KEY_R] = SDLK_r;
+ keymap[KEY_T] = SDLK_t;
+ keymap[KEY_Y] = SDLK_y;
+ keymap[KEY_U] = SDLK_u;
+ keymap[KEY_I] = SDLK_i;
+ keymap[KEY_O] = SDLK_o;
+ keymap[KEY_P] = SDLK_p;
+ keymap[KEY_LEFTBRACE] = SDLK_LEFTBRACKET;
+ keymap[KEY_RIGHTBRACE] = SDLK_RIGHTBRACKET;
+ keymap[KEY_ENTER] = SDLK_RETURN;
+
+ keymap[KEY_CAPSLOCK] = SDLK_CAPSLOCK;
+ keymap[KEY_A] = SDLK_a;
+ keymap[KEY_S] = SDLK_s;
+ keymap[KEY_D] = SDLK_d;
+ keymap[KEY_F] = SDLK_f;
+ keymap[KEY_G] = SDLK_g;
+ keymap[KEY_H] = SDLK_h;
+ keymap[KEY_J] = SDLK_j;
+ keymap[KEY_K] = SDLK_k;
+ keymap[KEY_L] = SDLK_l;
+ keymap[KEY_SEMICOLON] = SDLK_SEMICOLON;
+ keymap[KEY_APOSTROPHE] = SDLK_QUOTE;
+ keymap[KEY_BACKSLASH] = SDLK_BACKSLASH;
+
+ keymap[KEY_Z] = SDLK_z;
+ keymap[KEY_X] = SDLK_x;
+ keymap[KEY_C] = SDLK_c;
+ keymap[KEY_V] = SDLK_v;
+ keymap[KEY_B] = SDLK_b;
+ keymap[KEY_N] = SDLK_n;
+ keymap[KEY_M] = SDLK_m;
+ keymap[KEY_COMMA] = SDLK_COMMA;
+ keymap[KEY_DOT] = SDLK_PERIOD;
+ keymap[KEY_SLASH] = SDLK_SLASH;
+
+ keymap[KEY_SPACE] = SDLK_SPACE;
+
+ keymap[KEY_UP] = SDLK_UP;
+ keymap[KEY_DOWN] = SDLK_DOWN;
+ keymap[KEY_LEFT] = SDLK_LEFT;
+ keymap[KEY_RIGHT] = SDLK_RIGHT;
+
+ keymap[KEY_HOME] = SDLK_HOME;
+ keymap[KEY_END] = SDLK_END;
+ keymap[KEY_INSERT] = SDLK_INSERT;
+ keymap[KEY_DELETE] = SDLK_DELETE;
+
+ keymap[KEY_NUMLOCK] = SDLK_NUMLOCK;
+ keymap[KEY_LEFTMETA] = SDLK_LSUPER;
+
+ keymap[KEY_KPSLASH] = SDLK_KP_DIVIDE;
+ keymap[KEY_KPASTERISK] = SDLK_KP_MULTIPLY;
+ keymap[KEY_KPMINUS] = SDLK_KP_MINUS;
+ keymap[KEY_KPPLUS] = SDLK_KP_PLUS;
+ keymap[KEY_KPDOT] = SDLK_KP_PERIOD;
+ keymap[KEY_KPEQUAL] = SDLK_KP_EQUALS;
+
+ keymap[KEY_LEFTCTRL] = SDLK_LCTRL;
+ keymap[KEY_RIGHTCTRL] = SDLK_RCTRL;
+ keymap[KEY_LEFTALT] = SDLK_LALT;
+ keymap[KEY_RIGHTALT] = SDLK_RALT;
+ keymap[KEY_LEFTSHIFT] = SDLK_LSHIFT;
+ keymap[KEY_RIGHTSHIFT] = SDLK_RSHIFT;
+#endif
+}
+
+void PSP_EventInit(_THIS)
+{
+#ifdef PSPIRKEYB
+ int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE;
+ int ret = pspIrKeybInit(IRKBD_CONFIG_FILE, 0);
+ if (ret == PSP_IRKBD_RESULT_OK) {
+ pspIrKeybOutputMode(outputmode);
+ irkbd_ready = 1;
+ } else {
+ irkbd_ready = 0;
+ }
+#endif
+ /* Start thread to read data */
+ if((event_sem = SDL_CreateSemaphore(1)) == NULL) {
+ SDL_SetError("Can't create input semaphore");
+ return;
+ }
+ running = 1;
+ if((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) {
+ SDL_SetError("Can't create input thread");
+ return;
+ }
+}
+
+void PSP_EventQuit(_THIS)
+{
+ running = 0;
+ SDL_WaitThread(thread, NULL);
+ SDL_DestroySemaphore(event_sem);
+#ifdef PSPIRKEYB
+ if (irkbd_ready) {
+ pspIrKeybFinish();
+ irkbd_ready = 0;
+ }
+#endif
+}
+
+/* end of SDL_pspevents.c ... */
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspevents_c.h b/source/3rd-party/SDL2/src/video/psp/SDL_pspevents_c.h
new file mode 100644
index 0000000..e98beb4
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspevents_c.h
@@ -0,0 +1,31 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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_pspvideo.h"
+
+/* Variables and functions exported by SDL_sysevents.c to other parts
+ of the native video subsystem (SDL_sysvideo.c)
+*/
+extern void PSP_InitOSKeymap(_THIS);
+extern void PSP_PumpEvents(_THIS);
+
+/* end of SDL_pspevents_c.h ... */
+
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspgl.c b/source/3rd-party/SDL2/src/video/psp/SDL_pspgl.c
new file mode 100644
index 0000000..644fb34
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspgl.c
@@ -0,0 +1,210 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "SDL_error.h"
+#include "SDL_pspvideo.h"
+#include "SDL_pspgl_c.h"
+
+/*****************************************************************************/
+/* SDL OpenGL/OpenGL ES functions */
+/*****************************************************************************/
+#define EGLCHK(stmt) \
+ do { \
+ EGLint err; \
+ \
+ stmt; \
+ err = eglGetError(); \
+ if (err != EGL_SUCCESS) { \
+ SDL_SetError("EGL error %d", err); \
+ return 0; \
+ } \
+ } while (0)
+
+int
+PSP_GL_LoadLibrary(_THIS, const char *path)
+{
+ return 0;
+}
+
+/* pspgl doesn't provide this call, so stub it out since SDL requires it.
+#define GLSTUB(func,params) void func params {}
+
+GLSTUB(glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
+ GLdouble zNear, GLdouble zFar))
+*/
+void *
+PSP_GL_GetProcAddress(_THIS, const char *proc)
+{
+ return eglGetProcAddress(proc);
+}
+
+void
+PSP_GL_UnloadLibrary(_THIS)
+{
+ eglTerminate(_this->gl_data->display);
+}
+
+static EGLint width = 480;
+static EGLint height = 272;
+
+SDL_GLContext
+PSP_GL_CreateContext(_THIS, SDL_Window * window)
+{
+
+ SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
+
+ EGLint attribs[32];
+ EGLDisplay display;
+ EGLContext context;
+ EGLSurface surface;
+ EGLConfig config;
+ EGLint num_configs;
+ int i;
+
+
+ /* EGL init taken from glutCreateWindow() in PSPGL's glut.c. */
+ EGLCHK(display = eglGetDisplay(0));
+ EGLCHK(eglInitialize(display, NULL, NULL));
+ wdata->uses_gles = SDL_TRUE;
+ window->flags |= SDL_WINDOW_FULLSCREEN;
+
+ /* Setup the config based on SDL's current values. */
+ i = 0;
+ attribs[i++] = EGL_RED_SIZE;
+ attribs[i++] = _this->gl_config.red_size;
+ attribs[i++] = EGL_GREEN_SIZE;
+ attribs[i++] = _this->gl_config.green_size;
+ attribs[i++] = EGL_BLUE_SIZE;
+ attribs[i++] = _this->gl_config.blue_size;
+ attribs[i++] = EGL_DEPTH_SIZE;
+ attribs[i++] = _this->gl_config.depth_size;
+
+ if (_this->gl_config.alpha_size)
+ {
+ attribs[i++] = EGL_ALPHA_SIZE;
+ attribs[i++] = _this->gl_config.alpha_size;
+ }
+ if (_this->gl_config.stencil_size)
+ {
+ attribs[i++] = EGL_STENCIL_SIZE;
+ attribs[i++] = _this->gl_config.stencil_size;
+ }
+
+ attribs[i++] = EGL_NONE;
+
+ EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
+
+ if (num_configs == 0)
+ {
+ SDL_SetError("No valid EGL configs for requested mode");
+ return 0;
+ }
+
+ EGLCHK(eglGetConfigAttrib(display, config, EGL_WIDTH, &width));
+ EGLCHK(eglGetConfigAttrib(display, config, EGL_HEIGHT, &height));
+
+ EGLCHK(context = eglCreateContext(display, config, NULL, NULL));
+ EGLCHK(surface = eglCreateWindowSurface(display, config, 0, NULL));
+ EGLCHK(eglMakeCurrent(display, surface, surface, context));
+
+ _this->gl_data->display = display;
+ _this->gl_data->context = context;
+ _this->gl_data->surface = surface;
+
+
+ return context;
+}
+
+int
+PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
+{
+ if (!eglMakeCurrent(_this->gl_data->display, _this->gl_data->surface,
+ _this->gl_data->surface, _this->gl_data->context))
+ {
+ return SDL_SetError("Unable to make EGL context current");
+ }
+ return 0;
+}
+
+int
+PSP_GL_SetSwapInterval(_THIS, int interval)
+{
+ EGLBoolean status;
+ status = eglSwapInterval(_this->gl_data->display, interval);
+ if (status == EGL_TRUE) {
+ /* Return success to upper level */
+ _this->gl_data->swapinterval = interval;
+ return 0;
+ }
+ /* Failed to set swap interval */
+ return SDL_SetError("Unable to set the EGL swap interval");
+}
+
+int
+PSP_GL_GetSwapInterval(_THIS)
+{
+ return _this->gl_data->swapinterval;
+}
+
+int
+PSP_GL_SwapWindow(_THIS, SDL_Window * window)
+{
+ if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) {
+ return SDL_SetError("eglSwapBuffers() failed");
+ }
+ return 0;
+}
+
+void
+PSP_GL_DeleteContext(_THIS, SDL_GLContext context)
+{
+ SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
+ EGLBoolean status;
+
+ if (phdata->egl_initialized != SDL_TRUE) {
+ SDL_SetError("PSP: GLES initialization failed, no OpenGL ES support");
+ return;
+ }
+
+ /* Check if OpenGL ES connection has been initialized */
+ if (_this->gl_data->display != EGL_NO_DISPLAY) {
+ if (context != EGL_NO_CONTEXT) {
+ status = eglDestroyContext(_this->gl_data->display, context);
+ if (status != EGL_TRUE) {
+ /* Error during OpenGL ES context destroying */
+ SDL_SetError("PSP: OpenGL ES context destroy error");
+ return;
+ }
+ }
+ }
+
+ return;
+}
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspgl_c.h b/source/3rd-party/SDL2/src/video/psp/SDL_pspgl_c.h
new file mode 100644
index 0000000..49300fb
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspgl_c.h
@@ -0,0 +1,54 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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.
+*/
+
+#ifndef SDL_pspgl_c_h_
+#define SDL_pspgl_c_h_
+
+
+#include <GLES/egl.h>
+#include <GLES/gl.h>
+
+#include "SDL_pspvideo.h"
+
+
+typedef struct SDL_GLDriverData {
+ EGLDisplay display;
+ EGLContext context;
+ EGLSurface surface;
+ uint32_t swapinterval;
+}SDL_GLDriverData;
+
+extern void * PSP_GL_GetProcAddress(_THIS, const char *proc);
+extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context);
+extern void PSP_GL_SwapBuffers(_THIS);
+
+extern int PSP_GL_SwapWindow(_THIS, SDL_Window * window);
+extern SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window);
+
+extern int PSP_GL_LoadLibrary(_THIS, const char *path);
+extern void PSP_GL_UnloadLibrary(_THIS);
+extern int PSP_GL_SetSwapInterval(_THIS, int interval);
+extern int PSP_GL_GetSwapInterval(_THIS);
+
+
+#endif /* SDL_pspgl_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspmouse.c b/source/3rd-party/SDL2/src/video/psp/SDL_pspmouse.c
new file mode 100644
index 0000000..bd34dfa
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspmouse.c
@@ -0,0 +1,41 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+#include <stdio.h>
+
+#include "SDL_error.h"
+#include "SDL_mouse.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_pspmouse_c.h"
+
+
+/* The implementation dependent data for the window manager cursor */
+struct WMcursor {
+ int unused;
+};
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspmouse_c.h b/source/3rd-party/SDL2/src/video/psp/SDL_pspmouse_c.h
new file mode 100644
index 0000000..2d2640e
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspmouse_c.h
@@ -0,0 +1,24 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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_pspvideo.h"
+
+/* Functions to be exported */
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.c b/source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.c
new file mode 100644
index 0000000..8231779
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.c
@@ -0,0 +1,333 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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_internal.h"
+
+#if SDL_VIDEO_DRIVER_PSP
+
+/* SDL internals */
+#include "../SDL_sysvideo.h"
+#include "SDL_version.h"
+#include "SDL_syswm.h"
+#include "SDL_loadso.h"
+#include "SDL_events.h"
+#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_keyboard_c.h"
+
+
+
+/* PSP declarations */
+#include "SDL_pspvideo.h"
+#include "SDL_pspevents_c.h"
+#include "SDL_pspgl_c.h"
+
+/* unused
+static SDL_bool PSP_initialized = SDL_FALSE;
+*/
+static int
+PSP_Available(void)
+{
+ return 1;
+}
+
+static void
+PSP_Destroy(SDL_VideoDevice * device)
+{
+/* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */
+
+ if (device->driverdata != NULL) {
+ device->driverdata = NULL;
+ }
+}
+
+static SDL_VideoDevice *
+PSP_Create()
+{
+ SDL_VideoDevice *device;
+ SDL_VideoData *phdata;
+ SDL_GLDriverData *gldata;
+ int status;
+
+ /* Check if PSP could be initialized */
+ status = PSP_Available();
+ if (status == 0) {
+ /* PSP could not be used */
+ return NULL;
+ }
+
+ /* Initialize SDL_VideoDevice structure */
+ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+ if (device == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
+ /* Initialize internal PSP specific data */
+ phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (phdata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ return NULL;
+ }
+
+ gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
+ if (gldata == NULL) {
+ SDL_OutOfMemory();
+ SDL_free(device);
+ SDL_free(phdata);
+ return NULL;
+ }
+ device->gl_data = gldata;
+
+ device->driverdata = phdata;
+
+ phdata->egl_initialized = SDL_TRUE;
+
+
+ /* Setup amount of available displays */
+ device->num_displays = 0;
+
+ /* Set device free function */
+ device->free = PSP_Destroy;
+
+ /* Setup all functions which we can handle */
+ device->VideoInit = PSP_VideoInit;
+ device->VideoQuit = PSP_VideoQuit;
+ device->GetDisplayModes = PSP_GetDisplayModes;
+ device->SetDisplayMode = PSP_SetDisplayMode;
+ device->CreateSDLWindow = PSP_CreateWindow;
+ device->CreateSDLWindowFrom = PSP_CreateWindowFrom;
+ device->SetWindowTitle = PSP_SetWindowTitle;
+ device->SetWindowIcon = PSP_SetWindowIcon;
+ device->SetWindowPosition = PSP_SetWindowPosition;
+ device->SetWindowSize = PSP_SetWindowSize;
+ device->ShowWindow = PSP_ShowWindow;
+ device->HideWindow = PSP_HideWindow;
+ device->RaiseWindow = PSP_RaiseWindow;
+ device->MaximizeWindow = PSP_MaximizeWindow;
+ device->MinimizeWindow = PSP_MinimizeWindow;
+ device->RestoreWindow = PSP_RestoreWindow;
+ device->SetWindowGrab = PSP_SetWindowGrab;
+ device->DestroyWindow = PSP_DestroyWindow;
+#if 0
+ device->GetWindowWMInfo = PSP_GetWindowWMInfo;
+#endif
+ device->GL_LoadLibrary = PSP_GL_LoadLibrary;
+ device->GL_GetProcAddress = PSP_GL_GetProcAddress;
+ device->GL_UnloadLibrary = PSP_GL_UnloadLibrary;
+ device->GL_CreateContext = PSP_GL_CreateContext;
+ device->GL_MakeCurrent = PSP_GL_MakeCurrent;
+ device->GL_SetSwapInterval = PSP_GL_SetSwapInterval;
+ device->GL_GetSwapInterval = PSP_GL_GetSwapInterval;
+ device->GL_SwapWindow = PSP_GL_SwapWindow;
+ device->GL_DeleteContext = PSP_GL_DeleteContext;
+ device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
+ device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
+ device->HideScreenKeyboard = PSP_HideScreenKeyboard;
+ device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
+
+ device->PumpEvents = PSP_PumpEvents;
+
+ return device;
+}
+
+VideoBootStrap PSP_bootstrap = {
+ "PSP",
+ "PSP Video Driver",
+ PSP_Available,
+ PSP_Create
+};
+
+/*****************************************************************************/
+/* SDL Video and Display initialization/handling functions */
+/*****************************************************************************/
+int
+PSP_VideoInit(_THIS)
+{
+ SDL_VideoDisplay display;
+ SDL_DisplayMode current_mode;
+
+ SDL_zero(current_mode);
+
+ current_mode.w = 480;
+ current_mode.h = 272;
+
+ current_mode.refresh_rate = 60;
+ /* 32 bpp for default */
+ current_mode.format = SDL_PIXELFORMAT_ABGR8888;
+
+ current_mode.driverdata = NULL;
+
+ SDL_zero(display);
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+ display.driverdata = NULL;
+
+ SDL_AddVideoDisplay(&display);
+
+ return 1;
+}
+
+void
+PSP_VideoQuit(_THIS)
+{
+
+}
+
+void
+PSP_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
+{
+
+}
+
+int
+PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
+{
+ return 0;
+}
+#define EGLCHK(stmt) \
+ do { \
+ EGLint err; \
+ \
+ stmt; \
+ err = eglGetError(); \
+ if (err != EGL_SUCCESS) { \
+ SDL_SetError("EGL error %d", err); \
+ return 0; \
+ } \
+ } while (0)
+
+int
+PSP_CreateWindow(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wdata;
+
+ /* Allocate window internal data */
+ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (wdata == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ /* Setup driver data for this window */
+ window->driverdata = wdata;
+
+
+ /* Window has been successfully created */
+ return 0;
+}
+
+int
+PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
+{
+ return SDL_Unsupported();
+}
+
+void
+PSP_SetWindowTitle(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
+{
+}
+void
+PSP_SetWindowPosition(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_SetWindowSize(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_ShowWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_HideWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_RaiseWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_MaximizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_MinimizeWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_RestoreWindow(_THIS, SDL_Window * window)
+{
+}
+void
+PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
+{
+
+}
+void
+PSP_DestroyWindow(_THIS, SDL_Window * window)
+{
+}
+
+/*****************************************************************************/
+/* SDL Window Manager function */
+/*****************************************************************************/
+#if 0
+SDL_bool
+PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
+{
+ if (info->version.major <= SDL_MAJOR_VERSION) {
+ return SDL_TRUE;
+ } else {
+ SDL_SetError("Application not compiled with SDL %d.%d",
+ SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
+ return SDL_FALSE;
+ }
+
+ /* Failed to get window manager information */
+ return SDL_FALSE;
+}
+#endif
+
+
+/* TO Write Me */
+SDL_bool PSP_HasScreenKeyboardSupport(_THIS)
+{
+ return SDL_FALSE;
+}
+void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window)
+{
+}
+void PSP_HideScreenKeyboard(_THIS, SDL_Window *window)
+{
+}
+SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window)
+{
+ return SDL_FALSE;
+}
+
+
+#endif /* SDL_VIDEO_DRIVER_PSP */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.h b/source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.h
new file mode 100644
index 0000000..741bad1
--- /dev/null
+++ b/source/3rd-party/SDL2/src/video/psp/SDL_pspvideo.h
@@ -0,0 +1,102 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2018 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.
+*/
+
+#ifndef SDL_pspvideo_h_
+#define SDL_pspvideo_h_
+
+#include <GLES/egl.h>
+
+#include "../../SDL_internal.h"
+#include "../SDL_sysvideo.h"
+
+typedef struct SDL_VideoData
+{
+ SDL_bool egl_initialized; /* OpenGL ES device initialization status */
+ uint32_t egl_refcount; /* OpenGL ES reference count */
+
+
+
+} SDL_VideoData;
+
+
+typedef struct SDL_DisplayData
+{
+
+} SDL_DisplayData;
+
+
+typedef struct SDL_WindowData
+{
+ SDL_bool uses_gles; /* if true window must support OpenGL ES */
+
+} SDL_WindowData;
+
+
+
+
+/****************************************************************************/
+/* SDL_VideoDevice functions declaration */
+/****************************************************************************/
+
+/* Display and window functions */
+int PSP_VideoInit(_THIS);
+void PSP_VideoQuit(_THIS);
+void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
+int PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
+int PSP_CreateWindow(_THIS, SDL_Window * window);
+int PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
+void PSP_SetWindowTitle(_THIS, SDL_Window * window);
+void PSP_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
+void PSP_SetWindowPosition(_THIS, SDL_Window * window);
+void PSP_SetWindowSize(_THIS, SDL_Window * window);
+void PSP_ShowWindow(_THIS, SDL_Window * window);
+void PSP_HideWindow(_THIS, SDL_Window * window);
+void PSP_RaiseWindow(_THIS, SDL_Window * window);
+void PSP_MaximizeWindow(_THIS, SDL_Window * window);
+void PSP_MinimizeWindow(_THIS, SDL_Window * window);
+void PSP_RestoreWindow(_THIS, SDL_Window * window);
+void PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
+void PSP_DestroyWindow(_THIS, SDL_Window * window);
+
+/* Window manager function */
+SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo *info);
+
+/* OpenGL/OpenGL ES functions */
+int PSP_GL_LoadLibrary(_THIS, const char *path);
+void *PSP_GL_GetProcAddress(_THIS, const char *proc);
+void PSP_GL_UnloadLibrary(_THIS);
+SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window);
+int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
+int PSP_GL_SetSwapInterval(_THIS, int interval);
+int PSP_GL_GetSwapInterval(_THIS);
+int PSP_GL_SwapWindow(_THIS, SDL_Window * window);
+void PSP_GL_DeleteContext(_THIS, SDL_GLContext context);
+
+/* PSP on screen keyboard */
+SDL_bool PSP_HasScreenKeyboardSupport(_THIS);
+void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window);
+void PSP_HideScreenKeyboard(_THIS, SDL_Window *window);
+SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window);
+
+#endif /* SDL_pspvideo_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */