]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Don't allow a higher depth than the desktop when using a windowed mode on Win32....
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 27 Jan 2004 08:12:54 +0000 (08:12 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 27 Jan 2004 08:12:54 +0000 (08:12 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3840 d7cf8633-e32d-0410-b094-e92efae38249

vid_wgl.c

index 0448ba64a4c32e16a9a4546deb98ef7142a0e439..fed809b0213e54ab80464d69ffe83b00f98a6fc8 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -751,6 +751,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp)
        HGLRC baseRC;
        int CenterX, CenterY;
        const char *gldrivername;
+       int depth;
 
        if (vid_initialized)
                Sys_Error("VID_InitMode called when video is already initialised\n");
@@ -802,6 +803,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp)
        {
                hdc = GetDC (NULL);
                i = GetDeviceCaps(hdc, RASTERCAPS);
+               depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
                ReleaseDC (NULL, hdc);
                if (i & RC_PALETTE)
                {
@@ -809,6 +811,12 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp)
                        Con_Printf ("Can't run in non-RGB mode\n");
                        return false;
                }
+               if (bpp > depth)
+               {
+                       VID_Shutdown();
+                       Con_Printf ("A higher desktop depth is required to run this video mode\n");
+                       return false;
+               }
 
                WindowStyle = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
                ExWindowStyle = 0;