changeset 2035:c848c18684ab

Started update for 1.3
author Patrice Mandin <patmandin@gmail.com>
date Wed, 20 Sep 2006 22:09:19 +0000
parents 59e1a50193aa
children 12ef90a41631
files src/video/xbios/SDL_xbios.c src/video/xbios/SDL_xbios.h
diffstat 2 files changed, 29 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/xbios/SDL_xbios.c	Wed Sep 20 21:38:06 2006 +0000
+++ b/src/video/xbios/SDL_xbios.c	Wed Sep 20 22:09:19 2006 +0000
@@ -50,8 +50,6 @@
 #include "SDL_xbios_centscreen.h"
 #include "SDL_xbios_sb3.h"
 
-#define XBIOS_VID_DRIVER_NAME "xbios"
-
 /* Debug print info */
 #if 0
 #define DEBUG_PRINT(what) \
@@ -141,7 +139,7 @@
 static void
 XBIOS_DeleteDevice(SDL_VideoDevice * device)
 {
-    SDL_free(device->hidden);
+    SDL_free(device->driverdata);
     SDL_free(device);
 }
 
@@ -149,33 +147,29 @@
 XBIOS_CreateDevice(int devindex)
 {
     SDL_VideoDevice *device;
+    SDL_VideoData *data;
 
     /* 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));
-        device->gl_data = (struct SDL_PrivateGLData *)
-            SDL_malloc((sizeof *device->gl_data));
+        data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
     }
-    if ((device == NULL) || (device->hidden == NULL)) {
+    if (!device || !data) {
         SDL_OutOfMemory();
         if (device) {
             SDL_free(device);
         }
-        return (0);
+        return NULL;
     }
-    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
-    SDL_memset(device->gl_data, 0, sizeof(*device->gl_data));
+    device->driverdata = data;
 
     /* Video functions */
     device->VideoInit = XBIOS_VideoInit;
+    device->VideoQuit = XBIOS_VideoQuit;
     device->ListModes = XBIOS_ListModes;
     device->SetVideoMode = XBIOS_SetVideoMode;
     device->SetColors = XBIOS_SetColors;
     device->UpdateRects = NULL;
-    device->VideoQuit = XBIOS_VideoQuit;
     device->AllocHWSurface = XBIOS_AllocHWSurface;
     device->LockHWSurface = XBIOS_LockHWSurface;
     device->UnlockHWSurface = XBIOS_UnlockHWSurface;
@@ -192,7 +186,6 @@
 #endif
 
     /* Events */
-    device->InitOSKeymap = Atari_InitOSKeymap;
     device->PumpEvents = Atari_PumpEvents;
 
     device->free = XBIOS_DeleteDevice;
@@ -201,7 +194,7 @@
 }
 
 VideoBootStrap XBIOS_bootstrap = {
-    XBIOS_VID_DRIVER_NAME, "Atari Xbios driver",
+    "xbios", "Atari Xbios driver",
     XBIOS_Available, XBIOS_CreateDevice
 };
 
--- a/src/video/xbios/SDL_xbios.h	Wed Sep 20 21:38:06 2006 +0000
+++ b/src/video/xbios/SDL_xbios.h	Wed Sep 20 22:09:19 2006 +0000
@@ -27,9 +27,6 @@
 #include "SDL_stdinc.h"
 #include "../SDL_sysvideo.h"
 
-/* Hidden "this" pointer for the video functions */
-#define _THIS	SDL_VideoDevice *this
-
 /* TT video modes:	2
    Falcon RVB:		16 (could be *2 by adding PAL/NTSC modes)
    Falcon VGA:		6
@@ -49,7 +46,7 @@
 /* Private display data */
 #define NUM_MODELISTS	2       /* 8 and 16 bits-per-pixel */
 
-struct SDL_PrivateVideoData
+struct SDL_VideoData
 {
     long cookie_vdo;
     int old_video_mode;         /* Old video mode before entering SDL */
@@ -71,7 +68,7 @@
 
     SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES + 1];
     xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES + 1];
-};
+} SDL_VideoData;
 
 /* _VDO cookie values */
 enum
@@ -106,25 +103,25 @@
 #define TT_HIGH	0x0600
 
 /* Hidden structure -> variables names */
-#define SDL_modelist		(this->hidden->SDL_modelist)
-#define XBIOS_mutex		    (this->hidden->mutex)
-#define XBIOS_cvdo		    (this->hidden->cookie_vdo)
-#define XBIOS_oldpalette	(this->hidden->old_palette)
-#define XBIOS_oldnumcol		(this->hidden->old_num_colors)
-#define XBIOS_oldvbase		(this->hidden->old_video_base)
-#define XBIOS_oldvmode		(this->hidden->old_video_mode)
-#define XBIOS_nummodes		(this->hidden->num_modes)
-#define XBIOS_modelist		(this->hidden->mode_list)
-#define XBIOS_screens		(this->hidden->screens)
-#define XBIOS_screensmem	(this->hidden->screensmem)
-#define XBIOS_shadowscreen	(this->hidden->shadowscreen)
-#define XBIOS_videomodes	(this->hidden->videomodes)
-#define XBIOS_doubleline	(this->hidden->doubleline)
-#define XBIOS_fbnum			(this->hidden->frame_number)
-#define XBIOS_pitch			(this->hidden->pitch)
-#define XBIOS_width			(this->hidden->width)
-#define XBIOS_height		(this->hidden->height)
-#define XBIOS_centscreen	(this->hidden->centscreen)
+#define SDL_modelist		(_this->driverdata->SDL_modelist)
+#define XBIOS_mutex		    (_this->driverdata->mutex)
+#define XBIOS_cvdo		    (_this->driverdata->cookie_vdo)
+#define XBIOS_oldpalette	(_this->driverdata->old_palette)
+#define XBIOS_oldnumcol		(_this->driverdata->old_num_colors)
+#define XBIOS_oldvbase		(_this->driverdata->old_video_base)
+#define XBIOS_oldvmode		(_this->driverdata->old_video_mode)
+#define XBIOS_nummodes		(_this->driverdata->num_modes)
+#define XBIOS_modelist		(_this->driverdata->mode_list)
+#define XBIOS_screens		(_this->driverdata->screens)
+#define XBIOS_screensmem	(_this->driverdata->screensmem)
+#define XBIOS_shadowscreen	(_this->driverdata->shadowscreen)
+#define XBIOS_videomodes	(_this->driverdata->videomodes)
+#define XBIOS_doubleline	(_this->driverdata->doubleline)
+#define XBIOS_fbnum			(_this->driverdata->frame_number)
+#define XBIOS_pitch			(_this->driverdata->pitch)
+#define XBIOS_width			(_this->driverdata->width)
+#define XBIOS_height		(_this->driverdata->height)
+#define XBIOS_centscreen	(_this->driverdata->centscreen)
 
 /*--- Functions prototypes ---*/