1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

140 Commits

Author SHA1 Message Date
narzoul
30bf0435f8 Fixed GetDDInterface implementation 2016-10-23 15:28:20 +02:00
narzoul
d163787437 Allow PrimarySurface to wrap different surface implementations 2016-10-23 15:28:14 +02:00
narzoul
47f02667bf Moved FullScreenTagSurface implementation to separate layer 2016-10-23 15:28:08 +02:00
narzoul
0dbd210649 Moved CompatPrimarySurface implementation to separate layer 2016-10-23 15:28:02 +02:00
narzoul
19cce6b9d6 Preparation for splitting the DirectDrawSurface wrapper into layers 2016-10-23 15:27:56 +02:00
narzoul
b8832a92be Moved DLL related parts to Dll namespace and subdirectory 2016-10-23 15:27:50 +02:00
narzoul
7fc059a02f Moved config header to Config subdirectory 2016-10-23 15:27:44 +02:00
narzoul
367f581e74 Moved Win32 API hooks to Win32 namespace and subdirectory 2016-10-23 15:27:38 +02:00
narzoul
66bc66f42f Moved visitors to Visitors subdirectories 2016-10-23 15:27:32 +02:00
narzoul
2097d737dc Moved common parts to Common subdirectory 2016-10-23 15:27:26 +02:00
narzoul
3243a17daf Moved Direct3D DDI parts to D3dDdi namespace and subdirectory 2016-10-23 15:27:16 +02:00
narzoul
1a9b4ce860 Moved Direct3D parts to Direct3d namespace and subdirectory 2016-10-23 15:25:32 +02:00
narzoul
55f840cb50 Moved DirectDraw parts to DDraw namespace and subdirectory 2016-10-23 15:25:27 +02:00
narzoul
b65f98f0e3 Moved GDI parts to Gdi namespace and subdirectory 2016-10-23 15:25:20 +02:00
narzoul
a078ea4be0 Added logging for some DDI structs 2016-10-23 15:25:14 +02:00
narzoul
08fb2fc9b4 Corrected naming convention on CompatPrimarySurface variables 2016-10-23 15:25:08 +02:00
narzoul
b8a674ffdd Refactored logging of structs 2016-10-23 15:25:03 +02:00
narzoul
12ad482d29 Hooked Direct3D display driver interfaces 2016-10-23 15:24:34 +02:00
narzoul
1adb27ead4 Updated target platform version to 10.0.14393.0 2016-09-24 16:04:58 +02:00
narzoul
78bc5c0ee3 Assume ddsCaps is valid even if DDSD_CAPS is not set
DirectDraw seems to assume the DDSD_CAPS flag is always set in CreateSurface.
This flag even has a comment in ddraw.h mentioning it's "default".

Some games set ddsCaps members without explicitly setting the DDSD_CAPS flag,
which causes DDrawCompat to incorrectly detect some capabilities. These checks
now always assume the ddsCaps member is valid even if DDSD_CAPS is not set.

Fixes a crash when launching Rogue Spear, mentioned in issue #2.
2016-06-12 16:31:59 +02:00
narzoul
b9b4a2aafd Fixed incorrect z-buffer bit depths reported in D3DDEVICEDESC
Legacy DirectDraw interfaces specify the z-buffer format as a single bit depth
number instead of as a DDPIXELFORMAT struct. DirectDraw seems to convert a
legacy z-buffer bit depth of N into a DDPIXELFORMAT with dwFlags = DDPF_ZBUFFER,
dwZBufferBitDepth = N and dwZBitMask set to 1s in the lowest N bits.

Some drivers (so far noticed with AMD only) report the list of supported
z-buffer bit depths incorrectly, resulting in a game potentially selecting a
bit depth that can't actually be created via the legacy interfaces.
For example, the driver may report 16 and 32 bits as supported whereas all
32 bit z-buffer pixel formats use only 24 bits for z-buffer (with the
remaining bits unused or used as stencil buffer). Meanwhile the same driver
doesn't report 24 bits as supported when it's actually supported.

This fix overrides the set of supported z-buffer bit depths in D3DDEVICEDESC
structs for HAL devices to align with the actually supported pixel formats.

Fixes a startup issue in Rainbow Six mentioned in issue #2.
2016-06-12 14:21:09 +02:00
narzoul
6aba3b6f39 Extended hooking to IDirect3DDevice interfaces 2016-06-12 12:32:33 +02:00
narzoul
691b10bff8 Extended hooking to IDirect3D interfaces 2016-06-12 12:27:12 +02:00
narzoul
923912d3af Refactored the queryInterface implementation 2016-06-08 22:18:50 +02:00
narzoul
d9e095f75d Return the emulated display mode from GetDisplayMode 2016-06-05 19:23:03 +02:00
narzoul
d68cafa522 Avoid redundant display mode changes 2016-05-29 23:58:03 +02:00
narzoul
04fc3c808b Added triple buffering in full screen mode
Fixes stuttering in Midtown Madness 2 Trial (and probably other games)
when V-sync is enabled.
2016-05-29 17:31:24 +02:00
narzoul
ee83a95c52 Added DDSCAPS_OFFSCREENPLAIN to surfaces with no type capability
When a surface is created without an explicit capability to specify the type
of surface to create, it only accepts a pixel format that matches the current
display mode. Since the display mode is forced to 32 bit color depth under
DDrawCompat, creating such surfaces could either fail if a different pixel
format is specified (even though it could match the emulated color depth),
or it could be created with the wrong color depth if no pixel format is given.

