bfirsh / bfirsh/jsnes

Most mappers missing toJSON/fromJSON — save states lose bank state

Open
#600 0 comments 0 reactions 0 assignees View on GitHub
bug component: mapper difficulty: medium priority: medium
Dominant language
JavaScript
Stars
6.4k
Forks
857
PR merge metrics
No merged PRs in 30d

Description

## Summary

Only 6 of 21 mapper implementations have custom `toJSON()`/`fromJSON()` methods. The rest inherit from Mapper0, which only serializes base class state. Mapper-specific bank registers, IRQ state, and other fields are lost on save/restore.

## Affected mappers

Missing serialization: Mapper 2 (UxROM), 3 (CNROM), 5 (MMC5), 7 (AxROM), 11 (Color Dreams), 34 (BNROM), 66 (GxROM), 71 (Camerica), 79 (NINA), 94 (UN1ROM), 180 (UNROM variant), 240, 241

## Impact

Save states with these mappers will restore to the wrong bank configuration, causing games to crash or show garbled graphics after loading a save state.

## Fix

Each mapper needs to serialize its bank registers and any other mutable state. For simple mappers like UxROM (just a bank number), this is a one-line addition.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.