zenilib: zenilib/jni/external/sdl/src/video/psp/SDL_pspvideo.c Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_pspvideo.c
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 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_config.h"
23
24 #if SDL_VIDEO_DRIVER_PSP
25
26 /* SDL internals */
27 #include "../SDL_sysvideo.h"
28 #include "SDL_version.h"
29 #include "SDL_syswm.h"
30 #include "SDL_loadso.h"
31 #include "SDL_events.h"
32 #include "../../events/SDL_mouse_c.h"
33 #include "../../events/SDL_keyboard_c.h"
34
35
36
37 /* PSP declarations */
38 #include "SDL_pspvideo.h"
39 #include "SDL_pspevents_c.h"
40 #include "SDL_pspgl_c.h"
41
42 /* unused
43 static SDL_bool PSP_initialized = SDL_FALSE;
44 */
45 static int
46 PSP_Available(void)
47 {
48 return 1;
49 }
50
51 static void
52 PSP_Destroy(SDL_VideoDevice * device)
53 {
54 /* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */
55
56 if (device->driverdata != NULL) {
57 device->driverdata = NULL;
58 }
59 }
60
61 static SDL_VideoDevice *
62 PSP_Create()
63 {
64 SDL_VideoDevice *device;
65 SDL_VideoData *phdata;
66 SDL_GLDriverData *gldata;
67 int status;
68
69 /* Check if pandora could be initialized */
70 status = PSP_Available();
71 if (status == 0) {
72 /* PSP could not be used */
73 return NULL;
74 }
75
76 /* Initialize SDL_VideoDevice structure */
77 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
78 if (device == NULL) {
79 SDL_OutOfMemory();
80 return NULL;
81 }
82
83 /* Initialize internal Pandora specific data */
84 phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
85 if (phdata == NULL) {
86 SDL_OutOfMemory();
87 SDL_free(device);
88 return NULL;
89 }
90
91 gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
92 if (gldata == NULL) {
93 SDL_OutOfMemory();
94 SDL_free(device);
95 return NULL;
96 }
97 device->gl_data = gldata;
98
99 device->driverdata = phdata;
100
101 phdata->egl_initialized = SDL_TRUE;
102
103
104 /* Setup amount of available displays and current display */
105 device->num_displays = 0;
106
107 /* Set device free function */
108 device->free = PSP_Destroy;
109
110 /* Setup all functions which we can handle */
111 device->VideoInit = PSP_VideoInit;
112 device->VideoQuit = PSP_VideoQuit;
113 device->GetDisplayModes = PSP_GetDisplayModes;
114 device->SetDisplayMode = PSP_SetDisplayMode;
115 device->CreateWindow = PSP_CreateWindow;
116 device->CreateWindowFrom = PSP_CreateWindowFrom;
117 device->SetWindowTitle = PSP_SetWindowTitle;
118 device->SetWindowIcon = PSP_SetWindowIcon;
119 device->SetWindowPosition = PSP_SetWindowPosition;
120 device->SetWindowSize = PSP_SetWindowSize;
121 device->ShowWindow = PSP_ShowWindow;
122 device->HideWindow = PSP_HideWindow;
123 device->RaiseWindow = PSP_RaiseWindow;
124 device->MaximizeWindow = PSP_MaximizeWindow;
125 device->MinimizeWindow = PSP_MinimizeWindow;
126 device->RestoreWindow = PSP_RestoreWindow;
127 device->SetWindowGrab = PSP_SetWindowGrab;
128 device->DestroyWindow = PSP_DestroyWindow;
129 device->GetWindowWMInfo = PSP_GetWindowWMInfo;
130 device->GL_LoadLibrary = PSP_GL_LoadLibrary;
131 device->GL_GetProcAddress = PSP_GL_GetProcAddress;
132 device->GL_UnloadLibrary = PSP_GL_UnloadLibrary;
133 device->GL_CreateContext = PSP_GL_CreateContext;
134 device->GL_MakeCurrent = PSP_GL_MakeCurrent;
135 device->GL_SetSwapInterval = PSP_GL_SetSwapInterval;
136 device->GL_GetSwapInterval = PSP_GL_GetSwapInterval;
137 device->GL_SwapWindow = PSP_GL_SwapWindow;
138 device->GL_DeleteContext = PSP_GL_DeleteContext;
139 device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
140 device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
141 device->HideScreenKeyboard = PSP_HideScreenKeyboard;
142 device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
143
144 device->PumpEvents = PSP_PumpEvents;
145
146 return device;
147 }
148
149 VideoBootStrap PSP_bootstrap = {
150 "PSP",
151 "PSP Video Driver",
152 PSP_Available,
153 PSP_Create
154 };
155
156 /*****************************************************************************/
157 /* SDL Video and Display initialization/handling functions */
158 /*****************************************************************************/
159 int
160 PSP_VideoInit(_THIS)
161 {
162 SDL_VideoDisplay display;
163 SDL_DisplayMode current_mode;
164
165 SDL_zero(current_mode);
166
167 current_mode.w = 480;
168 current_mode.h = 272;
169
170 current_mode.refresh_rate = 60;
171 /* 32 bpp for default */
172 current_mode.format = SDL_PIXELFORMAT_ABGR8888;
173
174 current_mode.driverdata = NULL;
175
176 SDL_zero(display);
177 display.desktop_mode = current_mode;
178 display.current_mode = current_mode;
179 display.driverdata = NULL;
180
181 SDL_AddVideoDisplay(&display);
182
183 return 1;
184 }
185
186 void
187 PSP_VideoQuit(_THIS)
188 {
189
190 }
191
192 void
193 PSP_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
194 {
195
196 }
197
198 int
199 PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
200 {
201 return 0;
202 }
203 #define EGLCHK(stmt) \
204 do { \
205 EGLint err; \
206 \
207 stmt; \
208 err = eglGetError(); \
209 if (err != EGL_SUCCESS) { \
210 SDL_SetError("EGL error %d", err); \
211 return 0; \
212 } \
213 } while (0)
214
215 int
216 PSP_CreateWindow(_THIS, SDL_Window * window)
217 {
218 SDL_WindowData *wdata;
219
220 /* Allocate window internal data */
221 wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
222 if (wdata == NULL) {
223 return SDL_OutOfMemory();
224 }
225
226 /* Setup driver data for this window */
227 window->driverdata = wdata;
228
229
230 /* Window has been successfully created */
231 return 0;
232 }
233
234 int
235 PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
236 {
237 return -1;
238 }
239
240 void
241 PSP_SetWindowTitle(_THIS, SDL_Window * window)
242 {
243 }
244 void
245 PSP_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
246 {
247 }
248 void
249 PSP_SetWindowPosition(_THIS, SDL_Window * window)
250 {
251 }
252 void
253 PSP_SetWindowSize(_THIS, SDL_Window * window)
254 {
255 }
256 void
257 PSP_ShowWindow(_THIS, SDL_Window * window)
258 {
259 }
260 void
261 PSP_HideWindow(_THIS, SDL_Window * window)
262 {
263 }
264 void
265 PSP_RaiseWindow(_THIS, SDL_Window * window)
266 {
267 }
268 void
269 PSP_MaximizeWindow(_THIS, SDL_Window * window)
270 {
271 }
272 void
273 PSP_MinimizeWindow(_THIS, SDL_Window * window)
274 {
275 }
276 void
277 PSP_RestoreWindow(_THIS, SDL_Window * window)
278 {
279 }
280 void
281 PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
282 {
283
284 }
285 void
286 PSP_DestroyWindow(_THIS, SDL_Window * window)
287 {
288 }
289
290 /*****************************************************************************/
291 /* SDL Window Manager function */
292 /*****************************************************************************/
293 SDL_bool
294 PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
295 {
296 if (info->version.major <= SDL_MAJOR_VERSION) {
297 return SDL_TRUE;
298 } else {
299 SDL_SetError("application not compiled with SDL %d.%d\n",
300 SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
301 return SDL_FALSE;
302 }
303
304 /* Failed to get window manager information */
305 return SDL_FALSE;
306 }
307
308
309 /* TO Write Me */
310 SDL_bool PSP_HasScreenKeyboardSupport(_THIS)
311 {
312 return SDL_FALSE;
313 }
314 void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window)
315 {
316 }
317 void PSP_HideScreenKeyboard(_THIS, SDL_Window *window)
318 {
319 }
320 SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window)
321 {
322 return SDL_FALSE;
323 }
324
325
326 #endif /* SDL_VIDEO_DRIVER_PSP */
327
328 /* vi: set ts=4 sw=4 expandtab: */
SDL_VideoDevice::GetDisplayModes
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:169
SDL_VideoDevice::MinimizeWindow
void(* MinimizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:195
SDL_MINOR_VERSION
#define SDL_MINOR_VERSION
Definition: SDL_version.h:61
SDL_VideoDevice::GetWindowWMInfo
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:215
SDL_pspevents_c.h
SDL_VideoDevice::IsScreenKeyboardShown
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:251
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:193
PSP_SetDisplayMode
int PSP_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
SDL_calloc
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
SDL_PIXELFORMAT_ABGR8888
Definition: SDL_pixels.h:230
NULL
#define NULL
Definition: ftobjs.h:61
SDL_DisplayMode::w
int w
Definition: SDL_video.h:56
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:192
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:226
SDL_MAJOR_VERSION
#define SDL_MAJOR_VERSION
Definition: SDL_version.h:60
PSP_GL_UnloadLibrary
void PSP_GL_UnloadLibrary(_THIS)
Definition: SDL_pspgl.c:67
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:116
SDL_TRUE
Definition: SDL_stdinc.h:119
PSP_GL_DeleteContext
void PSP_GL_DeleteContext(_THIS, SDL_GLContext context)
Definition: SDL_pspgl.c:181
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:314
SDL_events.h
SDL_free
DECLSPEC void SDLCALL SDL_free(void *mem)
SDL_VideoDevice::SetWindowGrab
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
Definition: SDL_sysvideo.h:201
PSP_GL_SwapWindow
void PSP_GL_SwapWindow(_THIS, SDL_Window *window)
Definition: SDL_pspgl.c:175
SDL_DisplayMode
The structure that defines a display mode.
Definition: SDL_video.h:53
SDL_SysWMinfo::version
SDL_version version
Definition: SDL_syswm.h:161
SDL_version::major
Uint8 major
Definition: SDL_version.h:53
SDL_VideoDevice::SetWindowIcon
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
Definition: SDL_sysvideo.h:186
SDL_DisplayMode::refresh_rate
int refresh_rate
Definition: SDL_video.h:58
SDL_VideoDevice::HasScreenKeyboardSupport
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
Definition: SDL_sysvideo.h:248
PSP_DestroyWindow
void PSP_DestroyWindow(_THIS, SDL_Window *window)
display
char * display
Definition: visualinfo.c:85
SDL_VideoDevice::CreateWindowFrom
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
Definition: SDL_sysvideo.h:184
PSP_RestoreWindow
void PSP_RestoreWindow(_THIS, SDL_Window *window)
SDL_FALSE
Definition: SDL_stdinc.h:118
PSP_SetWindowGrab
void PSP_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
PSP_MinimizeWindow
void PSP_MinimizeWindow(_THIS, SDL_Window *window)
PSP_GL_MakeCurrent
int PSP_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_pspgl.c:144
PSP_VideoQuit
void PSP_VideoQuit(_THIS)
SDL_VideoDevice::HideScreenKeyboard
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:250
SDL_config.h
SDL_AddVideoDisplay
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
Definition: SDL_video.c:568
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:327
SDL_VideoDevice::gl_data
struct SDL_GLDriverData * gl_data
Definition: SDL_sysvideo.h:315
SDL_WindowData
Definition: SDL_androidwindow.h:33
PSP_CreateWindow
int PSP_CreateWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::GL_SetSwapInterval
int(* GL_SetSwapInterval)(_THIS, int interval)
Definition: SDL_sysvideo.h:228
SDL_VideoDevice::CreateWindow
int(* CreateWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:183
SDL_VideoDevice::GL_UnloadLibrary
void(* GL_UnloadLibrary)(_THIS)
Definition: SDL_sysvideo.h:224
SDL_pspgl_c.h
SDL_SysWMinfo
Definition: SDL_syswm.h:159
PSP_HasScreenKeyboardSupport
SDL_bool PSP_HasScreenKeyboardSupport(_THIS)
PSP_SetWindowTitle
void PSP_SetWindowTitle(_THIS, SDL_Window *window)
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
PSP_SetWindowSize
void PSP_SetWindowSize(_THIS, SDL_Window *window)
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:148
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
SDL_pspvideo.h
SDL_DisplayMode::driverdata
void * driverdata
Definition: SDL_video.h:59
VideoBootStrap
Definition: SDL_sysvideo.h:330
PSP_ShowScreenKeyboard
void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window)
SDL_VideoDevice::num_displays
int num_displays
Definition: SDL_sysvideo.h:264
PSP_GetWindowWMInfo
SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
SDL_VideoDisplay::current_mode
SDL_DisplayMode current_mode
Definition: SDL_sysvideo.h:120
SDL_SetError
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
Definition: SDL_error.c:53
SDL_DisplayMode::h
int h
Definition: SDL_video.h:57
SDL_VideoDevice::SetWindowPosition
void(* SetWindowPosition)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:187
PSP_GL_LoadLibrary
int PSP_GL_LoadLibrary(_THIS, const char *path)
Definition: SDL_pspgl.c:45
SDL_VideoDevice::PumpEvents
void(* PumpEvents)(_THIS)
Definition: SDL_sysvideo.h:237
PSP_SetWindowPosition
void PSP_SetWindowPosition(_THIS, SDL_Window *window)
SDL_VideoDisplay
Definition: SDL_sysvideo.h:113
PSP_SetWindowIcon
void PSP_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
SDL_VideoDevice::GL_GetSwapInterval
int(* GL_GetSwapInterval)(_THIS)
Definition: SDL_sysvideo.h:229
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_VideoDisplay::desktop_mode
SDL_DisplayMode desktop_mode
Definition: SDL_sysvideo.h:119
PSP_GL_GetProcAddress
void * PSP_GL_GetProcAddress(_THIS, const char *proc)
Definition: SDL_pspgl.c:61
PSP_GL_CreateContext
SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window *window)
Definition: SDL_pspgl.c:76
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:231
SDL_VideoDevice::MaximizeWindow
void(* MaximizeWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:194
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:202
SDL_loadso.h
PSP_CreateWindowFrom
int PSP_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
SDL_GLDriverData
Definition: SDL_pspgl_c.h:32
SDL_VideoDevice::SetWindowSize
void(* SetWindowSize)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:188
SDL_VideoDevice::SetDisplayMode
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:177
PSP_GetDisplayModes
void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
PSP_RaiseWindow
void PSP_RaiseWindow(_THIS, SDL_Window *window)
SDL_Window
Definition: SDL_sysvideo.h:71
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:222
SDL_VideoData::egl_initialized
SDL_bool egl_initialized
Definition: SDL_pandora.h:32
SDL_VideoDevice::GL_SwapWindow
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:230
SDL_VideoDevice
Definition: SDL_sysvideo.h:135
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:154
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:191
PSP_IsScreenKeyboardShown
SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window)
SDL_VideoData
Definition: SDL_androidvideo.h:35
PSP_PumpEvents
void PSP_PumpEvents(_THIS)
Definition: SDL_pspevents.c:73
SDL_version.h
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:254
PSP_GL_SetSwapInterval
int PSP_GL_SetSwapInterval(_THIS, int interval)
Definition: SDL_pspgl.c:155
SDL_Window::driverdata
void * driverdata
Definition: SDL_sysvideo.h:99
SDL_VideoDevice::SetWindowTitle
void(* SetWindowTitle)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:185
PSP_ShowWindow
void PSP_ShowWindow(_THIS, SDL_Window *window)
PSP_HideWindow
void PSP_HideWindow(_THIS, SDL_Window *window)
SDL_DisplayMode::format
Uint32 format
Definition: SDL_video.h:55
PSP_VideoInit
int PSP_VideoInit(_THIS)
PSP_MaximizeWindow
void PSP_MaximizeWindow(_THIS, SDL_Window *window)
PSP_HideScreenKeyboard
void PSP_HideScreenKeyboard(_THIS, SDL_Window *window)
PSP_GL_GetSwapInterval
int PSP_GL_GetSwapInterval(_THIS)
Definition: SDL_pspgl.c:169
SDL_VideoDevice::GL_GetProcAddress
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:223
SDL_syswm.h
mode
GLenum mode
Definition: glew.h:2394
SDL_VideoDevice::ShowScreenKeyboard
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:249
SDL_VideoDevice::RestoreWindow
void(* RestoreWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:196
SDL_VideoDisplay::driverdata
void * driverdata
Definition: SDL_sysvideo.h:126