[WIN32SS] Introduce the NATIVE_REACTX define and disable some Dx calls (#6025)

The code itself isn't wrong but we're entirely missing the logic needed
to make it work. This leads to spontaneous crashes with video drivers and
various unity games.
This commit is contained in:
Justin Miller 2024-04-17 21:47:49 -07:00 committed by GitHub
parent 9452b29c7f
commit 2a2556c5d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,10 @@ set(USE_DIBLIB FALSE)
# Give WIN32 subsystem its own project.
PROJECT(WIN32SS)
if (NATIVE_REACTX)
add_definitions(-DNATIVE_REACTX)
endif()
add_subdirectory(drivers)
if(USE_DIBLIB)

View File

@ -337,6 +337,7 @@ PDEVOBJ_pSurface(
return ppdev->pSurface;
}
#ifdef NATIVE_REACTX
BOOL
PDEVOBJ_bEnableDirectDraw(
_Inout_ PPDEVOBJ ppdev)
@ -385,6 +386,7 @@ PDEVOBJ_vSwitchDirectDraw(
TRACE("DxDdDynamicModeChange(ppdev %p, ppdev2 %p)\n", ppdev, ppdev2);
pfnDdDynamicModeChange((HDEV)ppdev, (HDEV)ppdev2, 0);
}
#endif
VOID
PDEVOBJ_vEnableDisplay(
@ -415,7 +417,9 @@ PDEVOBJ_bDisableDisplay(
if (ppdev->flFlags & PDEV_DISABLED)
return TRUE;
#ifdef NATIVE_REACTX
PDEVOBJ_vSuspendDirectDraw(ppdev);
#endif
TRACE("DrvAssertMode(dhpdev %p, FALSE)\n", ppdev->dhpdev);
assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE);
@ -600,6 +604,7 @@ PDEVOBJ_Create(
return NULL;
}
#ifdef NATIVE_REACTX
/* Enable DirectDraw */
if (!PDEVOBJ_bEnableDirectDraw(ppdev))
{
@ -608,6 +613,7 @@ PDEVOBJ_Create(
EngUnloadImage(pldev);
return NULL;
}
#endif
/* Remove some acceleration capabilities from driver */
PDEVOBJ_vFilterDriverHooks(ppdev);
@ -692,8 +698,10 @@ PDEVOBJ_bDynamicModeChange(
ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
#ifdef NATIVE_REACTX
/* Switch DirectDraw mode */
PDEVOBJ_vSwitchDirectDraw(ppdev, ppdev2);
#endif
return TRUE;
}
@ -724,8 +732,10 @@ PDEVOBJ_bSwitchMode(
if (!PDEVOBJ_bDisableDisplay(ppdev))
{
DPRINT1("PDEVOBJ_bDisableDisplay() failed\n");
#ifdef NATIVE_REACTX
/* Resume DirectDraw in case of failure */
PDEVOBJ_vResumeDirectDraw(ppdev);
#endif
goto leave;
}
@ -746,9 +756,11 @@ PDEVOBJ_bSwitchMode(
goto leave2;
}
#ifdef NATIVE_REACTX
/* 4. Temporarily suspend DirectDraw for mode change */
PDEVOBJ_vSuspendDirectDraw(ppdev);
PDEVOBJ_vSuspendDirectDraw(ppdevTmp);
#endif
/* 5. Switch the PDEVs */
if (!PDEVOBJ_bDynamicModeChange(ppdev, ppdevTmp))
@ -758,16 +770,20 @@ PDEVOBJ_bSwitchMode(
goto leave2;
}
#ifdef NATIVE_REACTX
/* 6. Resume DirectDraw */
PDEVOBJ_vResumeDirectDraw(ppdev);
PDEVOBJ_vResumeDirectDraw(ppdevTmp);
#endif
/* Release temp PDEV */
PDEVOBJ_vRelease(ppdevTmp);
#ifdef NATIVE_REACTX
/* Re-initialize DirectDraw data */
ppdev->pEDDgpl->hDev = (HDEV)ppdev;
ppdev->pEDDgpl->dhpdev = ppdev->dhpdev;
#endif
/* Update primary display capabilities */
if (ppdev == gpmdev->ppdevGlobal)