From b30c4157e1f6265a46c7f0ff3e432e442060bb79 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 2 Apr 2025 20:12:52 +0300 Subject: [PATCH] Overscan TV mode top and bottom border interlace fix. --- custom.cpp | 4 ++-- drawing.cpp | 18 +++++++++++++----- include/drawing.h | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/custom.cpp b/custom.cpp index 3c6db2d1..49c15651 100644 --- a/custom.cpp +++ b/custom.cpp @@ -5092,7 +5092,7 @@ static void check_interlace(void) } } if (!ad->picasso_on) { - if (ad->interlace_on) { + if (ad->interlace_on && currprefs.gf[GF_INTERLACE].enable) { ad->gf_index = GF_INTERLACE; } else { ad->gf_index = GF_NORMAL; @@ -10757,7 +10757,7 @@ static void draw_line(void) int cslen = 10; draw_denise_line_queue(dvp, nextline_how, rga_denise_cycle_line, rga_denise_cycle_start, rga_denise_cycle, rga_denise_cycle_count, display_hstart_cyclewait_skip, display_hstart_cyclewait_skip2, - wclks, cs, cslen, lol, l); + wclks, cs, cslen, lof_store, lol, l); } static void dmal_fast(void) diff --git a/drawing.cpp b/drawing.cpp index 4ac9b7ca..044d22f7 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -81,7 +81,7 @@ struct denise_rga_queue int dtotal; int calib_start; int calib_len; - bool lol; + bool lol, lof; uae_u16 strobe; int strobe_pos; struct linestate *ls; @@ -3631,12 +3631,14 @@ static void handle_strobes(struct denise_rga *rd) if (rd->rga == 0x03c && previous_strobe != 0x03c) { linear_denise_vbstrt = this_line->linear_vpos; if (denise_vblank_extra) { - denise_vblank_extra_vbstrt = this_line->linear_vpos + denise_vblank_extra; + int lof = this_line->lof; + denise_vblank_extra_vbstrt = this_line->linear_vpos + denise_vblank_extra + lof; } } else if (rd->rga != 0x03c && previous_strobe == 0x03c) { linear_denise_vbstop = this_line->linear_vpos; if (denise_vblank_extra) { - denise_vblank_extra_vbstop = this_line->linear_vpos - denise_vblank_extra; + int lof = this_line->lof; + denise_vblank_extra_vbstop = this_line->linear_vpos - denise_vblank_extra + lof; } denise_visible_lines = 0; } @@ -5317,7 +5319,7 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start if (h) { denise_hcounter_next = denise_hcounter_new; } - checkhorizontal1_aga(denise_hcounter << 2, denise_hcounter_next << 2, h); + checkhorizontal1_aga(denise_hcounter, denise_hcounter_next, h); flush_null(); #ifdef DEBUGGER *debug_dma_dhpos_odd = denise_hcounter; @@ -6754,6 +6756,10 @@ void draw_denise_bitplane_line_fast(int gfx_ypos, enum nln_how how, struct lines return; } + if ((this_line->linear_vpos >= denise_vblank_extra_vbstop || this_line->linear_vpos < denise_vblank_extra_vbstrt) && currprefs.gfx_overscanmode < OVERSCANMODE_ULTRA) { + return; + } + uae_u32 *buf1p = buf1; uae_u32 *buf2p = buf2 != buf1 ? buf2 : NULL; int planecnt = GET_PLANES(ls->bplcon0); @@ -7125,6 +7131,7 @@ static void updatelinedata(void) { this_line = &temp_line; this_line->vpos = vpos; + this_line->lof = lof_store; this_line->linear_vpos = linear_vpos; } @@ -7253,7 +7260,7 @@ void denise_handle_quick_strobe_queue(uae_u16 strobe, int strobe_pos, int endpos } } -void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int startpos, int endpos, int total, int skip, int skip2, int dtotal, int calib_start, int calib_len, bool lol, struct linestate *ls) +void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int startpos, int endpos, int total, int skip, int skip2, int dtotal, int calib_start, int calib_len, bool lof, bool lol, struct linestate *ls) { if (MULTITHREADED_DENISE) { @@ -7274,6 +7281,7 @@ void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int star q->dtotal = dtotal; q->calib_start = calib_start; q->calib_len = calib_len; + q->lof = lof; q->lol = lol; q->ls = ls; q->vpos = vpos; diff --git a/include/drawing.h b/include/drawing.h index eec0fb5f..55fd2a1f 100644 --- a/include/drawing.h +++ b/include/drawing.h @@ -177,7 +177,7 @@ struct linestate extern struct color_entry denise_colors; void draw_denise_line(int gfx_ypos, nln_how how, uae_u32 linecnt, int startpos, int total, int skip, int skip2, int dtotal, int calib_start, int calib_len, bool lol, struct linestate *ls); -void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int startpos, int endpos, int total, int skip, int skip2, int dtotal, int calib_start, int calib_len, bool lol, struct linestate *ls); +void draw_denise_line_queue(int gfx_ypos, nln_how how, uae_u32 linecnt, int startpos, int endpos, int total, int skip, int skip2, int dtotal, int calib_start, int calib_len, bool lof, bool lol, struct linestate *ls); void draw_denise_bitplane_line_fast(int gfx_ypos, enum nln_how how, struct linestate *ls); void draw_denise_bitplane_line_fast_queue(int gfx_ypos, enum nln_how how, struct linestate *ls); void draw_denise_border_line_fast(int gfx_ypos, enum nln_how how, struct linestate *ls); -- 2.47.3