Vehicle driving: WASD never accelerates or brakes — port Darner's seat-based W/S → RT/LT remap #93

Open
opened 2026-12-05 18:14:26 +00:00 by github-bot · 3 comments
Owner

@⁠omeglejason on GitHub · 2026-12-05 18:13 UTC · original

Vehicle driving with mouse & keyboard: WASD never accelerates/brakes — please port Darner's seat-based W/S → RT/LT remap

Summary

With LARP_CONTROLS=mnk and a Darner-style controls.ini, getting into a car leaves W/S on the left stick, where they do nothing, so the only way to drive is the mouse buttons (or whatever is bound to RT/LT). Darner, from the same GPL-3.0 lineage, does this automatically and with no toggle key: it reads the player's vehicle seat from title memory every frame and, only while you are in a non-aircraft driver seat, adds the left stick's up/down to RT/LT, zeros the stick's Y, and turns the mouse buttons into LB/RB for drive-bys.

I believe this was never ported when the Darner-style mouse & keyboard support was added to larp: the key mapping and raw-input smoothing are there, the vehicle-seat input layer is not. There is no VehicleSeat / vehicle_seat anywhere in crates/larp-hle/src/modules/gameinput/.

Related: #16 (controls.ini not reflected in game), #30 (mouse look), #46 (direct mouse camera, also ported from Darner and still open).

Environment

  • larp v1.0.11 (main @ 84f8870), bin/larp.exe SHA-256 7812152786646B40B7081A18D1F469217C3AC443AC29BF1745BFDA6217B29F71
  • Windows 11, RTX 4060 Laptop 8 GB, driver 621.47
  • Title: game_scarlett_master.exe 1.0.2.1 (build b99f876b74d4a77f…), --console series-s
  • LARP_CONTROLS=mnk, LARP_CONTROLS_INI=Larp\controls.ini, LARP_PIPELINE_WAIT_MS=8, nv-profile --mb 2048
  • controls.ini in use (the load is confirmed in the log: loaded custom controls.ini … entries=24, sensitivity=0.864 bindings=25):
sensitivity = 0.864
MoveUp = W
MoveDown = S
MoveLeft = A
MoveRight = D
RT = C
LT = Z
A = Enter, Space
B = R, Backspace
X = X
Y = Y
LB = Q
RB = E
LS = F
RS = H
Menu = Esc
View = Tab

Steps to reproduce

  1. Launch with LARP_CONTROLS=mnk and the controls.ini above.
  2. Walk with W A S D (works), enter a car with Y (get in), stay in the driver seat.
  3. Hold W / S — nothing happens. The car does not move.
  4. Hold the left mouse button / press C (bound to RT) — the car accelerates. Right mouse / Z brakes.
  5. Get out: W A S D walk again, mouse buttons are RT/LT again. So the mapping follows the button, not the seat.

Expected

Darner's behaviour, for reference (no toggle, no extra key):

  • In the driver seat of a non-aircraft vehicle: W → RT (accelerate), S → LT (brake/reverse), A/D stay on the left stick's X (steering), the stick's Y goes to 0.
  • Left/right mouse buttons in the driver seat become RB/LB (drive-by), not RT/LT.
  • Passenger seat, aircraft pilot seat, and on foot: unchanged (mouse buttons stay RT/LT, W/S are the stick).

How Darner does it (reference implementation, GPL-3.0-or-later, portable to larp)

victory-hle/src/mousehook.rs returns VehicleSeat { None, Driver, Passenger, AircraftPilot } from pure memory reads, re-evaluated on every input poll:

base + 0x0ab5_6e38                       → LOCAL_PLAYER (CPed*)
  +0x30 == 3                             → entity is a ped
  ECS component 0x47 (fallback 0x46)     → the CVehicle the ped is attached to
  CVehicle's CSeatManager                → driver seat index, compare its ped reference with LOCAL_PLAYER
  model info +0x99 & 7 == 5, +0x1dc      → vehicle type (plane/heli/blimp ⇒ AircraftPilot)
  menu or pause active                   → forced None

All reads are pointer-validated (0x1_0000 ≤ p, sign-extended 47-bit, alignment), and there are unit tests that build a fake ped/vehicle pool in memory.

Then the only behavioural change lives in the input layer (victory-hle/src/modules/gameinput.rs:436):

let driving = seat == VehicleSeat::Driver;
let (left_trigger, right_trigger, left_y) = if driving {
    (on(PadControl::LeftTrigger).max(on(PadControl::LeftStickDown)),   // S → LT
     on(PadControl::RightTrigger).max(on(PadControl::LeftStickUp)),    // W → RT
     on_key(0xA0) - on_key(0xA2))                                      // LShift − RCtrl → pitch
} else {
    (on(PadControl::LeftTrigger), on(PadControl::RightTrigger), /* as today */)
};

and in overlay_mouse_mapping() the driver case swaps the mouse buttons to shoulders:

