Skip to content

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

@bfirsh

Description

@bfirsh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomponent: mapperMemory mappers (mappers/)difficulty: mediumModerate change requiring understanding of one subsystempriority: mediumIncorrect behavior for specific games or edge cases

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions