void picasso_InitResolutions (void) { struct MultiDisplay *md1; int i, count = 0; char tmp[200]; int bit_idx; int bits[] = { 8, 16, 32 }; Displays[0].primary = 1; Displays[0].disabled = 0; Displays[0].rect.left = 0; Displays[0].rect.top = 0; Displays[0].rect.right = 800; Displays[0].rect.bottom = 640; sprintf (tmp, "%s (%d*%d)", "Display", Displays[0].rect.right, Displays[0].rect.bottom); Displays[0].name = my_strdup(tmp); Displays[0].name2 = my_strdup("Display"); md1 = Displays; DisplayModes = md1->DisplayModes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES); for (i = 0; i < MAX_SCREEN_MODES && count < MAX_PICASSO_MODES; i++) { for(bit_idx = 0; bit_idx < 3; ++bit_idx) { int bitdepth = bits[bit_idx]; int bit_unit = (bitdepth + 1) & 0xF8; int rgbFormat = (bitdepth == 8 ? RGBFB_CLUT : (bitdepth == 16 ? RGBFB_R5G6B5 : RGBFB_R8G8B8A8)); int pixelFormat = 1 << rgbFormat; pixelFormat |= RGBFF_CHUNKY; //if (SDL_VideoModeOK (x_size_table[i], y_size_table[i], 16, SDL_SWSURFACE)) { DisplayModes[count].res.width = x_size_table[i]; DisplayModes[count].res.height = y_size_table[i]; DisplayModes[count].depth = bit_unit >> 3; DisplayModes[count].refresh[0] = 50; DisplayModes[count].refresh[1] = 60; DisplayModes[count].refresh[2] = 0; DisplayModes[count].colormodes = pixelFormat; sprintf(DisplayModes[count].name, "%dx%d, %d-bit", DisplayModes[count].res.width, DisplayModes[count].res.height, DisplayModes[count].depth * 8); count++; } } } DisplayModes[count].depth = -1; sortmodes(); modesList(); DisplayModes = Displays[0].DisplayModes; }
void sortdisplays (void) { struct MultiDisplay *md; int i, idx; int w = GetSystemMetrics (SM_CXSCREEN); int h = GetSystemMetrics (SM_CYSCREEN); int b = 0; // HDC hdc = GetDC (NULL); // if (hdc) { // b = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES); // ReleaseDC (NULL, hdc); // } write_log (_T("Desktop: W=%d H=%d B=%d. CXVS=%d CYVS=%d\n"), w, h, b, GetSystemMetrics (SM_CXVIRTUALSCREEN), GetSystemMetrics (SM_CYVIRTUALSCREEN)); md = Displays; while (md->monitorname) { md->DisplayModes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES); md->DisplayModes[0].depth = -1; write_log (_T("%s '%s' [%s]\n"), md->adaptername, md->adapterid, md->adapterkey); write_log (_T("-: %s [%s]\n"), md->fullname, md->monitorid); for (int mode = 0; mode < 2; mode++) { DEVMODE dm; dm.dmSize = sizeof dm; dm.dmDriverExtra = 0; idx = 0; //let's hope for the best dm.dmPelsWidth = 1280; dm.dmPelsHeight = 1024; dm.dmBitsPerPel = 32; dm.dmDisplayFrequency = 50; //dm.dmDisplayFlags = //dm.dmPosition = //dm.dmDisplayOrientation = // while (EnumDisplaySettingsEx (md->adapterid, idx, &dm, mode ? EDS_RAWMODE : 0)) { int found = 0; int idx2 = 0; while (md->DisplayModes[idx2].depth >= 0 && !found) { struct PicassoResolution *pr = &md->DisplayModes[idx2]; if ( (pr->res.width == (uae_u32)dm.dmPelsWidth) && (pr->res.height == (uae_u32)dm.dmPelsHeight) && (pr->depth == (int)(dm.dmBitsPerPel / 8)) ) { for (i = 0; pr->refresh[i]; i++) { if (pr->refresh[i] == (int)dm.dmDisplayFrequency) { found = 1; break; } } } idx2++; } if (!found && dm.dmBitsPerPel > 8) { /// REMOVEME: unused: int freq = 0; // if ((dm.dmFields & DM_PELSWIDTH) && (dm.dmFields & DM_PELSHEIGHT) && (dm.dmFields & DM_BITSPERPEL)) { addmode (md, &dm, mode); // } } idx++; // } } sortmodes (md); modesList (md); i = 0; while (md->DisplayModes[i].depth > 0) i++; write_log (_T("%d display modes.\n"), i); md++; } }