62 |
|
static UWORD *current_pointer = (UWORD *)-1; // Currently visible mouse pointer data |
63 |
|
static LONG black_pen = -1, white_pen = -1; |
64 |
|
static struct Process *periodic_proc = NULL; // Periodic process |
65 |
+ |
static int window_width, window_height; // width and height for window display |
66 |
+ |
static ULONG screen_mode_id; // mode ID for screen display |
67 |
|
|
68 |
|
extern struct Task *MainTask; // Pointer to main task (from main_amiga.cpp) |
69 |
|
|
90 |
|
|
91 |
|
|
92 |
|
// Prototypes |
93 |
+ |
static bool video_open(const video_mode &mode); |
94 |
+ |
static void video_close(); |
95 |
|
static void periodic_func(void); |
96 |
+ |
static void add_mode(uint32 width, uint32 height, uint32 resolution_id, uint32 bytes_per_row, video_depth depth); |
97 |
+ |
static void add_modes(uint32 width, uint32 height, video_depth depth); |
98 |
+ |
static ULONG find_mode_for_depth(uint32 width, uint32 height, uint32 depth); |
99 |
+ |
static ULONG bits_from_depth(video_depth depth); |
100 |
+ |
static bool is_valid_modeid(int display_type, ULONG mode_id); |
101 |
+ |
static bool check_modeid_p96(ULONG mode_id); |
102 |
+ |
static bool check_modeid_cgfx(ULONG mode_id); |
103 |
|
|
104 |
|
|
105 |
|
/* |
106 |
|
* Initialization |
107 |
|
*/ |
108 |
|
|
98 |
– |
// Add resolution to list of supported modes and set VideoMonitor |
99 |
– |
static void set_video_monitor(uint32 width, uint32 height, uint32 bytes_per_row, int depth) |
100 |
– |
{ |
101 |
– |
video_mode mode; |
102 |
– |
|
103 |
– |
mode.x = width; |
104 |
– |
mode.y = height; |
105 |
– |
mode.resolution_id = 0x80; |
106 |
– |
mode.bytes_per_row = bytes_per_row; |
107 |
– |
|
108 |
– |
switch (depth) { |
109 |
– |
case 1: |
110 |
– |
mode.depth = VDEPTH_1BIT; |
111 |
– |
break; |
112 |
– |
case 2: |
113 |
– |
mode.depth = VDEPTH_2BIT; |
114 |
– |
break; |
115 |
– |
case 4: |
116 |
– |
mode.depth = VDEPTH_4BIT; |
117 |
– |
break; |
118 |
– |
case 8: |
119 |
– |
mode.depth = VDEPTH_8BIT; |
120 |
– |
break; |
121 |
– |
case 15: |
122 |
– |
case 16: |
123 |
– |
mode.depth = VDEPTH_16BIT; |
124 |
– |
break; |
125 |
– |
case 24: |
126 |
– |
case 32: |
127 |
– |
mode.depth = VDEPTH_32BIT; |
128 |
– |
break; |
129 |
– |
} |
130 |
– |
|
131 |
– |
VideoModes.push_back(mode); |
132 |
– |
video_init_depth_list(); |
133 |
– |
VideoMonitor.mode = mode; |
134 |
– |
} |
109 |
|
|
110 |
|
// Open window |
111 |
|
static bool init_window(int width, int height) |
141 |
|
} |
142 |
|
|
143 |
|
// Add resolution and set VideoMonitor |
170 |
– |
set_video_monitor(width, height, the_bitmap->BytesPerRow, 1); |
144 |
|
VideoMonitor.mac_frame_base = (uint32)the_bitmap->Planes[0]; |
145 |
|
|
146 |
|
// Set FgPen and BgPen |
189 |
|
|
190 |
|
// Add resolution and set VideoMonitor |
191 |
|
VideoMonitor.mac_frame_base = p96GetBitMapAttr(the_bitmap, P96BMA_MEMORY); |
192 |
< |
set_video_monitor(width, height, p96GetBitMapAttr(the_bitmap, P96BMA_BYTESPERROW), 16); |
192 |
> |
|
193 |
|
return true; |
194 |
|
} |
195 |
|
|
200 |
|
ADBSetRelMouseMode(true); |
201 |
|
|
202 |
|
// Check if the mode is one we can handle |
203 |
< |
uint32 depth = p96GetModeIDAttr(mode_id, P96IDA_DEPTH); |
204 |
< |
uint32 format = p96GetModeIDAttr(mode_id, P96IDA_RGBFORMAT); |
205 |
< |
|
206 |
< |
switch (depth) { |
207 |
< |
case 8: |
235 |
< |
break; |
236 |
< |
case 15: |
237 |
< |
case 16: |
238 |
< |
if (format != RGBFB_R5G5B5) { |
239 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
240 |
< |
return false; |
241 |
< |
} |
242 |
< |
break; |
243 |
< |
case 24: |
244 |
< |
case 32: |
245 |
< |
if (format != RGBFB_A8R8G8B8) { |
246 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
247 |
< |
return false; |
248 |
< |
} |
249 |
< |
break; |
250 |
< |
default: |
251 |
< |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
252 |
< |
return false; |
253 |
< |
} |
203 |
> |
if (!check_modeid_p96(mode_id)) |
204 |
> |
{ |
205 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
206 |
> |
return false; |
207 |
> |
} |
208 |
|
|
209 |
|
// Yes, get width and height |
210 |
+ |
uint32 depth = p96GetModeIDAttr(mode_id, P96IDA_DEPTH); |
211 |
|
uint32 width = p96GetModeIDAttr(mode_id, P96IDA_WIDTH); |
212 |
|
uint32 height = p96GetModeIDAttr(mode_id, P96IDA_HEIGHT); |
213 |
|
|
230 |
|
the_win = OpenWindowTags(NULL, |
231 |
|
WA_Left, 0, WA_Top, 0, |
232 |
|
WA_Width, width, WA_Height, height, |
233 |
+ |
WA_SimpleRefresh, TRUE, |
234 |
|
WA_NoCareRefresh, TRUE, |
235 |
|
WA_Borderless, TRUE, |
236 |
|
WA_Activate, TRUE, |
247 |
|
ScreenToFront(the_screen); |
248 |
|
|
249 |
|
// Add resolution and set VideoMonitor |
294 |
– |
set_video_monitor(width, height, p96GetBitMapAttr(the_screen->RastPort.BitMap, P96BMA_BYTESPERROW), depth); |
250 |
|
VideoMonitor.mac_frame_base = p96GetBitMapAttr(the_screen->RastPort.BitMap, P96BMA_MEMORY); |
251 |
+ |
|
252 |
|
return true; |
253 |
|
} |
254 |
|
|
259 |
|
ADBSetRelMouseMode(true); |
260 |
|
|
261 |
|
// Check if the mode is one we can handle |
262 |
< |
uint32 depth = GetCyberIDAttr(CYBRIDATTR_DEPTH, mode_id); |
263 |
< |
uint32 format = GetCyberIDAttr(CYBRIDATTR_PIXFMT, mode_id); |
264 |
< |
|
265 |
< |
switch (depth) { |
266 |
< |
case 8: |
311 |
< |
break; |
312 |
< |
case 15: |
313 |
< |
case 16: |
314 |
< |
// !!! PIXFMT_RGB15 is correct !!! |
315 |
< |
if (format != PIXFMT_RGB15) { |
316 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
317 |
< |
return false; |
318 |
< |
} |
319 |
< |
break; |
320 |
< |
case 24: |
321 |
< |
case 32: |
322 |
< |
if (format != PIXFMT_ARGB32) { |
323 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
324 |
< |
return false; |
325 |
< |
} |
326 |
< |
break; |
327 |
< |
default: |
328 |
< |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
329 |
< |
return false; |
330 |
< |
} |
262 |
> |
if (!check_modeid_cgfx(mode_id)) |
263 |
> |
{ |
264 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
265 |
> |
return false; |
266 |
> |
} |
267 |
|
|
268 |
|
// Yes, get width and height |
269 |
+ |
uint32 depth = GetCyberIDAttr(CYBRIDATTR_DEPTH, mode_id); |
270 |
|
uint32 width = GetCyberIDAttr(CYBRIDATTR_WIDTH, mode_id); |
271 |
|
uint32 height = GetCyberIDAttr(CYBRIDATTR_HEIGHT, mode_id); |
272 |
|
|
287 |
|
the_win = OpenWindowTags(NULL, |
288 |
|
WA_Left, 0, WA_Top, 0, |
289 |
|
WA_Width, width, WA_Height, height, |
290 |
+ |
WA_SimpleRefresh, TRUE, |
291 |
|
WA_NoCareRefresh, TRUE, |
292 |
|
WA_Borderless, TRUE, |
293 |
|
WA_Activate, TRUE, |
312 |
|
TAG_END |
313 |
|
); |
314 |
|
UnLockBitMap(handle); |
315 |
< |
set_video_monitor(width, height, GetCyberMapAttr(the_screen->RastPort.BitMap, CYBRMATTR_XMOD), depth); |
315 |
> |
|
316 |
|
VideoMonitor.mac_frame_base = frame_base; |
317 |
+ |
|
318 |
|
return true; |
319 |
|
} |
320 |
|
|
321 |
|
bool VideoInit(bool classic) |
322 |
|
{ |
323 |
+ |
int default_width, default_height, default_depth; |
324 |
+ |
|
325 |
|
// Allocate blank mouse pointer data |
326 |
|
null_pointer = (UWORD *)AllocMem(12, MEMF_PUBLIC | MEMF_CHIP | MEMF_CLEAR); |
327 |
|
if (null_pointer == NULL) { |
343 |
|
|
344 |
|
// Determine type and mode |
345 |
|
display_type = DISPLAY_WINDOW; |
346 |
< |
int width = 512, height = 384; |
347 |
< |
ULONG mode_id = 0; |
346 |
> |
|
347 |
> |
default_width = window_width = 512; |
348 |
> |
default_height = window_height = 384; |
349 |
> |
|
350 |
|
if (mode_str) { |
351 |
< |
if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2) |
351 |
> |
if (sscanf(mode_str, "win/%d/%d", &window_width, &window_height) == 2) |
352 |
|
display_type = DISPLAY_WINDOW; |
353 |
< |
else if (sscanf(mode_str, "pip/%d/%d", &width, &height) == 2 && P96Base) |
353 |
> |
else if (sscanf(mode_str, "pip/%d/%d", &window_width, &window_height) == 2 && P96Base) |
354 |
|
display_type = DISPLAY_PIP; |
355 |
< |
else if (sscanf(mode_str, "scr/%08lx", &mode_id) == 1 && (CyberGfxBase || P96Base)) { |
356 |
< |
if (P96Base && p96GetModeIDAttr(mode_id, P96IDA_ISP96)) |
355 |
> |
else if (sscanf(mode_str, "scr/%08lx", &screen_mode_id) == 1 && (CyberGfxBase || P96Base)) { |
356 |
> |
if (P96Base && p96GetModeIDAttr(screen_mode_id, P96IDA_ISP96)) |
357 |
|
display_type = DISPLAY_SCREEN_P96; |
358 |
< |
else if (CyberGfxBase && IsCyberModeID(mode_id)) |
358 |
> |
else if (CyberGfxBase && IsCyberModeID(screen_mode_id)) |
359 |
|
display_type = DISPLAY_SCREEN_CGFX; |
360 |
|
else { |
361 |
|
ErrorAlert(STR_NO_P96_MODE_ERR); |
364 |
|
} |
365 |
|
} |
366 |
|
|
367 |
+ |
// Construct list of supported modes |
368 |
+ |
switch (display_type) { |
369 |
+ |
case DISPLAY_WINDOW: |
370 |
+ |
default_width = window_width; |
371 |
+ |
default_height = window_height; |
372 |
+ |
default_depth = 1; |
373 |
+ |
add_modes(window_width, window_height, VDEPTH_1BIT); |
374 |
+ |
break; |
375 |
+ |
|
376 |
+ |
case DISPLAY_PIP: |
377 |
+ |
default_depth = 16; |
378 |
+ |
default_width = window_width; |
379 |
+ |
default_height = window_height; |
380 |
+ |
add_modes(window_width, window_height, VDEPTH_16BIT); |
381 |
+ |
break; |
382 |
+ |
|
383 |
+ |
case DISPLAY_SCREEN_P96: |
384 |
+ |
case DISPLAY_SCREEN_CGFX: |
385 |
+ |
struct DimensionInfo dimInfo; |
386 |
+ |
DisplayInfoHandle handle = FindDisplayInfo(screen_mode_id); |
387 |
+ |
|
388 |
+ |
if (NULL == handle) |
389 |
+ |
return false; |
390 |
+ |
|
391 |
+ |
if (GetDisplayInfoData(handle, (UBYTE *) &dimInfo, sizeof(dimInfo), DTAG_DIMS, 0) <= 0) |
392 |
+ |
return false; |
393 |
+ |
|
394 |
+ |
default_width = 1 + dimInfo.Nominal.MaxX - dimInfo.Nominal.MinX; |
395 |
+ |
default_height = 1 + dimInfo.Nominal.MaxY - dimInfo.Nominal.MinY; |
396 |
+ |
default_depth = dimInfo.MaxDepth; |
397 |
+ |
|
398 |
+ |
for (unsigned d=VDEPTH_8BIT; d<=VDEPTH_32BIT; d++) |
399 |
+ |
{ |
400 |
+ |
ULONG mode_id = find_mode_for_depth(default_width, default_height, bits_from_depth(video_depth(d))); |
401 |
+ |
|
402 |
+ |
if (is_valid_modeid(display_type, mode_id)) |
403 |
+ |
{ |
404 |
+ |
add_modes(default_width, default_height, video_depth(d)); |
405 |
+ |
} |
406 |
+ |
} |
407 |
+ |
break; |
408 |
+ |
} |
409 |
+ |
|
410 |
+ |
video_init_depth_list(); |
411 |
+ |
|
412 |
+ |
#if DEBUG |
413 |
+ |
bug("Available video modes:\n"); |
414 |
+ |
vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end(); |
415 |
+ |
while (i != end) { |
416 |
+ |
bug(" %dx%d (ID %02x), %d colors\n", i->x, i->y, i->resolution_id, 1 << bits_from_depth(i->depth)); |
417 |
+ |
++i; |
418 |
+ |
} |
419 |
+ |
#endif |
420 |
+ |
|
421 |
+ |
D(bug("VideoInit: def_width=%ld def_height=%ld def_depth=%ld\n", default_width, default_height, default_depth)); |
422 |
+ |
|
423 |
+ |
// Find requested default mode and open display |
424 |
+ |
if (VideoModes.size() == 1) |
425 |
+ |
return video_open(VideoModes[0]); |
426 |
+ |
else { |
427 |
+ |
// Find mode with specified dimensions |
428 |
+ |
std::vector<video_mode>::const_iterator i, end = VideoModes.end(); |
429 |
+ |
for (i = VideoModes.begin(); i != end; ++i) |
430 |
+ |
{ |
431 |
+ |
D(bug("VideoInit: w=%ld h=%ld d=%ld\n", i->x, i->y, bits_from_depth(i->depth))); |
432 |
+ |
if (i->x == default_width && i->y == default_height && bits_from_depth(i->depth) == default_depth) |
433 |
+ |
return video_open(*i); |
434 |
+ |
} |
435 |
+ |
return video_open(VideoModes[0]); |
436 |
+ |
} |
437 |
+ |
|
438 |
+ |
return true; |
439 |
+ |
} |
440 |
+ |
|
441 |
+ |
|
442 |
+ |
static bool video_open(const video_mode &mode) |
443 |
+ |
{ |
444 |
+ |
ULONG depth_bits = bits_from_depth(mode.depth); |
445 |
+ |
ULONG ID = find_mode_for_depth(mode.x, mode.y, depth_bits); |
446 |
+ |
|
447 |
+ |
D(bug("video_open: width=%ld height=%ld depth=%ld ID=%08lx\n", mode.x, mode.y, depth_bits, ID)); |
448 |
+ |
|
449 |
+ |
if (INVALID_ID == ID) |
450 |
+ |
{ |
451 |
+ |
ErrorAlert(STR_NO_VIDEO_MODE_ERR); |
452 |
+ |
return false; |
453 |
+ |
} |
454 |
+ |
|
455 |
+ |
VideoMonitor.mode = mode; |
456 |
+ |
|
457 |
|
// Open display |
458 |
|
switch (display_type) { |
459 |
|
case DISPLAY_WINDOW: |
460 |
< |
if (!init_window(width, height)) |
460 |
> |
if (!init_window(mode.x, mode.y)) |
461 |
|
return false; |
462 |
|
break; |
463 |
|
|
464 |
|
case DISPLAY_PIP: |
465 |
< |
if (!init_pip(width, height)) |
465 |
> |
if (!init_pip(mode.x, mode.y)) |
466 |
|
return false; |
467 |
|
break; |
468 |
|
|
469 |
|
case DISPLAY_SCREEN_P96: |
470 |
< |
if (!init_screen_p96(mode_id)) |
470 |
> |
if (!init_screen_p96(ID)) |
471 |
|
return false; |
472 |
|
break; |
473 |
|
|
474 |
|
case DISPLAY_SCREEN_CGFX: |
475 |
< |
if (!init_screen_cgfx(mode_id)) |
475 |
> |
if (!init_screen_cgfx(ID)) |
476 |
|
return false; |
477 |
|
break; |
478 |
|
} |
488 |
|
ErrorAlert(STR_NO_MEM_ERR); |
489 |
|
return false; |
490 |
|
} |
491 |
+ |
|
492 |
|
return true; |
493 |
|
} |
494 |
|
|
495 |
|
|
496 |
< |
/* |
463 |
< |
* Deinitialization |
464 |
< |
*/ |
465 |
< |
|
466 |
< |
void VideoExit(void) |
496 |
> |
static void video_close() |
497 |
|
{ |
498 |
|
// Stop periodic process |
499 |
|
if (periodic_proc) { |
518 |
|
ReleasePen(the_win->WScreen->ViewPort.ColorMap, white_pen); |
519 |
|
|
520 |
|
CloseWindow(the_win); |
521 |
+ |
the_win = NULL; |
522 |
|
} |
523 |
|
break; |
524 |
|
|
533 |
|
|
534 |
|
// Close window |
535 |
|
if (the_win) |
536 |
+ |
{ |
537 |
|
CloseWindow(the_win); |
538 |
+ |
the_win = NULL; |
539 |
+ |
} |
540 |
|
|
541 |
|
// Close screen |
542 |
|
if (the_screen) { |
549 |
|
|
550 |
|
// Close window |
551 |
|
if (the_win) |
552 |
+ |
{ |
553 |
|
CloseWindow(the_win); |
554 |
+ |
the_win = NULL; |
555 |
+ |
} |
556 |
|
|
557 |
|
// Close screen |
558 |
|
if (the_screen) { |
571 |
|
|
572 |
|
|
573 |
|
/* |
574 |
+ |
* Deinitialization |
575 |
+ |
*/ |
576 |
+ |
|
577 |
+ |
void VideoExit(void) |
578 |
+ |
{ |
579 |
+ |
video_close(); |
580 |
+ |
} |
581 |
+ |
|
582 |
+ |
|
583 |
+ |
/* |
584 |
|
* Set palette |
585 |
|
*/ |
586 |
|
|
611 |
|
|
612 |
|
void video_switch_to_mode(const video_mode &mode) |
613 |
|
{ |
614 |
+ |
// Close and reopen display |
615 |
+ |
video_close(); |
616 |
+ |
if (!video_open(mode)) |
617 |
+ |
{ |
618 |
+ |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
619 |
+ |
QuitEmulator(); |
620 |
+ |
} |
621 |
|
} |
622 |
|
|
623 |
|
|
801 |
|
Forbid(); |
802 |
|
Signal(MainTask, SIGF_SINGLE); |
803 |
|
} |
804 |
+ |
|
805 |
+ |
|
806 |
+ |
// Add mode to list of supported modes |
807 |
+ |
static void add_mode(uint32 width, uint32 height, uint32 resolution_id, uint32 bytes_per_row, video_depth depth) |
808 |
+ |
{ |
809 |
+ |
video_mode mode; |
810 |
+ |
mode.x = width; |
811 |
+ |
mode.y = height; |
812 |
+ |
mode.resolution_id = resolution_id; |
813 |
+ |
mode.bytes_per_row = bytes_per_row; |
814 |
+ |
mode.depth = depth; |
815 |
+ |
|
816 |
+ |
D(bug("Added video mode: w=%ld h=%ld d=%ld\n", width, height, depth)); |
817 |
+ |
|
818 |
+ |
VideoModes.push_back(mode); |
819 |
+ |
} |
820 |
+ |
|
821 |
+ |
// Add standard list of windowed modes for given color depth |
822 |
+ |
static void add_modes(uint32 width, uint32 height, video_depth depth) |
823 |
+ |
{ |
824 |
+ |
D(bug("add_modes: w=%ld h=%ld d=%ld\n", width, height, depth)); |
825 |
+ |
|
826 |
+ |
if (width >= 512 && height >= 384) |
827 |
+ |
add_mode(512, 384, 0x80, TrivialBytesPerRow(512, depth), depth); |
828 |
+ |
if (width >= 640 && height >= 480) |
829 |
+ |
add_mode(640, 480, 0x81, TrivialBytesPerRow(640, depth), depth); |
830 |
+ |
if (width >= 800 && height >= 600) |
831 |
+ |
add_mode(800, 600, 0x82, TrivialBytesPerRow(800, depth), depth); |
832 |
+ |
if (width >= 1024 && height >= 768) |
833 |
+ |
add_mode(1024, 768, 0x83, TrivialBytesPerRow(1024, depth), depth); |
834 |
+ |
if (width >= 1152 && height >= 870) |
835 |
+ |
add_mode(1152, 870, 0x84, TrivialBytesPerRow(1152, depth), depth); |
836 |
+ |
if (width >= 1280 && height >= 1024) |
837 |
+ |
add_mode(1280, 1024, 0x85, TrivialBytesPerRow(1280, depth), depth); |
838 |
+ |
if (width >= 1600 && height >= 1200) |
839 |
+ |
add_mode(1600, 1200, 0x86, TrivialBytesPerRow(1600, depth), depth); |
840 |
+ |
} |
841 |
+ |
|
842 |
+ |
|
843 |
+ |
static ULONG find_mode_for_depth(uint32 width, uint32 height, uint32 depth) |
844 |
+ |
{ |
845 |
+ |
ULONG ID = BestModeID(BIDTAG_NominalWidth, width, |
846 |
+ |
BIDTAG_NominalHeight, height, |
847 |
+ |
BIDTAG_Depth, depth, |
848 |
+ |
BIDTAG_DIPFMustNotHave, DIPF_IS_ECS | DIPF_IS_HAM | DIPF_IS_AA, |
849 |
+ |
TAG_END); |
850 |
+ |
|
851 |
+ |
return ID; |
852 |
+ |
} |
853 |
+ |
|
854 |
+ |
|
855 |
+ |
static ULONG bits_from_depth(video_depth depth) |
856 |
+ |
{ |
857 |
+ |
int bits = 1 << depth; |
858 |
+ |
if (bits == 16) |
859 |
+ |
bits = 15; |
860 |
+ |
else if (bits == 32) |
861 |
+ |
bits = 24; |
862 |
+ |
|
863 |
+ |
return bits; |
864 |
+ |
} |
865 |
+ |
|
866 |
+ |
|
867 |
+ |
static bool is_valid_modeid(int display_type, ULONG mode_id) |
868 |
+ |
{ |
869 |
+ |
if (INVALID_ID == mode_id) |
870 |
+ |
return false; |
871 |
+ |
|
872 |
+ |
switch (display_type) |
873 |
+ |
{ |
874 |
+ |
case DISPLAY_SCREEN_P96: |
875 |
+ |
return check_modeid_p96(mode_id); |
876 |
+ |
break; |
877 |
+ |
case DISPLAY_SCREEN_CGFX: |
878 |
+ |
return check_modeid_cgfx(mode_id); |
879 |
+ |
break; |
880 |
+ |
default: |
881 |
+ |
return false; |
882 |
+ |
break; |
883 |
+ |
} |
884 |
+ |
} |
885 |
+ |
|
886 |
+ |
|
887 |
+ |
static bool check_modeid_p96(ULONG mode_id) |
888 |
+ |
{ |
889 |
+ |
// Check if the mode is one we can handle |
890 |
+ |
uint32 depth = p96GetModeIDAttr(mode_id, P96IDA_DEPTH); |
891 |
+ |
uint32 format = p96GetModeIDAttr(mode_id, P96IDA_RGBFORMAT); |
892 |
+ |
|
893 |
+ |
if (!p96GetModeIDAttr(screen_mode_id, P96IDA_ISP96)) |
894 |
+ |
return false; |
895 |
+ |
|
896 |
+ |
switch (depth) { |
897 |
+ |
case 8: |
898 |
+ |
break; |
899 |
+ |
case 15: |
900 |
+ |
case 16: |
901 |
+ |
if (format != RGBFB_R5G5B5) |
902 |
+ |
return false; |
903 |
+ |
break; |
904 |
+ |
case 24: |
905 |
+ |
case 32: |
906 |
+ |
if (format != RGBFB_A8R8G8B8) |
907 |
+ |
return false; |
908 |
+ |
break; |
909 |
+ |
default: |
910 |
+ |
return false; |
911 |
+ |
} |
912 |
+ |
|
913 |
+ |
return true; |
914 |
+ |
} |
915 |
+ |
|
916 |
+ |
|
917 |
+ |
static bool check_modeid_cgfx(ULONG mode_id) |
918 |
+ |
{ |
919 |
+ |
uint32 depth = GetCyberIDAttr(CYBRIDATTR_DEPTH, mode_id); |
920 |
+ |
uint32 format = GetCyberIDAttr(CYBRIDATTR_PIXFMT, mode_id); |
921 |
+ |
|
922 |
+ |
D(bug("init_screen_cgfx: mode_id=%08lx depth=%ld format=%ld\n", mode_id, depth, format)); |
923 |
+ |
|
924 |
+ |
if (!IsCyberModeID(mode_id)) |
925 |
+ |
return false; |
926 |
+ |
|
927 |
+ |
switch (depth) { |
928 |
+ |
case 8: |
929 |
+ |
break; |
930 |
+ |
case 15: |
931 |
+ |
case 16: |
932 |
+ |
// !!! PIXFMT_RGB15 is correct !!! |
933 |
+ |
if (format != PIXFMT_RGB15) |
934 |
+ |
return false; |
935 |
+ |
break; |
936 |
+ |
case 24: |
937 |
+ |
case 32: |
938 |
+ |
if (format != PIXFMT_ARGB32) |
939 |
+ |
return false; |
940 |
+ |
break; |
941 |
+ |
default: |
942 |
+ |
return false; |
943 |
+ |
} |
944 |
+ |
|
945 |
+ |
return true; |
946 |
+ |
} |
947 |
+ |
|