# HG changeset patch # User Michael Pavone # Date 1494785756 25200 # Node ID 1679ea04c44941614f540b4560cc0142307f6acb # Parent e1a6e8ee656fe912ddd4693ec0bb2b214b0af224 WIP attempt at fixing the minor line -2 glitch in the OD2 Ninja Escape scene diff -r e1a6e8ee656f -r 1679ea04c449 vdp.c --- a/vdp.c Fri May 12 23:34:17 2017 -0700 +++ b/vdp.c Sun May 14 11:15:56 2017 -0700 @@ -2057,12 +2057,13 @@ if (headless) { dst = context->output; } else { - dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2))) - + (context->hslot - BG_START_SLOT) * 2; + dst = context->output + (context->hslot - BG_START_SLOT) * 2; } - for (int i = 0; i < LINEBUF_SIZE - 2 * (context->hslot - BG_START_SLOT); i++) + for (int i = 0; i < LINEBUF_SIZE - 2 * (context->hslot - BG_START_SLOT); i++, dst++) { - *(dst++) = bg_color; + if (dst >= context->done_output) { + *dst = bg_color; + } } } context->sprite_index = 0x80; @@ -2720,11 +2721,13 @@ } if (dst >= context->done_output) { *(dst++) = bg_color; + context->done_output = dst; } else { dst++; } if (context->hslot == (bg_end_slot-1)) { *(dst++) = bg_color; + context->done_output = dst; } } @@ -2912,6 +2915,9 @@ if (reg == REG_BG_COLOR) { value &= 0x3F; } + if (reg == REG_MODE_2 && ((value ^ context->regs[reg]) & BIT_DISP_EN)) { + printf("Display %s at %d, %d, %d\n", value & BIT_DISP_EN ? "enabled" : "disabled", context->frame, context->vcounter, context->hslot); + } /*if (reg == REG_MODE_4 && ((value ^ context->regs[reg]) & BIT_H40)) { printf("Mode changed from H%d to H%d @ %d, frame: %d\n", context->regs[reg] & BIT_H40 ? 40 : 32, value & BIT_H40 ? 40 : 32, context->cycles, context->frame); }*/