if seat == VehicleSeat::Driver {
    let mut buttons = mmb_btn;
    if rmb { buttons |= LEFT_SHOULDER; }
    if lmb { buttons |= RIGHT_SHOULDER; }
    (buttons, 0.0, 0.0)
}

Proposed change for larp

  1. Add a seat query to larp's input layer — a mousehook-style function next to the existing title hooks in larp-loader/larp-hle, using the offsets above (they are for title build 1.0.2.1, the same build larp targets).
  2. Thread Option<VehicleSeat> into gameinput::mouse::mnk_pad() (or into the PadState assembly) and apply exactly the two rules above.
  3. Optional: gate it behind e.g. LARP_DRIVE_WASD=1 (default on/off up to you) so it can be bisected if something misbehaves in menus.

Notes

  • No game files, keys or assets are involved; the Darner/Victory code is GPL-3.0-or-later, same licence family as larp.
  • I can test builds on this machine (RTX 4060 Laptop, Series S, 1080p DLSS Quality + 2× FG) and report logs/screenshots — including a before/after of entering a vehicle, if that helps.
  • Also happy to test a patch-only build if you'd rather keep the seat query out of the main tree.
**@⁠omeglejason** on GitHub · 2026-12-05 18:13 UTC · [original](https://github.com/gamingwithhomie/larp/issues/93) # Vehicle driving with mouse & keyboard: WASD never accelerates/brakes — please port Darner's seat-based W/S → RT/LT remap ## Summary With `LARP_CONTROLS=mnk` and a Darner-style `controls.ini`, **getting into a car leaves `W`/`S` on the left stick, where they do nothing**, so the only way to drive is the mouse buttons (or whatever is bound to `RT`/`LT`). Darner, from the same GPL-3.0 lineage, does this automatically and with no toggle key: it reads the player's vehicle seat from title memory every frame and, **only while you are in a non-aircraft driver seat**, adds the left stick's up/down to `RT`/`LT`, zeros the stick's Y, and turns the mouse buttons into `LB`/`RB` for drive-bys. I believe this was never ported when the Darner-style mouse & keyboard support was added to larp: the key mapping and raw-input smoothing are there, the vehicle-seat input layer is not. There is no `VehicleSeat` / `vehicle_seat` anywhere in `crates/larp-hle/src/modules/gameinput/`. Related: #16 (controls.ini not reflected in game), #30 (mouse look), #46 (direct mouse camera, also ported from Darner and still open). ## Environment - larp **v1.0.11** (`main` @ `84f8870`), `bin/larp.exe` SHA-256 `7812152786646B40B7081A18D1F469217C3AC443AC29BF1745BFDA6217B29F71` - Windows 11, RTX 4060 Laptop 8 GB, driver 621.47 - Title: `game_scarlett_master.exe` 1.0.2.1 (build `b99f876b74d4a77f…`), `--console series-s` - `LARP_CONTROLS=mnk`, `LARP_CONTROLS_INI=Larp\controls.ini`, `LARP_PIPELINE_WAIT_MS=8`, `nv-profile --mb 2048` - `controls.ini` in use (the load is confirmed in the log: `loaded custom controls.ini … entries=24`, `sensitivity=0.864 bindings=25`): ```ini sensitivity = 0.864 MoveUp = W MoveDown = S MoveLeft = A MoveRight = D RT = C LT = Z A = Enter, Space B = R, Backspace X = X Y = Y LB = Q RB = E LS = F RS = H Menu = Esc View = Tab ``` ## Steps to reproduce 1. Launch with `LARP_CONTROLS=mnk` and the `controls.ini` above. 2. Walk with `W A S D` (works), enter a car with `Y` (get in), stay in the **driver** seat. 3. Hold `W` / `S` — nothing happens. The car does not move. 4. Hold the left mouse button / press `C` (bound to `RT`) — the car accelerates. Right mouse / `Z` brakes. 5. Get out: `W A S D` walk again, mouse buttons are `RT`/`LT` again. So the mapping follows the *button*, not the seat. ## Expected Darner's behaviour, for reference (no toggle, no extra key): - In the driver seat of a non-aircraft vehicle: `W` → `RT` (accelerate), `S` → `LT` (brake/reverse), `A`/`D` stay on the left stick's X (steering), the stick's Y goes to 0. - Left/right mouse buttons in the driver seat become `RB`/`LB` (drive-by), not `RT`/`LT`. - Passenger seat, aircraft pilot seat, and on foot: unchanged (mouse buttons stay `RT`/`LT`, `W`/`S` are the stick). ## How Darner does it (reference implementation, GPL-3.0-or-later, portable to larp) `victory-hle/src/mousehook.rs` returns `VehicleSeat { None, Driver, Passenger, AircraftPilot }` from **pure memory reads**, re-evaluated on every input poll: ``` base + 0x0ab5_6e38 → LOCAL_PLAYER (CPed*) +0x30 == 3 → entity is a ped ECS component 0x47 (fallback 0x46) → the CVehicle the ped is attached to CVehicle's CSeatManager → driver seat index, compare its ped reference with LOCAL_PLAYER model info +0x99 & 7 == 5, +0x1dc → vehicle type (plane/heli/blimp ⇒ AircraftPilot) menu or pause active → forced None ``` All reads are pointer-validated (`0x1_0000 ≤ p`, sign-extended 47-bit, alignment), and there are unit tests that build a fake ped/vehicle pool in memory. Then the **only** behavioural change lives in the input layer (`victory-hle/src/modules/gameinput.rs:436`): ```rust let driving = seat == VehicleSeat::Driver; let (left_trigger, right_trigger, left_y) = if driving { (on(PadControl::LeftTrigger).max(on(PadControl::LeftStickDown)), // S → LT on(PadControl::RightTrigger).max(on(PadControl::LeftStickUp)), // W → RT on_key(0xA0) - on_key(0xA2)) // LShift − RCtrl → pitch } else { (on(PadControl::LeftTrigger), on(PadControl::RightTrigger), /* as today */) }; ``` and in `overlay_mouse_mapping()` the driver case swaps the mouse buttons to shoulders: ```rust if seat == VehicleSeat::Driver { let mut buttons = mmb_btn; if rmb { buttons |= LEFT_SHOULDER; } if lmb { buttons |= RIGHT_SHOULDER; } (buttons, 0.0, 0.0) } ``` ## Proposed change for larp 1. Add a seat query to larp's input layer — a `mousehook`-style function next to the existing title hooks in `larp-loader`/`larp-hle`, using the offsets above (they are for title build 1.0.2.1, the same build larp targets). 2. Thread `Option<VehicleSeat>` into `gameinput::mouse::mnk_pad()` (or into the `PadState` assembly) and apply exactly the two rules above. 3. Optional: gate it behind e.g. `LARP_DRIVE_WASD=1` (default on/off up to you) so it can be bisected if something misbehaves in menus. ## Notes - No game files, keys or assets are involved; the Darner/Victory code is GPL-3.0-or-later, same licence family as larp. - I can test builds on this machine (RTX 4060 Laptop, Series S, 1080p DLSS Quality + 2× FG) and report logs/screenshots — including a before/after of entering a vehicle, if that helps. - Also happy to test a patch-only build if you'd rather keep the seat query out of the main tree.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 18:14:27 +00:00
Author
Owner

@⁠gamingwithhomie on GitHub · 2026-12-05 21:02 UTC · original

Implemented for the next release (v1.1.2) via PR #134: set keyboard_driving = 1 in controls.ini (or LARP_KEYBOARD_DRIVING=1) - in the drivers seat W/S become RT/LT (gas/brake), Shift/Ctrl lean, LMB/RMB are LB/RB, using the same seat check as Darner. Off by default so pad driving is unchanged. Will close once v1.1.2 is out and youve confirmed.

**@⁠gamingwithhomie** on GitHub · 2026-12-05 21:02 UTC · [original](https://github.com/gamingwithhomie/larp/issues/93#issuecomment-7445309796) Implemented for the next release (v1.1.2) via PR #134: set `keyboard_driving = 1` in `controls.ini` (or `LARP_KEYBOARD_DRIVING=1`) - in the drivers seat W/S become RT/LT (gas/brake), Shift/Ctrl lean, LMB/RMB are LB/RB, using the same seat check as Darner. Off by default so pad driving is unchanged. Will close once v1.1.2 is out and youve confirmed.
Author
Owner

@⁠gamingwithhomie on GitHub · 2026-12-05 21:18 UTC · original

Shipped in v1.1.2: LARP_KEYBOARD_DRIVING=1 (or keyboard_driving = 1 in controls.ini). Please confirm W/S drive properly in the drivers seat and Ill close this.

**@⁠gamingwithhomie** on GitHub · 2026-12-05 21:18 UTC · [original](https://github.com/gamingwithhomie/larp/issues/93#issuecomment-7445537754) Shipped in **v1.1.2**: `LARP_KEYBOARD_DRIVING=1` (or `keyboard_driving = 1` in `controls.ini`). Please confirm W/S drive properly in the drivers seat and Ill close this.
Author
Owner

@⁠omar2205 on GitHub · 2026-12-05 22:15 UTC · original · edited 2026-12-05 22:16 UTC

The controls.ini still doesnt work. I changed the sensitivity and it was not reflected.

**@⁠omar2205** on GitHub · 2026-12-05 22:15 UTC · [original](https://github.com/gamingwithhomie/larp/issues/93#issuecomment-7446512768) · edited 2026-12-05 22:16 UTC The controls.ini still doesnt work. I changed the sensitivity and it was not reflected.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/gamingwithhomie--larp#93
No description provided.