aboutsummaryrefslogtreecommitdiffstats
path: root/distrib/sdl-1.2.12/src/video/dc
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-06-04 16:07:01 +0200
committerDavid 'Digit' Turner <digit@google.com>2009-06-08 17:43:17 +0200
commit46be48730333120a7b939116cef075e61c12c703 (patch)
tree92bde033dd93fc14e0e2565a52293b59787b8859 /distrib/sdl-1.2.12/src/video/dc
parentb72269abe4a75736c09b0ee8797b736f49c058c8 (diff)
downloadexternal_qemu-46be48730333120a7b939116cef075e61c12c703.zip
external_qemu-46be48730333120a7b939116cef075e61c12c703.tar.gz
external_qemu-46be48730333120a7b939116cef075e61c12c703.tar.bz2
Add our modified SDL sources under distrib/sdl-1.2.12
Fix distrib/make-distrib.sh script to work with git Fix distrib/build-emulator.sh to accomodate for new SDL configure script Handle Tiger SDK usage in SDL configure script
Diffstat (limited to 'distrib/sdl-1.2.12/src/video/dc')
-rw-r--r--distrib/sdl-1.2.12/src/video/dc/SDL_dcevents.c152
-rw-r--r--distrib/sdl-1.2.12/src/video/dc/SDL_dcevents_c.h33
-rw-r--r--distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse.c35
-rw-r--r--distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse_c.h26
-rw-r--r--distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.c445
-rw-r--r--distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.h42
6 files changed, 733 insertions, 0 deletions
diff --git a/distrib/sdl-1.2.12/src/video/dc/SDL_dcevents.c b/distrib/sdl-1.2.12/src/video/dc/SDL_dcevents.c
new file mode 100644
index 0000000..1e8e2b5
--- /dev/null
+++ b/distrib/sdl-1.2.12/src/video/dc/SDL_dcevents.c
@@ -0,0 +1,152 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2006 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL.h"
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "SDL_dcvideo.h"
+#include "SDL_dcevents_c.h"
+
+#include <dc/maple.h>
+#include <dc/maple/mouse.h>
+#include <dc/maple/keyboard.h>
+
+const static unsigned short sdl_key[]= {
+ /*0*/ 0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
+ 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+ 'u', 'v', 'w', 'x', 'y', 'z',
+ /*1e*/ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
+ /*28*/ SDLK_RETURN, SDLK_ESCAPE, SDLK_BACKSPACE, SDLK_TAB, SDLK_SPACE, SDLK_MINUS, SDLK_PLUS, SDLK_LEFTBRACKET,
+ SDLK_RIGHTBRACKET, SDLK_BACKSLASH , 0, SDLK_SEMICOLON, SDLK_QUOTE,
+ /*35*/ '~', SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH, SDLK_CAPSLOCK,
+ SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12,
+ /*46*/ SDLK_PRINT, SDLK_SCROLLOCK, SDLK_PAUSE, SDLK_INSERT, SDLK_HOME, SDLK_PAGEUP, SDLK_DELETE, SDLK_END, SDLK_PAGEDOWN, SDLK_RIGHT, SDLK_LEFT, SDLK_DOWN, SDLK_UP,
+ /*53*/ SDLK_NUMLOCK, SDLK_KP_DIVIDE, SDLK_KP_MULTIPLY, SDLK_KP_MINUS, SDLK_KP_PLUS, SDLK_KP_ENTER,
+ SDLK_KP1, SDLK_KP2, SDLK_KP3, SDLK_KP4, SDLK_KP5, SDLK_KP6,
+ /*5f*/ SDLK_KP7, SDLK_KP8, SDLK_KP9, SDLK_KP0, SDLK_KP_PERIOD, 0 /* S3 */
+};
+
+const static unsigned short sdl_shift[] = {
+ SDLK_LCTRL,SDLK_LSHIFT,SDLK_LALT,0 /* S1 */,
+ SDLK_RCTRL,SDLK_RSHIFT,SDLK_RALT,0 /* S2 */,
+};
+
+#define MOUSE_WHEELUP (1<<4)
+#define MOUSE_WHEELDOWN (1<<5)
+
+static void mouse_update(void)
+{
+const static char sdl_mousebtn[] = {
+ MOUSE_LEFTBUTTON,
+ MOUSE_RIGHTBUTTON,
+ MOUSE_SIDEBUTTON,
+ MOUSE_WHEELUP,
+ MOUSE_WHEELDOWN
+};
+
+ uint8 addr;
+ mouse_cond_t cond;
+
+ static int prev_buttons;
+ int buttons,changed;
+ int i;
+
+ if ((addr = maple_first_mouse())==0 || mouse_get_cond(addr, &cond)<0) return;
+
+ buttons = cond.buttons^0xff;
+ if (cond.dz<0) buttons|=MOUSE_WHEELUP;
+ if (cond.dz>0) buttons|=MOUSE_WHEELDOWN;
+
+ if (cond.dx||cond.dy) SDL_PrivateMouseMotion(0,1,cond.dx,cond.dy);
+
+ changed = buttons^prev_buttons;
+ for(i=0;i<sizeof(sdl_mousebtn);i++) {
+ if (changed & sdl_mousebtn[i]) {
+ SDL_PrivateMouseButton((buttons & sdl_mousebtn[i])?SDL_PRESSED:SDL_RELEASED,i,0,0);
+ }
+ }
+ prev_buttons = buttons;
+}
+
+static void keyboard_update(void)
+{
+ static kbd_state_t old_state;
+ static uint8 old_addr;
+
+ kbd_state_t *state;
+ uint8 addr;
+ int port,unit;
+
+ int shiftkeys;
+ SDL_keysym keysym;
+
+ int i;
+
+ addr = maple_first_kb();
+
+ if (addr==0) return;
+
+ if (addr!=old_addr) {
+ old_addr = addr;
+ SDL_memset(&old_state,0,sizeof(old_state));
+ }
+
+ maple_raddr(addr,&port,&unit);
+
+ state = maple_dev_state(port,unit);
+ if (!state) return;
+
+ shiftkeys = state->shift_keys ^ old_state.shift_keys;
+ for(i=0;i<sizeof(sdl_shift);i++) {
+ if ((shiftkeys>>i)&1) {
+ keysym.sym = sdl_shift[i];
+ SDL_PrivateKeyboard(((state->shift_keys>>i)&1)?SDL_PRESSED:SDL_RELEASED,&keysym);
+ }
+ }
+
+ for(i=0;i<sizeof(sdl_key);i++) {
+ if (state->matrix[i]!=old_state.matrix[i]) {
+ int key = sdl_key[i];
+ if (key) {
+ keysym.sym = key;
+ SDL_PrivateKeyboard(state->matrix[i]?SDL_PRESSED:SDL_RELEASED,&keysym);
+ }
+ }
+ }
+
+ old_state = *state;
+}
+
+void DC_PumpEvents(_THIS)
+{
+ keyboard_update();
+ mouse_update();
+}
+
+void DC_InitOSKeymap(_THIS)
+{
+ /* do nothing. */
+}
+
+/* end of SDL_dcevents.c ... */
+
diff --git a/distrib/sdl-1.2.12/src/video/dc/SDL_dcevents_c.h b/distrib/sdl-1.2.12/src/video/dc/SDL_dcevents_c.h
new file mode 100644
index 0000000..57dc6d6
--- /dev/null
+++ b/distrib/sdl-1.2.12/src/video/dc/SDL_dcevents_c.h
@@ -0,0 +1,33 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2006 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_dcvideo.h"
+
+/* Variables and functions exported by SDL_sysevents.c to other parts
+ of the native video subsystem (SDL_sysvideo.c)
+*/
+extern void DC_InitOSKeymap(_THIS);
+extern void DC_PumpEvents(_THIS);
+
+/* end of SDL_dcevents_c.h ... */
+
diff --git a/distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse.c b/distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse.c
new file mode 100644
index 0000000..ccb969d
--- /dev/null
+++ b/distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse.c
@@ -0,0 +1,35 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2006 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include <stdio.h>
+
+#include "SDL_mouse.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_dcmouse_c.h"
+
+
+/* The implementation dependent data for the window manager cursor */
+struct WMcursor {
+ int unused;
+};
diff --git a/distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse_c.h b/distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse_c.h
new file mode 100644
index 0000000..e985c75
--- /dev/null
+++ b/distrib/sdl-1.2.12/src/video/dc/SDL_dcmouse_c.h
@@ -0,0 +1,26 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2006 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_dcvideo.h"
+
+/* Functions to be exported */
diff --git a/distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.c b/distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.c
new file mode 100644
index 0000000..3d884c3
--- /dev/null
+++ b/distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.c
@@ -0,0 +1,445 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2006 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+#include "../../events/SDL_events_c.h"
+
+#include "SDL_dcvideo.h"
+#include "SDL_dcevents_c.h"
+#include "SDL_dcmouse_c.h"
+
+#include <dc/video.h>
+#include <dc/pvr.h>
+
+
+/* Initialization/Query functions */
+static int DC_VideoInit(_THIS, SDL_PixelFormat *vformat);
+static SDL_Rect **DC_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
+static SDL_Surface *DC_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
+static int DC_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
+static void DC_VideoQuit(_THIS);
+
+/* Hardware surface functions */
+static int DC_AllocHWSurface(_THIS, SDL_Surface *surface);
+static int DC_LockHWSurface(_THIS, SDL_Surface *surface);
+static void DC_UnlockHWSurface(_THIS, SDL_Surface *surface);
+static void DC_FreeHWSurface(_THIS, SDL_Surface *surface);
+static int DC_FlipHWSurface(_THIS, SDL_Surface *surface);
+
+/* etc. */
+static void DC_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
+
+/* OpenGL */
+#if SDL_VIDEO_OPENGL
+static void *DC_GL_GetProcAddress(_THIS, const char *proc);
+static int DC_GL_LoadLibrary(_THIS, const char *path);
+static int DC_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
+static void DC_GL_SwapBuffers(_THIS);
+#endif
+
+/* DC driver bootstrap functions */
+
+static int DC_Available(void)
+{
+ return 1;
+}
+
+static void DC_DeleteDevice(SDL_VideoDevice *device)
+{
+ SDL_free(device->hidden);
+ SDL_free(device);
+}
+
+static SDL_VideoDevice *DC_CreateDevice(int devindex)
+{
+ SDL_VideoDevice *device;
+
+ /* Initialize all variables that we clean on shutdown */
+ device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
+ if ( device ) {
+ SDL_memset(device, 0, (sizeof *device));
+ device->hidden = (struct SDL_PrivateVideoData *)
+ SDL_malloc((sizeof *device->hidden));
+ }
+ if ( (device == NULL) || (device->hidden == NULL) ) {
+ SDL_OutOfMemory();
+ if ( device ) {
+ SDL_free(device);
+ }
+ return(0);
+ }
+ SDL_memset(device->hidden, 0, (sizeof *device->hidden));
+
+ /* Set the function pointers */
+ device->VideoInit = DC_VideoInit;
+ device->ListModes = DC_ListModes;
+ device->SetVideoMode = DC_SetVideoMode;
+ device->CreateYUVOverlay = NULL;
+ device->SetColors = DC_SetColors;
+ device->UpdateRects = DC_UpdateRects;
+ device->VideoQuit = DC_VideoQuit;
+ device->AllocHWSurface = DC_AllocHWSurface;
+ device->CheckHWBlit = NULL;
+ device->FillHWRect = NULL;
+ device->SetHWColorKey = NULL;
+ device->SetHWAlpha = NULL;
+ device->LockHWSurface = DC_LockHWSurface;
+ device->UnlockHWSurface = DC_UnlockHWSurface;
+ device->FlipHWSurface = DC_FlipHWSurface;
+ device->FreeHWSurface = DC_FreeHWSurface;
+#if SDL_VIDEO_OPENGL
+ device->GL_LoadLibrary = DC_GL_LoadLibrary;
+ device->GL_GetProcAddress = DC_GL_GetProcAddress;
+ device->GL_GetAttribute = DC_GL_GetAttribute;
+ device->GL_MakeCurrent = NULL;
+ device->GL_SwapBuffers = DC_GL_SwapBuffers;
+#endif
+ device->SetCaption = NULL;
+ device->SetIcon = NULL;
+ device->IconifyWindow = NULL;
+ device->GrabInput = NULL;
+ device->GetWMInfo = NULL;
+ device->InitOSKeymap = DC_InitOSKeymap;
+ device->PumpEvents = DC_PumpEvents;
+
+ device->free = DC_DeleteDevice;
+
+ return device;
+}
+
+VideoBootStrap DC_bootstrap = {
+ "dcvideo", "Dreamcast Video",
+ DC_Available, DC_CreateDevice
+};
+
+
+int DC_VideoInit(_THIS, SDL_PixelFormat *vformat)
+{
+ /* Determine the screen depth (use default 16-bit depth) */
+ /* we change this during the SDL_SetVideoMode implementation... */
+ vformat->BitsPerPixel = 16;
+ vformat->Rmask = 0x0000f800;
+ vformat->Gmask = 0x000007e0;
+ vformat->Bmask = 0x0000001f;
+
+ /* We're done! */
+ return(0);
+}
+
+const static SDL_Rect
+ RECT_800x600 = {0,0,800,600},
+ RECT_640x480 = {0,0,640,480},
+ RECT_320x240 = {0,0,320,240};
+const static SDL_Rect *vid_modes[] = {
+ &RECT_800x600,
+ &RECT_640x480,
+ &RECT_320x240,
+ NULL
+};
+
+SDL_Rect **DC_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
+{
+ switch(format->BitsPerPixel) {
+ case 15:
+ case 16:
+ return &vid_modes;
+ case 32:
+ if (!(flags & SDL_OPENGL))
+ return &vid_modes;
+ default:
+ return NULL;
+ }
+// return (SDL_Rect **) -1;
+}
+
+pvr_init_params_t params = {
+ /* Enable opaque and translucent polygons with size 16 */
+ { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_16 },
+
+ /* Vertex buffer size */
+ 512*1024
+};
+
+#if SDL_VIDEO_OPENGL
+static int pvr_inited;
+#endif
+
+SDL_Surface *DC_SetVideoMode(_THIS, SDL_Surface *current,
+ int width, int height, int bpp, Uint32 flags)
+{
+ int disp_mode,pixel_mode,pitch;
+ Uint32 Rmask, Gmask, Bmask;
+
+ if (width==320 && height==240) disp_mode=DM_320x240;
+ else if (width==640 && height==480) disp_mode=DM_640x480;
+ else if (width==800 && height==600) disp_mode=DM_800x608;
+ else {
+ SDL_SetError("Couldn't find requested mode in list");
+ return(NULL);
+ }
+
+ switch(bpp) {
+ case 15: pixel_mode = PM_RGB555; pitch = width*2;
+ /* 5-5-5 */
+ Rmask = 0x00007c00;
+ Gmask = 0x000003e0;
+ Bmask = 0x0000001f;
+ break;
+ case 16: pixel_mode = PM_RGB565; pitch = width*2;
+ /* 5-6-5 */
+ Rmask = 0x0000f800;
+ Gmask = 0x000007e0;
+ Bmask = 0x0000001f;
+ break;
+ case 24: bpp = 32;
+ case 32: pixel_mode = PM_RGB888; pitch = width*4;
+ Rmask = 0x00ff0000;
+ Gmask = 0x0000ff00;
+ Bmask = 0x000000ff;
+#if SDL_VIDEO_OPENGL
+ if (!(flags & SDL_OPENGL))
+#endif
+ break;
+ default:
+ SDL_SetError("Couldn't find requested mode in list");
+ return(NULL);
+ }
+
+// if ( bpp != current->format->BitsPerPixel ) {
+ if ( ! SDL_ReallocFormat(current, bpp, Rmask, Gmask, Bmask, 0) ) {
+ return(NULL);
+ }
+// }
+
+ /* Set up the new mode framebuffer */
+ current->flags = (SDL_FULLSCREEN|SDL_HWSURFACE);
+ current->w = width;
+ current->h = height;
+ current->pitch = pitch;
+
+#if SDL_VIDEO_OPENGL
+ if (pvr_inited) {
+ pvr_inited = 0;
+ pvr_shutdown();
+ }
+#endif
+
+ vid_set_mode(disp_mode,pixel_mode);
+
+ current->pixels = vram_s;
+
+#if SDL_VIDEO_OPENGL
+ if (flags & SDL_OPENGL) {
+ this->gl_config.driver_loaded = 1;
+ current->flags = SDL_FULLSCREEN | SDL_OPENGL;
+ current->pixels = NULL;
+ pvr_inited = 1;
+ pvr_init(&params);
+ glKosInit();
+ glKosBeginFrame();
+ } else
+#endif
+ if (flags | SDL_DOUBLEBUF) {
+ current->flags |= SDL_DOUBLEBUF;
+ current->pixels = (void*)((int)current->pixels | 0x400000);
+ }
+
+ /* We're done */
+ return(current);
+}
+
+/* We don't actually allow hardware surfaces other than the main one */
+static int DC_AllocHWSurface(_THIS, SDL_Surface *surface)
+{
+ return(-1);
+}
+static void DC_FreeHWSurface(_THIS, SDL_Surface *surface)
+{
+ return;
+}
+
+/* We need to wait for vertical retrace on page flipped displays */
+static int DC_LockHWSurface(_THIS, SDL_Surface *surface)
+{
+ return(0);
+}
+
+static void DC_UnlockHWSurface(_THIS, SDL_Surface *surface)
+{
+ return;
+}
+
+static int DC_FlipHWSurface(_THIS, SDL_Surface *surface)
+{
+ if (surface->flags & SDL_DOUBLEBUF) {
+ vid_set_start((int)surface->pixels & 0xffffff);
+ surface->pixels = (void*)((int)surface->pixels ^ 0x400000);
+ }
+ return(0);
+}
+
+static void DC_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
+{
+ /* do nothing. */
+}
+
+static int DC_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
+{
+ /* do nothing of note. */
+ return(1);
+}
+
+/* Note: If we are terminated, this could be called in the middle of
+ another SDL video routine -- notably UpdateRects.
+*/
+static void DC_VideoQuit(_THIS)
+{
+#if SDL_VIDEO_OPENGL
+ if (pvr_inited) {
+ pvr_inited = 0;
+ pvr_shutdown();
+ }
+#endif
+}
+
+#if SDL_VIDEO_OPENGL
+
+void dmyfunc(void) {}
+
+typedef void (*funcptr)();
+const static struct {
+ char *name;
+ funcptr addr;
+} glfuncs[] = {
+#define DEF(func) {#func,&func}
+ DEF(glBegin),
+ DEF(glBindTexture),
+ DEF(glBlendFunc),
+ DEF(glColor4f),
+// DEF(glCopyImageID),
+ DEF(glDisable),
+ DEF(glEnable),
+ DEF(glEnd),
+ DEF(glFlush),
+ DEF(glGenTextures),
+ DEF(glGetString),
+ DEF(glLoadIdentity),
+ DEF(glMatrixMode),
+ DEF(glOrtho),
+ DEF(glPixelStorei),
+// DEF(glPopAttrib),
+// DEF(glPopClientAttrib),
+ {"glPopAttrib",&dmyfunc},
+ {"glPopClientAttrib",&dmyfunc},
+ DEF(glPopMatrix),
+// DEF(glPushAttrib),
+// DEF(glPushClientAttrib),
+ {"glPushAttrib",&dmyfunc},
+ {"glPushClientAttrib",&dmyfunc},
+ DEF(glPushMatrix),
+ DEF(glTexCoord2f),
+ DEF(glTexEnvf),
+ DEF(glTexImage2D),
+ DEF(glTexParameteri),
+ DEF(glTexSubImage2D),
+ DEF(glVertex2i),
+ DEF(glViewport),
+#undef DEF
+};
+
+static void *DC_GL_GetProcAddress(_THIS, const char *proc)
+{
+ void *ret;
+ int i;
+
+ ret = glKosGetProcAddress(proc);
+ if (ret) return ret;
+
+ for(i=0;i<sizeof(glfuncs)/sizeof(glfuncs[0]);i++) {
+ if (SDL_strcmp(proc,glfuncs[i].name)==0) return glfuncs[i].addr;
+ }
+
+ return NULL;
+}
+
+static int DC_GL_LoadLibrary(_THIS, const char *path)
+{
+ this->gl_config.driver_loaded = 1;
+
+ return 0;
+}
+
+static int DC_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
+{
+ GLenum mesa_attrib;
+ int val;
+
+ switch(attrib) {
+ case SDL_GL_RED_SIZE:
+ val = 5;
+ break;
+ case SDL_GL_GREEN_SIZE:
+ val = 6;
+ break;
+ case SDL_GL_BLUE_SIZE:
+ val = 5;
+ break;
+ case SDL_GL_ALPHA_SIZE:
+ val = 0;
+ break;
+ case SDL_GL_DOUBLEBUFFER:
+ val = 1;
+ break;
+ case SDL_GL_DEPTH_SIZE:
+ val = 16; /* or 32? */
+ break;
+ case SDL_GL_STENCIL_SIZE:
+ val = 0;
+ break;
+ case SDL_GL_ACCUM_RED_SIZE:
+ val = 0;
+ break;
+ case SDL_GL_ACCUM_GREEN_SIZE:
+ val = 0;
+ case SDL_GL_ACCUM_BLUE_SIZE:
+ val = 0;
+ break;
+ case SDL_GL_ACCUM_ALPHA_SIZE:
+ val = 0;
+ break;
+ default :
+ return -1;
+ }
+ *value = val;
+ return 0;
+}
+
+static void DC_GL_SwapBuffers(_THIS)
+{
+ glKosFinishFrame();
+ glKosBeginFrame();
+}
+#endif
diff --git a/distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.h b/distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.h
new file mode 100644
index 0000000..2c7bf25
--- /dev/null
+++ b/distrib/sdl-1.2.12/src/video/dc/SDL_dcvideo.h
@@ -0,0 +1,42 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2006 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_dcvideo_h
+#define _SDL_dcvideo_h
+
+#include "SDL_mouse.h"
+#include "SDL_mutex.h"
+#include "../SDL_sysvideo.h"
+
+/* Hidden "this" pointer for the video functions */
+#define _THIS SDL_VideoDevice *this
+
+
+/* Private display data */
+
+struct SDL_PrivateVideoData {
+ int w, h;
+ void *buffer;
+};
+
+#endif /* _SDL_dcvideo_h */