Skip to content

Commit fa5df07

Browse files
bfirshclaude
andcommitted
fix: remove dead code and fix save state serialization
- Remove always-false condition `sprX >= 256 && sprX < 256` in renderSpritesPartially - Serialize persistent hardware state (secondaryOAM, spritesFound, sprite0InSecondary) instead of transient per-scanline evaluation arrays (scanlineSpriteCount, scanlineSecondaryOAM, scanlineSprite0) which are recomputed each frame Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent adda623 commit fa5df07

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/ppu/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,8 +1688,6 @@ class PPU {
16881688
let palAdd = (sprAttr & 3) << 2;
16891689

16901690
if (priority !== bgPri) continue;
1691-
if (sprX >= 256 && sprX < 256) continue; // always false, X is u8
1692-
16931691
if (this.f_spriteSize === 0) {
16941692
// 8x8 sprites
16951693
let tileIndex = this.f_spPatternTable === 0 ? sprTile : sprTile + 256;
@@ -2208,10 +2206,10 @@ class PPU {
22082206
"sramAddress",
22092207
// Sprites. Most sprite data is rebuilt from spriteMem
22102208
"hitSpr0",
2211-
// Secondary OAM / per-scanline sprite evaluation data
2212-
"scanlineSpriteCount",
2213-
"scanlineSecondaryOAM",
2214-
"scanlineSprite0",
2209+
// Secondary OAM: persistent hardware state (not cleared on pre-render)
2210+
"secondaryOAM",
2211+
"spritesFound",
2212+
"sprite0InSecondary",
22152213
// Palettes
22162214
"sprPalette",
22172215
"imgPalette",

0 commit comments

Comments
 (0)