mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-26 02:19:24 +01:00
read desc and apply filter in EnumDisplayModes
This commit is contained in:
parent
d4097ddc14
commit
5f3a968b08
40
src/dd.c
40
src/dd.c
@ -25,6 +25,28 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
{
|
{
|
||||||
dbg_dump_edm_flags(dwFlags);
|
dbg_dump_edm_flags(dwFlags);
|
||||||
|
|
||||||
|
DWORD bpp_filter = 0;
|
||||||
|
|
||||||
|
if (lpDDSurfaceDesc)
|
||||||
|
{
|
||||||
|
dbg_dump_dds_flags(lpDDSurfaceDesc->dwFlags);
|
||||||
|
dbg_dump_dds_caps(lpDDSurfaceDesc->ddsCaps.dwCaps);
|
||||||
|
|
||||||
|
if (lpDDSurfaceDesc->dwFlags & DDSD_PIXELFORMAT)
|
||||||
|
{
|
||||||
|
TRACE(" ddpfPixelFormat.dwRGBBitCount=%u\n", lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount);
|
||||||
|
|
||||||
|
switch (lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount)
|
||||||
|
{
|
||||||
|
case 8:
|
||||||
|
case 16:
|
||||||
|
case 32:
|
||||||
|
bpp_filter = lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DWORD i = 0;
|
DWORD i = 0;
|
||||||
DWORD res_count = 0;
|
DWORD res_count = 0;
|
||||||
DDSURFACEDESC2 s;
|
DDSURFACEDESC2 s;
|
||||||
@ -175,6 +197,8 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
||||||
s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||||
|
|
||||||
|
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
|
||||||
|
{
|
||||||
if (g_ddraw->bpp == 8 || g_ddraw->resolutions == RESLIST_FULL)
|
if (g_ddraw->bpp == 8 || g_ddraw->resolutions == RESLIST_FULL)
|
||||||
{
|
{
|
||||||
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
||||||
@ -189,6 +213,7 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
s.ddpfPixelFormat.dwRGBBitCount = 16;
|
s.ddpfPixelFormat.dwRGBBitCount = 16;
|
||||||
@ -197,6 +222,8 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
s.ddpfPixelFormat.dwBBitMask = 0x001F;
|
s.ddpfPixelFormat.dwBBitMask = 0x001F;
|
||||||
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
||||||
|
|
||||||
|
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
|
||||||
|
{
|
||||||
if (g_ddraw->bpp == 16 || g_ddraw->resolutions == RESLIST_FULL)
|
if (g_ddraw->bpp == 16 || g_ddraw->resolutions == RESLIST_FULL)
|
||||||
{
|
{
|
||||||
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
||||||
@ -211,6 +238,7 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
s.ddpfPixelFormat.dwRGBBitCount = 32;
|
s.ddpfPixelFormat.dwRGBBitCount = 32;
|
||||||
@ -219,6 +247,8 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
s.ddpfPixelFormat.dwBBitMask = 0x0000FF;
|
s.ddpfPixelFormat.dwBBitMask = 0x0000FF;
|
||||||
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
||||||
|
|
||||||
|
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
|
||||||
|
{
|
||||||
if (g_ddraw->bpp == 32 || g_ddraw->resolutions == RESLIST_FULL)
|
if (g_ddraw->bpp == 32 || g_ddraw->resolutions == RESLIST_FULL)
|
||||||
{
|
{
|
||||||
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
||||||
@ -233,6 +263,7 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int x = 0; x < sizeof(resolutions) / sizeof(resolutions[0]); x++)
|
for (int x = 0; x < sizeof(resolutions) / sizeof(resolutions[0]); x++)
|
||||||
{
|
{
|
||||||
@ -284,6 +315,8 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
s.dwWidth = resolutions[i].cx;
|
s.dwWidth = resolutions[i].cx;
|
||||||
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
||||||
|
|
||||||
|
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
|
||||||
|
{
|
||||||
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
||||||
{
|
{
|
||||||
TRACE(" resolution limit reached, stopping\n");
|
TRACE(" resolution limit reached, stopping\n");
|
||||||
@ -295,6 +328,7 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
TRACE(" DDENUMRET_CANCEL returned, stopping\n");
|
TRACE(" DDENUMRET_CANCEL returned, stopping\n");
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
s.ddpfPixelFormat.dwRGBBitCount = 16;
|
s.ddpfPixelFormat.dwRGBBitCount = 16;
|
||||||
@ -303,6 +337,8 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
s.ddpfPixelFormat.dwBBitMask = 0x001F;
|
s.ddpfPixelFormat.dwBBitMask = 0x001F;
|
||||||
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
||||||
|
|
||||||
|
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
|
||||||
|
{
|
||||||
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
||||||
{
|
{
|
||||||
TRACE(" resolution limit reached, stopping\n");
|
TRACE(" resolution limit reached, stopping\n");
|
||||||
@ -314,6 +350,7 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
TRACE(" DDENUMRET_CANCEL returned, stopping\n");
|
TRACE(" DDENUMRET_CANCEL returned, stopping\n");
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (g_ddraw->resolutions == RESLIST_MINI)
|
if (g_ddraw->resolutions == RESLIST_MINI)
|
||||||
continue;
|
continue;
|
||||||
@ -325,6 +362,8 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
s.ddpfPixelFormat.dwBBitMask = 0x0000FF;
|
s.ddpfPixelFormat.dwBBitMask = 0x0000FF;
|
||||||
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
s.lPitch = ((s.dwWidth * s.ddpfPixelFormat.dwRGBBitCount + 31) & ~31) >> 3;
|
||||||
|
|
||||||
|
if (s.ddpfPixelFormat.dwRGBBitCount == bpp_filter || !bpp_filter)
|
||||||
|
{
|
||||||
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
if (g_ddraw->max_resolutions && res_count++ >= g_ddraw->max_resolutions)
|
||||||
{
|
{
|
||||||
TRACE(" resolution limit reached, stopping\n");
|
TRACE(" resolution limit reached, stopping\n");
|
||||||
@ -338,6 +377,7 @@ HRESULT dd_EnumDisplayModes(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user