Implement fullscreen 8bpp mode as a borderless, desktop-sized window when running on Windows, and expose an 8bpp mode to the game with the same size as the desktop when no fullscreen 8bpp modes are exposed by Windows. This is required on Windows 8 if we want to have any operation of classic mode in fullscreen, because Windows 8 drops the ability to set any mode other than 32bpp (leaving us largely in the same position we are when running under X).

git-svn-id: https://svn.eduke32.com/eduke32@3296 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-12-16 04:04:02 +00:00
parent 441e2ed220
commit 9770b7ee39

View file

@ -71,6 +71,8 @@
// undefine to restrict windowed resolutions to conventional sizes
#define ANY_WINDOWED_SIZE
#define FAKE_FS(x, y, bpp) (bpp == 8 && x == desktopxdim && y == desktopydim)
static mutex_t m_initprintf;
static int32_t winlayer_have_ATI = 0;
@ -1838,6 +1840,17 @@ void getvalidmodes(void)
}
}
}
for (i=0; i<validmodecnt; i++)
if (validmode[i].fs && validmode[i].bpp == 8)
break;
if (i == validmodecnt)
{
initprintf("No fullscreen 8-bit modes exposed\n");
ADDMODE(desktopxdim, desktopydim, 8, 1, -1);
}
#ifdef USE_OPENGL
cdsenummodes();
#endif
@ -1893,13 +1906,13 @@ void begindrawing(void)
if (offscreenrendering) return;
frameplace = fullscreen ? (intptr_t)lpOffscreen : (intptr_t)lpPixels;
frameplace = fullscreen && !FAKE_FS(xres, yres, bpp) ? (intptr_t)lpOffscreen : (intptr_t)lpPixels;
if (!modechange) return;
modechange=0;
if (!fullscreen)
if (!fullscreen || FAKE_FS(xres, yres, bpp))
{
bytesperline = xres|4;
}
@ -1961,7 +1974,7 @@ void showframe(int32_t w)
while (lockcount) enddrawing();
}
if (!fullscreen)
if (!fullscreen || FAKE_FS(xres, yres, bpp))
{
BitBlt(hDC, 0, 0, xres, yres, hDCSection, 0, 0, SRCCOPY);
return;
@ -2049,8 +2062,8 @@ int32_t setpalette(int32_t start, int32_t num)
Bmemcpy(lpal.palPalEntry, curpalettefaded, sizeof(lpal.palPalEntry));
for (i=start, n=num-1; n>0; i++, n--)
curpalettefaded[i].f = lpal.palPalEntry[i].peFlags = PC_NOCOLLAPSE;
if (fullscreen)
if (fullscreen && !FAKE_FS(xres, yres, bpp))
{
if (!lpDDPalette) return -1;
result = IDirectDrawPalette_SetEntries(lpDDPalette, 0, 0, 256, (LPPALETTEENTRY)lpal.palPalEntry);
@ -2105,7 +2118,7 @@ return 0;
//
static int32_t setgammaramp(WORD gt[3][256])
{
if (!fullscreen || bpp > 8)
if (!fullscreen || bpp > 8 || FAKE_FS(xres, yres, bpp))
{
// GL and windowed mode use DIB method
int32_t i;
@ -2178,8 +2191,9 @@ int32_t setgamma(void)
static int32_t getgammaramp(WORD gt[3][256])
{
return -1;
if (!hWindow) return -1;
if (!fullscreen || bpp > 8)
if (!fullscreen || bpp > 8 || FAKE_FS(xres, yres, bpp))
{
int32_t i;
HDC hDC = GetDC(hWindow);
@ -2978,8 +2992,13 @@ static BOOL CreateAppWindow(int32_t modenum)
ShowWindow(hWindow, SW_HIDE); // so Windows redraws what's behind if the window shrinks
}
if (fs)
if (fs && FAKE_FS(width, height, bitspp))
{
stylebitsex = 0;
stylebits = WS_POPUP | WS_MAXIMIZE | WS_VISIBLE | WS_CLIPSIBLINGS;
}
else if (fs)
{
stylebitsex = WS_EX_TOPMOST;
stylebits = WS_POPUP;
@ -3020,7 +3039,7 @@ static BOOL CreateAppWindow(int32_t modenum)
}
// resize the window
if (!fs)
if (!fs && !FAKE_FS(width, height, bitspp))
{
rect.left = 0;
rect.top = 0;
@ -3054,7 +3073,7 @@ static BOOL CreateAppWindow(int32_t modenum)
SetWindowPos(hWindow, HWND_TOP, windowpos?windowx:x, windowpos?windowy:y, w, h, 0);
// fullscreen?
if (!fs)
if (!fs || FAKE_FS(width, height, bitspp))
{
if (bitspp > 8)
{