Fixed a crash in the response curve axis filter and rewritten it to use integer math#10
Fixed a crash in the response curve axis filter and rewritten it to use integer math#10LunarEclipse363 wants to merge 3 commits intoxiota:mainfrom
Conversation
| int bucket_size = max_norm / bucket_count; | ||
| int bucket_index = std::min(value_norm / bucket_size, bucket_count - 1); |
There was a problem hiding this comment.
Hmm yes this relies on some assumptions that should be upheld at the config validation level, I'll figure out what exactly those are and how to solve that later and update the PR.
| int bucket_size_final; | ||
| if (bucket_index == bucket_count - 1) { | ||
| bucket_size_final = max_norm - (bucket_size * (bucket_count - 1)); | ||
| } else { | ||
| bucket_size_final = bucket_size; | ||
| } |
|
If I wanted to write some unit tests for this, how do I go about that? I see there's a |
I don't know. I didn't update or add the tests to meson. Are you using this as a driver or remapper? I no longer use it for either, so not sure it's worth investing a lot of time into anymore. As a driver, there are some kernel modules that work well enough. For basic remapping, you can set For advanced remapping, I started a separate project. aelkey It's a Lua module, so can do almost anything. Turn gamepad into air mouse, midi controller, etc. Also not limited to gamepads. |
|
I'm using it to make an old game (a revival of Need for Speed: World) running under Wine accept a DS5 controller, so it needs to be an xinput device with the exact name an Xbox 360 controller would use, as presented by Wine. Otherwise the game won't even attempt to use it. I've tried SC-Controller but it only really works properly for the original steam controller, the DS5 support is somewhat incomplete. xboxdrv works great overall but I wanted to use a custom response curve for the steering axis to have better control and that's how I ran into a crash with this filter. Could make another PR to make the configs I came up with as examples, the DS5 config seems especially useful to have, and a config that changes the device name to exactly pretend to be an Xbox 360 controller may be helpful to someone too. |
Pretty cool that this is still useful... I revised the deprecation notice in the readme, but will still consider PRs/fixes to keep it usable.
Aelkey should be able to do that, but probably more effort because you'd have to implement the remapping/curves/etc in Lua. Latency from Lua averages around 0.2 ms.
I wouldn't mind merging a PR with example configs. |
As the TODOs in the old code implied there were unhandled edge cases, this PR solves that.