Nescartdb

The nescartdb database converted to JSON — identifies cartridge PCBs by the CRC32 of their PRG/CHR dumps

Converted nescartdb database in JSON format, used to identify NES/Famicom cartridge PCBs by the content of their PRG/CHR dumps.

This folder is the single source of cartridge-identification data for every Breaknes consumer: the native core (BreaksCore), the managed application (Breaknes), the SDL port, and the tools (PPUPlayer, APUPlayer).


1. Why this folder exists

The old Mappers component identifies cartridges by the iNES header and the iNES mapper number. That is a poor fit for a functional simulator:

The solution (issue #508) is to identify cartridges by board type using the nescartdb database, which describes the actual PCB of every dumped cartridge (components, sizes, CRCs, mirroring).

The native code has no XML engine, so the nescartdb XML is converted to JSON once, stored here, and consumed by everyone.

2. Data source

Databasenescartdb (bootgod / brizzo)
Export usedforum.nesdev.org - tepples/NesCarts (2017-08-21).utf8.xml from the MetaFight/NesCartDB mirror
Contents~3179 cartridge entries, 273 distinct board types, for all regions (NES-NTSC, NES-PAL, Famicom, Dendy, ...)

The export is a static snapshot (2017-08-21). The conversion is deterministic: the same XML always produces the same JSON, so the JSON can be regenerated at any time.

3. Files in this folder

Nescartdb/
  Readme.md          <- this file
  nescarts.json      <- the full converted database (generated, committed)
  index.json         <- flattened lookup index: prg_crc/chr_crc -> board type (generated, committed)
  boards/            <- board definitions (authored, not generated) + the family index

The generated files are committed to the repository so that no network access is needed at build or run time.

4. Conversion pipeline

Tools/NescartdbConvert/convert.py
   XML (tepples export)  --->  nescarts.json  --->  index.json

5. JSON schema (nescarts.json)

Direct mapping of the XML structure:

{
  "source": {
    "name": "NesCartDB",
    "agent": "NesCartDB",
    "author": "BootGod",
    "export": "forum.nesdev.org - tepples/NesCarts (2017-08-21).utf8.xml",
    "converted_at": "2026-09-01T00:00:00Z",
    "converter": "Tools/NescartdbConvert/convert.py"
  },
  "games": [
    {
      "name": "10-Yard Fight",
      "altname": "10ヤードファイト",
      "class": "Licensed",
      "subclass": "3rd-Party",
      "catalog": "IF-02",
      "publisher": "Irem",
      "developer": "Irem",
      "portdeveloper": null,
      "region": "Japan",
      "players": 2,
      "date": "1985-08-30",
      "cartridges": [
        {
          "system": "Famicom",
          "revision": null,
          "crc": "836C4FA7",
          "dump": "ok",
          "dumper": "bootgod",
          "datedumped": "2007-05-06",
          "prototype": false,
          "board": {
            "type": "IREM-NROM-128",
            "pcb": "IREM-01-V",
            "mapper": 0,
            "prg":  { "name": null, "id": null, "size": 16384, "crc": "D3D248C9" },
            "chr":  { "name": null, "id": null, "size": 8192,  "crc": "9C124A53" },
            "wram": null,
            "vram": null,
            "chips": [],
            "cic":   [],
            "pad":   { "h": 0, "v": 1 },
            "peripherals": []
          }
        }
      ]
    }
  ]
}

5.1 XML → JSON mapping

XMLJSONNotes
<database>sourceversion, conformance, agent, author, timestamp folded into source; the converter adds export, converted_at, converter
<game>games[]name, altname, class, subclass, catalog, publisher, developer, portdeveloper, region, players, date
<cartridge>games[].cartridges[]system, revision, crc, dump, dumper, datedumped, prototype (sha1 intentionally omitted — identification is CRC-only)
<board>...boardtype (board type), pcb (board revision), mapper (iNES mapper number — informational only, not used for identification)
<prg> / <chr>board.prg / board.chrname, id, size (bytes), crc (sha1 intentionally omitted)
<wram> / <vram>board.wram / board.vramsize, battery, id
<chip>board.chips[]type (e.g. MMC1A, MMC3B), battery
<cic>board.cic[]type (e.g. 3193A, 6113)
<pad>board.padh, v (mirroring)
<peripherals>/<device>/<pin>board.peripherals[]passthrough of the raw pin data

5.2 Lookup index (index.json)

[
  {
    "prg_crc": "D3D248C9",
    "chr_crc": "9C124A53",
    "system": "Famicom",
    "type": "IREM-NROM-128",
    "pcb": "IREM-01-V",
    "mapper": 0
  }
]

6. Consumers

ConsumerHow it uses this folder
BreaksCore (native)CartPcb::NesCartDb loads index.json for CRC → board type lookup.
CartPcb (native)Board JSONs referenced by the index (built-in definitions + user overrides).
Managed Breaknes appLocates the JSON next to the executable (copied at build time) and can also parse it directly for UI purposes (board type shown to the user).
SDL portSame native path as BreaksCore.
PPUPlayer / APUPlayerUse the same Nescartdb data via the native core or their own copy.

Deployment: the Nescartdb/ files (including boards/*.json) are copied to the output directory on build (Breaknes.csproj and BreaknesSDL.vcxproj copy them next to the executable). Native code locates them relative to the executable: the managed app passes its base directory via SetNescartdbDir; the SDL port uses the Nescartdb folder next to the executable (override with the NESCARDB_DIR environment variable). Custom boards go to the user board directory (CustomBoards/ next to the executable by default in the managed app, configurable via SetUserBoardsDir).

6.1 Board definitions (boards/)

The boards/ folder contains the board JSONs that PcbLoader resolves a board type to:

Board definitions are authored (not generated from the XML): nescartdb describes the component inventory, CartPcb adds the wiring (circuit). New board types referenced by the converter output or by the iNES fallback must be added here by hand.

7. Versioning & regeneration policy

8. Licensing & attribution

9. Relationship to CartPcb and JSONES