Skip to main content

Module vs_db

Module vs_db 

Source
Expand description

Vs. System per-game database (v2.7.0).

Closes two gaps in Vs. System support:

  1. 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 SHA-256; the frontend applies it via crate::Nes::set_vs_ppu_type (always — the DB is authoritative for the palette).

  2. 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 is 0, 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 LockstepBus::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.cpp INPUT_PORTS_START blocks (PORT_DIPNAME(<mask>, <default>, ...)).
  • PPU types: MAME src/mame/nintendo/vsnes.cpp — the per-game ROM_START block’s PALETTE_2C04_000x / PALETTE_STANDARD macro is the authoritative PPU assignment (each .pal ROM is dumped from real hardware). The fceux src/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 MAME master. (For dual-system carts the ppu1 master-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 via crate::Emu::from_rom, which consults this table’s dual_system flag). Their DSW0 defaults are 0x00 (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.

The table is &'static, sorted by SHA-256, and binary-searched. It is no_std-safe (const data only).

Structs§

VsDbEntry
A single Vs. System per-game database entry.

Functions§

lookup
Look up a Vs. System per-game database entry by ROM SHA-256.