From a3b1719c61b4b916964368bf9968e5f822cd50ca Mon Sep 17 00:00:00 2001 From: Leonida local test Date: Sun, 22 Nov 2026 18:26:28 +0100 Subject: gameinput: report and drive force-feedback and haptic motors through SDL3 haptics (RT-160) IGameInputDevice answered the force-feedback and haptic half of the API with nothing: no motors in GameInputDeviceInfo, E_INVALIDARG from CreateForceFeedbackEffect, false from IsForceFeedbackMotorPoweredOn, a no-op SetForceFeedbackMotorGain and E_INVALIDARG from SetHapticMotorState. A pad SDL opens as a haptic device now reports one force-feedback motor with the effect kinds SDL lists, and a pad with trigger motors reports two haptic motors. Force feedback goes to SDL_CreateHapticEffect/RunHapticEffect on the poll thread, so title calls still never touch SDL; the eleven GameInput effect kinds are SDL's eleven force-feedback effects. The trigger haptic motors play their one waveform as an intensity on the existing trigger output. A pad with neither keeps the old answers, and LEONIDA_RUMBLE=0 silences both. gameinput_test drives all of it through a fake haptic backend, because SDL's virtual joysticks report no haptics. AI-assisted. --- runtime/test/gameinput_probe.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime/test/gameinput_probe.cpp') diff --git a/runtime/test/gameinput_probe.cpp b/runtime/test/gameinput_probe.cpp index 32ddf5d91..a56132ed5 100644 --- a/runtime/test/gameinput_probe.cpp +++ b/runtime/test/gameinput_probe.cpp @@ -26,8 +26,10 @@ std::vector g_devices; void CALLBACK on_device(GameInputCallbackToken, void*, IGameInputDevice* device, uint64_t, uint32_t current, uint32_t previous) { const GameInputDeviceInfo* i = device->GetDeviceInfo(); - std::printf("\n%s %s (%04x:%04x) motors=0x%x\n", (current & GameInputDeviceConnected) ? "connected " : "disconnected", - i->displayName ? i->displayName->data : "?", i->vendorId, i->productId, i->supportedRumbleMotors); + std::printf("\n%s %s (%04x:%04x) motors=0x%x forcefeedback=%u haptic=%u\n", + (current & GameInputDeviceConnected) ? "connected " : "disconnected", + i->displayName ? i->displayName->data : "?", i->vendorId, i->productId, i->supportedRumbleMotors, + i->forceFeedbackMotorCount, i->hapticFeedbackMotorCount); if ((current & GameInputDeviceConnected) && !(previous & GameInputDeviceConnected)) { device->AddRef(); g_devices.push_back(device); -- cgit v1.2.3