Skip to content

Commit 31f9857

Browse files
committed
custom steering handler
1 parent feb1f07 commit 31f9857

File tree

7 files changed

+245
-400
lines changed

7 files changed

+245
-400
lines changed

Config-UG/EventReference.txt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ Both ports are monitored for XInput separately, whereas on keyboard they're not
6767

6868
NOTE: some events (such as quitting with Q key or launching the tutorial video with LT) are hardcoded due to the way they're coded in the game
6969

70+
== STEER INPUT SPECIAL NOTES ==
71+
72+
Due to the buggy nature of the steer input handler, its code had to be rewritten.
73+
This *only* affects regular races, as drag races use a different event.
74+
This also enables higher resolution readout from the gamepad axis, as well as the ability to assign steering to both the analog axis and the digital buttons.
75+
76+
These are the special assignments available for steering input (gamepad):
77+
SteerLeftButton -- you may only assign buttons to these, not analog axis
78+
SteerRightButton
79+
SteerLeftAxis -- you may only assign analog axis to these, not buttons
80+
SteerRightAxis
81+
82+
These are the special assignments available for steering input (keyboard):
83+
KeyboardSteerLeft
84+
KeyboardSteerRight
85+
86+
== REGULAR EVENTS ==
87+
7088
JOY_EVENT_NULL
7189
JOY_EVENT_TYPE_CHANGED
7290
JOY_EVENT_EXIT_DEMO_DISC
@@ -200,8 +218,8 @@ JOY_EVENT_REPLAY_HIDE_TIMELINE
200218
JOY_EVENT_REPLAY_MARK_DEMO
201219
JOY_EVENT_REPLAY_TEST_DEMO
202220
JOY_EVENT_REPLAY_ERASE_DEMO
203-
JOY_EVENT_STEER -- you may only assign an analog axis or DPAD, nothing else
204-
JOY_EVENT_STEER_ANALOG -- breaks right after using JOY_EVENT_STEER (JOY_EVENT_STEER is analog as well anyway)
221+
JOY_EVENT_STEER -- steer input is NOT handled by the game code, therefore this event is not read
222+
JOY_EVENT_STEER_ANALOG -- same as previous steer event - not handled by game code, not parsed
205223
JOY_EVENT_THROTTLE
206224
JOY_EVENT_THROTTLE_ANALOG
207225
JOY_EVENT_THROTTLE_ANALOG_ALTERNATE

Config-UG/NFSU_XtendedInput.ini

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ControllerIconMode = 0 // 0 = Xbox, 1 = PlayStation 4 -- MAKE SURE TO DISABLE WI
1616
FirstControlDevice = 0 // 0 = Keyboard, 1 = Controller -- for setting the first state
1717

