Skip to content

fix(state): serialize CPU dataBus and controller state#646

Open
SergioChan wants to merge 2 commits intobfirsh:mainfrom
SergioChan:fix-state-serialization-614
Open

fix(state): serialize CPU dataBus and controller state#646
SergioChan wants to merge 2 commits intobfirsh:mainfrom
SergioChan:fix-state-serialization-614

Conversation

@SergioChan
Copy link

Summary

  • add dataBus to CPU.JSON_PROPERTIES so open-bus state survives save/load
  • serialize/restore controller runtime state in NES.toJSON() / NES.fromJSON()
  • add regression test covering dataBus and controller state round-trip

Testing

  • npm run typecheck
  • node --test ./test/nes.spec.js --test-name-pattern "serializes CPU dataBus and controller state"

Related

Fixes #614

@bfirsh
Copy link
Owner

bfirsh commented Mar 7, 2026

Thanks for the contribution! The build is failing.

@SergioChan
Copy link
Author

Thanks for flagging this — you were right. The CI failure came from missing controller.d.ts declarations for the new toJSON/fromJSON methods and JSON_PROPERTIES static member.

I just pushed a follow-up commit (fix(types): declare controller JSON serialization members) to this PR branch, and re-ran the relevant tests locally:

  • node --test test/typedefs.spec.js
  • node --test test/nes.spec.js

Both pass now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

State serialization gaps: CPU dataBus, controller state not saved

2 participants