Skip to content
This repository was archived by the owner on Sep 27, 2020. It is now read-only.

Latest commit

 

History

History
158 lines (124 loc) · 3.6 KB

gamepads.md

File metadata and controls

158 lines (124 loc) · 3.6 KB

Virtual gamepads

Connect a new virtual GamePad

curl -X POST -d 'snes' http://recalbox.local:1337/gamepads

Response (JSON by default):

{
    "message": "GamePad 1 connected",
    "index": 1
}
Types Description
snes Super Nintendo GamePad

Disconnect a virtual GamePad

curl -X DELETE http://recalbox.local:1337/gamepads/1

Response (JSON by default):

{
    "message": "GamePad 1 disconnected"
}

Directions

curl -X PUT -d 'pressed' http://recalbox.local:1337/gamepads/1/directions/left
State Description
pressed The direction is pressed
released The direction is released
pressedAndreleased The direction is pressed and released
Direction Identifier GamePad types
None none snes
Left left snes
Right right snes
Up up snes
Down down snes
Horizontal horizontal
Vertical vertical

Buttons

curl -X PUT -d 'pressed' http://recalbox.local:1337/gamepads/1/buttons/a
State Description
pressed The button is pressed
released The button is released
pressedAndreleased The button is pressed and released
Button Identifier GamePad types
A a snes
B b snes
X x snes
Y y snes
L tl snes
R tr snes
SELECT select snes
START start snes

Combo

A combo is a chain of states.

curl -X POST -d '[{"type": "direction", "id": "left", "state": "pressed"}, {"type": "button", "id": "a", "state": "pressedAndReleased"}, {"type": "direction", "id": "none", "state": "pressed"}]' http://recalbox.local:1337/gamepads/1/combo

Type direction

Property Description
id The direction identifier (see above)
state The direction state (see above)

Type button

Property Description
id The button identifier (see above)
state The button state (see above)

Type wait

Property Description
value The time to wait in milliseconds

Examples:

curl -X POST -d '[{"type": "direction", "id": "left", "state": "pressed"}, {"type": "wait", "value": 1000}, {"type": "direction", "id": "none", "state": "pressed"}]' http://recalbox.local:1337/gamepads/1/combo
curl -X POST -d @hadoken.json http://recalbox.local:1337/gamepads/1/combo

Hadoken:

[
    {
        "type" : "direction",
        "id"   : "down",
        "state": "pressed"
    },
    {
        "type" : "direction",
        "id"   : "right",
        "state": "pressed"
    },
    {
        "type" : "direction",
        "id"   : "down",
        "state": "released"
    },
    {
        "type" : "direction",
        "id"   : "right",
        "state": "released"
    },
    {
        "type" : "button",
        "id"   : "y",
        "state": "pressedAndReleased"
    }
]