Expand description
Vs. System per-game database (v2.7.0).
Closes two gaps in Vs. System support:
-
PPU palette. iNES-1.0 dumps carry no NES 2.0 byte-13, so the cartridge parser defaults every Vs. cart to [
VsPpuType::Rp2C03] ([crate::rustynes_mappers::parse] §arcade detection). Many Vs. games used a 2C04-000x or RC2C03 PPU whose colour LUT differs from the 2C03’s, so an iNES-1.0 dump renders with the wrong colours. This table supplies the correct [VsPpuType] keyed on the ROM’s identity (see “Keys” below); the frontend applies it viacrate::Nes::set_vs_ppu_type(always — the DB is authoritative for the palette). -
DIP-switch presets. Vs. arcade games read an 8-bit DIP bank through the upper bits of
$4016/$4017(coinage, difficulty, lives, PPU-type, etc.). The frontend’s default DIP is0, which is not always the factory-shipment setting; this table supplies each game’s documented default so the frontend can apply it when the user has not set an explicit[vs] dip(precedence: explicit config dip > DB > 0).
§DIP-byte encoding
The vs_dip byte here is in this emulator’s encoding: DIP switch 1 =
bit 0 .. DIP switch 8 = bit 7. The bus overlay maps DIP1 -> $4016 bit 3,
DIP2 -> $4016 bit 4, and DIP3..8 -> $4017 bits 2..7 (see
SystemBus::vs_overlay_4016 / vs_overlay_4017). Each value below is
MAME’s documented DSW0 factory default for the corresponding game
(the bitwise-OR of the per-field PORT_DIPNAME defaults in MAME’s
src/mame/nintendo/vsnes.cpp), which is exactly the vs_dip byte the
overlay consumes (switch 1 = bit 0). On the real dual-system boards there is
a second DIP bank (DSW1, for the sub-CPU); this single-CPU model only
exposes DSW0.
§Sources
- DIP defaults: MAME
src/mame/nintendo/vsnes.cppINPUT_PORTS_STARTblocks (PORT_DIPNAME(<mask>, <default>, ...)). - PPU types: MAME
src/mame/nintendo/vsnes.cpp— the per-gameROM_STARTblock’sPALETTE_2C04_000x/PALETTE_STANDARDmacro is the authoritative PPU assignment (each.palROM is dumped from real hardware). The fceuxsrc/vsuni.cpp“Games/PPU list. Information copied from MAME” table is a secondary cross-check; both agree for every game below. Verified 2026-06-11 against MAMEmaster. (For dual-system carts theppu1master-CPU PALETTE is used.)
§Caveats
- The dual-system games (Balloon Fight / Tennis / Mahjong / Wrecking Crew)
run two CPUs/PPUs, modelled since v2.0.0 beta.5 by
crate::VsDualSystem(routed viacrate::Emu::from_rom, which consults this table’sdual_systemflag). TheirDSW0defaults are0x00(Balloon Fight / Tennis / Mahjong) per MAME. - Two titles (Balloon Fight, Wrecking Crew) additionally carry a
second, COMBINED-dump entry with a different SHA-256: the
pre-existing 32 KiB-PRG entry (main-CPU program only – boot cannot
complete, the sub-CPU program is absent) coexists with a new 64 KiB-PRG
entry (main half + sub half concatenated) once the sub-CPU program was
located. See
docs/audit/vs-dualsystem-combined-dumps-2026-07-02.md. Tennis and Mahjong remain 32 KiB-only – no sub-CPU dump has been located for either.
§Keys (v2.9.8)
Each row carries two SHA-256 keys:
- an identity key:
crate::Nes::rom_sha256of the dump, the SHA-256 of the bytes after its 16-byte iNES header. It is the same identity saves, states and cheats are keyed by, and it survives any edit to the header: a re-headered or corrected dump still finds its row, so it keeps its palette and DIP preset instead of falling back to the 2C03 and DIP 0. Every row whose dump is staged undertests/roms/external/carries one, computed from that dump; at v2.9.8 that is all 19. - an image key: the SHA-256 of the whole file as dumped, header
included (
crate::Nes::image_sha256). Until v2.9.8 it was the only key. It stays on every row, so a row added from a dump that is not staged (for which no identity can be computed) is still reachable, and it records exactly which file each row was verified against.
lookup takes the crate::Nes and matches the identity key first, then
the image key. The table is &'static and scanned linearly (19 rows,
consulted once per ROM load). It is no_std-safe (const data only).
Structs§
- VsDb
Entry - A single Vs. System per-game database entry.
Functions§
- lookup
- Look up the Vs. System per-game database entry for a loaded ROM.
- lookup_
by_ hashes lookupwith the two hashes supplied directly.