]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Non-lace fields/fields+ last line flicker fix.
authorToni Wilen <twilen@winuae.net>
Fri, 13 Oct 2023 17:32:50 +0000 (20:32 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 13 Oct 2023 17:32:50 +0000 (20:32 +0300)
custom.cpp
drawing.cpp
include/drawing.h

index d2feaa64dafc2d219e59b4220db252abd78ec8db..51ca5cd9a0464af1f1d35e195eea66c89e78aa1f 100644 (file)
@@ -554,6 +554,7 @@ frame_time_t lastframetime;
 uae_u32 hsync_counter, vsync_counter;
 frame_time_t idletime;
 int bogusframe;
+static int display_vsync_counter;
 
 /* Recording of custom chip register changes.  */
 static int current_change_set;
@@ -11650,7 +11651,7 @@ static int calculate_lineno(int vp)
                lineno++;
        } else if (!interlace_seen && doublescan <= 0 && currprefs.gfx_vresolution && currprefs.gfx_pscanlines > 1) {
                lineno *= 2;
-               if (vsync_counter & 1) {
+               if (display_vsync_counter & 1) {
                        lineno++;
                        nextline_how = currprefs.gfx_pscanlines == 3 ? nln_lower_black_always : nln_lower_black;
                } else {
@@ -14251,6 +14252,7 @@ static void hsync_handler(void)
 
        }
        if (vpos == maxvpos_display_vsync) {
+               hsync_record_line_state_last(next_lineno, nextline_how, 0);
                inputdevice_read_msg(true);
                vsync_display_render();
                vsync_display_rendered = false;
@@ -14258,6 +14260,7 @@ static void hsync_handler(void)
                hstrobe_conflict = false;
                minfirstline_linear = minfirstline;
                reset_autoscale();
+               display_vsync_counter++;
        }
        vsync_line = vs;
        hsync_handler_post(vs);
@@ -14397,6 +14400,7 @@ void custom_reset(bool hardreset, bool keyboardreset)
                extra_cycle = 0;
                hsync_counter = 0;
                vsync_counter = 0;
+               display_vsync_counter = 0;
                currprefs.chipset_mask = changed_prefs.chipset_mask;
                update_mirrors();
                blitter_reset();
index 0211b8e3bca32cd582d9604d4e43246b8e6a73f4..cc25a59fe34137f9ff0a7bb698fd1858b298e459 100644 (file)
@@ -3566,7 +3566,11 @@ static void adjust_drawing_colors (int ctable, int need_full, bool blankcheck)
                        color_reg_cpy (&colors_for_drawing, curr_color_tables + ctable);
                        color_match_type = color_match_full;
                } else {
-                       memcpy (colors_for_drawing.acolors, curr_color_tables[ctable].acolors, sizeof colors_for_drawing.acolors);
+                       if (aga_mode) {
+                               memcpy(colors_for_drawing.acolors, curr_color_tables[ctable].acolors, sizeof(xcolnr) * 256);
+                       } else {
+                               memcpy(colors_for_drawing.acolors, curr_color_tables[ctable].acolors, sizeof(xcolnr) * 32);
+                       }
                        colors_for_drawing.extra = curr_color_tables[ctable].extra;
                        color_match_type = color_match_acolors;
                }
@@ -5145,7 +5149,21 @@ void vsync_handle_redraw(int long_field, int lof_changed, uae_u16 bplcon0p, uae_
        gui_flicker_led (-1, 0, 0);
 }
 
-void hsync_record_line_state (int lineno, enum nln_how how, int changed)
+void hsync_record_line_state_last(int lineno, enum nln_how how, int changed)
+{
+       uae_u8 *state = linestate + lineno;
+
+       switch (how) {
+               case nln_upper_black:
+               case nln_upper_black_always:
+               case nln_lower_black:
+               case nln_lower_black_always:
+               hsync_record_line_state(lineno, how, 0);
+               break;
+       }
+}
+
+void hsync_record_line_state(int lineno, enum nln_how how, int changed)
 {
        struct amigadisplay *ad = &adisplays[0];
        uae_u8 *state;
index 1b0db893c95acfbf4775a3e0b5003b4bd6e55eb2..9214106549f411b202153fb7c98af08308de7399 100644 (file)
@@ -357,7 +357,8 @@ enum nln_how {
        nln_lower_black_always
 };
 
-extern void hsync_record_line_state (int lineno, enum nln_how, int changed);
+extern void hsync_record_line_state(int lineno, enum nln_how, int changed);
+extern void hsync_record_line_state_last(int lineno, enum nln_how, int changed);
 extern void vsync_handle_redraw (int long_field, int lof_changed, uae_u16, uae_u16, bool drawlines, bool initial);
 extern bool vsync_handle_check (void);
 extern void draw_lines(int end, int section);