]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Reimplement interlace scandoubler
authorToni Wilen <twilen@winuae.net>
Thu, 16 Jan 2025 18:57:56 +0000 (20:57 +0200)
committerToni Wilen <twilen@winuae.net>
Thu, 16 Jan 2025 18:57:56 +0000 (20:57 +0200)
custom.cpp
drawing.cpp

index 8b99e24a6f71c085e0d99f7775b8ab00afb8a662..88dba25d50aa8cda89f3f5693d024e860b423703 100644 (file)
@@ -119,8 +119,8 @@ static uae_u32 custom_state_flags;
 static int not_safe_mode;
 static bool dmal_next;
 
-#define MAX_SCANDOUBLED_LINES 1000
-static uae_u32 scandoubled_bpl_ptr[MAX_SCANDOUBLED_LINES][8][2];
+#define MAX_SCANDOUBLED_LINES 1200
+static uae_u32 scandoubled_bpl_ptr[MAX_SCANDOUBLED_LINES][2][MAX_PLANES];
 
 static evt_t blitter_dma_change_cycle, copper_dma_change_cycle, sprite_dma_change_cycle_on, sprite_dma_change_cycle_off;
 
@@ -9637,7 +9637,7 @@ static void decide_bpl(int hpos)
                        ddf_enable_on = 1;
                        if (currprefs.gfx_scandoubler && vpos < MAX_SCANDOUBLED_LINES) {
                                for (int i = 0; i < MAX_PLANES; i++) {
-                                       scandoubled_bpl_ptr[vpos][i][lof_store] = bplpt[i];
+                                       scandoubled_bpl_ptr[vpos][lof_store][i] = bplpt[i];
                                }
                        }
                }
@@ -9795,7 +9795,7 @@ static void decide_bpl(int hpos)
                        ddfstrt_match = true;
                        if (currprefs.gfx_scandoubler && vpos < MAX_SCANDOUBLED_LINES) {
                                for (int i = 0; i < MAX_PLANES; i++) {
-                                       scandoubled_bpl_ptr[vpos][i][lof_store] = bplpt[i];
+                                       scandoubled_bpl_ptr[vpos][lof_store][i] = bplpt[i];
                                }
                        }
                } else {
@@ -10237,8 +10237,8 @@ static void do_scandouble(void)
                if (rd->rga >= 0x110 && rd->rga < 0x120) {
                        int plane = (rd->rga - 0x110) / 2;
                        if (vp < MAX_SCANDOUBLED_LINES) {
-                               uaecptr l1 = scandoubled_bpl_ptr[vp][plane][l];
-                               uaecptr l2 = scandoubled_bpl_ptr[vp][plane][l ^ 1];
+                               uaecptr l1 = scandoubled_bpl_ptr[vp][l][plane];
+                               uaecptr l2 = scandoubled_bpl_ptr[vp][l ^ 1][plane];
                                rga.pv = rd->pt - l1 + l2;
                                if (fetchmode_fmode_bpl == 3) {
                                        rd->v64 = fetch64(&rga);
@@ -10485,7 +10485,9 @@ static void decide_hsync(void)
                                                do_scandouble();
                                                denise_restore_registers();
                                                lof_display ^= 1;
+                                               scandoubled_line = 1;
                                                draw_line(linear_hpos);
+                                               scandoubled_line = 0;
                                                lof_display ^= 1;
                                        } else {
                                                draw_line(linear_hpos);
index 6c0fc6ce55a5e448790a196a5ce11e2f5ec8b378..1d5300099d356b47363dd61d421d74f4af9e3c8c 100644 (file)
@@ -42,6 +42,8 @@
 #define AUTOSCALE_SPRITES 1
 #define LOL_SHIFT_COLORS 0
 
+int scandoubled_line;
+
 struct amigadisplay adisplays[MAX_AMIGADISPLAYS];
 
 typedef enum
@@ -4579,8 +4581,10 @@ static void matchsprites_aga(int cnt)
 }
 
 static uae_u16 s_bplcon0, s_bplcon1, s_bplcon2, s_bplcon3, s_bplcon4, s_fmode;
+static int denise_hcounter_s;
 void denise_store_registers(void)
 {
+       denise_hcounter_s = denise_hcounter; 
        s_bplcon0 = bplcon0_denise;
        s_bplcon1 = bplcon1_denise;
        s_bplcon2 = bplcon2_denise;
@@ -4590,6 +4594,7 @@ void denise_store_registers(void)
 }
 void denise_restore_registers(void)
 {
+       denise_hcounter = denise_hcounter_s;
        expand_bplcon0(s_bplcon0);
        expand_bplcon1(s_bplcon1);
        expand_bplcon2(s_bplcon2);
@@ -4798,7 +4803,7 @@ static void get_line(int gfx_ypos, enum nln_how how)
        }
 
        // clear lines if mode height is now smaller than previously
-       if (gfx_ypos >= 0 && gfx_ypos < prevline) {
+       if (gfx_ypos >= 0 && gfx_ypos < prevline && !scandoubled_line) {
                struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
                struct vidbuffer *vb = &vidinfo->drawbuffer;
                if (prevline > vb->inheight) {
@@ -4927,7 +4932,6 @@ void draw_denise_line(int gfx_ypos, enum nln_how how, uae_u32 linecnt, int start
        get_line(gfx_ypos, how);
        hbstrt_ptr1 = NULL;
 
-
        if (denise_pixtotal_max == -0x7fffffff || ((linear_vpos >= denise_vblank_extra_vbstop || linear_vpos < denise_vblank_extra_vbstrt) && currprefs.gfx_overscanmode < OVERSCANMODE_ULTRA)) {
 
                // don't draw vertical blanking if not ultra extreme overscan