From 14d3bd8f8a642cc2f713ae8f0523fbacbe75b0ec Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 6 Dec 2022 15:58:00 +0200 Subject: [PATCH] Fix autoresolution support --- drawing.cpp | 87 ++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index e90f586c..8e338a21 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -4138,54 +4138,47 @@ static void init_drawing_frame (void) if (frame_res_cnt == 0) { int m = frame_res_detected * 2 + frame_res_lace_detected; struct wh *dst = currprefs.gfx_apmode[0].gfx_fullscreen ? &changed_prefs.gfx_monitor[0].gfx_size_fs : &changed_prefs.gfx_monitor[0].gfx_size_win; - while (m < 3 * 2) { - struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_monitor[0].gfx_size_fs_xtra[m] : &currprefs.gfx_monitor[0].gfx_size_win_xtra[m]; - if (src->width > 0 && src->height > 0) { - int nr = m >> 1; - int nl = (m & 1) == 0 ? 0 : 1; - int nr_o = nr; - int nl_o = nl; - - if (currprefs.gfx_autoresolution >= 100 && nl == 0 && nr > 0) { - nl = 1; - } - - if (currprefs.gfx_autoresolution_minh < 0) { - if (nr < nl) - nr = nl; - } else if (nr < currprefs.gfx_autoresolution_minh) { - nr = currprefs.gfx_autoresolution_minh; - } - if (currprefs.gfx_autoresolution_minv < 0) { - if (nl < nr) - nl = nr; - } else if (nl < currprefs.gfx_autoresolution_minv) { - nl = currprefs.gfx_autoresolution_minv; - } - - if (nr > vidinfo->gfx_resolution_reserved) - nr = vidinfo->gfx_resolution_reserved; - if (nl > vidinfo->gfx_vresolution_reserved) - nl = vidinfo->gfx_vresolution_reserved; - - if (changed_prefs.gfx_resolution != nr || changed_prefs.gfx_vresolution != nl) { - changed_prefs.gfx_resolution = nr; - changed_prefs.gfx_vresolution = nl; - - write_log (_T("RES -> %d (%d) LINE -> %d (%d) (%d - %d, %d - %d)\n"), nr, nr_o, nl, nl_o, - currprefs.gfx_autoresolution_minh, currprefs.gfx_autoresolution_minv, - vidinfo->gfx_resolution_reserved, vidinfo->gfx_vresolution_reserved); - set_config_changed (); - } - if (src->width > 0 && src->height > 0) { - if (memcmp (dst, src, sizeof *dst)) { - *dst = *src; - set_config_changed (); - } - } - break; + struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_monitor[0].gfx_size_fs_xtra[m] : &currprefs.gfx_monitor[0].gfx_size_win_xtra[m]; + int nr = m >> 1; + int nl = (m & 1) == 0 ? 0 : 1; + int nr_o = nr; + int nl_o = nl; + + if (currprefs.gfx_autoresolution >= 100 && nl == 0 && nr > 0) { + nl = 1; + } + if (currprefs.gfx_autoresolution_minh < 0) { + if (nr < nl) + nr = nl; + } else if (nr < currprefs.gfx_autoresolution_minh) { + nr = currprefs.gfx_autoresolution_minh; + } + if (currprefs.gfx_autoresolution_minv < 0) { + if (nl < nr) + nl = nr; + } else if (nl < currprefs.gfx_autoresolution_minv) { + nl = currprefs.gfx_autoresolution_minv; + } + + if (nr > vidinfo->gfx_resolution_reserved) + nr = vidinfo->gfx_resolution_reserved; + if (nl > vidinfo->gfx_vresolution_reserved) + nl = vidinfo->gfx_vresolution_reserved; + + if (changed_prefs.gfx_resolution != nr || changed_prefs.gfx_vresolution != nl) { + changed_prefs.gfx_resolution = nr; + changed_prefs.gfx_vresolution = nl; + + write_log(_T("RES -> %d (%d) LINE -> %d (%d) (%d - %d, %d - %d)\n"), nr, nr_o, nl, nl_o, + currprefs.gfx_autoresolution_minh, currprefs.gfx_autoresolution_minv, + vidinfo->gfx_resolution_reserved, vidinfo->gfx_vresolution_reserved); + set_config_changed(); + } + if (src->width > 0 && src->height > 0) { + if (memcmp(dst, src, sizeof(*dst))) { + *dst = *src; + set_config_changed(); } - m++; } frame_res_cnt = currprefs.gfx_autoresolution_delay; } -- 2.47.3