Skip to content

Implement the USB2SNES protocol #375

@Screwtapello

Description

@Screwtapello

USB2SNES seems to be an alternate firmware for the SD2SNES (I don't know if it's available for the FX Pak or FX Pak Pro) which uses the SD2SNES' USB port as an RS232 port, which speaks a protocol that lets the host computer read and write the SNES' RAM, as well as doing things like resetting the console and managing files on the SD card.

This would be a very useful thing for automating homebrew testing and it's also used for things like item tracking in randomisers, or (presumably) RetroAchievments on real hardware, so it would be useful to support in bsnes as well.

As I understand it, the SD2SNES is presented as a regular RS232 port, which speaks a custom protocol. The protocol doesn't seem to be officially documented anywhere, but there are tools like SNI and QUsb2snes that speak it, that could probably be reverse-engineered.

Since working with serial ports can be a pain, especially on Windows, SNI and QUsb2snes wrap that protocol in their own encodings - SNI provides a gRPC-based API, while QUsb2snes provides a JSON-over-websocket API. Client applications tend to be written to use those higher-level protocols, but we don't have to implement them since SNI and QUsb2snes already exist.

To make progress on this, we're going to need to figure out:

  • a detailed protocol description of the USB2SNES RS232 protocol
  • how to make a virtual serial port on Windows (I assume macOS, like Linux, can use openpty(3))
  • hooking this protocol into the emulation event loop (I assume memory access will be done the same way the Cheat Finder does it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions