1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

make util_get_lowest_resolution slightly more strict

This commit is contained in:
FunkyFr3sh 2023-08-25 21:23:37 +02:00
parent 3c4ec82617
commit ded6255a03

View File

@ -212,7 +212,7 @@ BOOL util_get_lowest_resolution(
DWORD max_height) DWORD max_height)
{ {
BOOL result = FALSE; BOOL result = FALSE;
int org_ratio = (int)((ratio + 0.005f) * 10); int org_ratio = (int)((ratio + 0.005f) * 100);
SIZE lowest = { .cx = max_width + 1, .cy = max_height + 1 }; SIZE lowest = { .cx = max_width + 1, .cy = max_height + 1 };
DWORD i = 0; DWORD i = 0;
DEVMODE m; DEVMODE m;
@ -228,9 +228,9 @@ BOOL util_get_lowest_resolution(
m.dmPelsWidth <= lowest.cx && m.dmPelsWidth <= lowest.cx &&
m.dmPelsHeight <= lowest.cy) m.dmPelsHeight <= lowest.cy)
{ {
int res_ratio = (int)((((float)m.dmPelsWidth / m.dmPelsHeight) + 0.005f) * 10); int res_ratio = (int)((((float)m.dmPelsWidth / m.dmPelsHeight) + 0.005f) * 100);
if (res_ratio == org_ratio) if (abs(res_ratio - org_ratio) <= 5)
{ {
result = TRUE; result = TRUE;
out_res->cx = lowest.cx = m.dmPelsWidth; out_res->cx = lowest.cx = m.dmPelsWidth;