Skip to content

State serialization gaps: CPU dataBus, controller state not saved #614

@bfirsh

Description

@bfirsh

Summary

CPU dataBus not serialized

cpu.js JSON_PROPERTIES does not include dataBus. The open bus value resets to 0 on save state restore. Games reading open bus immediately after a load could behave differently.

Controller state not serialized in NES.toJSON()

nes.js:177-185 serializes CPU, PPU, PAPU, and mapper state but not controller state. Button states, turbo state, and strobe protocol state are lost on save/restore. While usually minor (buttons are transient), the strobe state matters for correct controller reads immediately after restoring.

Fix

Add dataBus to CPU.JSON_PROPERTIES and serialize controller state in NES.toJSON()/NES.fromJSON().

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomponent: cpuCPU emulation (cpu.js)difficulty: easySmall, localized change (1-2 lines)priority: lowMinor inaccuracy or code quality issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions