upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/gameinput_probe.cpp
diff options
context:
space:
mode:
authorLeonida local test <local-test@localhost>2026-11-22 18:26:28 +0100
committerLeonida local test <local-test@localhost>2026-11-22 18:26:28 +0100
commita3b1719c61b4b916964368bf9968e5f822cd50ca (patch)
tree311db6edfb35ed70d274b4124ecbc55ab5386a82 /runtime/test/gameinput_probe.cpp
parent49475796c226c8511b9470bf97a4daf57b8af323 (diff)
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.
Diffstat (limited to 'runtime/test/gameinput_probe.cpp')
-rw-r--r--runtime/test/gameinput_probe.cpp6
1 files changed, 4 insertions, 2 deletions
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<IGameInputDevice*> g_devices;
26 26
27void CALLBACK on_device(GameInputCallbackToken, void*, IGameInputDevice* device, uint64_t, uint32_t current, uint32_t previous) { 27void CALLBACK on_device(GameInputCallbackToken, void*, IGameInputDevice* device, uint64_t, uint32_t current, uint32_t previous) {
28 const GameInputDeviceInfo* i = device->GetDeviceInfo(); 28 const GameInputDeviceInfo* i = device->GetDeviceInfo();
29 std::printf("\n%s %s (%04x:%04x) motors=0x%x\n", (current & GameInputDeviceConnected) ? "connected " : "disconnected", 29 std::printf("\n%s %s (%04x:%04x) motors=0x%x forcefeedback=%u haptic=%u\n",
30 i->displayName ? i->displayName->data : "?", i->vendorId, i->productId, i->supportedRumbleMotors); 30 (current & GameInputDeviceConnected) ? "connected " : "disconnected",
31 i->displayName ? i->displayName->data : "?", i->vendorId, i->productId, i->supportedRumbleMotors,
32 i->forceFeedbackMotorCount, i->hapticFeedbackMotorCount);
31 if ((current & GameInputDeviceConnected) && !(previous & GameInputDeviceConnected)) { 33 if ((current & GameInputDeviceConnected) && !(previous & GameInputDeviceConnected)) {
32 device->AddRef(); 34 device->AddRef();
33 g_devices.push_back(device); 35 g_devices.push_back(device);