Skip to content

Commit

Permalink
NES: Count partially-copied sprites towards the sprite count for the …
Browse files Browse the repository at this point in the history
…next row
  • Loading branch information
SourMesen committed Oct 19, 2024
1 parent ce4b3b8 commit f90465c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Core/NES/NesPpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,11 @@ template<class T> void NesPpu<T>::ProcessSpriteEvaluationStart()
template<class T> void NesPpu<T>::ProcessSpriteEvaluationEnd()
{
_sprite0Visible = _sprite0Added;
_spriteCount = (_secondaryOamAddr >> 2);

//Add 3 to address to count any partially-copied sprite.
//If eval is misaligned and wraps back to the start of OAM, the copy can
//be stopped mid-sprite (e.g only 1 to 3 bytes are copied to secondary OAM)
_spriteCount = ((_secondaryOamAddr + 3) >> 2);

if(_settings->GetNesConfig().EnablePpuSpriteEvalBug) {
//(Not entirely confirmed - but matches observed behavior)
Expand Down

0 comments on commit f90465c

Please sign in to comment.