Skip to content

Conversation

@privaloops
Copy link

Summary

This PR addresses 4 open issues reported by the community:

#107 — Outrun on MAME: no FFB until crash/off-track

The OutrunActive handler rejected Bank_Motor_Direction == 0, preventing the FFB state machine from initializing properly. All other implementations (RacingActive1, PDriftActive) accept all values unconditionally.

#82 — Demul Initial D: constant wheel shaking since v2.0.0.52

The 0x86 spring command lacked proper validation (ffb[1] > 0x00) unlike other commands (0x85, 0x84). This caused spurious spring effects from garbage data. Fixed across all 10 affected game files: Demul, InitialD0v131, InitialD0v211, InitialD0v230, InitialD4, InitialD4Japan, InitialD5, IDTAv231, KODrive, SWDC2018.

#108 — MAME crashes at launch with PXN V10 wheel

No NULL check on the haptic device pointer, and no validation of SDL_HapticNewEffect return values. Devices that don't support all effect types crashed at initialization. Now uses SDL_HapticQuery to check supported effects before creating them, and all Trigger functions guard against NULL haptic / invalid effect IDs. EffectCollection members are initialized to -1. Also fixes SDL_Init error handling (the if block had no body).

#103 — T500RS: FFB stops working after short time

Constant, Damper, and Inertia effects used configFeedbackLength (120ms default) as their duration and ran only once. When the game didn't re-trigger fast enough (e.g. sustained force during a long turn), the effect expired and the wheel went limp. Changed to SDL_HAPTIC_INFINITY, matching the pattern already used for Spring effects.

Test plan

  • Verify Outrun on MAME has FFB from the start of a race (not only after crash)
  • Verify Initial D on Demul no longer has constant shaking
  • Verify MAME launches without crash with PXN V10 (or other limited-haptic devices)
  • Verify T500RS maintains constant force during sustained turns
  • Verify existing wheels (Logitech G29/G920, Fanatec) still work correctly
  • Verify Spring/Friction/Sine effects are unaffected by the changes

)

The OutrunActive FFB handler rejected newstateFFB == 0, preventing
the state machine from tracking motor direction properly. FFB only
activated after a crash or off-track event sent a non-zero value.
All other implementations (RacingActive1, PDriftActive) accept all
values unconditionally.
…Boomslangnz#82)

The 0x86 spring command only checked FFBStr != 0, unlike other commands
(0x85, 0x84) which also validate ffb[1]. This caused spurious spring
effects when garbage data matched 0x86 in the command byte, resulting
in constant wheel shaking reported as "raised markers" vibration.

Fixed in: Demul, InitialD0v131, InitialD0v211, InitialD0v230, InitialD4,
InitialD4Japan, InitialD5, IDTAv231, KODrive, SWDC2018
…oomslangnz#108)

- Return early from Initialize() if haptic device is NULL
- Return early from Initialize() if SDL_Init fails
- Query supported effects with SDL_HapticQuery before creating them
- Initialize all effect IDs to -1 in EffectCollection
- Add NULL/invalid-ID guards to all Trigger functions

Devices that don't support all haptic effect types (e.g. PXN V10)
will no longer crash at launch. Unsupported effects are gracefully
skipped.
…langnz#103)

Effects with configFeedbackLength (120ms default) expired between game
loop triggers when the game state didn't change frequently enough.
The T500RS and other wheels that strictly respect SDL effect durations
would go limp during sustained forces (e.g. long turns).

Using SDL_HAPTIC_INFINITY keeps effects active until the next update
or explicit stop, matching the pattern already used for Spring effects.
@privaloops privaloops closed this Feb 10, 2026
@privaloops privaloops deleted the fix/community-issues branch February 10, 2026 16:49
@privaloops privaloops restored the fix/community-issues branch February 10, 2026 16:51
@privaloops privaloops reopened this Feb 10, 2026
Infinite duration causes FFB to stop working on some drivers because
RunEffect on an already-running infinite effect is silently ignored.
Reverts constant, inertia and damper effects back to configFeedbackLength.
@Boomslangnz
Copy link
Owner

Hi, sorry I’ve only just seen this PR

Have you finished adding or still in progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants