[Core/VDP] fixed issues caused by screen width change during active display (Golden Axe 3 intro, Ultraverse Prime)

This commit is contained in:
EkeEke 2016-05-01 20:10:37 +02:00
parent 79570c7d4e
commit 381a9d114f
2 changed files with 33 additions and 9 deletions

View File

@ -423,6 +423,9 @@ void system_frame_gen(int do_skip)
bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1); bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1);
} }
/* active screen width */
bitmap.viewport.w = 256 + ((reg[12] & 0x01) << 6);
/* check viewport changes */ /* check viewport changes */
if (bitmap.viewport.h != bitmap.viewport.oh) if (bitmap.viewport.h != bitmap.viewport.oh)
{ {
@ -792,6 +795,9 @@ void system_frame_scd(int do_skip)
bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1); bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1);
} }
/* active screen width */
bitmap.viewport.w = 256 + ((reg[12] & 0x01) << 6);
/* check viewport changes */ /* check viewport changes */
if (bitmap.viewport.h != bitmap.viewport.oh) if (bitmap.viewport.h != bitmap.viewport.oh)
{ {
@ -1180,7 +1186,10 @@ void system_frame_sms(int do_skip)
} }
} }
} }
/* active screen width */
bitmap.viewport.w = 256 + ((reg[12] & 0x01) << 6);
/* check viewport changes */ /* check viewport changes */
if (bitmap.viewport.h != bitmap.viewport.oh) if (bitmap.viewport.h != bitmap.viewport.oh)
{ {

View File

@ -1932,8 +1932,8 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
/* Update clipping */ /* Update clipping */
window_clip(reg[17], 1); window_clip(reg[17], 1);
/* Update active display width & max sprite pixels per line*/ /* Update max sprite pixels per line*/
max_sprite_pixels = bitmap.viewport.w = 320; max_sprite_pixels = 320;
} }
else else
{ {
@ -1949,15 +1949,30 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
/* Update clipping */ /* Update clipping */
window_clip(reg[17], 0); window_clip(reg[17], 0);
/* Update active display width & max sprite pixels per line*/ /* Update max sprite pixels per line*/
max_sprite_pixels = bitmap.viewport.w = 256; max_sprite_pixels = 256;
} }
/* Active display width modified during HBLANK (Bugs Bunny Double Trouble) */ if (v_counter >= bitmap.viewport.h)
if ((v_counter < bitmap.viewport.h) && (reg[1] & 0x40) && (cycles <= (mcycles_vdp + 860)))
{ {
/* Redraw entire line */ /* Active screen width modified during VBLANK will be applied on upcoming frame */
render_line(v_counter); bitmap.viewport.w = max_sprite_pixels;
}
else if ((v_counter == 0) && (cycles <= (mcycles_vdp + 860)))
{
/* Active screen width modified during first line HBLANK (Bugs Bunny in Double Trouble) */
bitmap.viewport.w = max_sprite_pixels;
/* Redraw first line */
render_line(0);
}
else
{
/* Screen width changes during active display (Golden Axe 3 intro, Ultraverse Prime) */
/* should be applied on next frame since backend rendered framebuffer width is fixed */
/* and can not be modified mid-frame. This is not 100% accurate but games generally */
/* do this where the screen is blanked so it is likely unnoticeable. */
bitmap.viewport.changed |= 2;
} }
} }
break; break;