Send the game's vibration values as they are to a Switch Pro Controller or Joy-Con, behind rumble_hd.

With NX2NAVI_RUMBLE_HD=1 (live, off by default) the gamepad the game reads, when it is a Switch Pro Controller, a
single Joy-Con or a pair of them, gets each side's low and high band with its own frequency and amplitude in the
controller's rumble report, and no dual-motor call any more. A Pro Controller and a single Joy-Con take the report
through SDL's effect call, over USB and Bluetooth; SDL refuses that call for a combined pair, so a pair's reports are
written to its two HID devices directly. Every other gamepad, the Switch 2 controllers included, keeps the motors.

The game's thread posts its newest values and a thread of input.c writes the reports: at most one every 15 ms
(rumble_hd_ms), a held value again every 30 ms, and the neutral value when the game stops sending for 250 ms, when
another gamepad takes over, when the setting is turned off and before the process ends. The rumble strength scales the
amplitude and rumble = 0 silences this path as well. With the setting off nothing is written to the controller: the
log line at the take names it by its ids, and the first report is the trial.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 22:27:34 -05:00
parent 59e3c6c35a
commit df8431da7b
9 changed files with 441 additions and 7 deletions

View File

@@ -21,6 +21,7 @@
#include "kernel.h"
#include "ipc.h"
#include "gfx.h"
#include "input.h"
#include "mods.h"
#include "nvn_api.h"
#include "platform/platform.h"
@@ -325,6 +326,7 @@ void rt_frame_presented(const tex_t *t, uint64_t n) {
fflush(stdout);
fflush(stderr);
coop_shutdown(); // LEAVE and BYE to the room, before the process ends
input_rumble_hd_stop(); // a controller on HD rumble gets the neutral value before the exit
fs_save_flush();
vk_pipeline_prewarm_marker_clear(); // an orderly end, not a driver crash in the boot's builds (vk_pipeline.c pm_skipped)
vk_pipeline_save_exit(); // no-op without the Vulkan back end