Commit 4acb646
committed
feat: PC-accurate per-controller vibration on top of upstream multi-controller
Layered the vibration improvements from the pre-cleanup branch (commit
878469f^) onto the contributor's multi-controller PR (utkarshdalal#1261, merged
upstream as dacbfa0). Upstream's slot infrastructure
(getBufferForSlot/setControllerForSlot/resolveControllerSlot) is
preserved unchanged; the additions are purely vibration quality.
What this changes:
- WinHandler.java: per-slot rumble poller wakes via FileObserver
(inotify) instead of a 20 ms sleep loop, dispatches dual-motor rumble
via VibratorManager (API 31+) with ascending-ID motor sort, applies a
240 ms keepalive cycle so long rumbles don't get cut off, refreshes
the InputDevice handle periodically to handle hot-swap mid-rumble,
and scales amplitude by the user's intensity preference.
- evshim.c: per-player atomic g_keepalive_active flag + per-player
last_rumble cache + inotify-based wake replace the prior 5 ms poll
fallback, eliminating dropped/stuck rumbles on rapid game-side
pulses. Includes the narrow-rumble re-entry guard (4a08598).
- libevshim.so: rebuilt against new evshim.c (26288 bytes).
Settings UI (ControllerTab):
- Vibration Mode dropdown: off / controller / device. (Pre-cleanup had
a 'both' option; dropped per design — pick one target, not both.)
- Vibration Intensity slider 0-100%, hidden when mode is 'off'.
Persistence:
- ContainerData: vibrationMode + vibrationIntensity fields with saver
/ restorer wiring.
- ContainerUtils: roundtrips both fields between PrefManager defaults,
ContainerData, and Container.extras.
- PrefManager: VIBRATION_MODE + VIBRATION_INTENSITY prefs with
normalizeVibrationModeInput() helper for safe deserialization.
- XServerScreen: pushes per-container vibration mode + intensity into
WinHandler at game launch.
What is intentionally left as upstream:
- All multi-controller routing, slot assignment, hot-plug, and the
ControllerManager / PhysicalControllerHandler integration. The
contributor's design for those is what the PR keeps.
build-evshim.ps1 and the SDL2 stub header are added to support
recompiling libevshim.so without an SDL2 SDK install.1 parent 98bd367 commit 4acb646
6 files changed
Lines changed: 265 additions & 99 deletions
File tree
- app/src/main
- java
- app/gamenative
- ui/component/dialog
- com/winlator
- container
- inputcontrols
- winhandler
- res/values
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
Lines changed: 1 addition & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 5 | | |
11 | | - | |
12 | 6 | | |
13 | 7 | | |
14 | 8 | | |
15 | 9 | | |
16 | | - | |
17 | 10 | | |
18 | 11 | | |
19 | | - | |
20 | 12 | | |
21 | 13 | | |
22 | 14 | | |
| |||
34 | 26 | | |
35 | 27 | | |
36 | 28 | | |
37 | | - | |
38 | 29 | | |
39 | 30 | | |
40 | 31 | | |
| |||
76 | 67 | | |
77 | 68 | | |
78 | 69 | | |
79 | | - | |
80 | 70 | | |
81 | | - | |
| 71 | + | |
82 | 72 | | |
83 | 73 | | |
84 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
170 | | - | |
171 | | - | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
| |||
233 | 235 | | |
234 | 236 | | |
235 | 237 | | |
236 | | - | |
237 | | - | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
Lines changed: 105 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | | - | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | | - | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
65 | 89 | | |
66 | 90 | | |
67 | 91 | | |
| |||
82 | 106 | | |
83 | 107 | | |
84 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
85 | 136 | | |
86 | 137 | | |
87 | 138 | | |
88 | 139 | | |
89 | 140 | | |
90 | | - | |
| 141 | + | |
91 | 142 | | |
92 | 143 | | |
93 | 144 | | |
| |||
106 | 157 | | |
107 | 158 | | |
108 | 159 | | |
109 | | - | |
| 160 | + | |
110 | 161 | | |
111 | 162 | | |
112 | 163 | | |
| |||
202 | 253 | | |
203 | 254 | | |
204 | 255 | | |
205 | | - | |
| 256 | + | |
206 | 257 | | |
207 | 258 | | |
208 | 259 | | |
209 | 260 | | |
210 | 261 | | |
211 | | - | |
| 262 | + | |
212 | 263 | | |
213 | 264 | | |
214 | 265 | | |
| |||
224 | 275 | | |
225 | 276 | | |
226 | 277 | | |
227 | | - | |
| 278 | + | |
228 | 279 | | |
229 | 280 | | |
230 | 281 | | |
| |||
277 | 328 | | |
278 | 329 | | |
279 | 330 | | |
280 | | - | |
| 331 | + | |
281 | 332 | | |
282 | 333 | | |
283 | 334 | | |
284 | 335 | | |
285 | 336 | | |
286 | | - | |
| 337 | + | |
287 | 338 | | |
288 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
289 | 385 | | |
0 commit comments