Mercurial > sdl-ios-xcode
changeset 4198:6405314a7c07 SDL-1.2
Define flags for double line and c2p operations. More Milan video work.
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Sun, 20 Sep 2009 12:08:51 +0000 |
parents | 1bf6585720e9 |
children | 4c92a3d196f1 |
files | src/video/xbios/SDL_xbios.c src/video/xbios/SDL_xbios.h src/video/xbios/SDL_xbios_blowup.c src/video/xbios/SDL_xbios_centscreen.c src/video/xbios/SDL_xbios_milan.c src/video/xbios/SDL_xbios_milan.h src/video/xbios/SDL_xbios_sb3.c |
diffstat | 7 files changed, 125 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/xbios/SDL_xbios.c Sat Sep 19 21:58:59 2009 +0000 +++ b/src/video/xbios/SDL_xbios.c Sun Sep 20 12:08:51 2009 +0000 @@ -98,40 +98,40 @@ /* Default list of video modes */ static const xbiosmode_t stmodes[1]={ - {ST_LOW>>8,320,200,4,SDL_FALSE} + {ST_LOW>>8,320,200,4, XBIOSMODE_C2P} }; static const xbiosmode_t ttmodes[2]={ - {TT_LOW,320,480,8,SDL_FALSE}, - {TT_LOW,320,240,8,SDL_TRUE} /* Software double-lined mode */ + {TT_LOW,320,480,8, XBIOSMODE_C2P}, + {TT_LOW,320,240,8, XBIOSMODE_C2P|XBIOSMODE_DOUBLELINE} }; static const xbiosmode_t falconrgbmodes[16]={ - {BPS16|COL80|OVERSCAN|VERTFLAG,768,480,16,SDL_FALSE}, - {BPS16|COL80|OVERSCAN,768,240,16,SDL_FALSE}, - {BPS16|COL80|VERTFLAG,640,400,16,SDL_FALSE}, - {BPS16|COL80,640,200,16,SDL_FALSE}, - {BPS16|OVERSCAN|VERTFLAG,384,480,16,SDL_FALSE}, - {BPS16|OVERSCAN,384,240,16,SDL_FALSE}, - {BPS16|VERTFLAG,320,400,16,SDL_FALSE}, - {BPS16,320,200,16,SDL_FALSE}, - {BPS8|COL80|OVERSCAN|VERTFLAG,768,480,8,SDL_FALSE}, - {BPS8|COL80|OVERSCAN,768,240,8,SDL_FALSE}, - {BPS8|COL80|VERTFLAG,640,400,8,SDL_FALSE}, - {BPS8|COL80,640,200,8,SDL_FALSE}, - {BPS8|OVERSCAN|VERTFLAG,384,480,8,SDL_FALSE}, - {BPS8|OVERSCAN,384,240,8,SDL_FALSE}, - {BPS8|VERTFLAG,320,400,8,SDL_FALSE}, - {BPS8,320,200,8,SDL_FALSE} + {BPS16|COL80|OVERSCAN|VERTFLAG,768,480,16,0}, + {BPS16|COL80|OVERSCAN,768,240,16,0}, + {BPS16|COL80|VERTFLAG,640,400,16,0}, + {BPS16|COL80,640,200,16,0}, + {BPS16|OVERSCAN|VERTFLAG,384,480,16,0}, + {BPS16|OVERSCAN,384,240,16,0}, + {BPS16|VERTFLAG,320,400,16,0}, + {BPS16,320,200,16,0}, + {BPS8|COL80|OVERSCAN|VERTFLAG,768,480,8,XBIOSMODE_C2P}, + {BPS8|COL80|OVERSCAN,768,240,8,XBIOSMODE_C2P}, + {BPS8|COL80|VERTFLAG,640,400,8,XBIOSMODE_C2P}, + {BPS8|COL80,640,200,8,XBIOSMODE_C2P}, + {BPS8|OVERSCAN|VERTFLAG,384,480,8,XBIOSMODE_C2P}, + {BPS8|OVERSCAN,384,240,8,XBIOSMODE_C2P}, + {BPS8|VERTFLAG,320,400,8,XBIOSMODE_C2P}, + {BPS8,320,200,8,XBIOSMODE_C2P} }; static const xbiosmode_t falconvgamodes[6]={ - {BPS16,320,480,16,SDL_FALSE}, - {BPS16|VERTFLAG,320,240,16,SDL_FALSE}, - {BPS8|COL80,640,480,8,SDL_FALSE}, - {BPS8|COL80|VERTFLAG,640,240,8,SDL_FALSE}, - {BPS8,320,480,8,SDL_FALSE}, - {BPS8|VERTFLAG,320,240,8,SDL_FALSE} + {BPS16,320,480,16,0}, + {BPS16|VERTFLAG,320,240,16,0}, + {BPS8|COL80,640,480,8,XBIOSMODE_C2P}, + {BPS8|COL80|VERTFLAG,640,240,8,XBIOSMODE_C2P}, + {BPS8,320,480,8,XBIOSMODE_C2P}, + {BPS8|VERTFLAG,320,240,8,XBIOSMODE_C2P} }; /* Xbios driver bootstrap functions */ @@ -492,7 +492,31 @@ } break; case VDO_MILAN: - SDL_XBIOS_ListMilanModes(this, 0); + { + SCREENINFO si; + + /* Read infos about current mode */ + VsetScreen(-1, &XBIOS_oldvmode, MI_MAGIC, CMD_GETMODE); + this->info.current_w = si.scrWidth; + this->info.current_h = si.scrHeight; + + si.size = sizeof(SCREENINFO); + si.devID = XBIOS_oldvmode; + si.scrFlags = 0; + VsetScreen(-1, &si, MI_MAGIC, CMD_GETINFO); + + XBIOS_oldnumcol = 0; + if (si.scrFlags & SCRINFO_OK) { + if (si.scrPlanes <= 8) { + XBIOS_oldnumcol = 1<<si.scrPlanes; + } + } + if (XBIOS_oldnumcol) { + VgetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); + } + + SDL_XBIOS_ListMilanModes(this, 0); + } break; } @@ -653,7 +677,7 @@ new_screen_size = width * height * ((new_depth)>>3); new_screen_size += 256; /* To align on a 256 byte adress */ - if (new_depth == 8) { + if (new_video_mode->flags & XBIOSMODE_C2P) { XBIOS_shadowscreen = Atari_SysMalloc(new_screen_size, MX_PREFTTRAM); if (XBIOS_shadowscreen == NULL) { @@ -664,10 +688,8 @@ } /* Output buffer needs to be twice in size for the software double-line mode */ - XBIOS_doubleline = SDL_FALSE; - if (new_video_mode->doubleline) { + if (new_video_mode->flags & XBIOSMODE_DOUBLELINE) { new_screen_size <<= 1; - XBIOS_doubleline = SDL_TRUE; } /* Double buffer ? */ @@ -706,14 +728,15 @@ return(NULL); } - current->w = XBIOS_width = width; - current->h = XBIOS_height = height; + XBIOS_current = new_video_mode; + current->w = width; + current->h = height; current->pitch = (width * new_depth)>>3; /* this is for C2P conversion */ XBIOS_pitch = (new_video_mode->width * new_video_mode->depth)>>3; - if (new_depth == 8) + if (new_video_mode->flags & XBIOSMODE_C2P) current->pixels = XBIOS_shadowscreen; else current->pixels = XBIOS_screens[0]; @@ -736,7 +759,11 @@ #ifndef DEBUG_VIDEO_XBIOS /* Now set the video mode */ - Setscreen(-1,XBIOS_screens[0],-1); + if ((XBIOS_cvdo>>16) == VDO_MILAN) { + VsetScreen(-1, XBIOS_screens[0], MI_MAGIC, CMD_SETADR); + } else { + Setscreen(-1,XBIOS_screens[0],-1); + } switch(XBIOS_cvdo >> 16) { case VDO_ST: @@ -772,7 +799,14 @@ } /* Set hardware palette to black in True Colour */ - if (new_depth == 16) { + if (new_depth > 8) { + SDL_memset(F30_palette, 0, sizeof(F30_palette)); + VsetRGB(0,256,F30_palette); + } + break; + case VDO_MILAN: + /* Set hardware palette to black in True Colour */ + if (new_depth > 8) { SDL_memset(F30_palette, 0, sizeof(F30_palette)); VsetRGB(0,256,F30_palette); } @@ -814,8 +848,9 @@ surface = this->screen; - if ((surface->format->BitsPerPixel) == 8) { + if (XBIOS_current->flags & XBIOSMODE_C2P) { int i; + int doubleline = (XBIOS_current->flags & XBIOSMODE_DOUBLELINE ? 1 : 0); for (i=0;i<numrects;i++) { void *source,*destination; @@ -841,7 +876,7 @@ destination, x2-x1, rects[i].h, - XBIOS_doubleline, + doubleline, surface->pitch, XBIOS_pitch ); @@ -849,14 +884,18 @@ } #ifndef DEBUG_VIDEO_XBIOS - Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); + if ((XBIOS_cvdo>>16) == VDO_MILAN) { + VsetScreen(-1, XBIOS_screens[XBIOS_fbnum], MI_MAGIC, CMD_SETADR); + } else { + Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); + } Vsync(); #endif if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) { XBIOS_fbnum ^= 1; - if ((surface->format->BitsPerPixel) > 8) { + if ((XBIOS_current->flags & XBIOSMODE_C2P) == 0) { surface->pixels=XBIOS_screens[XBIOS_fbnum]; } } @@ -864,14 +903,15 @@ static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface) { - if ((surface->format->BitsPerPixel) == 8) { + if (XBIOS_current->flags & XBIOSMODE_C2P) { void *destscr; int destx; + int doubleline = (XBIOS_current->flags & XBIOSMODE_DOUBLELINE ? 1 : 0); /* Center on destination screen */ destscr = XBIOS_screens[XBIOS_fbnum]; - destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1); - destx = (XBIOS_width - surface->w) >> 1; + destscr += XBIOS_pitch * ((XBIOS_current->height - surface->h) >> 1); + destx = (XBIOS_current->width - surface->w) >> 1; destx &= ~15; destscr += destx; @@ -881,21 +921,25 @@ destscr, surface->w, surface->h, - XBIOS_doubleline, + doubleline, surface->pitch, XBIOS_pitch ); } #ifndef DEBUG_VIDEO_XBIOS - Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); + if ((XBIOS_cvdo>>16) == VDO_MILAN) { + VsetScreen(-1, XBIOS_screens[XBIOS_fbnum], MI_MAGIC, CMD_SETADR); + } else { + Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); + } Vsync(); #endif if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) { XBIOS_fbnum ^= 1; - if ((surface->format->BitsPerPixel) > 8) { + if ((XBIOS_current->flags & XBIOSMODE_C2P) == 0) { surface->pixels=XBIOS_screens[XBIOS_fbnum]; } } @@ -934,6 +978,7 @@ EsetPalette(firstcolor,ncolors,TT_palette); break; case VDO_F30: + case VDO_MILAN: for(i = 0; i < ncolors; i++) { r = colors[i].r; @@ -987,6 +1032,12 @@ VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); } break; + case VDO_MILAN: + VsetScreen(-1, &XBIOS_oldvmode, MI_MAGIC, CMD_SETMODE); + if (XBIOS_oldnumcol) { + VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); + } + break; } Vsync(); #endif
--- a/src/video/xbios/SDL_xbios.h Sat Sep 19 21:58:59 2009 +0000 +++ b/src/video/xbios/SDL_xbios.h Sun Sep 20 12:08:51 2009 +0000 @@ -30,13 +30,16 @@ /* Hidden "this" pointer for the video functions */ #define _THIS SDL_VideoDevice *this +#define XBIOSMODE_DOUBLELINE (1<<0) +#define XBIOSMODE_C2P (1<<1) + typedef struct { Uint16 number; /* Video mode number */ Uint16 width; /* Size */ Uint16 height; Uint16 depth; /* bits per plane */ - SDL_bool doubleline; /* Double the lines ? */ + Uint16 flags; } xbiosmode_t; /* Private display data */ @@ -44,7 +47,7 @@ struct SDL_PrivateVideoData { long cookie_vdo; - int old_video_mode; /* Old video mode before entering SDL */ + long old_video_mode; /* Old video mode before entering SDL */ void *old_video_base; /* Old pointer to screen buffer */ void *old_palette; /* Old palette */ Uint32 old_num_colors; /* Nb of colors in saved palette */ @@ -52,13 +55,12 @@ void *screens[2]; /* Pointers to aligned screen buffer */ void *screensmem[2]; /* Pointers to screen buffer */ void *shadowscreen; /* Shadow screen for c2p conversion */ - int doubleline; /* Double line mode ? */ int frame_number; /* Number of frame for double buffer */ int pitch; /* Destination line width for C2P */ - int width, height; /* Screen size for centered C2P */ SDL_bool centscreen; /* Centscreen extension present ? */ + xbiosmode_t *current; /* Current set mode */ int SDL_nummodes[NUM_MODELISTS]; SDL_Rect **SDL_modelist[NUM_MODELISTS]; xbiosmode_t **SDL_xbiosmode[NUM_MODELISTS]; @@ -107,12 +109,10 @@ #define XBIOS_screens (this->hidden->screens) #define XBIOS_screensmem (this->hidden->screensmem) #define XBIOS_shadowscreen (this->hidden->shadowscreen) -#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 XBIOS_current (this->hidden->current) /*--- Functions prototypes ---*/
--- a/src/video/xbios/SDL_xbios_blowup.c Sat Sep 19 21:58:59 2009 +0000 +++ b/src/video/xbios/SDL_xbios_blowup.c Sun Sep 20 12:08:51 2009 +0000 @@ -68,7 +68,7 @@ modeinfo.width = blow_mode->width + 1; modeinfo.height = blow_mode->height + 1; modeinfo.depth = (num_mode == 3 ? 8 : 16); - modeinfo.doubleline = SDL_FALSE; + modeinfo.flags = (modeinfo.depth == 8 ? XBIOSMODE_C2P : 0); SDL_XBIOS_AddMode(this, actually_add, &modeinfo); }
--- a/src/video/xbios/SDL_xbios_centscreen.c Sat Sep 19 21:58:59 2009 +0000 +++ b/src/video/xbios/SDL_xbios_centscreen.c Sun Sep 20 12:08:51 2009 +0000 @@ -57,7 +57,7 @@ modeinfo.width = listedmode.physx; modeinfo.height = listedmode.physy; modeinfo.depth = listedmode.plan; - modeinfo.doubleline = SDL_FALSE; + modeinfo.flags = (modeinfo.depth == 8 ? XBIOSMODE_C2P : 0); SDL_XBIOS_AddMode(this, actually_add, &modeinfo); }
--- a/src/video/xbios/SDL_xbios_milan.c Sat Sep 19 21:58:59 2009 +0000 +++ b/src/video/xbios/SDL_xbios_milan.c Sun Sep 20 12:08:51 2009 +0000 @@ -73,7 +73,7 @@ modeinfo.width = inf->scrWidth; modeinfo.height = inf->scrHeight; modeinfo.depth = inf->scrPlanes; - modeinfo.doubleline = SDL_FALSE; + modeinfo.flags = 0; SDL_XBIOS_AddMode(enum_this, enum_actually_add, &modeinfo); @@ -84,8 +84,6 @@ { int i; - /* Read infos about current mode */ - /* Read validated predefined modes */ for (i=0; i<NUM_PREDEFINED_MODES; i++) { int j; @@ -99,7 +97,7 @@ modeinfo.width = mode_list[i].width; modeinfo.height = mode_list[i].height; modeinfo.depth = mode_bpp[j-1]; - modeinfo.doubleline = SDL_FALSE; + modeinfo.flags = 0; SDL_XBIOS_AddMode(this, actually_add, &modeinfo); }
--- a/src/video/xbios/SDL_xbios_milan.h Sat Sep 19 21:58:59 2009 +0000 +++ b/src/video/xbios/SDL_xbios_milan.h Sun Sep 20 12:08:51 2009 +0000 @@ -70,10 +70,23 @@ BLK_CLEARED }; -/* bitFlags */ -#define STANDARD_BITS 1 -#define FALCON_BITS 2 -#define INTEL_BITS 8 +/* scrFlags */ +#define SCRINFO_OK 1 + +/* scrClut */ +#define NO_CLUT 0 +#define HARD_CLUT 1 +#define SOFT_CLUT 2 + +/* scrFormat */ +#define INTERLEAVE_PLANES 0 +#define STANDARD_PLANES 1 +#define PACKEDPIX_PLANES 2 + +/* bitFlags */ +#define STANDARD_BITS 1 +#define FALCON_BITS 2 +#define INTEL_BITS 8 /*--- Structures ---*/
--- a/src/video/xbios/SDL_xbios_sb3.c Sat Sep 19 21:58:59 2009 +0000 +++ b/src/video/xbios/SDL_xbios_sb3.c Sun Sep 20 12:08:51 2009 +0000 @@ -77,7 +77,7 @@ modeinfo.width = scrinfo->virtual_width; modeinfo.height = scrinfo->virtual_height; modeinfo.depth = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]); - modeinfo.doubleline = SDL_FALSE; + modeinfo.flags = (modeinfo.depth == 8 ? XBIOSMODE_C2P : 0); SDL_XBIOS_AddMode(this, actually_add, &modeinfo); }