# Input and controllers ## Model GT3 was written for the **DualShock 2**: 16 buttons, 12 of them pressure-sensitive (D-pad, face buttons, L1/R1/L2/R2, each reporting 0–255), two 8-bit analog sticks, and two rumble motors (one on/off, one variable). The game uses pressure for throttle and brake by default. The engine always reads a **virtual DualShock 2** per player (`src/input/virtual_pad.h`). Physical devices are mapped onto it through *bindings*. So original behaviour is preserved exactly, and any device can drive any control. In particular, an **analog trigger can drive a pressure-sensitive button**: the default modern race layout maps the right trigger to the race's accelerate (Cross pressure) and the left trigger to brake (Square pressure). Each player has two such pads, each with its own bindings: - the **menu pad**: the DualShock 2 itself, used by every menu (and, with the `gt3` race layout, by the race too); - the **race pad**: what the race reads while driving. Its buttons always mean what they meant in GT3 (see [Race controls](#race-controls)); the player's race layout says which physical inputs drive them. All devices go through SDL3, which gives native support for Xbox (360/One/Series), PlayStation (DS4/DualSense), Nintendo Switch Pro and Joy-Con, 8BitDo, Steam Controller/Deck, Android and Apple MFi controllers, plus generic HID joysticks, wheels and pedals. Devices hot-plug at any time. ## Native features | Feature | How it is used | |---|---| | Rumble | DS2 large motor → low-frequency motor, small motor → high-frequency motor. In races, each player's **Rumble** (Settings → Rumble & feedback, `[playerN] rumble`) picks how the motors run: **GT3 original** (`gt3`) follows GT3's own vibration: each step's level (suspension movement, curbs under the front wheels, the front tires' drive and brake forces, wall hits) on the large motor as GT3 sends it (at most half strength), never the small motor; most controllers play its low levels much stronger than a DualShock 2, so it runs all the time there. **Modern** (`modern`) rumbles for what the car meets on both motors, so it is felt in both grips, with a lean: the body stronger on the large motor (the left grip), the tires on the small one (the right grip), the other motor at 35%, or 70% on a DualSense, whose motors play in separate grips where a split feels like a side. A wall or car hit pulses for 0.25 s by its speed change and off-road holds, leaning left; wheelspin, a slide (the tire squeal) and locked wheels hold, and curbs pulse at a rate that follows the speed, leaning right. **Auto** (`auto`, the default) is Modern on every controller. Either way, a car the AI drives, as after the finish, does not vibrate | | Phone vibration (Android, off by default) | `[player1] phone_vibration = on` (Settings → Rumble & feedback → Phone vibration): player 1's rumble on the device's own motor, only while the controls driving them have no rumble motor (built-in handheld controls, touch, a controller without motors). A controller that rumbles keeps it; the phone stays still | | Impulse triggers (Xbox One/Series) | See Force feedback: the ABS on the brake's trigger, the edge of grip on the throttle's. On Windows only through SDL's RAWINPUT driver (see Xbox controllers) | | Player LEDs / light bars | Set to the player number | | Button labels | The UI shows Cross/Circle on PlayStation pads and A/B on Xbox pads | | Motion sensors | `tilt` source: steer by rolling the controller (DualSense, DS4, Switch Pro, or a phone's own accelerometer on Android and iOS) | | Wheels and pedals | Raw joystick axes with `pedal` and `invert` options; the wheel layout | | Keyboard "analog" | `ramp=` smooths digital keys into analog throttle/steering | ## Controller Each player picks one **Controller** (Settings → Controls, `[playerN] controller`): **Auto** (`auto`), a connected pad or wheel by name (`controller` holds part of its name; one that isn't connected stays listed as "(not connected)"), or **Keyboard only** (`keyboard`; offered only when a keyboard is connected, never in VR builds). Left/Right changes it; Cross does nothing there. Auto takes a wheel SDL lists, then one known only by its forces, otherwise the first free gamepad, otherwise any other joystick (SDL also lists flight sticks and some keyboards, mice and macro pads as joysticks, so those never take a player's gamepad); Settings shows it as "Auto: ". A device chosen by name is used whatever its type. The kind of device in use picks the buttons; players don't choose a layout: | Kind | Buttons | |---|---| | Gamepad | DualShock 2 layout 1:1 (triggers → L2/R2 pressure); back paddles → R2 / L2 (right up, left down: GT3's shift buttons) | | Wheel (a device SDL identifies as a wheel, or a joystick SDL has no type for that plays a spring and a constant force, which rumble motors don't: SDL only lists the wheels it knows, and a Simucube 3 reaches the PC as its Link Hub, which isn't listed; issue 134) | Axis 0 steering, axes 1/2 pedals (resting at +1); typical Logitech layout. SDL's own Logitech driver (macOS, Linux, Android) sends a G29's, G27's or G25's pedals as axes 2 gas, 3 brake, 1 clutch; the game reads them as axes 1 gas, 2 brake, 3 clutch, the order Windows gives them, so a binding means the same pedal everywhere. A `pedal` on an axis that has stayed in the middle since it connected reads as nothing there, not half way down (a Simucube's Y axis idles at the centre). Races use GT3's steering-wheel path. A wheel earlier versions took for a joystick gets the joystick's custom bindings, if it has no wheel bindings yet | | Joystick (any other device SDL doesn't map as a gamepad) | None: nothing is pressed until its inputs are bound in Settings → Controls (saved to `[playerN.joystick.*]`) | | Keyboard (Keyboard only, or no device connected) | Keyboard only | VR builds' gamepad layout has B as Triangle (back) and Y as Circle. Every layout also includes the player's keyboard layout. Player 1's: arrows = D-pad, W/S = Cross/Square (ramped), A/D = left stick, Enter = Cross, Space = Circle, Esc/Backspace = Triangle, Q/E = L1/R1, Z/C = L2/R2, F/G = L3/R3, P = Start, Tab = Select, Home/End = right stick X, Page Up/Page Down = right stick Y (the race camera's look; they were I/J/K/L before 0.4, now player 2's). Player 2's keys sit around I / J / K / L, apart from player 1's, so both can share one keyboard: I/K/J/L = D-pad, O = Cross, U = Triangle, ; = Circle, H = Square, comma/period = L1/R1, N/M = L2/R2, ' = Start, / = Select. No default key is in both players' sets. (While driving with the modern layout the keyboard has its own race keys, below.) On any screen, F11 toggles fullscreen and F12 saves a screenshot. **Keyboard** (`keyboard = off`, hidden under Keyboard only) stops the keyboard also driving a player, except player 1 with buttons only the keyboard can drive (no device connected, custom bindings with only keys, or a wheel SDL doesn't list on the wheel layout, whose button numbers may not be that wheel's): their keyboard stays live, so the game can't be left with no way to control it. Keyboard only always drives the player with the keyboard. Configs from before the Controller choice used `preset` (`racing`, `classic`, `wheel`, `keyboard`) and `device`; they are read once: `racing` and `classic` are the gamepad (with the paddles), `wheel` is Auto (so a wheel is preferred), `keyboard` is Keyboard only (unless its custom bindings had controller inputs: then its device stays), and a named `device` stays. `wheel` with a named `device` also keeps the wheel layout for that device whatever SDL makes of it (`[playerN] wheel_device`). Custom bindings go by input type: `pad.*` to the gamepad's set, `joy.*` to the wheel's, keys, mouse buttons and `tilt` to the keyboard's. The config still carries `preset` and `device` for older builds. When nothing player 1 has can drive the menus (no device and no keyboard to use, or nothing readable bound to Cross and Up / Down), the menus outside races (ours and the game's) read every connected controller with the gamepad layout's buttons and the keyboard with its default keys, as Settings does, so the game can't be left without a way back. Races always read each player's own controls. Settings (every page, from our main menu or from the game's Key Configuration) also reads every connected controller with the gamepad layout's buttons and the keyboard with its default keys, besides player 1's own controls, so a choice or bindings that leave player 1 without a working controller can always be changed back. The game's menus and races follow the player's controls only, and nothing else reads while a binding is being captured. **Controllers in the background** (desktop; Settings → Controls, `[input] background`, off by default): controllers, wheels and joysticks keep driving the game while another window is in front, e.g. one on a second monitor. Off, they only reach the game while its window is in front, so another app or a second copy of the game can use the same pad without the game acting on it. The keyboard and mouse always need the game's window. VR builds always read their controllers (the headset's window never has the focus). With it off, a race the player drives pauses when another window takes the focus (online races go on, without rumble or force feedback until the game is in front again; presentation §E2). When the game's window has the focus again, each controller's motors are sent the level they should play now, written to the controller even if it matches the last one sent, and again 0.1 s later: a stop sent while the window was away could be lost on Windows, and the pad kept rumbling after the player came back until the game made it rumble again (issue 200). Wheels and the VR controllers are left alone. **Xbox controllers** (Windows; Settings → Controls, `[input] xbox_driver`, `rawinput` by default): SDL reads Xbox pads through its RAWINPUT driver, which plays their impulse triggers (through Windows.Gaming.Input, once a button has been pressed). `xinput` reads them through XInput instead, which has no trigger motors: no impulse triggers, for a pad that misbehaves with Raw Input. SDL takes the choice when it starts, so a change applies after a restart. ## Remapping in the app In Settings, choices, switches and sliders change only with Left/Right or a tap on their arrows, switch or track; Cross never changes a setting (it runs actions and starts a rebind). **Settings → Controls** starts with the settings for **all players** (Analog response, Controllers in the background, Xbox controllers on Windows; Race views and In-car camera shake are on **Settings → Cameras**, with your own cameras), then holds the controllers and their bindings, for player 1 and player 2 (split screen) alike: under each player's **Controller**, **Race controls** and **Keyboard** rows come their bindings, inline: - **Player N race controls**: the race actions in driving order (Accelerate, Brake, Shift up, Shift down, Handbrake, Reverse, Change view, Look back, Look left / right, Look ahead / behind, Look left, Look right, Pause, Steer, Steer left / right, the performance overlay); - **Player N menu buttons**: a reset row, then the DualShock 2's buttons and sticks, as the game's menus read them. Each row has a live meter (the button's pressure, or the stick's position) and two columns: the **controller's** inputs and the **keyboard's**. Select a row, then: - **Cross** (or a tap): release everything, then press the new input. A key replaces that action's keyboard input; any other input (a pad button, trigger or stick, a back paddle, a wheel axis or button) replaces its controller input. The other column keeps its input. Esc, Android Back or a tap / click cancels instead (so those keys can't be captured: choose the layout again to get them back), and mouse buttons aren't captured (set them in `config.ini`, e.g. `mouse.left`). A button or key on Steer, Look left / right, Look ahead / behind or a stick axis is refused: it could push it only one way (bind it to Steer left / Steer right, Look left / Look right or Look back, or the D-pad). A stick captured on Steer or a stick axis gets `deadzone=0.08`; a wheel's axis gets none, and the wheel's saved sets drop the `deadzone=0.08` earlier versions gave it (issue 134). In races Steer's dead zone is the **Steering dead zone** setting (see Race controls). An axis that rests at an end (a pedal, a joystick's trigger) captured on a button or a stick half reads over its whole travel (`pedal`, with `invert` when it rests at +1), not from half way; one resting in the middle (combined pedals) keeps its half. - **Square**: add an input instead of replacing - **Select** (Delete on the keyboard): clear the highlighted column - **Left/Right**: switch between the two columns While an input is being captured (up to 6 s) Settings takes nothing else, and the captured press does not also act on the page. A player's bindings are two sets. The **controller's** is one per kind of controller (gamepad, wheel), saved to `[playerN.bindings]` / `[playerN.race]` for a gamepad and `[playerN.wheel.bindings]` / `[playerN.wheel.race]` for a wheel. The **keyboard's** is one per player whatever the controller (Keyboard only included), saved to `[playerN.keyboard.bindings]` / `[playerN.keyboard.race]`. Custom profiles from before the two sets are split once by input type (above). The keyboard's set also holds `tilt`, so tilt steering works whatever the controller, a phone with no pad included. **Race controls** offers **Modern**, **GT3 original** and, once custom race controls exist, **Custom**; the **Menu buttons** row offers the device kind's layout and **Custom**. Choosing a layout keeps the custom set: it stays saved (`[playerN] race_custom = off` / `menu_custom = off`) and choosing Custom brings it back. Editing a row while a layout is chosen makes custom bindings from that layout as it stands (both sets) plus the edit; if another custom set is kept, Settings asks first ("Replace your custom race controls with GT3 original plus this change?", Cancel focused). Under **GT3 original** the race reads the menu pad, so the race list shows each action's menu button ("Accelerate (Cross)") and the menu buttons' inputs. R3 (the right stick's click) looks back there as well as L1, as Look back is the right stick's click in Modern: the list shows "Look back (L1, R3)" with both buttons' inputs, and the performance overlay none. Editing one there starts custom race controls from GT3 original's mapping plus the change, with R3's inputs on Look back. **Inputs from other devices.** Any binding can come from any connected controller, for either player: a brake pedal set, a second pad's trigger, a shifter. Capture takes every connected pad, wheel and joystick. An input from the player's own Controller is saved as usual. One from another device names that device and shows its name ("DualSense Wireless Controller 2: Left trigger", "G29 Pedals: Axis 2"; numbered among connected devices of that name). The binding's `device=` option holds the name, then what tells devices of that name apart: the device's serial number when the system reports one (Sony pads give their Bluetooth address), otherwise its USB port path, otherwise its order among them (`#2`). The name must match first; a binding whose serial or port path isn't connected does nothing (it never falls back to a look-alike), and a tag never reads the player's own Controller. Auto never gives a named device to the other player. The layouts' own buttons stay on the Controller. Races use GT3's steering-wheel path when Steer (LX) is bound to a wheel, and wheel forces go to that wheel; rumble stays on the Controller. The back paddles are controls of their own: capture takes them like any button and they show as **Right paddle**, **Left paddle** (and **Right paddle 2**, **Left paddle 2** for a second pair). A paddle does one thing: binding it to an action (Reverse, say) takes it off the one it had (shift); clearing Shift up or down, or rebinding it to another button, takes shift off the paddle. The **Settings** screen (Controls, Rumble & feedback and Touch pages) edits the `[playerN]` controller/keyboard/race/rumble/steering curve keys and bindings (and `[player1] phone_vibration` on Android), every `[ffb]` key and every `[touch]` key described below, and applies them immediately. In the game's own menus, Options → **Key Configuration** shows a **Controller Settings** button in place of the DualShock 2 table: Cross or Circle (or a tap) opens Settings on the Controls page over the game, with player 1's Controller row selected and the bindings below it. Its back button then reads **Back to game**; it, or Triangle / Esc, returns to the Key Configuration page as it was from anywhere on the page (buttons still held at that moment are ignored until released). Triangle / Esc on **Customize layout...** (Touch) also goes straight back to the game; the layout editor's **Done** returns to Settings. ## Config syntax ```ini [player1] controller = auto ; auto, part of a device name ("DualSense", "G29"), or keyboard (only) keyboard = on race = modern ; race layout (modern | gt3), used when there is no [player1.race] rumble = auto ; race rumble: auto (modern) | modern | gt3 (see Native features) steering_curve = 1.00 ; race steering = |x|^curve, 0.5..2.5 (see Race controls) wheel_steering_curve = 1.00 ; the same for a wheel steering_deadzone = 0.08 ; race steering's dead zone, 0..0.3 (see Race controls) wheel_steering_deadzone = 0.00 ; the same for a wheel phone_vibration = off ; Android, player 1 only: rumble on the device's own motor (see Native features) [player1.bindings] ; the menu pad, a gamepad's inputs ([player1.wheel.bindings], [player1.joystick.bindings]) Cross = pad.south LX = pad.leftx deadzone=0.08 [player1.keyboard.bindings] ; the menu pad, the keyboard's and tilt (whatever the controller) Cross = key.Return LX = tilt curve=1.5 [player1.race] ; the race pad: targets are GT3's buttons (Cross = accelerate ...) Cross = pad.righttrigger curve=1.4 Square = pad.lefttrigger LX = pad.leftx deadzone=0.08 [player1.keyboard.race] Cross = key.W ramp=0.12 Square = key.S ramp=0.08 LX- = key.A ramp=0.2 LX+ = key.D ramp=0.2 ``` Each section replaces its set's layout when present and keeps only that set's inputs: keys, mouse buttons and `tilt` in the `.keyboard` sections, everything else in the others. **Targets:** `Select L3 R3 Start Up Right Down Left L2 R2 L1 R1 Triangle Circle Cross Square`, and the axes `LX LY RX RY`, optionally as halves (`LX-`, `LX+`). **Sources** (alternatives separated by `|`): | Source | Meaning | |---|---| | `key.` | Keyboard scancode by SDL name; spaces become `_` (`key.Left_Shift`) | | `pad.