Mercurial > sdl-ios-xcode
comparison src/video/xbios/SDL_xbios.c @ 2035:c848c18684ab
Started update for 1.3
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Wed, 20 Sep 2006 22:09:19 +0000 |
parents | c121d94672cb |
children | 12ef90a41631 |
comparison
equal
deleted
inserted
replaced
2034:59e1a50193aa | 2035:c848c18684ab |
---|---|
47 #include "../ataricommon/SDL_atarigl_c.h" | 47 #include "../ataricommon/SDL_atarigl_c.h" |
48 #include "SDL_xbios.h" | 48 #include "SDL_xbios.h" |
49 #include "SDL_xbios_blowup.h" | 49 #include "SDL_xbios_blowup.h" |
50 #include "SDL_xbios_centscreen.h" | 50 #include "SDL_xbios_centscreen.h" |
51 #include "SDL_xbios_sb3.h" | 51 #include "SDL_xbios_sb3.h" |
52 | |
53 #define XBIOS_VID_DRIVER_NAME "xbios" | |
54 | 52 |
55 /* Debug print info */ | 53 /* Debug print info */ |
56 #if 0 | 54 #if 0 |
57 #define DEBUG_PRINT(what) \ | 55 #define DEBUG_PRINT(what) \ |
58 { \ | 56 { \ |
139 } | 137 } |
140 | 138 |
141 static void | 139 static void |
142 XBIOS_DeleteDevice(SDL_VideoDevice * device) | 140 XBIOS_DeleteDevice(SDL_VideoDevice * device) |
143 { | 141 { |
144 SDL_free(device->hidden); | 142 SDL_free(device->driverdata); |
145 SDL_free(device); | 143 SDL_free(device); |
146 } | 144 } |
147 | 145 |
148 static SDL_VideoDevice * | 146 static SDL_VideoDevice * |
149 XBIOS_CreateDevice(int devindex) | 147 XBIOS_CreateDevice(int devindex) |
150 { | 148 { |
151 SDL_VideoDevice *device; | 149 SDL_VideoDevice *device; |
150 SDL_VideoData *data; | |
152 | 151 |
153 /* Initialize all variables that we clean on shutdown */ | 152 /* Initialize all variables that we clean on shutdown */ |
154 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice)); | 153 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice)); |
155 if (device) { | 154 if (device) { |
156 SDL_memset(device, 0, (sizeof *device)); | 155 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); |
157 device->hidden = (struct SDL_PrivateVideoData *) | 156 } |
158 SDL_malloc((sizeof *device->hidden)); | 157 if (!device || !data) { |
159 device->gl_data = (struct SDL_PrivateGLData *) | |
160 SDL_malloc((sizeof *device->gl_data)); | |
161 } | |
162 if ((device == NULL) || (device->hidden == NULL)) { | |
163 SDL_OutOfMemory(); | 158 SDL_OutOfMemory(); |
164 if (device) { | 159 if (device) { |
165 SDL_free(device); | 160 SDL_free(device); |
166 } | 161 } |
167 return (0); | 162 return NULL; |
168 } | 163 } |
169 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); | 164 device->driverdata = data; |
170 SDL_memset(device->gl_data, 0, sizeof(*device->gl_data)); | |
171 | 165 |
172 /* Video functions */ | 166 /* Video functions */ |
173 device->VideoInit = XBIOS_VideoInit; | 167 device->VideoInit = XBIOS_VideoInit; |
168 device->VideoQuit = XBIOS_VideoQuit; | |
174 device->ListModes = XBIOS_ListModes; | 169 device->ListModes = XBIOS_ListModes; |
175 device->SetVideoMode = XBIOS_SetVideoMode; | 170 device->SetVideoMode = XBIOS_SetVideoMode; |
176 device->SetColors = XBIOS_SetColors; | 171 device->SetColors = XBIOS_SetColors; |
177 device->UpdateRects = NULL; | 172 device->UpdateRects = NULL; |
178 device->VideoQuit = XBIOS_VideoQuit; | |
179 device->AllocHWSurface = XBIOS_AllocHWSurface; | 173 device->AllocHWSurface = XBIOS_AllocHWSurface; |
180 device->LockHWSurface = XBIOS_LockHWSurface; | 174 device->LockHWSurface = XBIOS_LockHWSurface; |
181 device->UnlockHWSurface = XBIOS_UnlockHWSurface; | 175 device->UnlockHWSurface = XBIOS_UnlockHWSurface; |
182 device->FlipHWSurface = XBIOS_FlipHWSurface; | 176 device->FlipHWSurface = XBIOS_FlipHWSurface; |
183 device->FreeHWSurface = XBIOS_FreeHWSurface; | 177 device->FreeHWSurface = XBIOS_FreeHWSurface; |
190 device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent; | 184 device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent; |
191 device->GL_SwapBuffers = XBIOS_GL_SwapBuffers; | 185 device->GL_SwapBuffers = XBIOS_GL_SwapBuffers; |
192 #endif | 186 #endif |
193 | 187 |
194 /* Events */ | 188 /* Events */ |
195 device->InitOSKeymap = Atari_InitOSKeymap; | |
196 device->PumpEvents = Atari_PumpEvents; | 189 device->PumpEvents = Atari_PumpEvents; |
197 | 190 |
198 device->free = XBIOS_DeleteDevice; | 191 device->free = XBIOS_DeleteDevice; |
199 | 192 |
200 return device; | 193 return device; |
201 } | 194 } |
202 | 195 |
203 VideoBootStrap XBIOS_bootstrap = { | 196 VideoBootStrap XBIOS_bootstrap = { |
204 XBIOS_VID_DRIVER_NAME, "Atari Xbios driver", | 197 "xbios", "Atari Xbios driver", |
205 XBIOS_Available, XBIOS_CreateDevice | 198 XBIOS_Available, XBIOS_CreateDevice |
206 }; | 199 }; |
207 | 200 |
208 void | 201 void |
209 SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height, | 202 SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height, |