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

157 Commits

Author SHA1 Message Date
narzoul
1c82165214 Call window procedures through CallWindowProc 2016-12-22 20:49:06 +01:00
narzoul
26995d6108 Create palettized surfaces in system memory 2016-12-22 20:49:00 +01:00
narzoul
e6bb6b1e35 Fixed logging of uninitialized output parameters 2016-12-22 20:48:40 +01:00
narzoul
5b5863b028 Fixed various alt-tabbing issues 2016-12-20 18:52:50 +01:00
narzoul
d898961a7e Restore legacy double/triple buffered v-sync behavior
On recent drivers, double buffered DirectDraw flips no longer wait for the
vertical sync before returning and instead just insert the flip into the
flip queue for later execution. This effectively results in triple buffered
behavior (in the render-ahead sense) and causes up to an extra frame of
latency even if the flip queue size is set to 1.

To restore the legacy double buffered behavior, each flip waits for the
presented frame to leave the flip queue before returning.

To restore the legacy triple buffered behavior, the flip queue size is
forced to 1. This causes the flip to wait if the previous flip is still
pending.
2016-12-04 15:43:05 +01:00
narzoul
89f1556789 Lock render targets via off-screen plain copy
Video memory render target surfaces get an additional video memory off-screen
plain surface used for providing efficient direct memory access (locking).
All 2D operations starting with a lock are redirected to the off-screen plain
surface until the next rendering operation requires the render target surface.
The two surfaces are kept in sync via blits as needed.

Fixes performance issues in Rogue Spear menus, mentioned in issue #2.
2016-11-06 19:52:33 +01:00
narzoul
003c3e2f3b Moved Direct3D DDI struct logging to Log subdirectory 2016-11-05 11:46:01 +01:00
narzoul
1d14b606c2 Implemented GetGDISurface and FlipToGDISurface 2016-11-05 11:45:55 +01:00
narzoul
fbe34c0341 Handle mirrored blits via HEL
Disabled the indication of mirrored blit support via the driver GetCaps routine
as this may be reported as supported on modern GPUs even when it's not.
Removing this indication allows the HEL (Hardware Emulation Layer) to correctly
handle all mirrored blits. It also seems to perform better than the previous
clumsy line-by-line mirroring emulation.
2016-11-05 11:45:48 +01:00
narzoul
0edcde6d55 Force CpuOptimized flag on off-screen plain surfaces
This flag forces linear (non-swizzled) surface layout on Intel HD drivers.
Fixes issues with games that keep writing to unlocked surfaces (e.g. Nox)
as well as greatly increases lock performance.
2016-11-05 11:45:31 +01:00
narzoul
32259119c3 Hooked the IDirect3DVertexBuffer interfaces 2016-10-31 13:48:26 +01:00
narzoul
2d22ace9f1 Hooked the IDirect3DTexture interfaces 2016-10-31 13:48:19 +01:00
narzoul
6e95f7ca1b Hooked the IDirect3DViewport interfaces 2016-10-31 13:48:12 +01:00
narzoul
e8f987eb05 Create repository surfaces on the appropriate device
This change assigns a different DirectDraw repository object for each original
DirectDraw object that requires temporary surfaces, ensuring that video memory
surfaces are created on the appropriate device on a multi-GPU system.
2016-10-31 13:48:05 +01:00
narzoul
7220b80999 Tagged all DirectDraw objects for tracking lifetime 2016-10-31 13:47:59 +01:00
narzoul
3746362528 Allow hooking multiple user mode display drivers 2016-10-31 13:47:41 +01:00
narzoul
aabe85db65 Removed CompatVtable dependency on derived interface 2016-10-23 15:28:27 +02:00
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