Discord Rich Presence for the PlayStation Vita and PSP. It reads the game your console is running and publishes it to Discord, box art included, with no manual per-game setup.
Retail titles, homebrew and PSP or PS1 games running under Adrenaline all resolve to real artwork. Nothing is uploaded anywhere: the artwork is public image URLs handed to Discord by reference.
Playing Persona 4 Golden
PS Vita
- A PS Vita running the VitaPresence kernel plugin, on the same network as this machine.
- The Discord desktop client. The browser client has no local IPC socket, so it cannot be used.
- A Discord application ID from the developer portal. The application's name is what Discord prints above the activity.
Windows, Linux and macOS are all supported. The daemon is a console program; leave it running while you play.
CMake 3.20 or newer, a C++17 compiler, and libcurl. inih and nlohmann/json are fetched during configuration.
Windows, in an MSYS2 UCRT64 shell:
pacman -S --needed mingw-w64-ucrt-x86_64-{gcc,cmake,ninja,curl,nlohmann-json}
cmake -S . -B build -G Ninja
cmake --build buildLinux and macOS use the same two CMake commands with the distribution's equivalent packages.
Run the tests with ctest --test-dir build --output-on-failure.
Copy config.example.ini to vita-rpc.ini, set discord.app_id, and start it:
./build/vita-rpc--config PATH points at a different file, --verbose turns on debug logging.
Every other setting has a working default, and config.example.ini documents
what each one does and why it exists.
You do not need to know your Vita's IP address. Leave vita.host unset and the
daemon searches the local network, then remembers where it found the console so
later launches connect immediately.
A candidate is confirmed by asking it for a VitaPresence packet and checking the
protocol magic, so nothing else on the network can be mistaken for a Vita. The
sweep covers your own /24; set vita.scan_cidr if your network is laid out
differently, or vita.host to pin one console. Ranges wider than /20 are
refused, because a sweep that large is slow and looks like a port scan.
Set discovery = false and the daemon stops scanning entirely. It then uses
vita.host, or the address it last connected to, and says so if it has neither.
The Vita reports a title id and a title. Artwork resolution walks a chain of sources, cheapest first, and stops at the first hit:
- The NeoVitaDB homebrew catalog, held in memory, which covers homebrew and most plugins.
- PSMT covers for retail Vita titles, keyed on the title id.
- No-Intro and Redump serial indexes for PSP and PS1 discs, which is how games launched through Adrenaline get their own art instead of Adrenaline's.
- Wikipedia, keyed on the title text, for homebrew ports that no id database has heard of.
Covers are portrait and catalog icons are square, so covers pass through a public image proxy to square them. Discord keeps the query string on external image URLs, which is what makes that work without hosting anything.
Steps 3 and 4 are guarded by a name check. PSP homebrew commonly borrows a
retail serial: one measured example reports UCJS10041, which belongs to
LocoRoco, while the game is actually Minicraft PSP-O. Without the check that
homebrew renders LocoRoco's box art, and confidently wrong art is worse than
none, because it looks like a working feature.
[psp] enabled = true adds a real PSP running a presence plugin that speaks the
PSPR protocol, discovery on UDP 9277 and data on 9276. The plugin answers a
broadcast, so finding it costs one packet rather than a subnet sweep.
Discord shows one activity per user, measured rather than assumed: a second RPC client displaces the first. So with both consoles awake the daemon picks one. Whichever is actually playing wins, the Vita wins a tie, and a console idling on its shell never blanks out one that is mid-game.
This is an independent implementation. No code was copied from either project
below. What is shared is a wire protocol, reimplemented here for
interoperability. See NOTICE.
- Electry/VitaPresence (GPL-2.0) is the Vita kernel plugin this program talks to, and the origin of the protocol.
- TheMightyV/vita-presence-the-server (GPL-3.0-or-later) was the first program to pair that plugin with Discord Rich Presence.
MIT. See LICENSE.