Contents of /trunk/libsdl/patches/libsdl-1.2.11-libcaca.patch
Parent Directory | Revision Log
Revision 144 -
(show annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 17026 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 17026 byte(s)
-import
1 | --- SDL-1.2.10/configure.in |
2 | +++ SDL-1.2.10/configure.in |
3 | @@ -1316,6 +1316,38 @@ AC_HELP_STRING([--enable-video-aalib], [ |
4 | fi |
5 | } |
6 | |
7 | +dnl Find the libcaca includes |
8 | +CheckCaca() |
9 | +{ |
10 | + AC_ARG_ENABLE(video-caca, |
11 | +AC_HELP_STRING([--enable-video-caca], [use libcaca video driver [[default=no]]]), |
12 | + , enable_video_caca=no) |
13 | + if test x$enable_video = xyes -a x$enable_video_caca = xyes; then |
14 | + video_caca=no |
15 | + AC_PATH_PROG(CACACONFIG, caca-config, no) |
16 | + if test x$CACACONFIG != xno; then |
17 | + AC_MSG_CHECKING(for libcaca support) |
18 | + CACA_CFLAGS=`$CACACONFIG --cflags` |
19 | + CACA_LDFLAGS=`$CACACONFIG --libs` |
20 | + save_CFLAGS="$CFLAGS" |
21 | + AC_TRY_COMPILE([ |
22 | + #include <caca.h> |
23 | + ],[ |
24 | + ],[ |
25 | + video_caca=yes |
26 | + ]) |
27 | + CFLAGS="$save_CFLAGS" |
28 | + AC_MSG_RESULT($video_caca) |
29 | + if test x$video_caca = xyes; then |
30 | + AC_DEFINE(SDL_VIDEO_DRIVER_CACA) |
31 | + EXTRA_CFLAGS="$EXTRA_CFLAGS $CACA_CFLAGS" |
32 | + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $CACA_LDFLAGS" |
33 | + SOURCES="$SOURCES $srcdir/src/video/caca/*.c" |
34 | + fi |
35 | + fi |
36 | + fi |
37 | +} |
38 | + |
39 | dnl Set up the QTopia video driver if enabled |
40 | CheckQtopia() |
41 | { |
42 | @@ -2130,6 +2162,7 @@ case "$host" in |
43 | CheckVGL |
44 | CheckWscons |
45 | CheckAAlib |
46 | + CheckCaca |
47 | CheckQtopia |
48 | CheckPicoGUI |
49 | CheckOpenGLX11 |
50 | --- SDL-1.2.10/src/video/caca/SDL_cacaevents.c |
51 | +++ SDL-1.2.10/src/video/caca/SDL_cacaevents.c |
52 | @@ -0,0 +1,98 @@ |
53 | +/* |
54 | + SDL - Simple DirectMedia Layer |
55 | + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
56 | + |
57 | + This library is free software; you can redistribute it and/or |
58 | + modify it under the terms of the GNU Library General Public |
59 | + License as published by the Free Software Foundation; either |
60 | + version 2 of the License, or (at your option) any later version. |
61 | + |
62 | + This library is distributed in the hope that it will be useful, |
63 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
64 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
65 | + Library General Public License for more details. |
66 | + |
67 | + You should have received a copy of the GNU Library General Public |
68 | + License along with this library; if not, write to the Free |
69 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
70 | + |
71 | + Sam Lantinga |
72 | + slouken@libsdl.org |
73 | +*/ |
74 | + |
75 | +#ifdef SAVE_RCSID |
76 | +static char rcsid = |
77 | + "@(#) $Id: libsdl-1.2.11-libcaca.patch,v 1.1 2007-05-08 19:57:41 niro Exp $"; |
78 | +#endif |
79 | + |
80 | +#include <stdio.h> |
81 | + |
82 | +#include <caca.h> |
83 | + |
84 | +#include "SDL.h" |
85 | +#include "../../events/SDL_sysevents.h" |
86 | +#include "../../events/SDL_events_c.h" |
87 | +#include "SDL_cacavideo.h" |
88 | +#include "SDL_cacaevents_c.h" |
89 | + |
90 | +void Caca_PumpEvents(_THIS) |
91 | +{ |
92 | + int posted = 0; |
93 | + int event; |
94 | + SDL_keysym keysym; |
95 | + |
96 | + if( ! this->screen ) /* Wait till we got the screen initialised */ |
97 | + return; |
98 | + |
99 | + do { |
100 | + posted = 0; |
101 | + |
102 | + /* Get libcaca event */ |
103 | + SDL_mutexP(Caca_mutex); |
104 | + event = caca_get_event(CACA_EVENT_ANY); |
105 | + SDL_mutexV(Caca_mutex); |
106 | + |
107 | + if ( event & (CACA_EVENT_KEY_PRESS | CACA_EVENT_KEY_RELEASE)) { |
108 | + int key; |
109 | + switch ( event & 0xffffff ) |
110 | + { |
111 | + case CACA_KEY_LEFT: key = SDLK_LEFT; break; |
112 | + case CACA_KEY_RIGHT: key = SDLK_RIGHT; break; |
113 | + case CACA_KEY_UP: key = SDLK_UP; break; |
114 | + case CACA_KEY_DOWN: key = SDLK_DOWN; break; |
115 | + default: key = event & 0xff; break; |
116 | + } |
117 | + /* Key pressed */ |
118 | +/* printf("Key pressed: %d (%c)\n", key, key); */ |
119 | + keysym.scancode = key; |
120 | + keysym.sym = key; |
121 | + keysym.mod = KMOD_NONE; |
122 | + keysym.unicode = 0; |
123 | + if ( SDL_TranslateUNICODE ) { |
124 | + keysym.unicode = key; |
125 | + } |
126 | + posted += SDL_PrivateKeyboard((event & CACA_EVENT_KEY_PRESS) ? SDL_PRESSED : SDL_RELEASED, &keysym); |
127 | + } |
128 | + else if ( event & (CACA_EVENT_MOUSE_PRESS | CACA_EVENT_MOUSE_RELEASE) ) { |
129 | + /* FIXME: we currently ignore the button type! */ |
130 | + int button = event & 0x00ffffff; |
131 | + if ( button > 3 ) { |
132 | + button = 1; |
133 | + } |
134 | + posted += SDL_PrivateMouseButton((event & CACA_EVENT_MOUSE_PRESS) ? SDL_PRESSED : SDL_RELEASED, button, 0, 0); |
135 | + } |
136 | + else if ( event & CACA_EVENT_MOUSE_MOTION ) { |
137 | + int new_x = 0, new_y = 0; |
138 | + new_x = ((event & 0x00fff000) >> 12) * Caca_w / caca_get_width(); |
139 | + new_y = ((event & 0x00000fff) >> 0) * Caca_h / caca_get_height(); |
140 | + posted += SDL_PrivateMouseMotion(0, 0, new_x, new_y); |
141 | + } |
142 | + } while ( posted ); |
143 | +} |
144 | + |
145 | +void Caca_InitOSKeymap(_THIS) |
146 | +{ |
147 | + return; |
148 | +} |
149 | + |
150 | + |
151 | --- SDL-1.2.10/src/video/caca/SDL_cacaevents_c.h |
152 | +++ SDL-1.2.10/src/video/caca/SDL_cacaevents_c.h |
153 | @@ -0,0 +1,35 @@ |
154 | +/* |
155 | + SDL - Simple DirectMedia Layer |
156 | + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
157 | + |
158 | + This library is free software; you can redistribute it and/or |
159 | + modify it under the terms of the GNU Library General Public |
160 | + License as published by the Free Software Foundation; either |
161 | + version 2 of the License, or (at your option) any later version. |
162 | + |
163 | + This library is distributed in the hope that it will be useful, |
164 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
165 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
166 | + Library General Public License for more details. |
167 | + |
168 | + You should have received a copy of the GNU Library General Public |
169 | + License along with this library; if not, write to the Free |
170 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
171 | + |
172 | + Sam Lantinga |
173 | + slouken@libsdl.org |
174 | +*/ |
175 | + |
176 | +#ifdef SAVE_RCSID |
177 | +static char rcsid = |
178 | + "@(#) $Id: libsdl-1.2.11-libcaca.patch,v 1.1 2007-05-08 19:57:41 niro Exp $"; |
179 | +#endif |
180 | + |
181 | +#include "SDL_cacavideo.h" |
182 | + |
183 | +/* Variables and functions exported by SDL_sysevents.c to other parts. |
184 | + of the native video subsystem (SDL_sysvideo.c) |
185 | +*/ |
186 | +extern void Caca_PumpEvents(_THIS); |
187 | +extern void Caca_InitOSKeymap(_THIS); |
188 | + |
189 | --- SDL-1.2.10/src/video/caca/SDL_cacavideo.c |
190 | +++ SDL-1.2.10/src/video/caca/SDL_cacavideo.c |
191 | @@ -0,0 +1,301 @@ |
192 | +/* |
193 | + SDL - Simple DirectMedia Layer |
194 | + Copyright (C) 2003 Sam Hocevar |
195 | + |
196 | + This library is free software; you can redistribute it and/or |
197 | + modify it under the terms of the GNU Library General Public |
198 | + License as published by the Free Software Foundation; either |
199 | + version 2 of the License, or (at your option) any later version. |
200 | + |
201 | + This library is distributed in the hope that it will be useful, |
202 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
203 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
204 | + Library General Public License for more details. |
205 | + |
206 | + You should have received a copy of the GNU Library General Public |
207 | + License along with this library; if not, write to the Free |
208 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
209 | + |
210 | + Sam Hocevar |
211 | + sam@zoy.org |
212 | +*/ |
213 | + |
214 | +#ifdef SAVE_RCSID |
215 | +static char rcsid = |
216 | + "@(#) $Id: libsdl-1.2.11-libcaca.patch,v 1.1 2007-05-08 19:57:41 niro Exp $"; |
217 | +#endif |
218 | + |
219 | +/* libcaca based SDL video driver implementation. |
220 | +*/ |
221 | + |
222 | +#include <stdlib.h> |
223 | +#include <stdio.h> |
224 | +#include <string.h> |
225 | +#include <unistd.h> |
226 | +#include <sys/stat.h> |
227 | + |
228 | + |
229 | +#include "SDL.h" |
230 | +#include "SDL_error.h" |
231 | +#include "SDL_video.h" |
232 | +#include "SDL_mouse.h" |
233 | +#include "../SDL_sysvideo.h" |
234 | +#include "../SDL_pixels_c.h" |
235 | +#include "../../events/SDL_events_c.h" |
236 | + |
237 | +#include "SDL_cacavideo.h" |
238 | +#include "SDL_cacaevents_c.h" |
239 | + |
240 | +#include <caca.h> |
241 | + |
242 | +/* Initialization/Query functions */ |
243 | +static int Caca_VideoInit(_THIS, SDL_PixelFormat *vformat); |
244 | +static SDL_Rect **Caca_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); |
245 | +static SDL_Surface *Caca_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); |
246 | +static void Caca_VideoQuit(_THIS); |
247 | + |
248 | +/* Hardware surface functions */ |
249 | +static int Caca_AllocHWSurface(_THIS, SDL_Surface *surface); |
250 | +static int Caca_LockHWSurface(_THIS, SDL_Surface *surface); |
251 | +static int Caca_FlipHWSurface(_THIS, SDL_Surface *surface); |
252 | +static void Caca_UnlockHWSurface(_THIS, SDL_Surface *surface); |
253 | +static void Caca_FreeHWSurface(_THIS, SDL_Surface *surface); |
254 | + |
255 | +/* Cache the VideoDevice struct */ |
256 | +static struct SDL_VideoDevice *local_this; |
257 | + |
258 | +/* libcaca driver bootstrap functions */ |
259 | + |
260 | +static int Caca_Available(void) |
261 | +{ |
262 | + return 1; /* Always available ! */ |
263 | +} |
264 | + |
265 | +static void Caca_DeleteDevice(SDL_VideoDevice *device) |
266 | +{ |
267 | + free(device->hidden); |
268 | + free(device); |
269 | +} |
270 | +static SDL_VideoDevice *Caca_CreateDevice(int devindex) |
271 | +{ |
272 | + SDL_VideoDevice *device; |
273 | + |
274 | + /* Initialize all variables that we clean on shutdown */ |
275 | + device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); |
276 | + if ( device ) { |
277 | + memset(device, 0, (sizeof *device)); |
278 | + device->hidden = (struct SDL_PrivateVideoData *) |
279 | + malloc((sizeof *device->hidden)); |
280 | + } |
281 | + if ( (device == NULL) || (device->hidden == NULL) ) { |
282 | + SDL_OutOfMemory(); |
283 | + if ( device ) { |
284 | + free(device); |
285 | + } |
286 | + return(0); |
287 | + } |
288 | + memset(device->hidden, 0, (sizeof *device->hidden)); |
289 | + |
290 | + /* Set the function pointers */ |
291 | + device->VideoInit = Caca_VideoInit; |
292 | + device->ListModes = Caca_ListModes; |
293 | + device->SetVideoMode = Caca_SetVideoMode; |
294 | + device->CreateYUVOverlay = NULL; |
295 | + device->SetColors = NULL; |
296 | + device->UpdateRects = NULL; |
297 | + device->VideoQuit = Caca_VideoQuit; |
298 | + device->AllocHWSurface = Caca_AllocHWSurface; |
299 | + device->CheckHWBlit = NULL; |
300 | + device->FillHWRect = NULL; |
301 | + device->SetHWColorKey = NULL; |
302 | + device->SetHWAlpha = NULL; |
303 | + device->LockHWSurface = Caca_LockHWSurface; |
304 | + device->UnlockHWSurface = Caca_UnlockHWSurface; |
305 | + device->FlipHWSurface = NULL; |
306 | + device->FreeHWSurface = Caca_FreeHWSurface; |
307 | + device->SetCaption = NULL; |
308 | + device->SetIcon = NULL; |
309 | + device->IconifyWindow = NULL; |
310 | + device->GrabInput = NULL; |
311 | + device->GetWMInfo = NULL; |
312 | + device->InitOSKeymap = Caca_InitOSKeymap; |
313 | + device->PumpEvents = Caca_PumpEvents; |
314 | + |
315 | + device->free = Caca_DeleteDevice; |
316 | + |
317 | + return device; |
318 | +} |
319 | + |
320 | +VideoBootStrap Caca_bootstrap = { |
321 | + "caca", "Color ASCII Art Library", |
322 | + Caca_Available, Caca_CreateDevice |
323 | +}; |
324 | + |
325 | +int Caca_VideoInit(_THIS, SDL_PixelFormat *vformat) |
326 | +{ |
327 | + int i; |
328 | + |
329 | + /* Initialize all variables that we clean on shutdown */ |
330 | + for ( i=0; i<SDL_NUMMODES; ++i ) { |
331 | + SDL_modelist[i] = malloc(sizeof(SDL_Rect)); |
332 | + SDL_modelist[i]->x = SDL_modelist[i]->y = 0; |
333 | + } |
334 | + /* Modes sorted largest to smallest */ |
335 | + SDL_modelist[0]->w = 1024; SDL_modelist[0]->h = 768; |
336 | + SDL_modelist[1]->w = 800; SDL_modelist[1]->h = 600; |
337 | + SDL_modelist[2]->w = 640; SDL_modelist[2]->h = 480; |
338 | + SDL_modelist[3]->w = 320; SDL_modelist[3]->h = 400; |
339 | + SDL_modelist[4]->w = 320; SDL_modelist[4]->h = 240; |
340 | + SDL_modelist[5]->w = 320; SDL_modelist[5]->h = 200; |
341 | + SDL_modelist[6] = NULL; |
342 | + |
343 | + Caca_mutex = SDL_CreateMutex(); |
344 | + |
345 | + /* Initialize the library */ |
346 | + if ( caca_init() != 0 ) { |
347 | + SDL_SetError("Unable to initialize libcaca"); |
348 | + return(-1); |
349 | + } |
350 | + |
351 | + /* Initialize private variables */ |
352 | + Caca_lastkey = 0; |
353 | + Caca_bitmap = NULL; |
354 | + Caca_buffer = NULL; |
355 | + |
356 | + local_this = this; |
357 | + |
358 | + /* Determine the screen depth (use default 8-bit depth) */ |
359 | + vformat->BitsPerPixel = 8; |
360 | + vformat->BytesPerPixel = 1; |
361 | + |
362 | + /* We're done! */ |
363 | + return(0); |
364 | +} |
365 | + |
366 | +SDL_Rect **Caca_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) |
367 | +{ |
368 | + if(format->BitsPerPixel != 8) |
369 | + return NULL; |
370 | + |
371 | + if ( flags & SDL_FULLSCREEN ) { |
372 | + return SDL_modelist; |
373 | + } else { |
374 | + return (SDL_Rect **) -1; |
375 | + } |
376 | +} |
377 | + |
378 | +/* Various screen update functions available */ |
379 | +static void Caca_DirectUpdate(_THIS, int numrects, SDL_Rect *rects); |
380 | + |
381 | +SDL_Surface *Caca_SetVideoMode(_THIS, SDL_Surface *current, |
382 | + int width, int height, int bpp, Uint32 flags) |
383 | +{ |
384 | + if ( Caca_buffer ) { |
385 | + free( Caca_buffer ); |
386 | + Caca_buffer = NULL; |
387 | + } |
388 | + |
389 | + if ( Caca_bitmap ) { |
390 | + caca_free_bitmap( Caca_bitmap ); |
391 | + Caca_bitmap = NULL; |
392 | + } |
393 | + |
394 | + Caca_buffer = malloc(2 * ((width + 15) & ~15) * height); |
395 | + if ( ! Caca_buffer ) { |
396 | + SDL_SetError("Couldn't allocate buffer for requested mode"); |
397 | + return(NULL); |
398 | + } |
399 | + |
400 | + memset(Caca_buffer, 0, 2 * ((width + 15) & ~15) * height); |
401 | + |
402 | + /* Allocate the new pixel format for the screen */ |
403 | + if ( ! SDL_ReallocFormat(current, 16, 0xf800, 0x07e0, 0x001f, 0) ) { |
404 | + return(NULL); |
405 | + } |
406 | + |
407 | + /* Set up the new mode framebuffer */ |
408 | + current->flags = SDL_FULLSCREEN; |
409 | + Caca_w = current->w = width; |
410 | + Caca_h = current->h = height; |
411 | + current->pitch = 2 * ((width + 15) & ~15); |
412 | + current->pixels = Caca_buffer; |
413 | + |
414 | + /* Create the libcaca bitmap */ |
415 | + Caca_bitmap = caca_create_bitmap( 16, width, height, current->pitch, 0xf800, 0x07e0, 0x001f, 0x0000 ); |
416 | + if ( ! Caca_bitmap ) { |
417 | + SDL_SetError("Couldn't allocate libcaca bitmap"); |
418 | + return(NULL); |
419 | + } |
420 | + |
421 | + /* Set the blit function */ |
422 | + this->UpdateRects = Caca_DirectUpdate; |
423 | + |
424 | + /* We're done */ |
425 | + return(current); |
426 | +} |
427 | + |
428 | +/* We don't actually allow hardware surfaces other than the main one */ |
429 | +static int Caca_AllocHWSurface(_THIS, SDL_Surface *surface) |
430 | +{ |
431 | + return(-1); |
432 | +} |
433 | +static void Caca_FreeHWSurface(_THIS, SDL_Surface *surface) |
434 | +{ |
435 | + return; |
436 | +} |
437 | + |
438 | +/* We need to wait for vertical retrace on page flipped displays */ |
439 | +static int Caca_LockHWSurface(_THIS, SDL_Surface *surface) |
440 | +{ |
441 | + /* TODO ? */ |
442 | + return(0); |
443 | +} |
444 | +static void Caca_UnlockHWSurface(_THIS, SDL_Surface *surface) |
445 | +{ |
446 | + return; |
447 | +} |
448 | + |
449 | +/* FIXME: How is this done with libcaca? */ |
450 | +static int Caca_FlipHWSurface(_THIS, SDL_Surface *surface) |
451 | +{ |
452 | + SDL_mutexP(Caca_mutex); |
453 | + caca_refresh(); |
454 | + SDL_mutexV(Caca_mutex); |
455 | + return(0); |
456 | +} |
457 | + |
458 | +static void Caca_DirectUpdate(_THIS, int numrects, SDL_Rect *rects) |
459 | +{ |
460 | + SDL_mutexP(Caca_mutex); |
461 | + caca_draw_bitmap( 0, 0, caca_get_width() - 1, caca_get_height() - 1, |
462 | + Caca_bitmap, Caca_buffer ); |
463 | + caca_refresh(); |
464 | + SDL_mutexV(Caca_mutex); |
465 | + return; |
466 | +} |
467 | + |
468 | +/* Note: If we are terminated, this could be called in the middle of |
469 | + another SDL video routine -- notably UpdateRects. |
470 | +*/ |
471 | +void Caca_VideoQuit(_THIS) |
472 | +{ |
473 | + int i; |
474 | + |
475 | + /* Free video mode lists */ |
476 | + for ( i=0; i<SDL_NUMMODES; ++i ) { |
477 | + if ( SDL_modelist[i] != NULL ) { |
478 | + free(SDL_modelist[i]); |
479 | + SDL_modelist[i] = NULL; |
480 | + } |
481 | + } |
482 | + |
483 | + if ( Caca_bitmap ) { |
484 | + caca_free_bitmap( Caca_bitmap ); |
485 | + Caca_bitmap = NULL; |
486 | + } |
487 | + |
488 | + caca_end(); |
489 | + |
490 | + SDL_DestroyMutex(Caca_mutex); |
491 | +} |
492 | + |
493 | --- SDL-1.2.10/src/video/caca/SDL_cacavideo.h |
494 | +++ SDL-1.2.10/src/video/caca/SDL_cacavideo.h |
495 | @@ -0,0 +1,73 @@ |
496 | +/* |
497 | + SDL - Simple DirectMedia Layer |
498 | + Copyright (C) 2003 Sam Hocevar |
499 | + |
500 | + This library is free software; you can redistribute it and/or |
501 | + modify it under the terms of the GNU Library General Public |
502 | + License as published by the Free Software Foundation; either |
503 | + version 2 of the License, or (at your option) any later version. |
504 | + |
505 | + This library is distributed in the hope that it will be useful, |
506 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
507 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
508 | + Library General Public License for more details. |
509 | + |
510 | + You should have received a copy of the GNU Library General Public |
511 | + License along with this library; if not, write to the Free |
512 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
513 | + |
514 | + Sam Hocevar |
515 | + sam@zoy.org |
516 | +*/ |
517 | + |
518 | +#ifdef SAVE_RCSID |
519 | +static char rcsid = |
520 | + "@(#) $Id: libsdl-1.2.11-libcaca.patch,v 1.1 2007-05-08 19:57:41 niro Exp $"; |
521 | +#endif |
522 | + |
523 | +#ifndef _SDL_cacavideo_h |
524 | +#define _SDL_cacavideo_h |
525 | + |
526 | +#include "SDL_mouse.h" |
527 | +#include "../SDL_sysvideo.h" |
528 | +#include "SDL_mutex.h" |
529 | + |
530 | +#include <sys/time.h> |
531 | +#include <time.h> |
532 | + |
533 | +#include <caca.h> |
534 | + |
535 | +/* Hidden "this" pointer for the video functions */ |
536 | +#define _THIS SDL_VideoDevice *this |
537 | + |
538 | +#define SDL_NUMMODES 6 |
539 | + |
540 | +/* Private display data */ |
541 | +struct SDL_PrivateVideoData { |
542 | + SDL_Rect *SDL_modelist[SDL_NUMMODES+1]; |
543 | + SDL_mutex *mutex; |
544 | + |
545 | + struct caca_bitmap *bitmap; |
546 | + void *buffer; |
547 | + int w, h; |
548 | + |
549 | + int lastkey; |
550 | + struct timeval lasttime; |
551 | +}; |
552 | + |
553 | +/* Old variable names */ |
554 | +#define SDL_modelist (this->hidden->SDL_modelist) |
555 | +#define Caca_palette (this->hidden->palette) |
556 | +#define Caca_bitmap (this->hidden->bitmap) |
557 | +#define Caca_buffer (this->hidden->buffer) |
558 | + |
559 | +#define Caca_w (this->hidden->w) |
560 | +#define Caca_h (this->hidden->h) |
561 | + |
562 | +#define Caca_lastkey (this->hidden->lastkey) |
563 | +#define Caca_lasttime (this->hidden->lasttime) |
564 | + |
565 | +#define Caca_mutex (this->hidden->mutex) |
566 | + |
567 | +#endif /* _SDL_cacavideo_h */ |
568 | + |
569 | --- SDL-1.2.10/src/video/SDL_sysvideo.h |
570 | +++ SDL-1.2.10/src/video/SDL_sysvideo.h |
571 | @@ -404,6 +404,9 @@ extern VideoBootStrap OS2FSLib_bootstrap |
572 | #if SDL_VIDEO_DRIVER_AALIB |
573 | extern VideoBootStrap AALIB_bootstrap; |
574 | #endif |
575 | +#if SDL_VIDEO_DRIVER_CACA |
576 | +extern VideoBootStrap CACA_bootstrap; |
577 | +#endif |
578 | #if SDL_VIDEO_DRIVER_DUMMY |
579 | extern VideoBootStrap DUMMY_bootstrap; |
580 | #endif |
581 | --- SDL-1.2.10/src/video/SDL_video.c |
582 | +++ SDL-1.2.10/src/video/SDL_video.c |
583 | @@ -120,6 +120,9 @@ static VideoBootStrap *bootstrap[] = { |
584 | #if SDL_VIDEO_DRIVER_AALIB |
585 | &AALIB_bootstrap, |
586 | #endif |
587 | +#if SDL_VIDEO_DRIVER_CACA |
588 | + &CACA_bootstrap, |
589 | +#endif |
590 | #if SDL_VIDEO_DRIVER_DUMMY |
591 | &DUMMY_bootstrap, |
592 | #endif |