Simulate NTSC timings for Windows desktop display modes
This commit is contained in:
@@ -159,6 +159,19 @@ static SDL_DisplayOrientation WIN_GetDisplayOrientation(DEVMODE *mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float WIN_GetRefreshRate(DEVMODE *mode)
|
||||||
|
{
|
||||||
|
/* We're not currently using DXGI to query display modes, so fake NTSC timings */
|
||||||
|
switch (mode->dmDisplayFrequency) {
|
||||||
|
case 119:
|
||||||
|
case 59:
|
||||||
|
case 29:
|
||||||
|
return ((100 * (mode->dmDisplayFrequency + 1) * 1000) / 1001) / 100.0f;
|
||||||
|
default:
|
||||||
|
return (float)mode->dmDisplayFrequency;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static SDL_bool WIN_GetDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode *mode, SDL_DisplayOrientation *orientation)
|
static SDL_bool WIN_GetDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode *mode, SDL_DisplayOrientation *orientation)
|
||||||
{
|
{
|
||||||
SDL_DisplayModeData *data;
|
SDL_DisplayModeData *data;
|
||||||
@@ -181,7 +194,7 @@ static SDL_bool WIN_GetDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_D
|
|||||||
mode->format = SDL_PIXELFORMAT_UNKNOWN;
|
mode->format = SDL_PIXELFORMAT_UNKNOWN;
|
||||||
mode->w = data->DeviceMode.dmPelsWidth;
|
mode->w = data->DeviceMode.dmPelsWidth;
|
||||||
mode->h = data->DeviceMode.dmPelsHeight;
|
mode->h = data->DeviceMode.dmPelsHeight;
|
||||||
mode->refresh_rate = (float)data->DeviceMode.dmDisplayFrequency;
|
mode->refresh_rate = WIN_GetRefreshRate(&data->DeviceMode);
|
||||||
|
|
||||||
/* Fill in the mode information */
|
/* Fill in the mode information */
|
||||||
WIN_UpdateDisplayMode(_this, deviceName, index, mode);
|
WIN_UpdateDisplayMode(_this, deviceName, index, mode);
|
||||||
|
|||||||
Reference in New Issue
Block a user