lemoGamePad ultimate

How it works

Part of lemoGamePad ultimate.

How it works

Browser pad transport

The browser gamepad is a second transport in front of the same slot logic. The PC serves a page on TCP control port + 2 and accepts a WebSocket at /ws?k=<key>:

Protocol (little endian):

header (12 B): "VPAD" | ver u8 | type u8 | seq u16 | token u32
type 1 INPUT   : header + buttons u32 | lx i16 | ly i16 | rx i16 | ry i16
                 | l2 u8 | r2 u8 | battery u8 | pad u8
                 | want_pad u8 (0 = auto, 1..8 = P1..P8, 1.5+)   (29 B total)
type 2 DISCOVER: header only, broadcast to the control port
type 3 OFFER   : header + name_len u8 + name + pad_type u8
                 + ip_count u8 + ip_count * 4 bytes (IPv4 list, 1.3+)
type 5 PING    : header + client_clock u32
type 6 PONG    : echo of PING + loss_permille u16 (1.4+)
                 + assigned_pad u8 (1.5+)
                  + party_locked u8 + is_host u8 (party lock)
type 7 RUMBLE  : header + small u8 + large u8
type 8 SLOT_REQUEST : header + target pad u8 (1..8)            (1.6.9+)
type 9 SLOT_ASK     : header + request_id u32 + requester pad u8
type 10 SLOT_VOTE   : header + request_id u32 + accept u8
type 11 SLOT_RESULT : header + request_id u32 + result u8 + pad u8
type 12 PARTY_LOCK  : header + locked u8 (1 = lock, 0 = unlock; host only)

Types 8–12 are additive. VERSION stays 1: an older app ignores the new types, and a request to one simply times out. The two extra PONG bytes are likewise ignored by old apps, which stop reading after the assigned-pad byte. Result codes are 1 ACCEPTED, 2 DECLINED, 3 TIMEOUT, 4 UNAVAILABLE, 5 CANCELLED.

Button bits: Select 0, L3 1, R3 2, Start 3, Up 4, Right 5, Down 6, Left 7, L2 8, R2 9, L1 10, R1 11, Triangle 12, Circle 13, Cross 14, Square 15, PS 16.


← Back to lemoGamePad ultimate home