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 |
|
/* |
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: |
205 |
< |
break; |
206 |
< |
case 15: |
207 |
< |
case 16: |
208 |
< |
if (format != RGBFB_R5G5B5) { |
209 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
210 |
< |
return false; |
211 |
< |
} |
212 |
< |
break; |
213 |
< |
case 24: |
214 |
< |
case 32: |
215 |
< |
if (format != RGBFB_A8R8G8B8) { |
216 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
217 |
< |
return false; |
218 |
< |
} |
219 |
< |
break; |
220 |
< |
default: |
221 |
< |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
222 |
< |
return false; |
223 |
< |
} |
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 |
|
|
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: |
282 |
< |
break; |
283 |
< |
case 15: |
284 |
< |
case 16: |
285 |
< |
// !!! PIXFMT_RGB15 is correct !!! |
286 |
< |
if (format != PIXFMT_RGB15) { |
287 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
288 |
< |
return false; |
289 |
< |
} |
290 |
< |
break; |
291 |
< |
case 24: |
292 |
< |
case 32: |
293 |
< |
if (format != PIXFMT_ARGB32) { |
294 |
< |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
295 |
< |
return false; |
296 |
< |
} |
297 |
< |
break; |
298 |
< |
default: |
299 |
< |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
300 |
< |
return false; |
301 |
< |
} |
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 |
|
|
395 |
|
default_height = 1 + dimInfo.Nominal.MaxY - dimInfo.Nominal.MinY; |
396 |
|
default_depth = dimInfo.MaxDepth; |
397 |
|
|
398 |
< |
for (unsigned d=VDEPTH_1BIT; d<=VDEPTH_32BIT; d++) |
398 |
> |
for (unsigned d=VDEPTH_8BIT; d<=VDEPTH_32BIT; d++) |
399 |
|
{ |
400 |
< |
if (INVALID_ID != find_mode_for_depth(default_width, default_height, bits_from_depth(video_depth(d)))) |
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 |
|
} |
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; |
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 |
+ |
|