# Controls Input comes from the first SDL3 gamepad and the keyboard, merged into one Switch controller (`runtime/input_win.c`). Buttons are ORed; each stick takes the source with the larger deflection. Keys count only while the game window is in the foreground. `TOTK_INPUT=none` disables both (automated runs). `TOTK_*` settings can also be set in `totk.ini` next to `totk.exe` (`input = none`, `motion = 0`, `rumble = 0`); the environment overrides the file. | Switch | Gamepad (by position) | Keyboard | |---|---|---| | Left stick | left stick | W A S D | | Right stick | right stick | I J K L | | D-pad | D-pad | Arrow keys | | A | east | E | | B | south | Left Shift | | X | north | Space | | Y | west | F | | L / R | shoulders | Tab / R | | ZL / ZR | triggers (over 50%) | Q / Z | | Left / right stick click | stick clicks | C / V | | Plus / Minus | Start / Back | Enter / Backspace | The stick direction bits (`StickLLeft` to `StickRDown`) are derived from the sticks at 50% deflection. A gamepad plugged in later is picked up within one second; with none connected the log says `input: no gamepad`. ## Scripted input `TOTK_INPUT_SCRIPT=` replays presses by presented-frame number (`gfx_counters.frames`). It is ORed with real input and still applies under `TOTK_INPUT=none`. One event per line, `#` starts a comment: ```