# HG changeset patch # User Michael Pavone # Date 1700629276 28800 # Node ID ce9f5a42c4816e8203a7ae0a34c9605606ddca63 # Parent 03e6ac327ba05e874cf07aeaeeb660c647506d96 Ensure VDP double_res flag is updated when loading a save state diff -r 03e6ac327ba0 -r ce9f5a42c481 vdp.c --- a/vdp.c Tue Nov 21 20:47:11 2023 -0800 +++ b/vdp.c Tue Nov 21 21:01:16 2023 -0800 @@ -144,6 +144,10 @@ } context->border_top = calc_crop(top_crop, border_top); context->top_offset = border_top - context->border_top; + context->double_res = (context->regs[REG_MODE_4] & (BIT_INTERLACE | BIT_DOUBLE_RES)) == (BIT_INTERLACE | BIT_DOUBLE_RES); + if (!context->double_res) { + context->flags2 &= ~FLAG2_EVEN_FIELD; + } } static uint8_t static_table_init_done; @@ -4646,12 +4650,6 @@ uint8_t buffer[2] = {reg, value}; event_log(EVENT_VDP_REG, context->cycles, sizeof(buffer), buffer); context->regs[reg] = value; - if (reg == REG_MODE_4) { - context->double_res = (value & (BIT_INTERLACE | BIT_DOUBLE_RES)) == (BIT_INTERLACE | BIT_DOUBLE_RES); - if (!context->double_res) { - context->flags2 &= ~FLAG2_EVEN_FIELD; - } - } if (reg == REG_MODE_1 || reg == REG_MODE_2 || reg == REG_MODE_4) { update_video_params(context); }