mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
add all resolutions to the in-game list (Tiberian Sun / Red Alert 2)
This commit is contained in:
parent
12586a4b0e
commit
85b6ad7201
160
src/main.c
160
src/main.c
@ -209,74 +209,122 @@ HRESULT __stdcall ddraw_EnumDisplayModes(IDirectDrawImpl *This, DWORD dwFlags, L
|
|||||||
return DDERR_UNSUPPORTED;
|
return DDERR_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
SIZE resolutions[] =
|
// Some games crash when you feed them with too many resolutions...
|
||||||
{
|
|
||||||
{ 320, 200 },
|
|
||||||
{ 640, 400 },
|
|
||||||
{ 640, 480 },
|
|
||||||
{ 800, 600 },
|
|
||||||
{ 1024, 768 },
|
|
||||||
{ 1280, 1024 },
|
|
||||||
{ 1280, 720 },
|
|
||||||
{ 1920, 1080 },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (i = 0; i < sizeof(resolutions) / sizeof(resolutions[0]); i++)
|
if (This->bpp)
|
||||||
{
|
{
|
||||||
memset(&s, 0, sizeof(DDSURFACEDESC));
|
printf(" This->bpp=%d\n", This->bpp);
|
||||||
s.dwSize = sizeof(DDSURFACEDESC);
|
|
||||||
s.dwFlags = DDSD_HEIGHT | DDSD_REFRESHRATE | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
|
||||||
s.dwHeight = resolutions[i].cy;
|
|
||||||
s.dwWidth = resolutions[i].cx;
|
|
||||||
s.dwRefreshRate = 60;
|
|
||||||
s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
|
||||||
s.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
|
|
||||||
s.ddpfPixelFormat.dwRGBBitCount = 8;
|
|
||||||
|
|
||||||
if (lpEnumModesCallback(&s, lpContext) == DDENUMRET_CANCEL)
|
//set up some filters to keep the list short
|
||||||
|
DWORD refreshRate = 0;
|
||||||
|
DWORD bpp = 0;
|
||||||
|
DWORD flags = 0;
|
||||||
|
DWORD fixedOutput = 0;
|
||||||
|
|
||||||
|
DEVMODE m;
|
||||||
|
while (EnumDisplaySettings(NULL, i, &m))
|
||||||
{
|
{
|
||||||
printf(" DDENUMRET_CANCEL returned, stopping\n");
|
if (refreshRate != 60 && m.dmDisplayFrequency >= 50)
|
||||||
break;
|
refreshRate = m.dmDisplayFrequency;
|
||||||
|
|
||||||
|
if (bpp != 32 && m.dmBitsPerPel >= 16)
|
||||||
|
bpp = m.dmBitsPerPel;
|
||||||
|
|
||||||
|
if (flags == 0)
|
||||||
|
flags = m.dmDisplayFlags;
|
||||||
|
|
||||||
|
if (fixedOutput == 0)
|
||||||
|
fixedOutput = m.dmDisplayFixedOutput;
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
i = 0;
|
||||||
s.ddpfPixelFormat.dwRGBBitCount = 16;
|
while (EnumDisplaySettings(NULL, i, &m))
|
||||||
s.ddpfPixelFormat.dwRBitMask = 0xF800;
|
|
||||||
s.ddpfPixelFormat.dwGBitMask = 0x07E0;
|
|
||||||
s.ddpfPixelFormat.dwBBitMask = 0x001F;
|
|
||||||
|
|
||||||
if (lpEnumModesCallback(&s, lpContext) == DDENUMRET_CANCEL)
|
|
||||||
{
|
{
|
||||||
printf(" DDENUMRET_CANCEL returned, stopping\n");
|
if (refreshRate == m.dmDisplayFrequency &&
|
||||||
break;
|
bpp == m.dmBitsPerPel &&
|
||||||
}
|
flags == m.dmDisplayFlags &&
|
||||||
}
|
fixedOutput == m.dmDisplayFixedOutput)
|
||||||
|
{
|
||||||
/* Some games crash when you feed them with too many resolutions...
|
|
||||||
DEVMODE m;
|
|
||||||
while (EnumDisplaySettings(NULL, i, &m))
|
|
||||||
{
|
|
||||||
#if _DEBUG_X
|
#if _DEBUG_X
|
||||||
printf(" %d: %dx%d@%d %d bpp\n", (int)i, (int)m.dmPelsWidth, (int)m.dmPelsHeight, (int)m.dmDisplayFrequency, (int)m.dmBitsPerPel);
|
printf(" %d: %dx%d@%d %d bpp\n", (int)i, (int)m.dmPelsWidth, (int)m.dmPelsHeight, (int)m.dmDisplayFrequency, (int)m.dmBitsPerPel);
|
||||||
#endif
|
#endif
|
||||||
memset(&s, 0, sizeof(DDSURFACEDESC));
|
memset(&s, 0, sizeof(DDSURFACEDESC));
|
||||||
s.dwSize = sizeof(DDSURFACEDESC);
|
s.dwSize = sizeof(DDSURFACEDESC);
|
||||||
s.dwFlags = DDSD_HEIGHT | DDSD_REFRESHRATE | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
s.dwFlags = DDSD_HEIGHT | DDSD_REFRESHRATE | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
||||||
s.dwHeight = m.dmPelsHeight;
|
s.dwHeight = m.dmPelsHeight;
|
||||||
s.dwWidth = m.dmPelsWidth;
|
s.dwWidth = m.dmPelsWidth;
|
||||||
s.dwRefreshRate = m.dmDisplayFrequency;
|
s.dwRefreshRate = 60;
|
||||||
s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||||
s.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
|
|
||||||
s.ddpfPixelFormat.dwRGBBitCount = 8;
|
|
||||||
|
|
||||||
if (lpEnumModesCallback(&s, lpContext) == DDENUMRET_CANCEL)
|
s.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
|
||||||
{
|
s.ddpfPixelFormat.dwRGBBitCount = 8;
|
||||||
printf(" DDENUMRET_CANCEL returned, stopping\n");
|
|
||||||
break;
|
if (This->bpp == 16)
|
||||||
|
{
|
||||||
|
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
|
s.ddpfPixelFormat.dwRGBBitCount = 16;
|
||||||
|
s.ddpfPixelFormat.dwRBitMask = 0xF800;
|
||||||
|
s.ddpfPixelFormat.dwGBitMask = 0x07E0;
|
||||||
|
s.ddpfPixelFormat.dwBBitMask = 0x001F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lpEnumModesCallback(&s, lpContext) == DDENUMRET_CANCEL)
|
||||||
|
{
|
||||||
|
printf(" DDENUMRET_CANCEL returned, stopping\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
*/
|
else
|
||||||
|
{
|
||||||
|
SIZE resolutions[] =
|
||||||
|
{
|
||||||
|
{ 320, 200 },
|
||||||
|
{ 640, 400 },
|
||||||
|
{ 640, 480 },
|
||||||
|
{ 800, 600 },
|
||||||
|
{ 1024, 768 },
|
||||||
|
{ 1280, 1024 },
|
||||||
|
{ 1280, 720 },
|
||||||
|
{ 1920, 1080 },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(resolutions) / sizeof(resolutions[0]); i++)
|
||||||
|
{
|
||||||
|
memset(&s, 0, sizeof(DDSURFACEDESC));
|
||||||
|
s.dwSize = sizeof(DDSURFACEDESC);
|
||||||
|
s.dwFlags = DDSD_HEIGHT | DDSD_REFRESHRATE | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
||||||
|
s.dwHeight = resolutions[i].cy;
|
||||||
|
s.dwWidth = resolutions[i].cx;
|
||||||
|
s.dwRefreshRate = 60;
|
||||||
|
s.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||||
|
s.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
|
||||||
|
s.ddpfPixelFormat.dwRGBBitCount = 8;
|
||||||
|
|
||||||
|
if (lpEnumModesCallback(&s, lpContext) == DDENUMRET_CANCEL)
|
||||||
|
{
|
||||||
|
printf(" DDENUMRET_CANCEL returned, stopping\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
s.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
|
s.ddpfPixelFormat.dwRGBBitCount = 16;
|
||||||
|
s.ddpfPixelFormat.dwRBitMask = 0xF800;
|
||||||
|
s.ddpfPixelFormat.dwGBitMask = 0x07E0;
|
||||||
|
s.ddpfPixelFormat.dwBBitMask = 0x001F;
|
||||||
|
|
||||||
|
if (lpEnumModesCallback(&s, lpContext) == DDENUMRET_CANCEL)
|
||||||
|
{
|
||||||
|
printf(" DDENUMRET_CANCEL returned, stopping\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1089,7 +1089,9 @@ HRESULT __stdcall ddraw_CreateSurface(IDirectDrawImpl *This, LPDDSURFACEDESC lpD
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lpDDSurfaceDesc->dwFlags & DDSD_BACKBUFFERCOUNT)
|
if (lpDDSurfaceDesc->dwFlags & DDSD_BACKBUFFERCOUNT)
|
||||||
|
{
|
||||||
printf(" dwBackBufferCount=%d\n", lpDDSurfaceDesc->dwBackBufferCount);
|
printf(" dwBackBufferCount=%d\n", lpDDSurfaceDesc->dwBackBufferCount);
|
||||||
|
}
|
||||||
|
|
||||||
printf(" Surface = %p (%dx%d@%d)\n", Surface, (int)Surface->width, (int)Surface->height, (int)Surface->bpp);
|
printf(" Surface = %p (%dx%d@%d)\n", Surface, (int)Surface->width, (int)Surface->height, (int)Surface->bpp);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user