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

174 Commits

Author SHA1 Message Date
narzoul
1af227afc4 Fixed display of check boxes and radio buttons
Fixes an issue with missing icons on check/radio buttons, reported in
issue #15.
2017-07-20 20:55:32 +02:00
narzoul
c63d36d831 Fixed issue with GDI controls not always being visible
Reverted an earlier optimization that tried to handle WM_ERASEBKGND and
WM_PAINT events in a single update cycle for reduced flickering.
It caused some child controls to not display properly.

Fixes an issue reported in #15.
2017-07-16 22:47:19 +02:00
narzoul
d2adc5c811 Fixed incorrect primary update schedule when updates are disabled/enabled 2017-07-16 22:47:14 +02:00
narzoul
6a2255160f Add extra rows to system memory primary surface buffers
Fixes a memory corruption issue in Diablo 1, reported in issue #3.
2017-07-15 12:47:08 +02:00
narzoul
5668bf7c35 Repaint scrolled area when smooth scrolling is disabled
When the SW_SMOOTHSCROLL flag is removed in ScrollWindowEx, it needs to be
replaced with SW_ERASE and SW_INVALIDATE to properly repaint the scrolled
portions of the window.

Fixes an issue reported in #16.
2017-07-14 11:31:55 +02:00
narzoul
ab7271b986 Disable primary surface updates during display mode change 2017-07-02 16:38:31 +02:00
narzoul
c81c12df84 Redirect gamma controls to the real primary surface 2017-06-05 16:35:50 +02:00
narzoul
4b02a40bc9 Hooked the IDirectDrawGammaControl interface 2017-06-05 16:35:48 +02:00
narzoul
5c91706b03 Fixed black screen issue with Windows 10 Creators Update
Also added v-sync to direct primary surface updates (i.e. those that are
not using a back buffer and flip).

Fixes issues #3 and #15.
2017-06-05 16:35:32 +02:00
narzoul
640f746633 Implement 8/16 bit display mode emulation
8/16 bit display mode emulation is now implemented internally instead of
relying on the builtin Windows shims, as those are sometimes unreliable
(not triggering for some games on some systems when they should).

External DirectDraw hooks (such as the DWM8And16BitMitigation shim)
are disabled to avoid interference.

Fixes issues reported in #8, #9, #15.
2017-05-28 15:40:33 +02:00
narzoul
672b3b640f Fixed handling of IDirectDrawClipper window clip lists
DirectDraw does not properly update the clip lists of IDirectDrawClipper
objects that are using window handles. (Probably it only tracks child window
changes and not other overlapping windows when composition is enabled).

Clip lists are now manually calculated and updated on window position
changes instead.

Fixes "invisible" GDI windows in O2Jam (issue #9).
2017-05-28 12:43:51 +02:00
narzoul
5195a5e4b4 Minimize GDI redraws on window position changes
When the display mode changes in full screen mode, DirectDraw resets
the main window to topmost after a short delay, generating a
WM_WINDOWPOSCHANGED message. This could cause an unnecessary repainting
of the window, erasing the background even if nothing needed to be updated.

Now only the regions that change during window repositioning are redrawn.

Fixes the black flashing in Rogue Spear's menus after display mode changes,
mentioned in issue #2.
2017-05-28 12:43:43 +02:00
narzoul
d1cd72b304 Hooked the IDirectDrawClipper interface 2017-05-20 11:34:28 +02:00
narzoul
cd22b333e3 Support oversized surfaces in system memory
AMD drivers reject system memory surfaces that are larger than the maximum
texture width/height supported by the driver (usually 4096x4096 for AMD).
This can cause issues in games that create larger system memory surfaces.

This workaround crops the driver resource dimensions to the allowed
maximum values and handles blitting outside this region by creating a
temporary resource that maps to the actual affected system memory region.

Fixes crashes with AMD drivers in Rainbow Six games and Desperados,
mentioned in issue #2 and #8.
2017-02-18 18:53:53 +01:00
narzoul
60129a1000 Suppress the ForceDirectDrawEmulation compatibility shim 2016-12-27 17:31:48 +01:00
narzoul
8818d5b136 Fixed improper linking to functions not available in Windows Vista 2016-12-23 19:53:36 +01:00
narzoul
347713cdce Create off-screen plain surfaces in system memory
Fixes performance issues with Desperados mentioned in issue #5
(possibly #8 as well).
2016-12-22 20:49:12 +01:00
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