342 |
|
return depth; |
343 |
|
} |
344 |
|
|
345 |
< |
// Add mode to list of supported modes |
346 |
< |
static void add_mode(int type, int width, int height, int resolution_id, int bytes_per_row, int depth) |
345 |
> |
// Check wether specified mode is available |
346 |
> |
static bool has_mode(int type, int width, int height) |
347 |
|
{ |
348 |
< |
VIDEO_MODE mode; |
348 |
> |
// FIXME: no fullscreen support yet |
349 |
> |
if (type == DISPLAY_SCREEN) |
350 |
> |
return false; |
351 |
> |
|
352 |
|
#ifdef SHEEPSHAVER |
353 |
< |
// Don't add 512x384 modes |
353 |
> |
// Filter out Classic resolutiosn |
354 |
|
if (width == 512 && height == 384) |
355 |
+ |
return false; |
356 |
+ |
|
357 |
+ |
// Read window modes prefs |
358 |
+ |
static uint32 window_modes = 0; |
359 |
+ |
static uint32 screen_modes = 0; |
360 |
+ |
if (window_modes == 0 || screen_modes == 0) { |
361 |
+ |
window_modes = PrefsFindInt32("windowmodes"); |
362 |
+ |
screen_modes = PrefsFindInt32("screenmodes"); |
363 |
+ |
if (window_modes == 0 || screen_modes == 0) |
364 |
+ |
window_modes |= 3; // Allow at least 640x480 and 800x600 window modes |
365 |
+ |
} |
366 |
+ |
|
367 |
+ |
if (type == DISPLAY_WINDOW) { |
368 |
+ |
int apple_mask, apple_id = find_apple_resolution(width, height); |
369 |
+ |
switch (apple_id) { |
370 |
+ |
case APPLE_640x480: apple_mask = 0x01; break; |
371 |
+ |
case APPLE_800x600: apple_mask = 0x02; break; |
372 |
+ |
case APPLE_1024x768: apple_mask = 0x04; break; |
373 |
+ |
case APPLE_1152x768: apple_mask = 0x40; break; |
374 |
+ |
case APPLE_1152x900: apple_mask = 0x08; break; |
375 |
+ |
case APPLE_1280x1024: apple_mask = 0x10; break; |
376 |
+ |
case APPLE_1600x1200: apple_mask = 0x20; break; |
377 |
+ |
default: apple_mask = 0x00; break; |
378 |
+ |
} |
379 |
+ |
return (window_modes & apple_mask); |
380 |
+ |
} |
381 |
+ |
#else |
382 |
+ |
return true; |
383 |
+ |
#endif |
384 |
+ |
return false; |
385 |
+ |
} |
386 |
+ |
|
387 |
+ |
// Add mode to list of supported modes |
388 |
+ |
static void add_mode(int type, int width, int height, int resolution_id, int bytes_per_row, int depth) |
389 |
+ |
{ |
390 |
+ |
// Filter out unsupported modes |
391 |
+ |
if (!has_mode(type, width, height)) |
392 |
|
return; |
393 |
|
|
394 |
+ |
// Fill in VideoMode entry |
395 |
+ |
VIDEO_MODE mode; |
396 |
+ |
#ifdef SHEEPSHAVER |
397 |
|
// Recalculate dimensions to fit Apple modes |
398 |
|
resolution_id = match_apple_resolution(width, height); |
399 |
|
mode.viType = type; |
791 |
|
{ |
792 |
|
D(bug("video_open()\n")); |
793 |
|
const VIDEO_MODE &mode = get_current_mode(); |
794 |
+ |
#if DEBUG |
795 |
+ |
D(bug("Current video mode:\n")); |
796 |
+ |
D(bug(" %dx%d (ID %02x), %d bpp\n", VIDEO_MODE_X, VIDEO_MODE_Y, VIDEO_MODE_RESOLUTION, 1 << (VIDEO_MODE_DEPTH & 0x0f))); |
797 |
+ |
#endif |
798 |
|
|
799 |
|
// Create display driver object of requested type |
800 |
|
switch (display_type) { |
867 |
|
mouse_wheel_lines = PrefsFindInt32("mousewheellines"); |
868 |
|
|
869 |
|
// Get screen mode from preferences |
870 |
< |
const char *mode_str; |
870 |
> |
const char *mode_str = NULL; |
871 |
> |
#ifndef SHEEPSHAVER |
872 |
|
if (classic_mode) |
873 |
|
mode_str = "win/512/342"; |
874 |
|
else |
875 |
|
mode_str = PrefsFindString("screen"); |
876 |
+ |
#endif |
877 |
|
|
878 |
|
// Determine display type and default dimensions |
879 |
|
int default_width, default_height; |
891 |
|
display_type = DISPLAY_WINDOW; |
892 |
|
} |
893 |
|
int max_width = 640, max_height = 480; |
894 |
< |
if (display_type == DISPLAY_SCREEN) { |
895 |
< |
SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); |
896 |
< |
if (modes && modes != (SDL_Rect **)-1) { |
897 |
< |
max_width = modes[0]->w; |
898 |
< |
max_height = modes[0]->h; |
899 |
< |
} |
894 |
> |
SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); |
895 |
> |
if (modes && modes != (SDL_Rect **)-1) { |
896 |
> |
max_width = modes[0]->w; |
897 |
> |
max_height = modes[0]->h; |
898 |
> |
if (default_width > max_width) |
899 |
> |
default_width = max_width; |
900 |
> |
if (default_height > max_height) |
901 |
> |
default_height = max_height; |
902 |
|
} |
903 |
|
if (default_width <= 0) |
904 |
|
default_width = max_width; |
965 |
|
} |
966 |
|
|
967 |
|
#ifdef SHEEPSHAVER |
968 |
< |
for (int i = 0; i < VideoModes.size(); ++i) |
968 |
> |
for (int i = 0; i < VideoModes.size(); i++) |
969 |
|
VModes[i] = VideoModes[i]; |
970 |
< |
|
971 |
< |
const VIDEO_MODE & mode = VideoModes[cur_mode]; |
972 |
< |
D(bug("Current video mode\n")); |
973 |
< |
D(bug(" %dx%d (ID %02x), %d bpp\n", VIDEO_MODE_X, VIDEO_MODE_Y, VIDEO_MODE_RESOLUTION, 1 << (VIDEO_MODE_DEPTH - 0x80))); |
970 |
> |
VideoInfo *p = &VModes[VideoModes.size()]; |
971 |
> |
p->viType = DIS_INVALID; // End marker |
972 |
> |
p->viRowBytes = 0; |
973 |
> |
p->viXsize = p->viYsize = 0; |
974 |
> |
p->viAppleMode = 0; |
975 |
> |
p->viAppleID = 0; |
976 |
|
#endif |
977 |
|
|
978 |
|
#if DEBUG |