|
|
1.1 root 1: /*
1.1.1.5 root 2: Hatari - screen.h
3:
4: This file is distributed under the GNU Public License, version 2 or at your
5: option any later version. Read the file gpl.txt for details.
1.1 root 6: */
7:
1.1.1.5 root 8: #ifndef HATARI_SCREEN_H
9: #define HATARI_SCREEN_H
1.1.1.3 root 10:
11: #include <SDL_video.h> /* for SDL_Surface */
12:
1.1 root 13:
1.1.1.11 root 14: /* The 'screen' is a representation of the ST video memory */
15: /* taking into account all the border tricks. Data are stored */
16: /* in 'planar' format (1 word per plane) and are then converted */
17: /* to an SDL buffer that will be displayed. */
18: /* So, all video lines are converted to a unique line of */
19: /* SCREENBYTES_LINE bytes in planar format. */
20: /* SCREENBYTES_LINE should always be a multiple of 8. */
21:
22: /* left/right borders must be multiple of 8 bytes */
23: #define SCREENBYTES_LEFT (nBorderPixelsLeft/2) /* Bytes for left border */
24: #define SCREENBYTES_MIDDLE 160 /* Middle (320 pixels) */
25: #define SCREENBYTES_RIGHT (nBorderPixelsRight/2) /* Right border */
1.1.1.10 root 26: #define SCREENBYTES_LINE (SCREENBYTES_LEFT+SCREENBYTES_MIDDLE+SCREENBYTES_RIGHT)
27: #define SCREENBYTES_MONOLINE 80 /* Byte per line in ST-high resolution */
28:
29: /* Overscan values */
1.1.1.12 root 30: #define OVERSCAN_TOP 29
31: #define MAX_OVERSCAN_BOTTOM 47 /* number of bottom lines to display on screen */
1.1.1.10 root 32:
33: /* Number of visible screen lines including top/bottom borders */
1.1.1.12 root 34: #define NUM_VISIBLE_LINES (OVERSCAN_TOP+200+MAX_OVERSCAN_BOTTOM)
1.1.1.10 root 35:
1.1.1.13! root 36: /* 1x16 colour palette per screen line, +1 line as may write after line 200 */
! 37: #define HBL_PALETTE_LINES ((NUM_VISIBLE_LINES+1)*16)
! 38: /* Bit mask of palette colours changes, top bit set is resolution change */
! 39: #define HBL_PALETTE_MASKS (NUM_VISIBLE_LINES+1)
! 40:
1.1.1.10 root 41:
1.1 root 42: /* Frame buffer, used to store details in screen conversion */
1.1.1.5 root 43: typedef struct
44: {
1.1.1.13! root 45: Uint16 HBLPalettes[HBL_PALETTE_LINES];
! 46: Uint32 HBLPaletteMasks[HBL_PALETTE_MASKS];
1.1.1.9 root 47: Uint8 *pSTScreen; /* Copy of screen built up during frame (copy each line on HBL to simulate monitor raster) */
48: Uint8 *pSTScreenCopy; /* Previous frames copy of above */
49: int OverscanModeCopy; /* Previous screen overscan mode */
1.1.1.12 root 50: bool bFullUpdate; /* Set TRUE to cause full update on next draw */
1.1 root 51: } FRAMEBUFFER;
1.1.1.5 root 52:
1.1.1.6 root 53: /* Number of frame buffers (1 or 2) - should be 2 for supporting screen flipping */
54: #define NUM_FRAMEBUFFERS 2
1.1 root 55:
56:
1.1.1.11 root 57: /* ST/TT resolution defines */
1.1.1.5 root 58: enum
59: {
1.1 root 60: ST_LOW_RES,
61: ST_MEDIUM_RES,
62: ST_HIGH_RES,
1.1.1.11 root 63: TT_MEDIUM_RES = 4,
64: TT_HIGH_RES = 6,
65: TT_LOW_RES
1.1 root 66: };
1.1.1.11 root 67: #define ST_MEDIUM_RES_BIT 0x1
68: #define ST_RES_MASK 0x3
1.1 root 69:
70: /* Palette mask values for 'HBLPaletteMask[]' */
71: #define PALETTEMASK_RESOLUTION 0x00040000
1.1.1.2 root 72: #define PALETTEMASK_PALETTE 0x0000ffff
73: #define PALETTEMASK_UPDATERES 0x20000000
74: #define PALETTEMASK_UPDATEPAL 0x40000000
1.1 root 75: #define PALETTEMASK_UPDATEFULL 0x80000000
76: #define PALETTEMASK_UPDATEMASK (PALETTEMASK_UPDATEFULL|PALETTEMASK_UPDATEPAL|PALETTEMASK_UPDATERES)
77:
78: /* Overscan values */
1.1.1.5 root 79: enum
80: {
1.1.1.2 root 81: OVERSCANMODE_NONE, /* 0x00 */
82: OVERSCANMODE_TOP, /* 0x01 */
83: OVERSCANMODE_BOTTOM /* 0x02 (Top+Bottom) 0x03 */
1.1 root 84: };
85:
1.1.1.12 root 86: extern bool bGrabMouse;
87: extern bool bInFullScreen;
1.1.1.11 root 88: extern int nScreenZoomX, nScreenZoomY;
89: extern int nBorderPixelsLeft, nBorderPixelsRight;
1.1.1.9 root 90: extern int STScreenStartHorizLine;
91: extern int STScreenLeftSkipBytes;
92: extern FRAMEBUFFER *pFrameBuffer;
93: extern Uint8 *pSTScreen;
1.1.1.3 root 94: extern SDL_Surface *sdlscrn;
1.1.1.9 root 95: extern Uint32 STRGBPalette[16];
96: extern Uint32 ST2RGB[4096];
1.1 root 97:
98: extern void Screen_Init(void);
99: extern void Screen_UnInit(void);
100: extern void Screen_Reset(void);
101: extern void Screen_SetFullUpdate(void);
102: extern void Screen_EnterFullScreen(void);
103: extern void Screen_ReturnFromFullScreen(void);
1.1.1.11 root 104: extern void Screen_ModeChanged(void);
1.1.1.12 root 105: extern bool Screen_Draw(void);
1.1.1.3 root 106:
1.1.1.5 root 107: #endif /* ifndef HATARI_SCREEN_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.