You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a980554
Browse filesBrowse the repository at this point in the historyBrowse files
Gamepad: optional XtendedInput layout (RT throttle, LT brake) (#31)
The DirectInput pad from #8 is what Windows shows the game for an Xbox pad:
both triggers on one Z axis, bound in the game's controller menu, so throttle
and brake cancel each other. On Windows most players use xan1242's
NFSU-XtendedInput plugin instead: the triggers are separate analog throttle
and brake, and every button, in races and in the menus, is set in
NFSU_XtendedInput.ini.
runtime/xtinput.c ports the plugin's NFSU2 code (MIT, notice kept):
- FindScannerConfig (0x572120) is overridden (OVR_NA) and returns one
ScannerConfig per JoyEvent, whatever the device type. The configs point at
one native entry (a dispatch_patch address) that runs the plugin's scanners:
buttons, triggers and stick directions as buttons, analog values,
press-only events.
- The RealDriver steering handler (0x407750) becomes the plugin's: left stick
plus keys, written to RealDriver+0x2C8.
- Player 1's port is marked present every poll, as the plugin does; the game
drops the events of a port typed 0xFF (sub_00571a60).
- The keyboard goes through the same scanners with the ini's [EventsKB] keys,
as with the plugin; the mouse is unchanged. Back sends 'Q' to the front end.
- The pad is no longer offered to the game as a DirectInput device.
gamepad.m keeps an XInput-style snapshot that the controller's
valueChangedHandler fills on a queue of its own; the game thread only copies
it. GameController calls made from the game thread wait for the main thread
while it presents frames.
Off by default. Settings › Controls has an "XtendedInput layout" switch
under "Use a game controller" that sets NFSU2_XTINPUT=1 while the controller
is on (disabled for the European executable: the addresses are the North
American v1.2 ones). Settings come
from <game>/scripts/NFSU_XtendedInput.ini when it exists (a Windows install
with the plugin has one), otherwise from the plugin's stock ini, built in.
Tested: North American v1.2, original engine, Flydigi APEX 4 in Xbox mode:
menus, car select and races (throttle and brake on the triggers, steering,
nitrous) behave as with the plugin under Windows; with the switch off the pad
is the DirectInput one as before. Pad reads take about 1 us. The European
build compiles to stubs; not run here (no European executable).
?"RT accelerates, LT brakes, every button as in the NFSU-XtendedInput mod, set in scripts/NFSU_XtendedInput.ini in the game folder if there is one. Off: buttons are set in the game's Controls menu."
0 commit comments