summaryrefslogtreecommitdiff
path: root/contrib/SDL-3.2.8/src/video/psp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/psp')
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspevents.c274
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspevents_c.h29
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspgl.c190
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspgl_c.h50
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse.c37
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse_c.h24
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c499
-rw-r--r--contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.h81
8 files changed, 1184 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspevents.c b/contrib/SDL-3.2.8/src/video/psp/SDL_pspevents.c
new file mode 100644
index 0000000..631f0aa
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspevents.c
@@ -0,0 +1,274 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21#include "SDL_internal.h"
22
23#ifdef SDL_VIDEO_DRIVER_PSP
24
25/* Being a null driver, there's no event stream. We just define stubs for
26 most of the API. */
27
28#include "../../events/SDL_events_c.h"
29#include "../../events/SDL_keyboard_c.h"
30#include "../SDL_sysvideo.h"
31#include "SDL_pspvideo.h"
32#include "SDL_pspevents_c.h"
33#include "../../thread/SDL_systhread.h"
34#include <psphprm.h>
35#include <pspthreadman.h>
36
37#ifdef PSPIRKEYB
38#include <pspirkeyb.h>
39#include <pspirkeyb_rawkeys.h>
40
41#define IRKBD_CONFIG_FILE NULL // this will take ms0:/seplugins/pspirkeyb.ini
42
43static int irkbd_ready = 0;
44static SDL_Scancode keymap[256];
45#endif
46
47static enum PspHprmKeys hprm = 0;
48static SDL_Semaphore *event_sem = NULL;
49static SDL_Thread *thread = NULL;
50static int running = 0;
51static struct
52{
53 enum PspHprmKeys id;
54 SDL_Scancode scancode;
55} keymap_psp[] = {
56 { PSP_HPRM_PLAYPAUSE, SDL_SCANCODE_F10 },
57 { PSP_HPRM_FORWARD, SDL_SCANCODE_F11 },
58 { PSP_HPRM_BACK, SDL_SCANCODE_F12 },
59 { PSP_HPRM_VOL_UP, SDL_SCANCODE_F13 },
60 { PSP_HPRM_VOL_DOWN, SDL_SCANCODE_F14 },
61 { PSP_HPRM_HOLD, SDL_SCANCODE_F15 }
62};
63
64int EventUpdate(void *data)
65{
66 while (running) {
67 SDL_WaitSemaphore(event_sem);
68 sceHprmPeekCurrentKey((u32 *)&hprm);
69 SDL_SignalSemaphore(event_sem);
70 // Delay 1/60th of a second
71 sceKernelDelayThread(1000000 / 60);
72 }
73 return 0;
74}
75
76void PSP_PumpEvents(SDL_VideoDevice *_this)
77{
78 int i;
79 enum PspHprmKeys keys;
80 enum PspHprmKeys changed;
81 static enum PspHprmKeys old_keys = 0;
82
83 SDL_WaitSemaphore(event_sem);
84 keys = hprm;
85 SDL_SignalSemaphore(event_sem);
86
87 // HPRM Keyboard
88 changed = old_keys ^ keys;
89 old_keys = keys;
90 if (changed) {
91 for (i = 0; i < sizeof(keymap_psp) / sizeof(keymap_psp[0]); i++) {
92 if (changed & keymap_psp[i].id) {
93 bool down = ((keys & keymap_psp[i].id) != 0);
94 SDL_SendKeyboardKey(0, SDL_GLOBAL_KEYBOARD_ID, keymap_psp[i].id, keymap_psp[i].scancode, down);
95 }
96 }
97 }
98
99#ifdef PSPIRKEYB
100 if (irkbd_ready) {
101 unsigned char buffer[255];
102 int i, length, count;
103 SIrKeybScanCodeData *scanData;
104
105 if (pspIrKeybReadinput(buffer, &length) >= 0) {
106 if ((length % sizeof(SIrKeybScanCodeData)) == 0) {
107 count = length / sizeof(SIrKeybScanCodeData);
108 for (i = 0; i < count; i++) {
109 unsigned char raw;
110 bool down;
111 scanData = (SIrKeybScanCodeData *)buffer + i;
112 raw = scanData->raw;
113 down = (scanData->pressed != 0);
114 SDL_SendKeyboardKey(0, SDL_GLOBAL_KEYBOARD_ID, raw, keymap[raw], down);
115 }
116 }
117 }
118 }
119#endif
120 sceKernelDelayThread(0);
121
122 return;
123}
124
125void PSP_InitOSKeymap(SDL_VideoDevice *_this)
126{
127#ifdef PSPIRKEYB
128 int i;
129 for (i = 0; i < SDL_arraysize(keymap); ++i) {
130 keymap[i] = SDL_SCANCODE_UNKNOWN;
131 }
132
133 keymap[KEY_ESC] = SDL_SCANCODE_ESCAPE;
134
135 keymap[KEY_F1] = SDL_SCANCODE_F1;
136 keymap[KEY_F2] = SDL_SCANCODE_F2;
137 keymap[KEY_F3] = SDL_SCANCODE_F3;
138 keymap[KEY_F4] = SDL_SCANCODE_F4;
139 keymap[KEY_F5] = SDL_SCANCODE_F5;
140 keymap[KEY_F6] = SDL_SCANCODE_F6;
141 keymap[KEY_F7] = SDL_SCANCODE_F7;
142 keymap[KEY_F8] = SDL_SCANCODE_F8;
143 keymap[KEY_F9] = SDL_SCANCODE_F9;
144 keymap[KEY_F10] = SDL_SCANCODE_F10;
145 keymap[KEY_F11] = SDL_SCANCODE_F11;
146 keymap[KEY_F12] = SDL_SCANCODE_F12;
147 keymap[KEY_F13] = SDL_SCANCODE_PRINT;
148 keymap[KEY_F14] = SDL_SCANCODE_PAUSE;
149
150 keymap[KEY_GRAVE] = SDL_SCANCODE_GRAVE;
151 keymap[KEY_1] = SDL_SCANCODE_1;
152 keymap[KEY_2] = SDL_SCANCODE_2;
153 keymap[KEY_3] = SDL_SCANCODE_3;
154 keymap[KEY_4] = SDL_SCANCODE_4;
155 keymap[KEY_5] = SDL_SCANCODE_5;
156 keymap[KEY_6] = SDL_SCANCODE_6;
157 keymap[KEY_7] = SDL_SCANCODE_7;
158 keymap[KEY_8] = SDL_SCANCODE_8;
159 keymap[KEY_9] = SDL_SCANCODE_9;
160 keymap[KEY_0] = SDL_SCANCODE_0;
161 keymap[KEY_MINUS] = SDL_SCANCODE_MINUS;
162 keymap[KEY_EQUAL] = SDL_SCANCODE_EQUALS;
163 keymap[KEY_BACKSPACE] = SDL_SCANCODE_BACKSPACE;
164
165 keymap[KEY_TAB] = SDL_SCANCODE_TAB;
166 keymap[KEY_Q] = SDL_SCANCODE_q;
167 keymap[KEY_W] = SDL_SCANCODE_w;
168 keymap[KEY_E] = SDL_SCANCODE_e;
169 keymap[KEY_R] = SDL_SCANCODE_r;
170 keymap[KEY_T] = SDL_SCANCODE_t;
171 keymap[KEY_Y] = SDL_SCANCODE_y;
172 keymap[KEY_U] = SDL_SCANCODE_u;
173 keymap[KEY_I] = SDL_SCANCODE_i;
174 keymap[KEY_O] = SDL_SCANCODE_o;
175 keymap[KEY_P] = SDL_SCANCODE_p;
176 keymap[KEY_LEFTBRACE] = SDL_SCANCODE_LEFTBRACKET;
177 keymap[KEY_RIGHTBRACE] = SDL_SCANCODE_RIGHTBRACKET;
178 keymap[KEY_ENTER] = SDL_SCANCODE_RETURN;
179
180 keymap[KEY_CAPSLOCK] = SDL_SCANCODE_CAPSLOCK;
181 keymap[KEY_A] = SDL_SCANCODE_a;
182 keymap[KEY_S] = SDL_SCANCODE_s;
183 keymap[KEY_D] = SDL_SCANCODE_d;
184 keymap[KEY_F] = SDL_SCANCODE_f;
185 keymap[KEY_G] = SDL_SCANCODE_g;
186 keymap[KEY_H] = SDL_SCANCODE_h;
187 keymap[KEY_J] = SDL_SCANCODE_j;
188 keymap[KEY_K] = SDL_SCANCODE_k;
189 keymap[KEY_L] = SDL_SCANCODE_l;
190 keymap[KEY_SEMICOLON] = SDL_SCANCODE_SEMICOLON;
191 keymap[KEY_APOSTROPHE] = SDL_SCANCODE_APOSTROPHE;
192 keymap[KEY_BACKSLASH] = SDL_SCANCODE_BACKSLASH;
193
194 keymap[KEY_Z] = SDL_SCANCODE_z;
195 keymap[KEY_X] = SDL_SCANCODE_x;
196 keymap[KEY_C] = SDL_SCANCODE_c;
197 keymap[KEY_V] = SDL_SCANCODE_v;
198 keymap[KEY_B] = SDL_SCANCODE_b;
199 keymap[KEY_N] = SDL_SCANCODE_n;
200 keymap[KEY_M] = SDL_SCANCODE_m;
201 keymap[KEY_COMMA] = SDL_SCANCODE_COMMA;
202 keymap[KEY_DOT] = SDL_SCANCODE_PERIOD;
203 keymap[KEY_SLASH] = SDL_SCANCODE_SLASH;
204
205 keymap[KEY_SPACE] = SDL_SCANCODE_SPACE;
206
207 keymap[KEY_UP] = SDL_SCANCODE_UP;
208 keymap[KEY_DOWN] = SDL_SCANCODE_DOWN;
209 keymap[KEY_LEFT] = SDL_SCANCODE_LEFT;
210 keymap[KEY_RIGHT] = SDL_SCANCODE_RIGHT;
211
212 keymap[KEY_HOME] = SDL_SCANCODE_HOME;
213 keymap[KEY_END] = SDL_SCANCODE_END;
214 keymap[KEY_INSERT] = SDL_SCANCODE_INSERT;
215 keymap[KEY_DELETE] = SDL_SCANCODE_DELETE;
216
217 keymap[KEY_NUMLOCK] = SDL_SCANCODE_NUMLOCK;
218 keymap[KEY_LEFTMETA] = SDL_SCANCODE_LSUPER;
219
220 keymap[KEY_KPSLASH] = SDL_SCANCODE_KP_DIVIDE;
221 keymap[KEY_KPASTERISK] = SDL_SCANCODE_KP_MULTIPLY;
222 keymap[KEY_KPMINUS] = SDL_SCANCODE_KP_MINUS;
223 keymap[KEY_KPPLUS] = SDL_SCANCODE_KP_PLUS;
224 keymap[KEY_KPDOT] = SDL_SCANCODE_KP_PERIOD;
225 keymap[KEY_KPEQUAL] = SDL_SCANCODE_KP_EQUALS;
226
227 keymap[KEY_LEFTCTRL] = SDL_SCANCODE_LCTRL;
228 keymap[KEY_RIGHTCTRL] = SDL_SCANCODE_RCTRL;
229 keymap[KEY_LEFTALT] = SDL_SCANCODE_LALT;
230 keymap[KEY_RIGHTALT] = SDL_SCANCODE_RALT;
231 keymap[KEY_LEFTSHIFT] = SDL_SCANCODE_LSHIFT;
232 keymap[KEY_RIGHTSHIFT] = SDL_SCANCODE_RSHIFT;
233#endif
234}
235
236bool PSP_EventInit(SDL_VideoDevice *_this)
237{
238#ifdef PSPIRKEYB
239 int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE;
240 int ret = pspIrKeybInit(IRKBD_CONFIG_FILE, 0);
241 if (ret == PSP_IRKBD_RESULT_OK) {
242 pspIrKeybOutputMode(outputmode);
243 irkbd_ready = 1;
244 } else {
245 irkbd_ready = 0;
246 }
247#endif
248 // Start thread to read data
249 if ((event_sem = SDL_CreateSemaphore(1)) == NULL) {
250 return SDL_SetError("Can't create input semaphore");
251 }
252 running = 1;
253 if ((thread = SDL_CreateThreadWithStackSize(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) {
254 return SDL_SetError("Can't create input thread");
255 }
256 return true;
257}
258
259void PSP_EventQuit(SDL_VideoDevice *_this)
260{
261 running = 0;
262 SDL_WaitThread(thread, NULL);
263 SDL_DestroySemaphore(event_sem);
264#ifdef PSPIRKEYB
265 if (irkbd_ready) {
266 pspIrKeybFinish();
267 irkbd_ready = 0;
268 }
269#endif
270}
271
272// end of SDL_pspevents.c ...
273
274#endif // SDL_VIDEO_DRIVER_PSP
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspevents_c.h b/contrib/SDL-3.2.8/src/video/psp/SDL_pspevents_c.h
new file mode 100644
index 0000000..295c21a
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspevents_c.h
@@ -0,0 +1,29 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22#include "SDL_pspvideo.h"
23
24extern void PSP_InitOSKeymap(SDL_VideoDevice *_this);
25extern void PSP_PumpEvents(SDL_VideoDevice *_this);
26extern bool PSP_EventInit(SDL_VideoDevice *_this);
27extern void PSP_EventQuit(SDL_VideoDevice *_this);
28
29// end of SDL_pspevents_c.h ...
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspgl.c b/contrib/SDL-3.2.8/src/video/psp/SDL_pspgl.c
new file mode 100644
index 0000000..0e58256
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspgl.c
@@ -0,0 +1,190 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21#include "SDL_internal.h"
22
23#ifdef SDL_VIDEO_DRIVER_PSP
24
25#include <stdlib.h>
26#include <string.h>
27
28#include "SDL_pspvideo.h"
29#include "SDL_pspgl_c.h"
30
31/*****************************************************************************/
32// SDL OpenGL/OpenGL ES functions
33/*****************************************************************************/
34#define EGLCHK(stmt) \
35 do { \
36 EGLint err; \
37 \
38 stmt; \
39 err = eglGetError(); \
40 if (err != EGL_SUCCESS) { \
41 SDL_SetError("EGL error %d", err); \
42 return NULL; \
43 } \
44 } while (0)
45
46bool PSP_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
47{
48 return true;
49}
50
51/* pspgl doesn't provide this call, so stub it out since SDL requires it.
52#define GLSTUB(func,params) void func params {}
53
54GLSTUB(glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
55 GLdouble zNear, GLdouble zFar))
56*/
57SDL_FunctionPointer PSP_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc)
58{
59 return eglGetProcAddress(proc);
60}
61
62void PSP_GL_UnloadLibrary(SDL_VideoDevice *_this)
63{
64 eglTerminate(_this->gl_data->display);
65}
66
67static EGLint width = 480;
68static EGLint height = 272;
69
70SDL_GLContext PSP_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
71{
72
73 SDL_WindowData *wdata = window->internal;
74
75 EGLint attribs[32];
76 EGLDisplay display;
77 EGLContext context;
78 EGLSurface surface;
79 EGLConfig config;
80 EGLint num_configs;
81 int i;
82
83 // EGL init taken from glutCreateWindow() in PSPGL's glut.c.
84 EGLCHK(display = eglGetDisplay(0));
85 EGLCHK(eglInitialize(display, NULL, NULL));
86 wdata->uses_gles = true;
87 window->flags |= SDL_WINDOW_FULLSCREEN;
88
89 // Setup the config based on SDL's current values.
90 i = 0;
91 attribs[i++] = EGL_RED_SIZE;
92 attribs[i++] = _this->gl_config.red_size;
93 attribs[i++] = EGL_GREEN_SIZE;
94 attribs[i++] = _this->gl_config.green_size;
95 attribs[i++] = EGL_BLUE_SIZE;
96 attribs[i++] = _this->gl_config.blue_size;
97 attribs[i++] = EGL_DEPTH_SIZE;
98 attribs[i++] = _this->gl_config.depth_size;
99
100 if (_this->gl_config.alpha_size) {
101 attribs[i++] = EGL_ALPHA_SIZE;
102 attribs[i++] = _this->gl_config.alpha_size;
103 }
104 if (_this->gl_config.stencil_size) {
105 attribs[i++] = EGL_STENCIL_SIZE;
106 attribs[i++] = _this->gl_config.stencil_size;
107 }
108
109 attribs[i++] = EGL_NONE;
110
111 EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
112
113 if (num_configs == 0) {
114 SDL_SetError("No valid EGL configs for requested mode");
115 return NULL;
116 }
117
118 EGLCHK(eglGetConfigAttrib(display, config, EGL_WIDTH, &width));
119 EGLCHK(eglGetConfigAttrib(display, config, EGL_HEIGHT, &height));
120
121 EGLCHK(context = eglCreateContext(display, config, NULL, NULL));
122 EGLCHK(surface = eglCreateWindowSurface(display, config, 0, NULL));
123 EGLCHK(eglMakeCurrent(display, surface, surface, context));
124
125 _this->gl_data->display = display;
126 _this->gl_data->context = context;
127 _this->gl_data->surface = surface;
128
129 return context;
130}
131
132bool PSP_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
133{
134 if (!eglMakeCurrent(_this->gl_data->display, _this->gl_data->surface,
135 _this->gl_data->surface, _this->gl_data->context)) {
136 return SDL_SetError("Unable to make EGL context current");
137 }
138 return true;
139}
140
141bool PSP_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval)
142{
143 EGLBoolean status;
144 status = eglSwapInterval(_this->gl_data->display, interval);
145 if (status == EGL_TRUE) {
146 // Return success to upper level
147 _this->gl_data->swapinterval = interval;
148 return true;
149 }
150 // Failed to set swap interval
151 return SDL_SetError("Unable to set the EGL swap interval");
152}
153
154bool PSP_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
155{
156 *interval = _this->gl_data->swapinterval;
157 return true;
158}
159
160bool PSP_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
161{
162 if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) {
163 return SDL_SetError("eglSwapBuffers() failed");
164 }
165 return true;
166}
167
168bool PSP_GL_DestroyContext(SDL_VideoDevice *_this, SDL_GLContext context)
169{
170 SDL_VideoData *phdata = _this->internal;
171 EGLBoolean status;
172
173 if (phdata->egl_initialized != true) {
174 return SDL_SetError("PSP: GLES initialization failed, no OpenGL ES support");
175 }
176
177 // Check if OpenGL ES connection has been initialized
178 if (_this->gl_data->display != EGL_NO_DISPLAY) {
179 if (context != EGL_NO_CONTEXT) {
180 status = eglDestroyContext(_this->gl_data->display, context);
181 if (status != EGL_TRUE) {
182 // Error during OpenGL ES context destroying
183 return SDL_SetError("PSP: OpenGL ES context destroy error");
184 }
185 }
186 }
187 return true;
188}
189
190#endif // SDL_VIDEO_DRIVER_PSP
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspgl_c.h b/contrib/SDL-3.2.8/src/video/psp/SDL_pspgl_c.h
new file mode 100644
index 0000000..028860d
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspgl_c.h
@@ -0,0 +1,50 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22#ifndef SDL_pspgl_c_h_
23#define SDL_pspgl_c_h_
24
25#include <GLES/egl.h>
26#include <GLES/gl.h>
27
28#include "SDL_pspvideo.h"
29
30typedef struct SDL_GLDriverData
31{
32 EGLDisplay display;
33 EGLContext context;
34 EGLSurface surface;
35 uint32_t swapinterval;
36} SDL_GLDriverData;
37
38extern SDL_FunctionPointer PSP_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc);
39extern bool PSP_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
40extern void PSP_GL_SwapBuffers(SDL_VideoDevice *_this);
41
42extern bool PSP_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
43extern SDL_GLContext PSP_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
44
45extern bool PSP_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path);
46extern void PSP_GL_UnloadLibrary(SDL_VideoDevice *_this);
47extern bool PSP_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval);
48extern bool PSP_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval);
49
50#endif // SDL_pspgl_c_h_
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse.c b/contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse.c
new file mode 100644
index 0000000..e63be96
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse.c
@@ -0,0 +1,37 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21#include "SDL_internal.h"
22
23#ifdef SDL_VIDEO_DRIVER_PSP
24
25#include <stdio.h>
26
27#include "../../events/SDL_events_c.h"
28
29#include "SDL_pspmouse_c.h"
30
31// The implementation dependent data for the window manager cursor
32struct WMcursor
33{
34 int unused;
35};
36
37#endif // SDL_VIDEO_DRIVER_PSP
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse_c.h b/contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse_c.h
new file mode 100644
index 0000000..95d1ff4
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspmouse_c.h
@@ -0,0 +1,24 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22#include "SDL_pspvideo.h"
23
24// Functions to be exported
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c b/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c
new file mode 100644
index 0000000..2458235
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c
@@ -0,0 +1,499 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22#include "SDL_internal.h"
23
24#ifdef SDL_VIDEO_DRIVER_PSP
25
26// SDL internals
27#include "../SDL_sysvideo.h"
28#include "../../events/SDL_mouse_c.h"
29#include "../../events/SDL_keyboard_c.h"
30
31// PSP declarations
32#include "SDL_pspvideo.h"
33#include "SDL_pspevents_c.h"
34#include "SDL_pspgl_c.h"
35#include "../../render/psp/SDL_render_psp_c.h"
36
37#include <psputility.h>
38#include <pspgu.h>
39#include <pspdisplay.h>
40#include <vram.h>
41
42/* unused
43static bool PSP_initialized = false;
44*/
45
46static void PSP_Destroy(SDL_VideoDevice *device)
47{
48 SDL_free(device->internal);
49 SDL_free(device);
50}
51
52static SDL_VideoDevice *PSP_Create(void)
53{
54 SDL_VideoDevice *device;
55 SDL_VideoData *phdata;
56 SDL_GLDriverData *gldata;
57
58 // Initialize SDL_VideoDevice structure
59 device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
60 if (!device) {
61 return NULL;
62 }
63
64 // Initialize internal PSP specific data
65 phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData));
66 if (!phdata) {
67 SDL_free(device);
68 return NULL;
69 }
70
71 gldata = (SDL_GLDriverData *)SDL_calloc(1, sizeof(SDL_GLDriverData));
72 if (!gldata) {
73 SDL_free(device);
74 SDL_free(phdata);
75 return NULL;
76 }
77 device->gl_data = gldata;
78
79 device->internal = phdata;
80
81 phdata->egl_initialized = true;
82
83 // Setup amount of available displays
84 device->num_displays = 0;
85
86 // Set device free function
87 device->free = PSP_Destroy;
88
89 // Setup all functions which we can handle
90 device->VideoInit = PSP_VideoInit;
91 device->VideoQuit = PSP_VideoQuit;
92 device->GetDisplayModes = PSP_GetDisplayModes;
93 device->SetDisplayMode = PSP_SetDisplayMode;
94 device->CreateSDLWindow = PSP_CreateWindow;
95 device->SetWindowTitle = PSP_SetWindowTitle;
96 device->SetWindowPosition = PSP_SetWindowPosition;
97 device->SetWindowSize = PSP_SetWindowSize;
98 device->ShowWindow = PSP_ShowWindow;
99 device->HideWindow = PSP_HideWindow;
100 device->RaiseWindow = PSP_RaiseWindow;
101 device->MaximizeWindow = PSP_MaximizeWindow;
102 device->MinimizeWindow = PSP_MinimizeWindow;
103 device->RestoreWindow = PSP_RestoreWindow;
104 device->DestroyWindow = PSP_DestroyWindow;
105 device->GL_LoadLibrary = PSP_GL_LoadLibrary;
106 device->GL_GetProcAddress = PSP_GL_GetProcAddress;
107 device->GL_UnloadLibrary = PSP_GL_UnloadLibrary;
108 device->GL_CreateContext = PSP_GL_CreateContext;
109 device->GL_MakeCurrent = PSP_GL_MakeCurrent;
110 device->GL_SetSwapInterval = PSP_GL_SetSwapInterval;
111 device->GL_GetSwapInterval = PSP_GL_GetSwapInterval;
112 device->GL_SwapWindow = PSP_GL_SwapWindow;
113 device->GL_DestroyContext = PSP_GL_DestroyContext;
114 device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
115 device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
116 device->HideScreenKeyboard = PSP_HideScreenKeyboard;
117 device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
118
119 device->PumpEvents = PSP_PumpEvents;
120
121 return device;
122}
123
124static void configure_dialog(pspUtilityMsgDialogParams *dialog, size_t dialog_size)
125{
126 // clear structure and setup size
127 SDL_memset(dialog, 0, dialog_size);
128 dialog->base.size = dialog_size;
129
130 // set language
131 sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &dialog->base.language);
132
133 // set X/O swap
134 sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &dialog->base.buttonSwap);
135
136 // set thread priorities
137 // TODO: understand how these work
138 dialog->base.soundThread = 0x10;
139 dialog->base.graphicsThread = 0x11;
140 dialog->base.fontThread = 0x12;
141 dialog->base.accessThread = 0x13;
142}
143
144static void *setup_temporal_gu(void *list)
145{
146 // Using GU_PSM_8888 for the framebuffer
147 int bpp = 4;
148
149 void *doublebuffer = vramalloc(PSP_FRAME_BUFFER_SIZE * bpp * 2);
150 void *backbuffer = doublebuffer;
151 void *frontbuffer = ((uint8_t *)doublebuffer) + PSP_FRAME_BUFFER_SIZE * bpp;
152
153 sceGuInit();
154
155 sceGuStart(GU_DIRECT,list);
156 sceGuDrawBuffer(GU_PSM_8888, vrelptr(frontbuffer), PSP_FRAME_BUFFER_WIDTH);
157 sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, vrelptr(backbuffer), PSP_FRAME_BUFFER_WIDTH);
158
159 sceGuOffset(2048 - (PSP_SCREEN_WIDTH >> 1), 2048 - (PSP_SCREEN_HEIGHT >> 1));
160 sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
161
162 sceGuDisable(GU_DEPTH_TEST);
163
164 // Scissoring
165 sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
166 sceGuEnable(GU_SCISSOR_TEST);
167
168 sceGuFinish();
169 sceGuSync(0,0);
170
171 sceDisplayWaitVblankStart();
172 sceGuDisplay(GU_TRUE);
173
174 return doublebuffer;
175}
176
177static void term_temporal_gu(void *guBuffer)
178{
179 sceGuTerm();
180 vfree(guBuffer);
181 sceDisplayWaitVblankStart();
182}
183
184bool PSP_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
185{
186 unsigned char list[64] __attribute__((aligned(64)));
187 pspUtilityMsgDialogParams dialog;
188 int status;
189 void *guBuffer = NULL;
190
191 // check if it's possible to use existing video context
192 if (SDL_GetKeyboardFocus() == NULL) {
193 guBuffer = setup_temporal_gu(list);
194 }
195
196 // configure dialog
197 configure_dialog(&dialog, sizeof(dialog));
198
199 // setup dialog options for text
200 dialog.mode = PSP_UTILITY_MSGDIALOG_MODE_TEXT;
201 dialog.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT;
202
203 // copy the message in, 512 bytes max
204 SDL_snprintf(dialog.message, sizeof(dialog.message), "%s\r\n\r\n%s", messageboxdata->title, messageboxdata->message);
205
206 // too many buttons
207 if (messageboxdata->numbuttons > 2)
208 return SDL_SetError("messageboxdata->numbuttons valid values are 0, 1, 2");
209
210 // we only have two options, "yes/no" or "ok"
211 if (messageboxdata->numbuttons == 2)
212 dialog.options |= PSP_UTILITY_MSGDIALOG_OPTION_YESNO_BUTTONS | PSP_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO;
213
214 // start dialog
215 if (sceUtilityMsgDialogInitStart(&dialog) != 0)
216 return SDL_SetError("sceUtilityMsgDialogInitStart() failed for some reason");
217
218 // loop while the dialog is active
219 status = PSP_UTILITY_DIALOG_NONE;
220 do
221 {
222 sceGuStart(GU_DIRECT, list);
223 sceGuClearColor(0);
224 sceGuClearDepth(0);
225 sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
226 sceGuFinish();
227 sceGuSync(0,0);
228
229 status = sceUtilityMsgDialogGetStatus();
230
231 switch (status)
232 {
233 case PSP_UTILITY_DIALOG_VISIBLE:
234 sceUtilityMsgDialogUpdate(1);
235 break;
236
237 case PSP_UTILITY_DIALOG_QUIT:
238 sceUtilityMsgDialogShutdownStart();
239 break;
240 }
241
242 sceDisplayWaitVblankStart();
243 sceGuSwapBuffers();
244
245 } while (status != PSP_UTILITY_DIALOG_NONE);
246
247 // cleanup
248 if (guBuffer)
249 {
250 term_temporal_gu(guBuffer);
251 }
252
253 // success
254 if (dialog.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_YES)
255 *buttonID = messageboxdata->buttons[0].buttonID;
256 else if (dialog.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_NO)
257 *buttonID = messageboxdata->buttons[1].buttonID;
258 else
259 *buttonID = messageboxdata->buttons[0].buttonID;
260
261 return true;
262}
263
264VideoBootStrap PSP_bootstrap = {
265 "psp",
266 "PSP Video Driver",
267 PSP_Create,
268 PSP_ShowMessageBox,
269 false
270};
271
272/*****************************************************************************/
273// SDL Video and Display initialization/handling functions
274/*****************************************************************************/
275bool PSP_VideoInit(SDL_VideoDevice *_this)
276{
277 SDL_DisplayMode mode;
278
279 if (!PSP_EventInit(_this)) {
280 return false; // error string would already be set
281 }
282
283 SDL_zero(mode);
284 mode.w = PSP_SCREEN_WIDTH;
285 mode.h = PSP_SCREEN_HEIGHT;
286 mode.refresh_rate = 60.0f;
287
288 // 32 bpp for default
289 mode.format = SDL_PIXELFORMAT_ABGR8888;
290
291 if (SDL_AddBasicVideoDisplay(&mode) == 0) {
292 return false;
293 }
294 return true;
295}
296
297void PSP_VideoQuit(SDL_VideoDevice *_this)
298{
299 PSP_EventQuit(_this);
300}
301
302bool PSP_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
303{
304 SDL_DisplayMode mode;
305
306 SDL_zero(mode);
307 mode.w = PSP_SCREEN_WIDTH;
308 mode.h = PSP_SCREEN_HEIGHT;
309 mode.refresh_rate = 60.0f;
310
311 // 32 bpp for default
312 mode.format = SDL_PIXELFORMAT_ABGR8888;
313 SDL_AddFullscreenDisplayMode(display, &mode);
314
315 // 16 bpp secondary mode
316 mode.format = SDL_PIXELFORMAT_BGR565;
317 SDL_AddFullscreenDisplayMode(display, &mode);
318 return true;
319}
320
321bool PSP_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
322{
323 return true;
324}
325
326#define EGLCHK(stmt) \
327 do { \
328 EGLint err; \
329 \
330 stmt; \
331 err = eglGetError(); \
332 if (err != EGL_SUCCESS) { \
333 SDL_SetError("EGL error %d", err); \
334 return true; \
335 } \
336 } while (0)
337
338bool PSP_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
339{
340 SDL_WindowData *wdata;
341
342 // Allocate window internal data
343 wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
344 if (!wdata) {
345 return false;
346 }
347
348 // Setup driver data for this window
349 window->internal = wdata;
350
351 SDL_SetKeyboardFocus(window);
352
353 // Window has been successfully created
354 return true;
355}
356
357void PSP_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
358{
359}
360bool PSP_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
361{
362 return SDL_Unsupported();
363}
364void PSP_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
365{
366}
367void PSP_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
368{
369}
370void PSP_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
371{
372}
373void PSP_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
374{
375}
376void PSP_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
377{
378}
379void PSP_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
380{
381}
382void PSP_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
383{
384}
385void PSP_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
386{
387}
388
389bool PSP_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
390{
391 return true;
392}
393
394void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props)
395{
396 char list[0x20000] __attribute__((aligned(64))); // Needed for sceGuStart to work
397 int i;
398 int done = 0;
399 int input_text_length = 32; // SDL_SendKeyboardText supports up to 32 characters per event
400 unsigned short outtext[input_text_length];
401 char text_string[input_text_length];
402
403 SceUtilityOskData data;
404 SceUtilityOskParams params;
405
406 SDL_memset(outtext, 0, input_text_length * sizeof(unsigned short));
407
408 data.language = PSP_UTILITY_OSK_LANGUAGE_DEFAULT;
409 data.lines = 1;
410 data.unk_24 = 1;
411 switch (SDL_GetTextInputType(props)) {
412 default:
413 case SDL_TEXTINPUT_TYPE_TEXT:
414 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL;
415 break;
416 case SDL_TEXTINPUT_TYPE_TEXT_NAME:
417 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL;
418 break;
419 case SDL_TEXTINPUT_TYPE_TEXT_EMAIL:
420 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL;
421 break;
422 case SDL_TEXTINPUT_TYPE_TEXT_USERNAME:
423 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL;
424 break;
425 case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN:
426 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL;
427 break;
428 case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE:
429 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL;
430 break;
431 case SDL_TEXTINPUT_TYPE_NUMBER:
432 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT;
433 break;
434 case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN:
435 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT;
436 break;
437 case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE:
438 data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT;
439 break;
440 }
441 data.desc = NULL;
442 data.intext = NULL;
443 data.outtextlength = input_text_length;
444 data.outtextlimit = input_text_length;
445 data.outtext = outtext;
446
447 params.base.size = sizeof(params);
448 sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &params.base.language);
449 sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &params.base.buttonSwap);
450 params.base.graphicsThread = 17;
451 params.base.accessThread = 19;
452 params.base.fontThread = 18;
453 params.base.soundThread = 16;
454 params.datacount = 1;
455 params.data = &data;
456
457 sceUtilityOskInitStart(&params);
458
459 while(!done) {
460 sceGuStart(GU_DIRECT, list);
461 sceGuClearColor(0);
462 sceGuClearDepth(0);
463 sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
464 sceGuFinish();
465 sceGuSync(0,0);
466
467 switch(sceUtilityOskGetStatus())
468 {
469 case PSP_UTILITY_DIALOG_VISIBLE:
470 sceUtilityOskUpdate(1);
471 break;
472 case PSP_UTILITY_DIALOG_QUIT:
473 sceUtilityOskShutdownStart();
474 break;
475 case PSP_UTILITY_DIALOG_NONE:
476 done = 1;
477 break;
478 default :
479 break;
480 }
481 sceDisplayWaitVblankStart();
482 sceGuSwapBuffers();
483 }
484
485 // Convert input list to string
486 for (i = 0; i < input_text_length; i++) {
487 text_string[i] = outtext[i];
488 }
489 SDL_SendKeyboardText((const char *) text_string);
490}
491void PSP_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
492{
493}
494bool PSP_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
495{
496 return false;
497}
498
499#endif // SDL_VIDEO_DRIVER_PSP
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.h b/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.h
new file mode 100644
index 0000000..971f442
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.h
@@ -0,0 +1,81 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22#ifndef SDL_pspvideo_h_
23#define SDL_pspvideo_h_
24
25#include <GLES/egl.h>
26
27#include "SDL_internal.h"
28#include "../SDL_sysvideo.h"
29
30struct SDL_VideoData
31{
32 bool egl_initialized; // OpenGL ES device initialization status
33 uint32_t egl_refcount; // OpenGL ES reference count
34
35};
36
37struct SDL_WindowData
38{
39 bool uses_gles; // if true window must support OpenGL ES
40
41};
42
43/****************************************************************************/
44// SDL_VideoDevice functions declaration
45/****************************************************************************/
46
47// Display and window functions
48extern bool PSP_VideoInit(SDL_VideoDevice *_this);
49extern void PSP_VideoQuit(SDL_VideoDevice *_this);
50extern bool PSP_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
51extern bool PSP_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
52extern bool PSP_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props);
53extern void PSP_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
54extern bool PSP_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window);
55extern void PSP_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
56extern void PSP_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
57extern void PSP_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
58extern void PSP_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window);
59extern void PSP_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
60extern void PSP_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
61extern void PSP_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window);
62extern void PSP_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
63
64// OpenGL/OpenGL ES functions
65extern bool PSP_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path);
66extern SDL_FunctionPointer PSP_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc);
67extern void PSP_GL_UnloadLibrary(SDL_VideoDevice *_this);
68extern SDL_GLContext PSP_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
69extern bool PSP_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
70extern bool PSP_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval);
71extern bool PSP_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval);
72extern bool PSP_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
73extern bool PSP_GL_DestroyContext(SDL_VideoDevice *_this, SDL_GLContext context);
74
75// PSP on screen keyboard
76extern bool PSP_HasScreenKeyboardSupport(SDL_VideoDevice *_this);
77extern void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props);
78extern void PSP_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window);
79extern bool PSP_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window);
80
81#endif // SDL_pspvideo_h_