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

226 Commits

Author SHA1 Message Date
narzoul
7b6b7c911c Resync source surface from system memory during presentation blit
Fixes issues with writing to unlocked primary surfaces (e.g. Nox).
2019-08-01 16:00:22 +02:00
narzoul
d23904afd2 Prefer color fills in system memory 2019-08-01 16:00:22 +02:00
narzoul
c526cc2506 Prefer locks and blits in system memory 2019-08-01 16:00:21 +02:00
narzoul
545b08c55b Minor logging improvements 2019-08-01 16:00:20 +02:00
narzoul
063cefb46e Simplified Surface implementation 2019-08-01 16:00:19 +02:00
narzoul
b0c5736bbf Updated project to VS2019 and SDK/WDK 10.0.17763.0 2019-08-01 16:00:18 +02:00
narzoul
07de716af9 Reworked oversized surface support 2019-08-01 16:00:18 +02:00
narzoul
3e0eada40d Refactored adapter and device references 2019-08-01 16:00:17 +02:00
narzoul
d817c4bfb3 Simplified 8/16 bit display mode emulation 2019-08-01 16:00:16 +02:00
narzoul
26f8742dc2 Reverted forcing surfaces to system memory 2019-08-01 16:00:10 +02:00
narzoul
5b171691f0 Separate DirectDraw and UMD critical sections 2019-06-08 15:59:17 +02:00
narzoul
180811bda1 Handle forwarded exports in getProcAddress 2019-06-08 15:58:07 +02:00
narzoul
0f88271668 Fixed compatibility issue with Windows 10 v1903
See issue #43
2019-06-07 21:19:22 +02:00
narzoul
8e8eeb083a Fixed deadlock when hooking NVIDIA user-mode display drivers
See issue #28
2019-01-02 18:52:06 +01:00
narzoul
14104894b2 Generate full debug info for all build types 2019-01-02 18:17:30 +01:00
narzoul
3de50d98ad Fixed wrong palette returned by GetSystemPaletteEntries 2019-01-02 18:17:19 +01:00
narzoul
7fe68a6e1e Reverting commit 6a225516 due to possible BSOD on AMD drivers 2018-12-31 20:32:09 +01:00
narzoul
587af2c855 Fixed incorrect DC used for opening GDI adapter 2018-12-31 20:32:09 +01:00
narzoul
d655947f18 Fixed crash when rehooking a user-mode display driver 2018-12-31 20:32:08 +01:00
narzoul
c1b35e0434 Workaround for VirtualizeDesktopPainting shim 2018-12-31 20:32:08 +01:00
narzoul
403037c0da Workaround for ForceSimpleWindow shim 2018-12-31 20:32:07 +01:00
narzoul
ec61179b84 Track layered window transparency and position changes 2018-12-31 20:32:07 +01:00
narzoul
291a9c2f9a Fixed various multi-monitor display issues 2018-12-31 20:32:06 +01:00
narzoul
727be63db1 Implement GDI system palette emulation 2018-12-31 20:31:58 +01:00
narzoul
12e78aab84 Moved presentation windows to dedicated thread 2018-12-08 21:58:19 +01:00
narzoul
906ef5ebe2 Added ReleaseWithDebugLogs configuration 2018-12-08 21:58:18 +01:00
narzoul
cd674d54c8 Fixed potential deadlocks during WM_ACTIVATEAPP 2018-12-08 21:57:15 +01:00
narzoul
7785133d02 Improved GDI performance 2018-12-08 21:57:14 +01:00
narzoul
c53ffab664 Indented function logging 2018-12-08 21:57:14 +01:00
narzoul
58aba66ca2 Hook all GDI threads 2018-12-08 21:57:13 +01:00
narzoul
4717b9aa1b Fixed caret display issues 2018-12-08 21:57:12 +01:00
narzoul
2f00b74a56 Fixed display issues with user32 controls 2018-12-08 21:57:12 +01:00
narzoul
537ef9c595 Improved presentation scheduling
Fixes cursor flickering issues in Siege of Avalon (issue #34)
and multimon flip issues on Windows 8.1 (issue #28).
2018-12-08 21:57:09 +01:00
narzoul
e69b5e312c Moved common macros to compiler options 2018-12-08 21:53:41 +01:00
narzoul
785663700d Separate GDI and DirectDraw surfaces 2018-12-08 21:53:40 +01:00
narzoul
6183aed7da Optimize GDI redraw on window position changes 2018-12-08 21:53:38 +01:00
narzoul
7cbc65878a Update visible regions of all top-level windows on pos changes 2018-12-08 21:53:38 +01:00
narzoul
1ee48b11df Enable GDI emulation in windowed mode 2018-12-08 21:53:38 +01:00
narzoul
c384167244 Removed layered windows from DirectDraw primary surface 2018-12-08 21:53:31 +01:00
narzoul
5770c990ed Fixed GDI resource handle initialization 2018-03-17 13:11:45 +01:00
narzoul
335d093cb9 Fixed palette issues with GetDC on primary surface 2018-03-12 21:02:28 +01:00
narzoul
6c34bbb437 Fixed QueryInterface on same interface
Because multiple DirectDraw interface versions may share the same
method implementations, CompatVtable may dispatch calls to an earlier
interface where that method implementation was already hooked.

Therefore a call to QueryInterface is needed even if the method
thinks the result will be the same interface type; a simple
AddRef may not have the same effect.
2018-02-27 20:21:04 +01:00
narzoul
39d148e3ba Aggregate render target locks 2018-02-03 17:02:32 +01:00
narzoul
60c3c4f153 Mitigate performance issues caused by slow surface interface release
Releasing the last reference to a surface interface has a significant
performance impact. Mitigating the issue by eliminating some frequent
but unnecessary QueryInterface calls.

Fixes most of the performance drop reported in issue #24.
2017-11-18 22:43:55 +01:00
narzoul
3f1fa0fae1 Updated windowed mode presentation to use multiple window-clipped blits
Windowed mode presentation is changed to use a series of blits clipped to
each top level window to work around performance issues when a clipper uses
a clip list instead of a window. Otherwise DirectDraw uses StretchBlt rather
than the driver Present call even if the clip list is a single rectangle
matching the window client area.

Fixes a performance issue reported in issue #24.
2017-11-18 22:36:31 +01:00
narzoul
46f71be51a Removed CpuOptimized flag on off-screen plain surfaces
Fixes a black screen issue on some Intel GPU drivers, reported in issue #23.
2017-11-05 13:20:38 +01:00
narzoul
cff2b7e1eb Updated project to VS2017 and latest SDK/WDK (10.0.16299.0) 2017-11-05 13:14:13 +01:00
narzoul
4dc1c70f41 Fix pixel W-fog when projection matrix is not set
When the 3D projection matrix is not set (transformation is performed in
software), pixel (table) fog effects appear to be missing on some drivers.

The matrix itself normally isn't passed to the user mode SetTransform
driver function anyway due to the fixed-function shader converters being
enabled by default. Instead only UpdateWInfo is called with the W-range
calculated from the matrix.

For the initial identity matrix, UpdateWInfo receives the range (1.0, 1.0).
This seems to cause Intel (HD 4600) drivers to interpret pixel fog ranges as
Z-depth values, while with any other range specified eye-relative (W) depth
is used. The actual values otherwise don't seem to matter with respect to
how fog is rendered.
On AMD (RX 480), eye-relative depth is used irrespective of the W-range.
There is currently no information on how NVIDIA drivers behave, except that
with the default W-range no fog seems to be produced.

This fix replaces the W-range (1.0, 1.0) with (0.0, 1.0) which causes Intel
to also interpret fog range in eye-relative depth with the default identity
projection matrix.

Fixes missing fog on Intel HD (and hopefully NVIDIA) in Combat Mission
games reported in issue #20.
2017-08-21 22:26:44 +02:00
narzoul
8ab8058ceb Fix reported memory caps of primary surface
Changed primary surface caps to report video memory in case the surface
was only forced into system memory by DDrawCompat.

Fixes startup issues in C&C 95 and Red Alert, reported in issue #3.
2017-08-06 21:42:24 +02:00
narzoul
e3396a18b8 Support for COM instantiation
Added proper installation of hooks when DirectDraw interfaces are instantiated
through the COM API (e.g. with CoCreateInstance).

Fixes a crash in Warhammer 40,000: Chaos Gate mentioned in issue #15.
2017-08-05 11:32:28 +02:00