To prevent these issues, the DDSCAPS_OFFSCREENPLAIN capability is added to all
"untyped" surfaces, which accepts any color depth and already has code in place
to match the emulated display mode's color depth when no pixel format is given.

Fixes #1
2016-05-29 17:31:18 +02:00
narzoul
8694b9a42b Log __COMPAT_LAYER environment variable 2016-05-29 17:31:12 +02:00
narzoul
9f206897ad Disabled the IgnoreAltTab shim 2016-05-29 17:31:06 +02:00
narzoul
abb1b32f2c Restore font smoothing settings 2016-05-29 17:31:00 +02:00
narzoul
f29c371b8b Disabled dynamic thread priority boosts
Fixes performance issues in The Longest Journey.
2016-05-29 17:30:54 +02:00
narzoul
c8ecb227a3 GDI performance enhancements 2016-05-29 17:30:44 +02:00
narzoul
c4ea2541a9 Moved display mode operations to CompatDisplayMode 2016-05-29 17:26:02 +02:00
narzoul
cf08f10162 Improved GetPixel performance via DDLOCK_READONLY
Reduces Diablo II startup time.
2016-05-29 17:02:59 +02:00
narzoul
b78ea774d7 Disabled the VirtualizeDesktopPainting shim 2016-05-29 17:02:53 +02:00
narzoul
f973291f93 Replaced DirectDraw palette and clipper raw pointers with smart pointers 2016-05-29 17:02:47 +02:00
narzoul
e8f4a970e0 Replaced IDirectDraw raw pointers with smart pointers 2016-05-29 17:02:34 +02:00
narzoul
068cdb8028 Replaced IDirectDrawSurface raw pointers with smart pointers 2016-05-29 16:59:35 +02:00
narzoul
70a29c2f12 Fixed unsafe use of released primary surface interface 2016-05-29 16:59:29 +02:00
narzoul
2717b095ec Restore main window, last active popup and GDI on WM_ACTIVATEAPP
Fixes an issue with Fallout's window disappearing from the taskbar every other
time it's minimized.
Also fixes StarCraft's Save Screen Capture dialog being hidden after the main
window is restored.
2016-05-10 00:04:21 +02:00
narzoul
fef2598e5f Do not minimize on deactivation if DDSCL_NOWINDOWCHANGES is set
Fixes alt-tabbing issues in Age of Wonders 2 that was making it difficult
to properly activate the minimized game.
2016-05-08 21:57:51 +02:00
narzoul
639d0ce8fb Disable setting full-screen cooperative level while the app is inactive
Commandos 2 reacts to WM_DISPLAYCHANGE messages by reapplying the full-screen
cooperative level and the display mode. This makes the RestoreDisplayMode call
(which itself generates WM_DISPLAYCHANGE) ineffective.
Additionally, on WM_ACTIVATE it removes the primary surface, which DDrawCompat
was relying on for full-screen detection.

This fix returns DDERR_EXCLUSIVEMODEALREADYSET if the app tries to set
full-screen cooperative level while inactive. The tracking of full-screen
mode is now done via a dummy surface instead of the primary surface.
2016-05-08 21:57:26 +02:00
narzoul
c647f4b2ef Disabled GDI emulation while the app is inactive v0.2.1 2016-05-03 23:02:46 +02:00
narzoul
fe8abe9d5a Avoid side effects when method implementations are delegated to higher versions
Some DirectDraw methods are implemented by delegating to the same method
in a higher interface version. In this case, the hooking logic could be
executed twice, leading to unwanted side effects. This is now avoided.
2016-05-03 23:02:39 +02:00
narzoul
f7f5348a87 Fixed/simplified hooking logic for COM methods 2016-05-03 23:02:33 +02:00
narzoul
e4b67be7ec Fixed misleading error messages 2016-05-03 22:12:46 +02:00
narzoul
5e972cf056 Handle WM_ACTIVATEAPP messages
Aiming to fix Alt-Tabbing issues (such as black screen instead of desktop)
by temporarily setting the cooperative level to windowed mode, restoring
the display mode and minimizing the main window when the app is inactive.
2016-05-03 22:12:25 +02:00
narzoul
f0425495bc Updated disabling of immersive context menus 2016-04-30 23:43:40 +02:00
narzoul
441d7794cd Fixed hangups caused by unreleased back buffer surface 2016-04-30 23:43:20 +02:00