21 |
|
#ifndef VIDEO_H |
22 |
|
#define VIDEO_H |
23 |
|
|
24 |
< |
// Description for one (possibly virtual) monitor |
25 |
< |
enum { |
26 |
< |
VMODE_1BIT, |
27 |
< |
VMODE_2BIT, |
28 |
< |
VMODE_4BIT, |
29 |
< |
VMODE_8BIT, |
30 |
< |
VMODE_16BIT, |
31 |
< |
VMODE_32BIT |
24 |
> |
#include <vector> |
25 |
> |
|
26 |
> |
// Color depth codes |
27 |
> |
enum video_depth { |
28 |
> |
VDEPTH_1BIT, // 2 colors |
29 |
> |
VDEPTH_2BIT, // 4 colors |
30 |
> |
VDEPTH_4BIT, // 16 colors |
31 |
> |
VDEPTH_8BIT, // 256 colors |
32 |
> |
VDEPTH_16BIT, // "Thousands" |
33 |
> |
VDEPTH_32BIT // "Millions" |
34 |
|
}; |
35 |
|
|
36 |
< |
#define IsDirectMode(x) ((x) == VMODE_16BIT || (x) == VMODE_32BIT) |
36 |
> |
inline bool IsDirectMode(video_depth depth) |
37 |
> |
{ |
38 |
> |
return depth == VDEPTH_16BIT || depth == VDEPTH_32BIT; |
39 |
> |
} |
40 |
|
|
41 |
< |
struct video_desc { |
42 |
< |
uint32 mac_frame_base; // Mac frame buffer address |
43 |
< |
uint32 bytes_per_row; // Bytes per row |
41 |
> |
inline uint16 DepthToAppleMode(video_depth depth) |
42 |
> |
{ |
43 |
> |
return depth + 0x80; |
44 |
> |
} |
45 |
> |
|
46 |
> |
inline video_depth AppleModeToDepth(uint16 mode) |
47 |
> |
{ |
48 |
> |
return video_depth(mode - 0x80); |
49 |
> |
} |
50 |
> |
|
51 |
> |
// Description of one video mode |
52 |
> |
struct video_mode { |
53 |
|
uint32 x; // X size of screen (pixels) |
54 |
|
uint32 y; // Y size of screen (pixels) |
55 |
< |
int mode; // Video mode |
55 |
> |
uint32 resolution_id; // Resolution ID (should be >= 0x80 and uniquely identify the sets of modes with the same X/Y size) |
56 |
> |
uint32 bytes_per_row; // Bytes per row of frame buffer |
57 |
> |
video_depth depth; // Color depth (see definitions above) |
58 |
> |
}; |
59 |
> |
|
60 |
> |
inline bool IsDirectMode(const video_mode &mode) |
61 |
> |
{ |
62 |
> |
return IsDirectMode(mode.depth); |
63 |
> |
} |
64 |
> |
|
65 |
> |
// List of all supported video modes |
66 |
> |
extern vector<video_mode> VideoModes; |
67 |
> |
|
68 |
> |
// Description for one (possibly virtual) monitor |
69 |
> |
struct monitor_desc { |
70 |
> |
uint32 mac_frame_base; // Mac frame buffer address |
71 |
> |
video_mode mode; // Currently selected video mode description |
72 |
|
}; |
73 |
|
|
74 |
< |
extern struct video_desc VideoMonitor; // Description of the main monitor, set by VideoInit() |
74 |
> |
extern monitor_desc VideoMonitor; // Description of the main monitor, set by VideoInit() |
75 |
|
|
76 |
|
extern int16 VideoDriverOpen(uint32 pb, uint32 dce); |
77 |
|
extern int16 VideoDriverControl(uint32 pb, uint32 dce); |