23 |
|
|
24 |
|
#include <vector> |
25 |
|
|
26 |
+ |
#ifndef NO_STD_NAMESPACE |
27 |
+ |
using std::vector; |
28 |
+ |
#endif |
29 |
+ |
|
30 |
|
/* |
31 |
|
Some of the terminology here is completely frelled. In Basilisk II, a |
32 |
|
"video mode" refers to a combination of resolution and color depth, and |
55 |
|
VDEPTH_32BIT // "Millions" |
56 |
|
}; |
57 |
|
|
58 |
< |
inline uint16 DepthToAppleMode(video_depth depth) |
59 |
< |
{ |
60 |
< |
return depth + 0x80; |
61 |
< |
} |
58 |
> |
// For compatibility reasons with older (pre-Display Manager) versions of |
59 |
> |
// MacOS, the Apple modes must start at 0x80 and be contiguous. Therefore |
60 |
> |
// we construct an array to map the depth codes to the corresponding Apple |
61 |
> |
// mode. This array is initialized by video_init_depth_list() which must |
62 |
> |
// be called by the platform-dependant VideoInit() routine after filling |
63 |
> |
// the VideoModes array. |
64 |
> |
extern uint16 apple_mode_for_depth[6]; |
65 |
|
|
66 |
< |
inline video_depth AppleModeToDepth(uint16 mode) |
66 |
> |
inline uint16 DepthToAppleMode(video_depth depth) |
67 |
|
{ |
68 |
< |
return video_depth(mode - 0x80); |
68 |
> |
return apple_mode_for_depth[depth]; |
69 |
|
} |
70 |
|
|
71 |
|
inline bool IsDirectMode(video_depth depth) |
73 |
|
return depth == VDEPTH_16BIT || depth == VDEPTH_32BIT; |
74 |
|
} |
75 |
|
|
69 |
– |
inline bool IsDirectMode(uint16 mode) |
70 |
– |
{ |
71 |
– |
return IsDirectMode(AppleModeToDepth(mode)); |
72 |
– |
} |
73 |
– |
|
76 |
|
// Return the depth code that corresponds to the specified bits-per-pixel value |
77 |
|
inline video_depth DepthModeForPixelDepth(int depth) |
78 |
|
{ |
97 |
|
case VDEPTH_8BIT: return width; |
98 |
|
case VDEPTH_16BIT: return width * 2; |
99 |
|
case VDEPTH_32BIT: return width * 4; |
100 |
+ |
default: return width; |
101 |
|
} |
102 |
|
} |
103 |
|
|
144 |
|
} |
145 |
|
|
146 |
|
// List of all supported video modes |
147 |
< |
extern std::vector<video_mode> VideoModes; |
147 |
> |
extern vector<video_mode> VideoModes; |
148 |
|
|
149 |
|
// Description for one (possibly virtual) monitor |
150 |
|
struct monitor_desc { |
173 |
|
|
174 |
|
// Called by the video driver to set the color palette (in indexed modes) |
175 |
|
// or gamma table (in direct modes) |
176 |
< |
extern void video_set_palette(uint8 *pal); |
176 |
> |
extern void video_set_palette(uint8 *pal, int num); |
177 |
> |
|
178 |
> |
// Check whether a mode with the specified depth exists |
179 |
> |
extern bool video_has_depth(video_depth depth); |
180 |
> |
|
181 |
> |
// Get bytes-per-row value for specified resolution/depth |
182 |
> |
extern uint32 video_bytes_per_row(video_depth depth, uint32 id); |
183 |
> |
|
184 |
> |
// Initialize apple_mode_for_depth[] array from VideoModes list |
185 |
> |
extern void video_init_depth_list(void); |
186 |
|
|
187 |
|
#endif |