Hello Sam.
I did fix/update the SDL 1.3 pandora port today ( 11 june 2010 ) and you can find the "hg diff" attached :)
David Carr? ( Cpasjuste )
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SDL_config.h"
25 #include "SDL_video.h"
26 #include "SDL_mouse.h"
27 #include "../SDL_sysvideo.h"
28 #include "../SDL_pixels_c.h"
30 #include "SDL_win32video.h"
31 #include "SDL_d3drender.h"
32 #include "SDL_gdirender.h"
34 /* Initialization/Query functions */
35 static int WIN_VideoInit(_THIS);
36 static void WIN_VideoQuit(_THIS);
38 /* WIN32 driver bootstrap functions */
47 WIN_DeleteDevice(SDL_VideoDevice * device)
49 SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
52 #if SDL_VIDEO_RENDER_D3D
54 IDirect3D9_Release(data->d3d);
55 FreeLibrary(data->d3dDLL);
58 #if SDL_VIDEO_RENDER_DDRAW
60 data->ddraw->lpVtbl->Release(data->ddraw);
61 FreeLibrary(data->ddrawDLL);
64 SDL_free(device->driverdata);
68 static SDL_VideoDevice *
69 WIN_CreateDevice(int devindex)
71 SDL_VideoDevice *device;
74 SDL_RegisterApp(NULL, 0, NULL);
76 /* Initialize all variables that we clean on shutdown */
77 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
79 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
90 device->driverdata = data;
92 #if SDL_VIDEO_RENDER_D3D
93 data->d3dDLL = LoadLibrary(TEXT("D3D9.DLL"));
95 IDirect3D9 *(WINAPI * D3DCreate) (UINT SDKVersion);
98 (IDirect3D9 * (WINAPI *) (UINT)) GetProcAddress(data->d3dDLL,
101 data->d3d = D3DCreate(D3D_SDK_VERSION);
104 FreeLibrary(data->d3dDLL);
108 #endif /* SDL_VIDEO_RENDER_D3D */
109 #if SDL_VIDEO_RENDER_DDRAW
110 data->ddrawDLL = LoadLibrary(TEXT("ddraw.dll"));
111 if (data->ddrawDLL) {
112 IDirectDraw *(WINAPI * DDCreate) (GUID FAR * lpGUID,
113 LPDIRECTDRAW FAR * lplpDD,
114 IUnknown FAR * pUnkOuter);
118 (WINAPI *) (GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *))
119 GetProcAddress(data->ddrawDLL, TEXT("DirectDrawCreate"));
120 if (!DDCreate || DDCreate(NULL, &data->ddraw, NULL) != DD_OK) {
121 FreeLibrary(data->ddrawDLL);
122 data->ddrawDLL = NULL;
126 #endif /* SDL_VIDEO_RENDER_DDRAW */
128 /* Set the function pointers */
129 device->VideoInit = WIN_VideoInit;
130 device->VideoQuit = WIN_VideoQuit;
131 device->GetDisplayBounds = WIN_GetDisplayBounds;
132 device->GetDisplayModes = WIN_GetDisplayModes;
133 device->SetDisplayMode = WIN_SetDisplayMode;
134 device->SetDisplayGammaRamp = WIN_SetDisplayGammaRamp;
135 device->GetDisplayGammaRamp = WIN_GetDisplayGammaRamp;
136 device->PumpEvents = WIN_PumpEvents;
139 device->CreateWindow = WIN_CreateWindow;
140 device->CreateWindowFrom = WIN_CreateWindowFrom;
141 device->SetWindowTitle = WIN_SetWindowTitle;
142 device->SetWindowIcon = WIN_SetWindowIcon;
143 device->SetWindowPosition = WIN_SetWindowPosition;
144 device->SetWindowSize = WIN_SetWindowSize;
145 device->ShowWindow = WIN_ShowWindow;
146 device->HideWindow = WIN_HideWindow;
147 device->RaiseWindow = WIN_RaiseWindow;
148 device->MaximizeWindow = WIN_MaximizeWindow;
149 device->MinimizeWindow = WIN_MinimizeWindow;
150 device->RestoreWindow = WIN_RestoreWindow;
151 device->SetWindowGrab = WIN_SetWindowGrab;
152 device->DestroyWindow = WIN_DestroyWindow;
153 device->GetWindowWMInfo = WIN_GetWindowWMInfo;
154 #ifdef SDL_VIDEO_OPENGL_WGL
155 device->GL_LoadLibrary = WIN_GL_LoadLibrary;
156 device->GL_GetProcAddress = WIN_GL_GetProcAddress;
157 device->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
158 device->GL_CreateContext = WIN_GL_CreateContext;
159 device->GL_MakeCurrent = WIN_GL_MakeCurrent;
160 device->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
161 device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
162 device->GL_SwapWindow = WIN_GL_SwapWindow;
163 device->GL_DeleteContext = WIN_GL_DeleteContext;
166 device->free = WIN_DeleteDevice;
171 VideoBootStrap WIN32_bootstrap = {
172 "win32", "SDL Win32/64 video driver", WIN_Available, WIN_CreateDevice
179 if (WIN_InitModes(_this) < 0) {
183 #if SDL_VIDEO_RENDER_D3D
184 D3D_AddRenderDriver(_this);
186 #if SDL_VIDEO_RENDER_DDRAW
187 DDRAW_AddRenderDriver(_this);
189 #if SDL_VIDEO_RENDER_GDI
190 GDI_AddRenderDriver(_this);
192 #if SDL_VIDEO_RENDER_GAPI
193 GAPI_AddRenderDriver(_this);
196 WIN_InitKeyboard(_this);
197 WIN_InitMouse(_this);
205 WIN_QuitModes(_this);
206 WIN_QuitKeyboard(_this);
207 WIN_QuitMouse(_this);
210 /* vim: set ts=4 sw=4 expandtab: */