Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Input

Note

This page is currently a stub and needs more detail.

Controller Entry

A controller entry is exactly 16 bytes. Controller N lives at base + N * 16, where base is the start of the controller table (see I/O Layout).

A controller entry in memory can be modified but will be overwritten by the hardware each frame.

Layout

OffsetSizeField
+0 low nybbleFace buttons: South, East, West, North (bits 0 to 3)
+0 high nybble1 byteStart, Select, Left stick click, Right stick click
+1 low nybbleD-pad: Up, Down, Left, Right
+1 high nybble1 byteLeft bumper, right bumper, left trigger (digital), right trigger (digital)
+21 byteLeft stick X
+31 byteLeft stick Y
+41 byteRight stick X
+51 byteRight stick Y
+61 byteLeft trigger
+71 byteRight trigger
+81 byteBattery
+91 byteFlags
+106 bytesReserved

Face Buttons

Other Buttons

D-pad

Bumpers and Triggers

Triggers (analogue)

Sticks

Battery

Outputs a level from 0 (empty) to 255 (full). A controller with no battery level will always return 255.

Flags

BitFlag
0Controller connected
1Controller uses battery
2 to 7Reserved