|
|
1.1 root 1: /*
1.1.1.5 root 2: Hatari - screen.h
3:
1.1.1.15 root 4: This file is distributed under the GNU General Public License, version 2
5: or at your 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.1.16 root 13: #if WITH_SDL2
14: extern SDL_Window *sdlWindow;
15: static inline int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors,
16: int firstcolor, int ncolors)
17: {
18: return SDL_SetPaletteColors(surface->format->palette, colors,
19: firstcolor, ncolors);
20: }
21: void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects);
22: void SDL_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h);
23: #define SDL_GRAB_OFF false
24: #define SDL_GRAB_ON true
25: #define SDL_WM_GrabInput SDL_SetRelativeMouseMode
26: #endif
1.1 root 27:
1.1.1.11 root 28: /* The 'screen' is a representation of the ST video memory */
29: /* taking into account all the border tricks. Data are stored */
30: /* in 'planar' format (1 word per plane) and are then converted */
31: /* to an SDL buffer that will be displayed. */
32: /* So, all video lines are converted to a unique line of */
33: /* SCREENBYTES_LINE bytes in planar format. */
34: /* SCREENBYTES_LINE should always be a multiple of 8. */
35:
36: /* left/right borders must be multiple of 8 bytes */
37: #define SCREENBYTES_LEFT (nBorderPixelsLeft/2) /* Bytes for left border */
38: #define SCREENBYTES_MIDDLE 160 /* Middle (320 pixels) */
39: #define SCREENBYTES_RIGHT (nBorderPixelsRight/2) /* Right border */
1.1.1.10 root 40: #define SCREENBYTES_LINE (SCREENBYTES_LEFT+SCREENBYTES_MIDDLE+SCREENBYTES_RIGHT)
41: #define SCREENBYTES_MONOLINE 80 /* Byte per line in ST-high resolution */
42:
43: /* Overscan values */
1.1.1.12 root 44: #define OVERSCAN_TOP 29
45: #define MAX_OVERSCAN_BOTTOM 47 /* number of bottom lines to display on screen */
1.1.1.10 root 46:
47: /* Number of visible screen lines including top/bottom borders */
1.1.1.12 root 48: #define NUM_VISIBLE_LINES (OVERSCAN_TOP+200+MAX_OVERSCAN_BOTTOM)
1.1.1.10 root 49:
1.1.1.16 root 50: /* Number of visible pixels on each screen line including left/right borders */
51: #define NUM_VISIBLE_LINE_PIXELS (48+320+48)
52:
1.1.1.13 root 53: /* 1x16 colour palette per screen line, +1 line as may write after line 200 */
1.1.1.14 root 54: #define HBL_PALETTE_LINES ((NUM_VISIBLE_LINES+1 +3 )*16) /* [NP] FIXME we need to handle 313 hbl, not 310 ; palette code is a mess it should be removed */
1.1.1.13 root 55: /* Bit mask of palette colours changes, top bit set is resolution change */
1.1.1.14 root 56: #define HBL_PALETTE_MASKS (NUM_VISIBLE_LINES+1 +3 ) /* [NP] FIXME we need to handle 313 hbl, not 310 ; palette code is a mess it should be removed */
1.1.1.13 root 57:
1.1.1.10 root 58:
1.1 root 59: /* Frame buffer, used to store details in screen conversion */
1.1.1.5 root 60: typedef struct
61: {
1.1.1.13 root 62: Uint16 HBLPalettes[HBL_PALETTE_LINES];
63: Uint32 HBLPaletteMasks[HBL_PALETTE_MASKS];
1.1.1.9 root 64: Uint8 *pSTScreen; /* Copy of screen built up during frame (copy each line on HBL to simulate monitor raster) */
65: Uint8 *pSTScreenCopy; /* Previous frames copy of above */
1.1.1.17! root 66: int VerticalOverscanCopy; /* Previous screen overscan mode */
1.1.1.12 root 67: bool bFullUpdate; /* Set TRUE to cause full update on next draw */
1.1 root 68: } FRAMEBUFFER;
1.1.1.5 root 69:
1.1.1.6 root 70: /* Number of frame buffers (1 or 2) - should be 2 for supporting screen flipping */
71: #define NUM_FRAMEBUFFERS 2
1.1 root 72:
73:
1.1.1.11 root 74: /* ST/TT resolution defines */
1.1.1.5 root 75: enum
76: {
1.1 root 77: ST_LOW_RES,
78: ST_MEDIUM_RES,
79: ST_HIGH_RES,
1.1.1.11 root 80: TT_MEDIUM_RES = 4,
81: TT_HIGH_RES = 6,
82: TT_LOW_RES
1.1 root 83: };
1.1.1.11 root 84: #define ST_MEDIUM_RES_BIT 0x1
85: #define ST_RES_MASK 0x3
1.1 root 86:
87: /* Palette mask values for 'HBLPaletteMask[]' */
88: #define PALETTEMASK_RESOLUTION 0x00040000
1.1.1.2 root 89: #define PALETTEMASK_PALETTE 0x0000ffff
90: #define PALETTEMASK_UPDATERES 0x20000000
91: #define PALETTEMASK_UPDATEPAL 0x40000000
1.1 root 92: #define PALETTEMASK_UPDATEFULL 0x80000000
93: #define PALETTEMASK_UPDATEMASK (PALETTEMASK_UPDATEFULL|PALETTEMASK_UPDATEPAL|PALETTEMASK_UPDATERES)
94:
95:
1.1.1.12 root 96: extern bool bGrabMouse;
97: extern bool bInFullScreen;
1.1.1.11 root 98: extern int nScreenZoomX, nScreenZoomY;
99: extern int nBorderPixelsLeft, nBorderPixelsRight;
1.1.1.9 root 100: extern int STScreenStartHorizLine;
101: extern int STScreenLeftSkipBytes;
102: extern FRAMEBUFFER *pFrameBuffer;
103: extern Uint8 *pSTScreen;
1.1.1.3 root 104: extern SDL_Surface *sdlscrn;
1.1.1.9 root 105: extern Uint32 STRGBPalette[16];
106: extern Uint32 ST2RGB[4096];
1.1 root 107:
108: extern void Screen_Init(void);
109: extern void Screen_UnInit(void);
110: extern void Screen_Reset(void);
1.1.1.17! root 111: extern bool Screen_Lock(void);
! 112: extern void Screen_UnLock(void);
1.1 root 113: extern void Screen_SetFullUpdate(void);
114: extern void Screen_EnterFullScreen(void);
115: extern void Screen_ReturnFromFullScreen(void);
1.1.1.16 root 116: extern void Screen_ModeChanged(bool bForceChange);
1.1.1.12 root 117: extern bool Screen_Draw(void);
1.1.1.16 root 118: extern bool Screen_SetSDLVideoSize(int width, int height, int bitdepth, bool bForceChange);
1.1.1.17! root 119: extern void Screen_SetGenConvSize(int width, int height, int bpp, bool bForceChange);
! 120: extern void Screen_GenConvUpdate(SDL_Rect *extra, bool forced);
! 121: extern Uint32 Screen_GetGenConvWidth(void);
! 122: extern Uint32 Screen_GetGenConvHeight(void);
1.1.1.15 root 123:
1.1.1.5 root 124: #endif /* ifndef HATARI_SCREEN_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.