1818
[Events]
19-
// FE controls
19+
; FE controls
2020
JOY_EVENT_FENG_PAD_UP = XINPUT_GAMEPAD_DPAD_UP
2121
JOY_EVENT_FENG_PAD_DOWN = XINPUT_GAMEPAD_DPAD_DOWN
2222
JOY_EVENT_FENG_PAD_LEFT = XINPUT_GAMEPAD_DPAD_LEFT
@@ -55,15 +55,16 @@ JOY_EVENT_CARSEL_CHANGE_MODE = XINPUT_GAMEPAD_RT
5555
JOY_EVENT_START = XINPUT_GAMEPAD_START
5656
JOY_EVENT_SELECT = XINPUT_GAMEPAD_A
5757
JOY_EVENT_SKIP = XINPUT_GAMEPAD_A
58-
// In-Game controls
58+
; In-Game controls
59+
SteerLeftButton = 0
60+
SteerRightButton = 0
61+
SteerLeftAxis = XINPUT_GAMEPAD_LS_LEFT
62+
SteerRightAxis = XINPUT_GAMEPAD_LS_RIGHT
5963
JOY_EVENT_THROTTLE_ANALOG = XINPUT_GAMEPAD_RT
6064
JOY_EVENT_BRAKE_ANALOG = XINPUT_GAMEPAD_LT
61-
JOY_EVENT_STEER = XINPUT_GAMEPAD_LS_X
62-
// commented out analog because it causes issues, when regular steer is activated, analog steering dies
63-
//JOY_EVENT_STEER_ANALOG = XINPUT_GAMEPAD_LS_X
64-
// horribly broken - goes full left or right...
65-
//JOY_EVENT_DRAG_RACE_CHANGE_LANE_LEFT_ANALOG = XINPUT_GAMEPAD_LS_X
66-
//JOY_EVENT_DRAG_RACE_CHANGE_LANE_RIGHT_ANALOG = XINPUT_GAMEPAD_LS_X
65+
; horribly broken - goes full left or right...
66+
;JOY_EVENT_DRAG_RACE_CHANGE_LANE_LEFT_ANALOG = XINPUT_GAMEPAD_LS_X
67+
;JOY_EVENT_DRAG_RACE_CHANGE_LANE_RIGHT_ANALOG = XINPUT_GAMEPAD_LS_X
6768
JOY_EVENT_DRAG_RACE_CHANGE_LANE_LEFT = XINPUT_GAMEPAD_LS_LEFT
6869
JOY_EVENT_DRAG_RACE_CHANGE_LANE_RIGHT = XINPUT_GAMEPAD_LS_RIGHT
6970
JOY_EVENT_SHIFTUP = XINPUT_GAMEPAD_RS_UP
@@ -74,13 +75,13 @@ JOY_EVENT_CAMERA_LOOKBACK = XINPUT_GAMEPAD_X
7475
JOY_EVENT_CAMERA_POV_CHANGE = XINPUT_GAMEPAD_Y
7576
JOY_EVENT_PAUSE = XINPUT_GAMEPAD_START
7677
JOY_EVENT_RESET_CAR = XINPUT_GAMEPAD_BACK
77-
// HP2 leftovers -- these all work
78+
; HP2 leftovers -- these all work
7879
JOY_EVENT_ZONE_PREVIEW = XINPUT_GAMEPAD_RIGHT_SHOULDER
7980
JOY_EVENT_ZONE_FREEZE = XINPUT_GAMEPAD_LEFT_SHOULDER
8081
JOY_EVENT_HONK_HORN = XINPUT_GAMEPAD_LEFT_THUMB
8182
JOY_EVENT_CYCLE_HUD = XINPUT_GAMEPAD_DPAD_UP
8283
JOY_EVENT_ZONE_SLOMO = XINPUT_GAMEPAD_DPAD_DOWN
83-
// debug camera -- only on port 2
84+
; debug camera -- only on port 2
8485
JOY_EVENT_CHANGE_DEBUG_CAMERA = XINPUT_GAMEPAD_BACK
8586
JOY_EVENT_DEBUG_CAMERA_DROP_CAR = XINPUT_GAMEPAD_START
8687
JOY_EVENT_DEBUG_CAMERA_INOUT = XINPUT_GAMEPAD_LS_Y
@@ -112,7 +113,7 @@ JOY_EVENT_DEBUG_CAMERA_SLOW = XINPUT_GAMEPAD_LEFT_THUMB
112113
JOY_EVENT_DEBUG_CAMERA_FORWARD_BLINK = XINPUT_GAMEPAD_DPAD_UP
113114
JOY_EVENT_DEBUG_CAMERA_BACKWARD_BLINK = XINPUT_GAMEPAD_DPAD_DOWN
114115
[EventsKB]
115-
// FE controls
116+
; FE controls
116117
JOY_EVENT_FENG_PAD_UP = VK_UP
117118
JOY_EVENT_FENG_PAD_DOWN = VK_DOWN
118119
JOY_EVENT_FENG_PAD_LEFT = VK_LEFT
@@ -123,7 +124,7 @@ JOY_EVENT_FENG_BUTTON0 = G
123124
JOY_EVENT_FENG_BUTTON1 = F
124125
JOY_EVENT_FENG_BUTTON2 = 9
125126
JOY_EVENT_FENG_BUTTON3 = 0
126-
//JOY_EVENT_FENG_START = VK_ESCAPE
127+
;JOY_EVENT_FENG_START = VK_ESCAPE
127128
JOY_EVENT_FENG_HELP = H
128129
JOY_EVENT_FENG_LTRIGGER = 9
129130
JOY_EVENT_FENG_RTRIGGER = 0
@@ -136,13 +137,13 @@ JOY_EVENT_MENU_R1 = 0
136137
JOY_EVENT_MENU_R2 = P
137138
JOY_EVENT_MENU_SQUARE = Z
138139
JOY_EVENT_CARSEL_UNLOCK = U
139-
//JOY_EVENT_START = VK_ESCAPE
140+
;JOY_EVENT_START = VK_ESCAPE
140141
JOY_EVENT_SELECT = VK_RETURN
141142
JOY_EVENT_CARSEL_ORBIT_UP = W
142143
JOY_EVENT_CARSEL_ORBIT_DOWN = S
143144
JOY_EVENT_CARSEL_ORBIT_RIGHT = A
144145
JOY_EVENT_CARSEL_ORBIT_LEFT = D
145-
// In-Game controls
146+
; In-Game controls
146147
KeyboardSteerLeft = VK_LEFT
147148
KeyboardSteerRight = VK_RIGHT
148149
JOY_EVENT_THROTTLE = VK_UP
@@ -158,13 +159,13 @@ JOY_EVENT_CAMERA_POV_CHANGE = C
158159
JOY_EVENT_RESET_CAR = R
159160
JOY_EVENT_DRAG_RACE_CHANGE_LANE_LEFT = VK_LEFT
160161
JOY_EVENT_DRAG_RACE_CHANGE_LANE_RIGHT = VK_RIGHT
161-
// HP2 leftovers -- these all work
162+
; HP2 leftovers -- these all work
162163
JOY_EVENT_ZONE_PREVIEW = VK_DELETE
163164
JOY_EVENT_ZONE_FREEZE = VK_NEXT
164165
JOY_EVENT_HONK_HORN = H
165-
//JOY_EVENT_CYCLE_HUD = XINPUT_GAMEPAD_DPAD_UP
166-
//JOY_EVENT_ZONE_SLOMO = XINPUT_GAMEPAD_DPAD_DOWN
167-
// debug camera
166+
;JOY_EVENT_CYCLE_HUD = XINPUT_GAMEPAD_DPAD_UP
167+
;JOY_EVENT_ZONE_SLOMO = XINPUT_GAMEPAD_DPAD_DOWN
168+
; debug camera
168169
JOY_EVENT_CHANGE_DEBUG_CAMERA = M
169170
JOY_EVENT_DEBUG_CAMERA_DROP_CAR = 5
170171
JOY_EVENT_DEBUG_CAMERA_MOVE_FWD = W

