From: Toni Wilen Date: Fri, 19 May 2023 18:57:13 +0000 (+0300) Subject: Autoscale and integer scale fixes and updates X-Git-Tag: 5.0.0~28 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=082e07b20ce2b447cf60c498d333bf952706754f;p=francis%2Fwinuae.git Autoscale and integer scale fixes and updates --- diff --git a/custom.cpp b/custom.cpp index 8719083e..d20801b0 100644 --- a/custom.cpp +++ b/custom.cpp @@ -307,7 +307,7 @@ int maxhpos_short = MAXHPOS_PAL; int maxvpos = MAXVPOS_PAL; int maxvpos_nom = MAXVPOS_PAL; // nominal value (same as maxvpos but "faked" maxvpos in fake 60hz modes) int maxvpos_display = MAXVPOS_PAL; // value used for display size -static int maxhpos_display = AMIGA_WIDTH_MAX; +int maxhpos_display = AMIGA_WIDTH_MAX; int maxvpos_display_vsync; // extra lines from top visible in bottom static int vblank_extraline; static int maxhposm1; @@ -12576,24 +12576,26 @@ static void reset_autoscale(void) autoscale_bordercolors = 0; } -static void hautoscale_check(void) +static void hautoscale_check(int vp) { + int vp_start = vp; + int vp_end = vp + 1; // border detection/autoscale if (GET_PLANES(bplcon0) > 0 && dmaen(DMA_BITPLANE) && !vb_state && !vb_end_line && !vb_start_line) { if (first_bplcon0 == 0) { first_bplcon0 = bplcon0; } - if (vpos > last_planes_vpos) { - last_planes_vpos = vpos; + if (vp_end > last_planes_vpos) { + last_planes_vpos = vp_end; } - if (vpos >= minfirstline && first_planes_vpos == 0) { - first_planes_vpos = vpos; - } else if (vpos >= current_maxvpos() - 1) { + if (vp_start >= minfirstline && first_planes_vpos == 0) { + first_planes_vpos = vp_start; + } else if (vp_end >= current_maxvpos() - 1) { last_planes_vpos = current_maxvpos(); } } if (diw_change == 0) { - if (vpos >= first_planes_vpos && vpos <= last_planes_vpos) { + if (vp_start >= first_planes_vpos && vp_end <= last_planes_vpos) { int diwlastword_lores = diwlastword; int diwfirstword_lores = diwfirstword; if (diwlastword_lores > diwlastword_total) { @@ -12619,7 +12621,7 @@ static void hautoscale_check(void) ddflastword_total = plfstop + 2 * f; } } - if ((plffirstline < plffirstline_total || (plffirstline_total == minfirstline && vpos > minfirstline)) && plffirstline < maxvpos / 2) { + if ((plffirstline < plffirstline_total || (plffirstline_total == minfirstline && vp_start > minfirstline)) && plffirstline < maxvpos / 2) { firstword_bplcon1 = bplcon1; if (plffirstline < minfirstline) { plffirstline_total = minfirstline; @@ -12654,7 +12656,7 @@ static void hsync_handlerh(bool onvsync) notice_resolution_seen(GET_RES_AGNUS(bplcon0), interlace_seen != 0); - hautoscale_check(); + hautoscale_check(vposh); int lineno = calculate_lineno(vposh); next_lineno = lineno; @@ -12662,6 +12664,7 @@ static void hsync_handlerh(bool onvsync) } vposh++; + hpos_hsync_extra = 0; estimate_last_fetch_cycle(hpos); diff --git a/drawing.cpp b/drawing.cpp index 007fcc89..59cda0ee 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -856,11 +856,6 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh) if (!lof_display) return ret; interlace_count = 0; - /* program may have set last visible line as last possible line (CD32 boot screen) */ - if (last_planes_vpos < maxvpos) - last_planes_vpos++; - if (plflastline_total < maxvpos) - plflastline_total++; } if (plflastline_total < 4) @@ -906,7 +901,7 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh) dbl2--; } - h = y2 - y1 + 1; + h = y2 - y1; dy = y1 - minfirstline; if (first_planes_vpos == 0) { diff --git a/include/custom.h b/include/custom.h index 9e298677..86742083 100644 --- a/include/custom.h +++ b/include/custom.h @@ -147,7 +147,7 @@ extern uae_u16 INTREQR(void); #define OCS_DENISE_HBLANK_DISABLE_HPOS 0x2d extern int maxhpos, maxhposm0, maxhpos_short; -extern int maxvpos, maxvpos_nom, maxvpos_display, maxvpos_display_vsync; +extern int maxvpos, maxvpos_nom, maxvpos_display, maxvpos_display_vsync, maxhpos_display; extern int hsyncstartpos_hw, hsyncendpos_hw; extern int minfirstline, vblank_endline, numscrlines; extern float vblank_hz, fake_vblank_hz; diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index ceb8ffe4..c379f286 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -117,7 +117,12 @@ static void getmanualpos(int monid, int *cxp, int *cyp, int *cwp, int *chp) if (programmedmode && native) { cw = avidinfo->outbuffer->outwidth << (RES_MAX - currprefs.gfx_resolution); } else { - cw = native ? AMIGA_WIDTH_MAX << RES_MAX : avidinfo->outbuffer->outwidth; + if (currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN) { + // keep old version compatibility + cw = native ? AMIGA_WIDTH_MAX << RES_MAX : avidinfo->outbuffer->outwidth; + } else { + cw = native ? maxhpos_display << RES_MAX : avidinfo->outbuffer->outwidth; + } } } else { cw = v; @@ -128,8 +133,11 @@ static void getmanualpos(int monid, int *cxp, int *cyp, int *cwp, int *chp) if (v <= 0) { if (programmedmode && native) { ch = avidinfo->outbuffer->outheight << (VRES_MAX - currprefs.gfx_vresolution); - } else { + } else if (currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN) { + // keep old version compatiblity ch = native ? AMIGA_HEIGHT_MAX << VRES_MAX : avidinfo->outbuffer->outheight; + } else { + ch = native ? (maxvpos_display + maxvpos_display_vsync - minfirstline) << VRES_MAX : avidinfo->outbuffer->outheight; } } else { ch = v;