1 |
|
/* |
2 |
|
* video_amiga.cpp - Video/graphics emulation, AmigaOS specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2001 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2002 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
364 |
|
} |
365 |
|
} |
366 |
|
|
367 |
+ |
D(bug("display_type %d, window_width %d, window_height %d\n", display_type, window_width, window_height)); |
368 |
+ |
|
369 |
|
// Construct list of supported modes |
370 |
|
switch (display_type) { |
371 |
|
case DISPLAY_WINDOW: |
387 |
|
struct DimensionInfo dimInfo; |
388 |
|
DisplayInfoHandle handle = FindDisplayInfo(screen_mode_id); |
389 |
|
|
390 |
< |
if (NULL == handle) |
390 |
> |
if (handle == NULL) |
391 |
|
return false; |
392 |
|
|
393 |
|
if (GetDisplayInfoData(handle, (UBYTE *) &dimInfo, sizeof(dimInfo), DTAG_DIMS, 0) <= 0) |
397 |
|
default_height = 1 + dimInfo.Nominal.MaxY - dimInfo.Nominal.MinY; |
398 |
|
default_depth = dimInfo.MaxDepth; |
399 |
|
|
400 |
< |
for (unsigned d=VDEPTH_8BIT; d<=VDEPTH_32BIT; d++) |
399 |
< |
{ |
400 |
> |
for (unsigned d=VDEPTH_8BIT; d<=VDEPTH_32BIT; d++) { |
401 |
|
ULONG mode_id = find_mode_for_depth(default_width, default_height, bits_from_depth(video_depth(d))); |
402 |
|
|
403 |
|
if (is_valid_modeid(display_type, mode_id)) |
403 |
– |
{ |
404 |
|
add_modes(default_width, default_height, video_depth(d)); |
405 |
< |
} |
406 |
< |
} |
405 |
> |
} |
406 |
|
break; |
407 |
|
} |
408 |
|
|
425 |
|
else { |
426 |
|
// Find mode with specified dimensions |
427 |
|
std::vector<video_mode>::const_iterator i, end = VideoModes.end(); |
428 |
< |
for (i = VideoModes.begin(); i != end; ++i) |
430 |
< |
{ |
428 |
> |
for (i = VideoModes.begin(); i != end; ++i) { |
429 |
|
D(bug("VideoInit: w=%ld h=%ld d=%ld\n", i->x, i->y, bits_from_depth(i->depth))); |
430 |
|
if (i->x == default_width && i->y == default_height && bits_from_depth(i->depth) == default_depth) |
431 |
|
return video_open(*i); |
432 |
< |
} |
432 |
> |
} |
433 |
|
return video_open(VideoModes[0]); |
434 |
|
} |
435 |
|
|
444 |
|
|
445 |
|
D(bug("video_open: width=%ld height=%ld depth=%ld ID=%08lx\n", mode.x, mode.y, depth_bits, ID)); |
446 |
|
|
447 |
< |
if (INVALID_ID == ID) |
450 |
< |
{ |
447 |
> |
if (ID == INVALID_ID) { |
448 |
|
ErrorAlert(STR_NO_VIDEO_MODE_ERR); |
449 |
|
return false; |
450 |
< |
} |
450 |
> |
} |
451 |
|
|
452 |
|
VideoMonitor.mode = mode; |
453 |
|
|
610 |
|
{ |
611 |
|
// Close and reopen display |
612 |
|
video_close(); |
613 |
< |
if (!video_open(mode)) |
617 |
< |
{ |
613 |
> |
if (!video_open(mode)) { |
614 |
|
ErrorAlert(STR_OPEN_WINDOW_ERR); |
615 |
|
QuitEmulator(); |
616 |
< |
} |
616 |
> |
} |
617 |
|
} |
618 |
|
|
619 |
|
|
814 |
|
VideoModes.push_back(mode); |
815 |
|
} |
816 |
|
|
817 |
< |
// Add standard list of windowed modes for given color depth |
817 |
> |
// Add standard list of modes for given color depth |
818 |
|
static void add_modes(uint32 width, uint32 height, video_depth depth) |
819 |
|
{ |
820 |
|
D(bug("add_modes: w=%ld h=%ld d=%ld\n", width, height, depth)); |
865 |
|
if (INVALID_ID == mode_id) |
866 |
|
return false; |
867 |
|
|
868 |
< |
switch (display_type) |
869 |
< |
{ |
870 |
< |
case DISPLAY_SCREEN_P96: |
871 |
< |
return check_modeid_p96(mode_id); |
872 |
< |
break; |
873 |
< |
case DISPLAY_SCREEN_CGFX: |
874 |
< |
return check_modeid_cgfx(mode_id); |
875 |
< |
break; |
876 |
< |
default: |
877 |
< |
return false; |
878 |
< |
break; |
883 |
< |
} |
868 |
> |
switch (display_type) { |
869 |
> |
case DISPLAY_SCREEN_P96: |
870 |
> |
return check_modeid_p96(mode_id); |
871 |
> |
break; |
872 |
> |
case DISPLAY_SCREEN_CGFX: |
873 |
> |
return check_modeid_cgfx(mode_id); |
874 |
> |
break; |
875 |
> |
default: |
876 |
> |
return false; |
877 |
> |
break; |
878 |
> |
} |
879 |
|
} |
880 |
|
|
881 |
|
|
885 |
|
uint32 depth = p96GetModeIDAttr(mode_id, P96IDA_DEPTH); |
886 |
|
uint32 format = p96GetModeIDAttr(mode_id, P96IDA_RGBFORMAT); |
887 |
|
|
888 |
+ |
D(bug("check_modeid_p96: mode_id=%08lx depth=%ld format=%ld\n", mode_id, depth, format)); |
889 |
+ |
|
890 |
|
if (!p96GetModeIDAttr(screen_mode_id, P96IDA_ISP96)) |
891 |
|
return false; |
892 |
|
|
916 |
|
uint32 depth = GetCyberIDAttr(CYBRIDATTR_DEPTH, mode_id); |
917 |
|
uint32 format = GetCyberIDAttr(CYBRIDATTR_PIXFMT, mode_id); |
918 |
|
|
919 |
< |
D(bug("init_screen_cgfx: mode_id=%08lx depth=%ld format=%ld\n", mode_id, depth, format)); |
919 |
> |
D(bug("check_modeid_cgfx: mode_id=%08lx depth=%ld format=%ld\n", mode_id, depth, format)); |
920 |
|
|
921 |
|
if (!IsCyberModeID(mode_id)) |
922 |
|
return false; |
926 |
|
break; |
927 |
|
case 15: |
928 |
|
case 16: |
932 |
– |
// !!! PIXFMT_RGB15 is correct !!! |
929 |
|
if (format != PIXFMT_RGB15) |
930 |
|
return false; |
931 |
|
break; |
940 |
|
|
941 |
|
return true; |
942 |
|
} |
947 |
– |
|