Pfiou, all of it to update, faster to rewrite from scratch?
authorPatrice Mandin <patmandin@gmail.com>
Fri, 22 Sep 2006 21:52:20 +0000
changeset 203612ef90a41631
parent 2035 c848c18684ab
child 2037 6bb97f41ab4b
Pfiou, all of it to update, faster to rewrite from scratch?
src/video/xbios/SDL_xbios.c
src/video/xbios/SDL_xbios.h
src/video/xbios/SDL_xbios_blowup.c
     1.1 --- a/src/video/xbios/SDL_xbios.c	Wed Sep 20 22:09:19 2006 +0000
     1.2 +++ b/src/video/xbios/SDL_xbios.c	Fri Sep 22 21:52:20 2006 +0000
     1.3 @@ -63,7 +63,10 @@
     1.4  #endif
     1.5  
     1.6  /* Initialization/Query functions */
     1.7 -static int XBIOS_VideoInit(_THIS, SDL_PixelFormat * vformat);
     1.8 +static int XBIOS_VideoInit(_THIS);
     1.9 +static void XBIOS_VideoQuit(_THIS);
    1.10 +
    1.11 +#if 0
    1.12  static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat * format,
    1.13                                    Uint32 flags);
    1.14  static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface * current,
    1.15 @@ -71,7 +74,6 @@
    1.16                                         Uint32 flags);
    1.17  static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors,
    1.18                             SDL_Color * colors);
    1.19 -static void XBIOS_VideoQuit(_THIS);
    1.20  
    1.21  /* Hardware surface functions */
    1.22  static int XBIOS_AllocHWSurface(_THIS, SDL_Surface * surface);
    1.23 @@ -90,6 +92,7 @@
    1.24  
    1.25  static unsigned short TT_palette[256];
    1.26  static unsigned long F30_palette[256];
    1.27 +#endif
    1.28  
    1.29  /* Xbios driver bootstrap functions */
    1.30  
    1.31 @@ -150,7 +153,7 @@
    1.32      SDL_VideoData *data;
    1.33  
    1.34      /* Initialize all variables that we clean on shutdown */
    1.35 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
    1.36 +    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
    1.37      if (device) {
    1.38          data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
    1.39      }
    1.40 @@ -166,28 +169,26 @@
    1.41      /* Video functions */
    1.42      device->VideoInit = XBIOS_VideoInit;
    1.43      device->VideoQuit = XBIOS_VideoQuit;
    1.44 -    device->ListModes = XBIOS_ListModes;
    1.45 -    device->SetVideoMode = XBIOS_SetVideoMode;
    1.46 -    device->SetColors = XBIOS_SetColors;
    1.47 -    device->UpdateRects = NULL;
    1.48 -    device->AllocHWSurface = XBIOS_AllocHWSurface;
    1.49 -    device->LockHWSurface = XBIOS_LockHWSurface;
    1.50 -    device->UnlockHWSurface = XBIOS_UnlockHWSurface;
    1.51 -    device->FlipHWSurface = XBIOS_FlipHWSurface;
    1.52 -    device->FreeHWSurface = XBIOS_FreeHWSurface;
    1.53 +
    1.54 +    /* Modes */
    1.55 +    device->GetDisplayModes = NULL /*XBIOS_GetDisplayModes*/;
    1.56 +    device->SetDisplayMode = NULL /*XBIOS_SetDisplayMode*/;
    1.57 +
    1.58 +    /* Events */
    1.59 +    device->PumpEvents = SDL_Atari_PumpEvents;
    1.60  
    1.61  #if SDL_VIDEO_OPENGL
    1.62      /* OpenGL functions */
    1.63      device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
    1.64      device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
    1.65 -    device->GL_GetAttribute = SDL_AtariGL_GetAttribute;
    1.66 +    device->GL_CreateContext = NULL;
    1.67      device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent;
    1.68 -    device->GL_SwapBuffers = XBIOS_GL_SwapBuffers;
    1.69 +    device->GL_SetSwapInterval = NULL;
    1.70 +    device->GL_GetSwapInterval = NULL;
    1.71 +    device->GL_SwapWindow = XBIOS_GL_SwapBuffers;
    1.72 +    device->GL_DeleteContext = NULL;
    1.73  #endif
    1.74  
    1.75 -    /* Events */
    1.76 -    device->PumpEvents = Atari_PumpEvents;
    1.77 -
    1.78      device->free = XBIOS_DeleteDevice;
    1.79  
    1.80      return device;
    1.81 @@ -198,6 +199,7 @@
    1.82      XBIOS_Available, XBIOS_CreateDevice
    1.83  };
    1.84  
    1.85 +#if 0
    1.86  void
    1.87  SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height,
    1.88                    Uint16 depth, SDL_bool flags)
    1.89 @@ -252,10 +254,14 @@
    1.90      XBIOS_modelist[curpos].depth = depth;
    1.91      XBIOS_modelist[curpos].doubleline = flags;
    1.92  }
    1.93 +#endif
    1.94  
    1.95  static int
    1.96 -XBIOS_VideoInit(_THIS, SDL_PixelFormat * vformat)
    1.97 +XBIOS_VideoInit(_THIS)
    1.98  {
    1.99 +    XBIOS_InitModes(_this);
   1.100 +
   1.101 +#if 0
   1.102      int i, j8, j16;
   1.103      xbiosmode_t *current_mode;
   1.104      unsigned long cookie_blow, cookie_scpn, cookie_cnts;
   1.105 @@ -480,10 +486,86 @@
   1.106      SDL_AtariGL_InitPointers(this);
   1.107  #endif
   1.108  
   1.109 -    /* We're done! */
   1.110 +#endif
   1.111 +
   1.112      return (0);
   1.113  }
   1.114  
   1.115 +static void
   1.116 +XBIOS_VideoQuit(_THIS)
   1.117 +{
   1.118 +/*    int i, j;*/
   1.119 +
   1.120 +    XBIOS_QuitModes(_this);
   1.121 +    Atari_ShutdownEvents();
   1.122 +
   1.123 +#if 0
   1.124 +    /* Restore video mode and palette */
   1.125 +#ifndef DEBUG_VIDEO_XBIOS
   1.126 +    switch (XBIOS_cvdo >> 16) {
   1.127 +    case VDO_ST:
   1.128 +    case VDO_STE:
   1.129 +        Setscreen(-1, XBIOS_oldvbase, XBIOS_oldvmode);
   1.130 +        if (XBIOS_oldnumcol) {
   1.131 +            Setpalette(XBIOS_oldpalette);
   1.132 +        }
   1.133 +        break;
   1.134 +    case VDO_TT:
   1.135 +        Setscreen(-1, XBIOS_oldvbase, -1);
   1.136 +        EsetShift(XBIOS_oldvmode);
   1.137 +        if (XBIOS_oldnumcol) {
   1.138 +            EsetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette);
   1.139 +        }
   1.140 +        break;
   1.141 +    case VDO_F30:
   1.142 +        Setscreen(-1, XBIOS_oldvbase, -1);
   1.143 +        if (XBIOS_centscreen) {
   1.144 +            SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode);
   1.145 +        } else {
   1.146 +            VsetMode(XBIOS_oldvmode);
   1.147 +        }
   1.148 +        if (XBIOS_oldnumcol) {
   1.149 +            VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
   1.150 +        }
   1.151 +        break;
   1.152 +    }
   1.153 +    Vsync();
   1.154 +#endif
   1.155 +
   1.156 +
   1.157 +#if SDL_VIDEO_OPENGL
   1.158 +    if (gl_active) {
   1.159 +        SDL_AtariGL_Quit(this, SDL_TRUE);
   1.160 +    }
   1.161 +#endif
   1.162 +
   1.163 +    if (XBIOS_oldpalette) {
   1.164 +        SDL_free(XBIOS_oldpalette);
   1.165 +        XBIOS_oldpalette = NULL;
   1.166 +    }
   1.167 +    XBIOS_FreeBuffers(this);
   1.168 +
   1.169 +    /* Free mode list */
   1.170 +    for (j = 0; j < NUM_MODELISTS; j++) {
   1.171 +        for (i = 0; i < SDL_NUMMODES; i++) {
   1.172 +            if (SDL_modelist[j][i] != NULL) {
   1.173 +                SDL_free(SDL_modelist[j][i]);
   1.174 +                SDL_modelist[j][i] = NULL;
   1.175 +            }
   1.176 +        }
   1.177 +    }
   1.178 +
   1.179 +    if (XBIOS_modelist) {
   1.180 +        SDL_free(XBIOS_modelist);
   1.181 +        XBIOS_nummodes = 0;
   1.182 +        XBIOS_modelist = NULL;
   1.183 +    }
   1.184 +
   1.185 +    this->screen->pixels = NULL;
   1.186 +#endif
   1.187 +}
   1.188 +
   1.189 +#if 0
   1.190  static SDL_Rect **
   1.191  XBIOS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   1.192  {
   1.193 @@ -876,81 +958,13 @@
   1.194  
   1.195      return (1);
   1.196  }
   1.197 +#endif
   1.198  
   1.199  /* Note:  If we are terminated, this could be called in the middle of
   1.200     another SDL video routine -- notably UpdateRects.
   1.201  */
   1.202 -static void
   1.203 -XBIOS_VideoQuit(_THIS)
   1.204 -{
   1.205 -    int i, j;
   1.206  
   1.207 -    Atari_ShutdownEvents();
   1.208 -
   1.209 -    /* Restore video mode and palette */
   1.210 -#ifndef DEBUG_VIDEO_XBIOS
   1.211 -    switch (XBIOS_cvdo >> 16) {
   1.212 -    case VDO_ST:
   1.213 -    case VDO_STE:
   1.214 -        Setscreen(-1, XBIOS_oldvbase, XBIOS_oldvmode);
   1.215 -        if (XBIOS_oldnumcol) {
   1.216 -            Setpalette(XBIOS_oldpalette);
   1.217 -        }
   1.218 -        break;
   1.219 -    case VDO_TT:
   1.220 -        Setscreen(-1, XBIOS_oldvbase, -1);
   1.221 -        EsetShift(XBIOS_oldvmode);
   1.222 -        if (XBIOS_oldnumcol) {
   1.223 -            EsetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette);
   1.224 -        }
   1.225 -        break;
   1.226 -    case VDO_F30:
   1.227 -        Setscreen(-1, XBIOS_oldvbase, -1);
   1.228 -        if (XBIOS_centscreen) {
   1.229 -            SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode);
   1.230 -        } else {
   1.231 -            VsetMode(XBIOS_oldvmode);
   1.232 -        }
   1.233 -        if (XBIOS_oldnumcol) {
   1.234 -            VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
   1.235 -        }
   1.236 -        break;
   1.237 -    }
   1.238 -    Vsync();
   1.239 -#endif
   1.240 -
   1.241 -
   1.242 -#if SDL_VIDEO_OPENGL
   1.243 -    if (gl_active) {
   1.244 -        SDL_AtariGL_Quit(this, SDL_TRUE);
   1.245 -    }
   1.246 -#endif
   1.247 -
   1.248 -    if (XBIOS_oldpalette) {
   1.249 -        SDL_free(XBIOS_oldpalette);
   1.250 -        XBIOS_oldpalette = NULL;
   1.251 -    }
   1.252 -    XBIOS_FreeBuffers(this);
   1.253 -
   1.254 -    /* Free mode list */
   1.255 -    for (j = 0; j < NUM_MODELISTS; j++) {
   1.256 -        for (i = 0; i < SDL_NUMMODES; i++) {
   1.257 -            if (SDL_modelist[j][i] != NULL) {
   1.258 -                SDL_free(SDL_modelist[j][i]);
   1.259 -                SDL_modelist[j][i] = NULL;
   1.260 -            }
   1.261 -        }
   1.262 -    }
   1.263 -
   1.264 -    if (XBIOS_modelist) {
   1.265 -        SDL_free(XBIOS_modelist);
   1.266 -        XBIOS_nummodes = 0;
   1.267 -        XBIOS_modelist = NULL;
   1.268 -    }
   1.269 -
   1.270 -    this->screen->pixels = NULL;
   1.271 -}
   1.272 -
   1.273 +#if 0
   1.274  #if SDL_VIDEO_OPENGL
   1.275  
   1.276  static void
   1.277 @@ -962,4 +976,5 @@
   1.278  }
   1.279  
   1.280  #endif
   1.281 +#endif
   1.282  /* vi: set ts=4 sw=4 expandtab: */
     2.1 --- a/src/video/xbios/SDL_xbios.h	Wed Sep 20 22:09:19 2006 +0000
     2.2 +++ b/src/video/xbios/SDL_xbios.h	Fri Sep 22 21:52:20 2006 +0000
     2.3 @@ -46,7 +46,7 @@
     2.4  /* Private display data */
     2.5  #define NUM_MODELISTS	2       /* 8 and 16 bits-per-pixel */
     2.6  
     2.7 -struct SDL_VideoData
     2.8 +typedef struct SDL_VideoData
     2.9  {
    2.10      long cookie_vdo;
    2.11      int old_video_mode;         /* Old video mode before entering SDL */
     3.1 --- a/src/video/xbios/SDL_xbios_blowup.c	Wed Sep 20 22:09:19 2006 +0000
     3.2 +++ b/src/video/xbios/SDL_xbios_blowup.c	Fri Sep 22 21:52:20 2006 +0000
     3.3 @@ -57,7 +57,7 @@
     3.4                  || ((blow_mode->monitor == MONITOR_RGB)
     3.5                      && (cookie_blow->montype == MONITOR_TV))) {
     3.6                  /* we can use this extended mode */
     3.7 -                SDL_XBIOS_AddMode(this,
     3.8 +                SDL_XBIOS_AddMode(_this,
     3.9                                    num_mode == 3 ? BPS8 : BPS16,
    3.10                                    blow_mode->width + 1,
    3.11                                    blow_mode->height + 1,