Skip to content

A DirectDraw game runs in a window only on a 16-bit desktop, else goes fullscreen ​

Symptoms ​

The game has a windowed mode, but every run ends up fullscreen. After the windowed flag is set, the game switches back to fullscreen on activation or on WM_DISPLAYCHANGE.

Cause ​

In 1997 a windowed DirectDraw game drew straight into the desktop's pixel format, so it allowed a window only when the desktop had the game's own depth, usually 16 bits. It reads the depth with GetDeviceCaps(PLANES) × GetDeviceCaps(BITSPIXEL). A modern desktop is 32-bit, so the game switches itself to fullscreen (observed in POD at three places).

Evidence ​

Follow the writes to the windowed flag. A breakpoint with a stack dump on each write names the code that switches back.

What to do ​

Patch the depth reads to return 16, so the game sees a 16-bit desktop. Clear the fullscreen flag. Then give the back surface the 16-bit format the game draws in (16-bit pixels on a 32-bit surface).

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.