← Blog
RETROPIE · DRIVERS · MILESTONE

Nintendo Switch Pro BT Driver + Savestates for All 73 RetroPie Cores — Complete Coverage

retropie drivers bluetooth savestate milestone 0.7.0

Two commits complete the RetroPie input and persistence story. sw_pro_bt.sg (sigil-drivers d73efcf) adds the Nintendo Switch Pro Controller Bluetooth driver — 057E:2009, 64-byte report 0x30, 12-bit packed sticks, 24 checks PASS. 1c48e9b (sigil-retropie) extends core_savestate/core_loadstate to all 73 RetroPie cores — previously only 7 had the ABI. 62 files, 730 insertions. Every system from the Fairchild Channel F (1976) to the Nintendo Switch (2017) can now save and restore state.


Nintendo Switch Pro Controller BT driver (sigil-drivers d73efcf)

The Switch Pro Controller is Nintendo's official Pro Controller for the Nintendo Switch. In Bluetooth Classic HID mode (not the Nintendo Switch USB protocol), it uses report ID 0x30: a 64-byte input report with 12-bit packed analog sticks, a 3-byte button bitfield, and hat-switch D-pad.

VID/PID: 057E:2009 (Nintendo, Switch Pro Controller). Same VID as Joy-Con (057E:2006/2007) but different PID and report format.

12-bit packed stick encoding

Unlike the Xbox One BT driver (16-bit sticks, one value per byte pair) or DS4 (8-bit sticks, one byte each), the Switch Pro packs two 12-bit values into 3 bytes using a packed nibble format:

Button field (3 bytes, b3/b4/b5)

Snap/restore rollback

sw_snap() / sw_rest(). The rollback state s1 encodes all 4 stick axes as a single 64-bit value: lx + ly*4096 + rx*16777216 + ry*68719476736 (each 12-bit axis occupies a 12-bit range in the 48-bit packed value). This lets the Mode-2 rollback buffer compare controller state between frames using a single integer comparison.

24 checks PASS: constants (VID/PID), 12-bit stick math (both encoding directions), all button bits (A/B/X/Y/L/R/ZL/ZR/+/-/Home/Capture/LS/RS), hat-switch all 8 directions + center, snap/restore round-trip, state machine. State at 0x9E0000.

BT gamepad stack — now 4 controllers

Driver Controller Report VID:PID Key feature
usb-hid-gamepad Generic USB HID 8 B any 16 buttons, 4×8-bit axes
bt-hid/xbox_bt Xbox One S 16 B 045E:02FD 4×16-bit sticks, 2 triggers
bt-hid/ds4_bt DualShock 4 77 B 054C:05C4/09CC Gyro, accel, touchpad, battery
bt-hid/sw_pro_bt Switch Pro 64 B 057E:2009 12-bit packed sticks, hat-switch, Home/Capture

Savestates for all 73 cores (sigil-retropie 1c48e9b)

The savestate ABI (core_savestate(slot) / core_loadstate(slot) / core_savestate_size()) previously existed for 7 cores: the NES, Game Boy, Odyssey 2, TI-99/4A, Dragon 32, Acorn Electron, and PC-FX (the Mode-2 rollback demo set). This commit extends the ABI to all 73 LAUNCHABLE systems.

The three implementation patterns

Old-ABI wrapper
11 cores — coleco, i8080, atari, c64, genesis, msx, pce, sms, sg1000, snes, zx. These cores already had core_save_state() (old naming convention). The commit adds thin core_savestate(slot) / core_loadstate(slot) wrappers that delegate to the existing function. Zero duplication — old code preserved.
Single-region copy
Most new cores. RAM + CPU state lives in a contiguous address region before the framebuffer. core_savestate(slot) copies [state_base, state_base + state_size) to slot memory. core_loadstate(slot) copies back. GBC and WSC are thin overlays of gb.sg/ws.sg (same hardware, slight config difference).
Two-region copy
psx, n64, saturn, dreamcast, bbc, vic20, ngcd, ws. CPU state lives at a higher address than the framebuffer. Savestate copies two non-contiguous regions: the pre-framebuffer RAM, and the post-framebuffer CPU registers. This avoids saving the (large) framebuffer itself, which can be reconstructed by running one frame.

Savestate sizes by tier

Core(s) Size Notes
fds (Famicom Disk System) 512 B Minimal extra state over NES
ws, wsc (WonderSwan) 8 KB Small handheld, 16-color LCD
gba (Game Boy Advance) 256 KB 256KB IWRAM + EWRAM
psx (PlayStation) 2 MB RAM + CPU + 512KB VRAM (two-region)
n64 (Nintendo 64) 4 MB RDRAM + RCP state
dreamcast, saturn 4–8 MB Large RAM, multi-processor state
gamecube, wii 8 MB MEM1 + MEM2
ps2, ps3, xbox360 16 MB Modern platform max

Why every core matters for Mode-2 SRDX

SRDX Mode-2 is the rollback netplay mode. In a two-player SRDX session, both sides need to save/restore core state to roll back to a pre-divergence frame when a late input arrives. Without universal savestate coverage, Mode-2 only works on the 7 original cores. With all 73 wired, the rollback netplay ABI is available across the entire 41-year library.


RetroPie fleet status — complete picture

Capability Count Status
LAUNCHABLE systems 73 Complete (Channel F 1976 → Switch 2017)
Cores with savestate ABI 73 Complete (this commit)
BT controller drivers 4 Xbox One S + DS4 + Switch Pro + USB-HID
ROM library browser 73 systems 4×5 card grid, L1/R1 navigation, [dat verified] badge
ROM scanner Sigil (on-device) rom_scan.sg (policy-compliant Sigil rewrite)
SRDX Mode-2 rollback ABI 73 cores ready — awaiting two-Pi session
ACPI PM timer (rollback clock) WIRED 3.579545 MHz, 279ns resolution