From fc9f3bbfa5971ee5138e3067a6d5b7f952b4bdb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 6 Sep 2022 19:20:35 +0300 Subject: [PATCH] ddraw/tests: Avoid picking a large mode on Win10 in test_coop_level_mode_set_enum_cb. --- dlls/ddraw/tests/ddraw1.c | 15 +++++++++++++-- dlls/ddraw/tests/ddraw2.c | 15 +++++++++++++-- dlls/ddraw/tests/ddraw4.c | 15 +++++++++++++-- dlls/ddraw/tests/ddraw7.c | 15 +++++++++++++-- 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 94d41dbc34d..531b16520a1 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2874,8 +2874,19 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_ if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) return DDENUMRET_OK; - param->user32_width = surface_desc->dwWidth; - param->user32_height = surface_desc->dwHeight; + /* The docs say the DDENUMRET_CANCEL below cancels the enumeration, so the check should be + * redundant. However, since Windows 10 this no longer works and the enumeration continues + * until all supported modes are enumerated. Win8 and earlier do cancel. + * + * Unrelatedly, some testbot machines report high res modes like 1920x1080, but suffer from + * some problems when we actually try to set them (w10pro64 and its localization siblings). + * Try to stay below the registry mode if possible. */ + if (!param->user32_width || (surface_desc->dwWidth < registry_mode.dmPelsWidth + && surface_desc->dwHeight < registry_mode.dmPelsHeight)) + { + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; + } return DDENUMRET_CANCEL; } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index d5b72793526..4c20a774b05 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2971,8 +2971,19 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_ if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) return DDENUMRET_OK; - param->user32_width = surface_desc->dwWidth; - param->user32_height = surface_desc->dwHeight; + /* The docs say the DDENUMRET_CANCEL below cancels the enumeration, so the check should be + * redundant. However, since Windows 10 this no longer works and the enumeration continues + * until all supported modes are enumerated. Win8 and earlier do cancel. + * + * Unrelatedly, some testbot machines report high res modes like 1920x1080, but suffer from + * some problems when we actually try to set them (w10pro64 and its localization siblings). + * Try to stay below the registry mode if possible. */ + if (!param->user32_width || (surface_desc->dwWidth < registry_mode.dmPelsWidth + && surface_desc->dwHeight < registry_mode.dmPelsHeight)) + { + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; + } return DDENUMRET_CANCEL; } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 471f6fc3f09..10cf8f88fd6 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -3209,8 +3209,19 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) return DDENUMRET_OK; - param->user32_width = surface_desc->dwWidth; - param->user32_height = surface_desc->dwHeight; + /* The docs say the DDENUMRET_CANCEL below cancels the enumeration, so the check should be + * redundant. However, since Windows 10 this no longer works and the enumeration continues + * until all supported modes are enumerated. Win8 and earlier do cancel. + * + * Unrelatedly, some testbot machines report high res modes like 1920x1080, but suffer from + * some problems when we actually try to set them (w10pro64 and its localization siblings). + * Try to stay below the registry mode if possible. */ + if (!param->user32_width || (surface_desc->dwWidth < registry_mode.dmPelsWidth + && surface_desc->dwHeight < registry_mode.dmPelsHeight)) + { + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; + } return DDENUMRET_CANCEL; } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 15ab548ebc6..062e8430a75 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2860,8 +2860,19 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) return DDENUMRET_OK; - param->user32_width = surface_desc->dwWidth; - param->user32_height = surface_desc->dwHeight; + /* The docs say the DDENUMRET_CANCEL below cancels the enumeration, so the check should be + * redundant. However, since Windows 10 this no longer works and the enumeration continues + * until all supported modes are enumerated. Win8 and earlier do cancel. + * + * Unrelatedly, some testbot machines report high res modes like 1920x1080, but suffer from + * some problems when we actually try to set them (w10pro64 and its localization siblings). + * Try to stay below the registry mode if possible. */ + if (!param->user32_width || (surface_desc->dwWidth < registry_mode.dmPelsWidth + && surface_desc->dwHeight < registry_mode.dmPelsHeight)) + { + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; + } return DDENUMRET_CANCEL; }