Pipe Input

From Dolphin Emulator Wiki
Revision as of 10:30, 8 January 2019 by JMC4789 (talk | contribs) (Creating the FIFO)
Jump to: navigation, search

Since 4.0-8065, Dolphin supports automated input using unix named pipes. This can be used to write bots, for example, or to automate tedious in-game tasks.

This features only works on UNIX systems for now, and needs some setup to work:

Creating the FIFO

First, locate your dolphin-emu user folder (usually in ~/.dolphin-emu, ~/.config/dolphin-emu, or ~/.local/share/dolphin-emu/Pipes), then run:

mkfifo pipe1

Controller Config

Then you can either perform the task of selecting the pipe input into the controller config dropdown and then sending the button push/release events manually into the configuration dialog (very tedious), or copy the following config section into the Config/GCPadNew.ini file in the user folder.

[GCPad1]
Device = Pipe/0/pipe1
Buttons/A = `Button A`
Buttons/B = `Button B`
Buttons/X = `Button X`
Buttons/Y = `Button Y`
Buttons/Z = `Button Z`
Buttons/Start = `Button START`
D-Pad/Up = `Button D_UP`
D-Pad/Down = `Button D_DOWN`
D-Pad/Left = `Button D_LEFT`
D-Pad/Right = `Button D_RIGHT`
Triggers/L = `Button L`
Triggers/R = `Button R`
Main Stick/Up = `Axis MAIN Y -`
Main Stick/Down =  `Axis MAIN Y +`
Main Stick/Left = `Axis MAIN X -`
Main Stick/Right = `Axis MAIN X +`
C-Stick/Up = `Axis C Y -`
C-Stick/Down =  `Axis C Y +`
C-Stick/Left = `Axis C X -`
C-Stick/Right = `Axis C X +`

Interacting

You can interact with the fifo using standard command-line tools such as echo.

Doing a button push:

echo 'PRESS A' > ~/my-dolphin-directory/pipe1

Doing a button release:

echo 'RELEASE A' > ~/my-dolphin-directory/pipe1

Moving a stick (where stick_name is C or MAIN and X and Y values between 0 and 1):

echo 'SET stick_name X Y' > ~/my-dolphin-directory/pipe1