mirror of
https://github.com/yawut/SDL.git
synced 2026-10-02 05:06:46 -05:00
Start Milan video support
--HG-- branch : SDL-1.2
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include "SDL_xbios_centscreen.h"
|
||||
#include "SDL_xbios_sb3.h"
|
||||
#include "SDL_xbios_tveille.h"
|
||||
#include "SDL_xbios_milan.h"
|
||||
|
||||
#define XBIOS_VID_DRIVER_NAME "xbios"
|
||||
|
||||
@@ -183,6 +184,8 @@ static int XBIOS_Available(void)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VDO_MILAN:
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -488,6 +491,9 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VDO_MILAN:
|
||||
SDL_XBIOS_ListMilanModes(this, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
for ( i=0; i<NUM_MODELISTS; ++i ) {
|
||||
@@ -552,6 +558,9 @@ static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VDO_MILAN:
|
||||
SDL_XBIOS_ListMilanModes(this, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
XBIOS_screens[0]=NULL;
|
||||
@@ -694,7 +703,7 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
XBIOS_screens[1]=(void *) (( (long) XBIOS_screensmem[1]+256) & 0xFFFFFF00UL);
|
||||
modeflags |= SDL_DOUBLEBUF;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate the new pixel format for the screen */
|
||||
if ( ! SDL_ReallocFormat(current, new_depth, 0, 0, 0, 0) ) {
|
||||
XBIOS_FreeBuffers(this);
|
||||
|
||||
@@ -69,7 +69,8 @@ enum {
|
||||
VDO_ST=0,
|
||||
VDO_STE,
|
||||
VDO_TT,
|
||||
VDO_F30
|
||||
VDO_F30,
|
||||
VDO_MILAN
|
||||
};
|
||||
|
||||
/* Monitor types */
|
||||
|
||||
87
src/video/xbios/SDL_xbios_milan.c
Normal file
87
src/video/xbios/SDL_xbios_milan.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
/*
|
||||
Milan Xbios video functions
|
||||
|
||||
Patrice Mandin
|
||||
*/
|
||||
|
||||
#include <mint/cookie.h>
|
||||
|
||||
#include "SDL_xbios.h"
|
||||
#include "SDL_xbios_milan.h"
|
||||
|
||||
#ifndef Validmode
|
||||
#define Validmode(mode) \
|
||||
(short)trap_14_ww((short)0x5f,(short)(mode))
|
||||
#endif
|
||||
|
||||
#define NUM_PREDEFINED_MODES 7
|
||||
|
||||
typedef struct {
|
||||
Uint16 width, height;
|
||||
} predefined_mode_t;
|
||||
|
||||
static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
|
||||
{640,400},
|
||||
{640,480},
|
||||
{800,608},
|
||||
{1024,768},
|
||||
{1152,864},
|
||||
{1280,1024},
|
||||
{1600,1200}
|
||||
};
|
||||
|
||||
static const Uint8 mode_bpp[4]={
|
||||
8, 15, 16, 32
|
||||
};
|
||||
|
||||
void SDL_XBIOS_ListMilanModes(_THIS, int actually_add)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Read infos about current mode */
|
||||
|
||||
/* Read validated predefined modes */
|
||||
for (i=0; i<NUM_PREDEFINED_MODES; i++) {
|
||||
int j;
|
||||
Uint16 deviceid = 0x1000 + (i<<4);
|
||||
|
||||
for (j=1; j<4; j++) {
|
||||
if (Validmode(deviceid + j)) {
|
||||
xbiosmode_t modeinfo;
|
||||
|
||||
modeinfo.number = deviceid + j;
|
||||
modeinfo.width = mode_list[i].width;
|
||||
modeinfo.height = mode_list[i].height;
|
||||
modeinfo.depth = mode_bpp[j-1];
|
||||
modeinfo.doubleline = SDL_FALSE;
|
||||
|
||||
SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Read custom created modes */
|
||||
}
|
||||
125
src/video/xbios/SDL_xbios_milan.h
Normal file
125
src/video/xbios/SDL_xbios_milan.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
/*
|
||||
Milan Xbios video functions
|
||||
|
||||
Patrice Mandin
|
||||
*/
|
||||
|
||||
#ifndef _SDL_xbios_milan_h
|
||||
#define _SDL_xbios_milan_h
|
||||
|
||||
#include "SDL_xbios.h"
|
||||
|
||||
/*--- Defines ---*/
|
||||
|
||||
/* Cookies */
|
||||
#ifndef C__MIL
|
||||
#define C__MIL 0x5F4D494CL
|
||||
#endif
|
||||
|
||||
#ifndef C__VDI
|
||||
#define C__VDI 0x5F564449L
|
||||
#endif
|
||||
|
||||
/* Vsetscreen() parameters */
|
||||
#define MI_MAGIC 0x4D49
|
||||
|
||||
enum {
|
||||
CMD_GETMODE=0,
|
||||
CMD_SETMODE,
|
||||
CMD_GETINFO,
|
||||
CMD_ALLOCPAGE,
|
||||
CMD_FREEPAGE,
|
||||
CMD_FLIPPAGE,
|
||||
CMD_ALLOCMEM,
|
||||
CMD_FREEMEM,
|
||||
CMD_SETADR,
|
||||
CMD_ENUMMODES
|
||||
};
|
||||
|
||||
enum {
|
||||
ENUMMODE_EXIT=0,
|
||||
ENUMMODE_CONT
|
||||
};
|
||||
|
||||
enum {
|
||||
BLK_ERR=0,
|
||||
BLK_OK,
|
||||
BLK_CLEARED
|
||||
};
|
||||
|
||||
/* bitFlags */
|
||||
#define STANDARD_BITS 1
|
||||
#define FALCON_BITS 2
|
||||
#define INTEL_BITS 8
|
||||
|
||||
/*--- Structures ---*/
|
||||
|
||||
typedef struct _scrblk {
|
||||
unsigned long size; /* size of strukture */
|
||||
unsigned long blk_status; /* status bits of blk */
|
||||
unsigned long blk_start; /* Start Adress */
|
||||
unsigned long blk_len; /* length of memblk */
|
||||
unsigned long blk_x; /* x pos in total screen*/
|
||||
unsigned long blk_y; /* y pos in total screen */
|
||||
unsigned long blk_w; /* width */
|
||||
unsigned long blk_h; /* height */
|
||||
unsigned long blk_wrap; /* width in bytes */
|
||||
} __attribute__((packed)) SCRMEMBLK;
|
||||
|
||||
typedef struct screeninfo {
|
||||
unsigned long size; /* Size of structure */
|
||||
unsigned long devID; /* device id number */
|
||||
unsigned char name[64]; /* Friendly name of Screen */
|
||||
unsigned long scrFlags; /* some Flags */
|
||||
unsigned long frameadr; /* Adress of framebuffer */
|
||||
unsigned long scrHeight; /* visible X res */
|
||||
unsigned long scrWidth; /* visible Y res */
|
||||
unsigned long virtHeight; /* virtual X res */
|
||||
unsigned long virtWidth; /* virtual Y res */
|
||||
unsigned long scrPlanes; /* color Planes */
|
||||
unsigned long scrColors; /* # of colors */
|
||||
unsigned long lineWrap; /* # of Bytes to next line */
|
||||
unsigned long planeWarp; /* # of Bytes to next plane */
|
||||
unsigned long scrFormat; /* screen Format */
|
||||
unsigned long scrClut; /* type of clut */
|
||||
unsigned long redBits; /* Mask of Red Bits */
|
||||
unsigned long greenBits; /* Mask of Green Bits */
|
||||
unsigned long blueBits; /* Mask of Blue Bits */
|
||||
unsigned long alphaBits; /* Mask of Alpha Bits */
|
||||
unsigned long genlockBits;/* Mask of Genlock Bits */
|
||||
unsigned long unusedBits; /* Mask of unused Bits */
|
||||
unsigned long bitFlags; /* Bits organisation flags */
|
||||
unsigned long maxmem; /* max. memory in this mode */
|
||||
unsigned long pagemem; /* needed memory for one page */
|
||||
unsigned long max_x; /* max. possible width */
|
||||
unsigned long max_y; /* max. possible heigth */
|
||||
} __attribute__((packed)) SCREENINFO;
|
||||
|
||||
/*--- Functions prototypes ---*/
|
||||
|
||||
void SDL_XBIOS_ListMilanModes(_THIS, int actually_add);
|
||||
|
||||
#endif /* _SDL_xbios_milan_h */
|
||||
Reference in New Issue
Block a user