Config-UG2/EventReference.txt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ Both ports are monitored for XInput separately, whereas on keyboard they're not
6767

6868
NOTE: some events (such as quitting with Q key) are hardcoded due to the way they're coded in the game
6969

70+
== STEER INPUT SPECIAL NOTES ==
71+
72+
Due to the buggy nature of the steer input handler, its code had to be rewritten.
73+
This *only* affects regular races, as drag races use a different event.
74+
This also enables higher resolution readout from the gamepad axis, as well as the ability to assign steering to both the analog axis and the digital buttons.
75+
76+
These are the special assignments available for steering input (gamepad):
77+
SteerLeftButton -- you may only assign buttons to these, not analog axis
78+
SteerRightButton
79+
SteerLeftAxis -- you may only assign analog axis to these, not buttons
80+
SteerRightAxis
81+
82+
These are the special assignments available for steering input (keyboard):
83+
KeyboardSteerLeft
84+
KeyboardSteerRight
85+
86+
== REGULAR EVENTS ==
87+
7088
JOY_EVENT_NULL
7189
JOY_EVENT_TYPE_CHANGED
7290
JOY_EVENT_LIVE_TYPE_CHANGED
@@ -202,8 +220,8 @@ JOY_EVENT_REPLAY_HIDE_TIMELINE
202220
JOY_EVENT_REPLAY_MARK_DEMO
203221
JOY_EVENT_REPLAY_TEST_DEMO
204222
JOY_EVENT_REPLAY_ERASE_DEMO
205-
JOY_EVENT_STEER -- you may only assign an analog axis or DPAD, nothing else
206-
JOY_EVENT_STEER_ANALOG -- breaks right after using JOY_EVENT_STEER (JOY_EVENT_STEER is analog as well anyway)
223+
JOY_EVENT_STEER -- steer input is NOT handled by the game code, therefore this event is not read
224+
JOY_EVENT_STEER_ANALOG -- same as previous steer event - not handled by game code, not parsed
207225
JOY_EVENT_THROTTLE
208226
JOY_EVENT_THROTTLE_ANALOG
209227
JOY_EVENT_THROTTLE_ANALOG_ALTERNATE
@@ -289,4 +307,4 @@ JOY_EVENT_CAMERA_EDITOR_BUBBLE_BACK_FORTH
289307
JOY_EVENT_CAMERA_EDITOR_SHAKE_MAG
290308
JOY_EVENT_CAMERA_EDITOR_SHAKE_FRQ
291309
JOY_EVENT_CAMERA_EDITOR_SHUTTLE_LEFT_RIGHT
292-
JOY_EVENT_CAMERA_EDITOR_SHUTTLE_SPEED
310+
JOY_EVENT_CAMERA_EDITOR_SHUTTLE_SPEED

0 commit comments

Comments
 (0)