RetroArch permanently listens for network commands over UDP. That mechanism is what allows resetting a game, saving a state or quitting the emulator from the outside — without touching the controller.
The most common use case: you have recycled the case of an old console, and you want its original RESET button to reset the running game instead of brutally rebooting the machine.
Those commands only work with RetroArch and Libretro cores. Standalone emulators (Dolphin, PPSSPP, ScummVM…) do not support them.
Recalbox enables network commands by default (
network_cmd_enable = truein its RetroArch configuration): there is nothing to turn on.
Connect to your Recalbox over SSH and send the command to port 55355:
echo -n "RESET" | nc -u -w1 127.0.0.1 55355
Replace RESET with any command from the list below. From another device on the network, replace 127.0.0.1 with the Recalbox IP address.
Do not mix that port up with port 55435, which is the netplay one.
| Command | Effect |
|---|---|
RESET |
Resets the running game |
QUIT |
Quits the emulator (back to the interface) |
SAVE_STATE / LOAD_STATE |
Saves / loads a state |
STATE_SLOT_PLUS / STATE_SLOT_MINUS |
Changes the save slot |
PAUSE_TOGGLE / FRAMEADVANCE |
Pauses / advances one frame |
FAST_FORWARD / FAST_FORWARD_HOLD / SLOWMOTION |
Speeds up / slows down |
REWIND |
Rewinds (when rewind is enabled) |
MUTE / VOLUME_UP / VOLUME_DOWN |
Sound |
SCREENSHOT |
Screenshot |
MENU_TOGGLE |
Opens the RetroArch menu |
FULLSCREEN_TOGGLE |
Toggles fullscreen |
SHADER_NEXT / SHADER_PREV |
Changes shader |
OVERLAY_NEXT |
Changes overlay |
CHEAT_TOGGLE / CHEAT_INDEX_PLUS / CHEAT_INDEX_MINUS |
Cheat codes |
DISK_EJECT_TOGGLE / DISK_NEXT / DISK_PREV |
Multi-disc handling |
MOVIE_RECORD_TOGGLE |
Video recording |
GRAB_MOUSE_TOGGLE |
Mouse grabbing |
They do not all behave the same remotely: some, like FAST_FORWARD_HOLD, are designed for a held button and give inconsistent results.
On a Raspberry Pi, a simple button wired between a GPIO pin and ground can send the command. Create a user script along these lines:
#!/usr/bin/env python3
import socket
import time
import RPi.GPIO as GPIO
# GPIO pin of the button (BCM numbering), pulled to ground when pressed
BUTTON_PIN = 3
# Command destination
IPADDR = "127.0.0.1"
PORTNUM = 55355
COMMAND = "RESET"
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def send_command(channel):
sock.sendto(COMMAND.encode(), (IPADDR, PORTNUM))
GPIO.add_event_detect(BUTTON_PIN, GPIO.FALLING, callback=send_command, bouncetime=500)
while True:
time.sleep(10)
Change the COMMAND value to send something else, and BUTTON_PIN according to the pin you wired.
If you already use GPIO controllers or a Recalbox RGB Dual board, check that the pin you picked is not already taken.
For a power on/off button, write nothing: Recalbox natively handles several wirings and cases, see Adding an on/off button to your Recalbox and the compatible cases.
Need help? Join the Recalbox Discord.