[Core/VDP] improved Mode 5 sprite parsing accuracy (verified on real hardware)

This commit is contained in:
EkeEke 2014-07-06 21:04:33 +02:00
parent 331ec8b7cb
commit 8c91bdc05e

View File

@ -3812,8 +3812,13 @@ void parse_satb_m5(int line)
do do
{ {
/* Read Y position & size from internal SAT */ /* Read Y position from internal SAT cache */
ypos = (q[link] >> im2_flag) & 0x1FF; ypos = (q[link] >> im2_flag) & 0x1FF;
/* Check if sprite Y position has been reached */
if (line >= ypos)
{
/* Read sprite size from internal SAT cache */
size = q[link + 1] >> 8; size = q[link + 1] >> 8;
/* Sprite height */ /* Sprite height */
@ -3822,8 +3827,8 @@ void parse_satb_m5(int line)
/* Y range */ /* Y range */
ypos = line - ypos; ypos = line - ypos;
/* Sprite is visble on this line ? */ /* Check if sprite is visible on current line */
if ((ypos >= 0) && (ypos < height)) if (ypos < height)
{ {
/* Sprite overflow */ /* Sprite overflow */
if (count == max) if (count == max)
@ -3844,12 +3849,13 @@ void parse_satb_m5(int line)
/* Next sprite entry */ /* Next sprite entry */
object_info++; object_info++;
} }
}
/* Read link data from internal SAT */ /* Read link data from internal SAT cache */
link = (q[link + 1] & 0x7F) << 2; link = (q[link + 1] & 0x7F) << 2;
/* Last sprite */ /* Stop parsing if link data points to first entry (#0) or after the last entry (#64 in H32 mode, #80 in H40 mode) */
if (link == 0) break; if ((link == 0) || (link >= bitmap.viewport.w)) break;
} }
while (--total); while (--total);