# Input `XamInputGetState(port, XINPUT_FLAG_GAMEPAD, &state)` (xam ordinal 0x191) returns the controller state for ports 0-3: - Buttons are a bit mask: up 0x1, down 0x2, left 0x4, right 0x8, start 0x10, back 0x20, stick clicks 0x40/0x80, LB 0x100, RB 0x200, A 0x1000, B 0x2000, X 0x4000, Y 0x8000. - Triggers run 0-255; sticks are signed 16-bit over the full range. Y points up. - A disconnected port returns an error, and xexkit zeroes the state. - While the Guide is open, XAM keeps the controllers and they read as released. `xex_input_get(port, &pad)` in `xex_input.h` wraps this; `XEX_PAD_*` are the bits. Notes from FAKE-08: - **Back+Start** is a screenshot hotkey on consoles with some dashboard plugins, so the title never sees it held. Use the Guide for leaving. - Xbox players expect **A to confirm and B to go back**. If a program's own layout maps them differently, as PICO-8's O/X do, choose the confirm button per layout. - The test `tests/video` logs every button, trigger and stick change with names. Use it to check a controller mapping.