Repository navigation
Conversation
|
Physical-device feedback for the vibration work: the player confirmed game-driven rumble on an iPhone while running LM3 1.4.0. Touch-control feedback was also felt, through a separate UIKit press-edge implementation. Important scope: this was a local haptics-only adaptation of the boundary proposed here, not your unmodified PR head The local integration exposes the active player-1 vibration channels, retains sanitized last values, and forwards snapshots to a coalescing serial queue. Focus loss, route changes and interruptions clear prior state; resume requires a new game signal. We kept touch feedback and game rumble as independent launcher settings. Standalone mixer tests and HID tests passed; the platform sink logged a phone route and the player confirmed the physical result. Core Haptics intensity/sharpness is an adaptation of the game's bands to the phone's single actuator. We have not confirmed left/right controller localities on physical hardware or equivalence to two Joy-Con motors, and we have not independently verified the tactile result in ACNH. Keeping the vibration work separate from the two memory features would make the device result easier to review and merge. Our LM3 investigation instead points to numerous private render-target variants over shared NVN storage; it is not evidence that the packaged-source reclaim measured for Hades II will fix that workload. No game files, audio, saves, screenshots or raw device logs are attached. |
The host answered nn::hid's seven vibration calls with "no devices", so every game saw no rumble at all. Now the two Switch motors are mixed on the host and played by the Taptic Engine or a connected controller. - hle_haptics.c mixes a device's low / high band pair into the one intensity and sharpness pair Core Haptics takes: the bands' energies add (a two-motor rumble is not just its stronger motor), sharpness follows the amplitude-weighted frequency, and a dynamic attack / release keeps a held rumble from stuttering at the value changes. A rumble ends on the game's own zero; the silence watchdog only backstops a game that stops writing, and its 120 ms floor applies only to rumbles that really were shorter than that. - Haptics.m runs one Core Haptics engine per target: the Taptic Engine on the phone, and a separate pattern player for a physical controller. It suspends on backgrounding and on an audio interruption, and invalidates the epoch so nothing queued before the pause fires afterwards. - hle_hid.c: the seven vibration HLEs forward to the sink. With no sink (the Mac host without DM_HAPTIC_FAKE) they report exactly what they did before, no devices, so nothing changes for a game that cannot feel anything. - The game's own strength setting is left alone: it already multiplies the amplitude before the call, so the in-game slider is what the player feels. DM_HAPTIC_GAIN (default 3) only compensates for the Taptic Engine being much weaker than a Joy-Con at the same amplitude; 0 = the raw mapping. - DM_HAPTIC_FAKE, DM_HAPTIC_OFF, DM_HAPTIC_TRACE, DM_HAPTIC_TRACE_ALL and DM_HAPTIC_GAIN are diagnostic switches; none is needed to play. - t_haptic_mixer.c pins the mixer's arithmetic: two motors beating one, no phantom level between the two amplitudes, the attack not freezing a rumble that stops writing, and suspend / resume not replaying an old value. Measured on a Hades II rumble (295 ms): the right motor alone at 0.119, then both at 0.105. The mixer's output is 0.505 and then 0.630 at gain 3. Co-Authored-By: Claude Code <[email protected]>
9f5c1ec to
2b7e392
Compare
|
Split as suggested: this PR now carries the vibration work only (one commit on top of Nothing in the vibration code changed in the split; the branch was rebuilt on the current |
Preserve per-player motor state and SDK vibration handles, apply batches atomically, and route Core Haptics output through existing controller assignments. Add independent launcher controls and lifecycle tests. Supersedes #86. Physical feel and controller compatibility still require device testing.
|
Thanks for proposing the game-rumble path. This is now implemented on main in 3eb1d76, so I am closing this PR as superseded. The implementation preserves SDK handle encoding and independent player/left-right motor state, commits vibration batches atomically, and shares Core Haptics output between iOS and Mac controllers. It uses separate controller localities when available and a combined phone output, follows existing player assignments, and adds independent Game rumble and Rumble strength launcher settings. Effects retain their requested timing, with state cleared on lifecycle and route changes. Validation passed: the host test suite, 60 HID checks, rumble state and Apple adapter tests with fake engines, the Mac host build, iOS compilation checks, and iOS build-input/settings generation. Physical feel and controller compatibility still need device testing; the device feedback on this PR is not being claimed as validation of this implementation. The memory-reclaim work in #103 and the LM3 memory issue #100 remain separate and open. |
Preserve per-player motor state and SDK vibration handles, apply batches atomically, and route Core Haptics output through existing controller assignments. Add independent launcher controls and lifecycle tests. Supersedes seedds#86. Physical feel and controller compatibility still require device testing.
nn::hid's six vibration entry points were all "not provided" stubs (IsVibrationPermitted→ 0,GetVibrationDeviceHandles→ 0 devices, the rest no-ops), so a game's rumble never reached anything on iOS or on a connected controller. They now carry the game'sNVNvibrationValuepairs to a host-side mixer and feed a sink.Split out of #86 on the reviewer's advice: the device result covers this work only, and the two memory features now live in their own PR.
What moves where
dm/host/hle_haptics.c/.h— the mixer. The game writes the two motors (low and high band) microseconds apart with the same value; the mixer adds both motors' energy and samples a settled pair, so a level neither motor was ever at can never be produced. It follows the hardware's amplitude / frequency band mapping, and appliesGeneralRumbleMultiplierthe way the game does (measured 0.030 / 0.060 / 0.119 at 50 / 100 / 200% in the save'sProfile<N>.sjson) — the host deliberately does not cancel it, so the in-game slider is what the player feels.dm/ios/Sources/Haptics.m— the iOS sink: Core Haptics engines, one per motor channel, created fromdm_haptics_ios_init()instartGamebeforefront_ios_boot(), so the guest sees the devices when it initializesnn::hid. Focus loss, route changes and interruptions clear the state; a resume needs a new game signal.dm/host/hle_hid.c— the six entry points. Handles are(npad << 8) | motor, two per controller;GetVibrationDeviceInfodescribes a linear resonant actuator with position 1 = left, 2 = right;GetActualVibrationValuereturns the last value the sink accepted.dm/host/Makefile—-framework CoreHaptics. The iOS project takes its frameworks from this line throughdm/ios/tools/gen_build.py, so no Xcode project file changes.dm/host/tests/t_haptic_mixer.c— the mixer on its own, no device needed.No sink, no change. On the Mac host without
DM_HAPTIC_FAKE=1the sink pointer stays null:IsVibrationPermittedanswers 0 andGetVibrationDeviceHandlesanswers 0 devices, which is exactly what every game saw before.t_hidbuilds against the sink so the hid take-overs are still tested.Tuning knobs:
DM_HAPTIC_OFF=1disables output,DM_HAPTIC_GAIN=<float>sets the output gain (default 3.0, range 0-10; 0 = raw mapping),DM_HAPTIC_FAKE=1logs the mixed values with no sink installed,DM_HAPTIC_TRACE=<path>writes a TSV of every value the game sends (the guest thread only copies into a ring; a writer thread does the file I/O).Verification
make -C dm/host/tests GAME=0100A00019DE0000 run— passes, includingt_haptic_mixer(one motor at 0.119 → 0.505, both at 0.105 → 0.630, both at 0.119 → 0.714, suspend silences, resume does not fire a phantom rumble) andt_hid(44 checks).DM_HAPTIC_FAKE=1logs the game's requestvibration value #1 frame 1002 0.119/160Hz 0.119/320Hz (gain 3.0, game multiplier 2.00)and the mixed outputI=0.505 S=0.625. The title → save A presses alone produce no vibration — the swings and hits after them do.Haptics.mcompiles clean against the iphoneos SDK with ARC.Not verified here: the Core Haptics feel on a real device. Core Haptics intensity / sharpness is an adaptation of the game's two-motor bands to a phone's single actuator; I have not checked how the Taptic Engine renders these values, and I have not confirmed left/right localities on physical Joy-Con or equivalence to two motors. A contributor reported game-driven rumble on an iPhone for an LM3 build of this boundary (see the comment below) — that was their own local adaptation, not this branch, and it covers the game-rumble path only.
🤖 Generated with Claude Code