[WIN32SS][NTDDRAW] Improve DxEngGetDCState type 2 implementation (#4176)

- Use the REGION_Complexity() function to get the actual region complexity instead of just number of rectangles.
- Don't use prgnRao at all, because it is always uninitialized when passed to the function. So in condition between prgnRao and prgnVis, the 2nd one always succeeds.
- Update the comment accordingly.
- Additionally, add a DPRINT to the end of the function, which displays the returned value.

This allows to properly enable and use DirectDraw and Direct3D hardware acceleration with the following MS DirectX components: ddraw.dll, d3d8.dll, d3d9.dll and dxg.sys. As in VM, same on real hardware.
But note that now the bugcheck 0x50 (PAGE_FAULT_IN_NONPAGED_AREA) occurs when executing fullscreen DDraw apps, after switching display mode. It's unhidden by this fix.
Addendum to 855bf46.
CORE-17561
This commit is contained in:
Oleg Dubinskiy 2021-12-20 20:27:13 +00:00 committed by GitHub
parent 9d33a2056e
commit 8a6312abda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -464,8 +464,8 @@ DxEngGetDCState(HDC hDC,
retVal = (DWORD_PTR) pDC->fs & DC_FLAG_FULLSCREEN;
break;
case 2:
/* Return the number of rectangles in the visible region. */
retVal = (DWORD_PTR) pDC->prgnRao ? pDC->prgnRao->rdh.nCount : pDC->prgnVis->rdh.nCount;
/* Return the complexity of the visible region. */
retVal = (DWORD_PTR) REGION_Complexity(pDC->prgnVis);
break;
case 3:
{
@ -481,6 +481,8 @@ DxEngGetDCState(HDC hDC,
DC_UnlockDc(pDC);
}
DPRINT1("Return value %08lx\n", retVal);
return retVal;
}