Skip to content
Snippets Groups Projects

Fix division-by-0 crash from 100% gamepad deadzones, and lack of input from 0% deadzones

Merged Zwip-Zwap Zapony requested to merge Zwip-Zwap_Zapony/SRB2:deadzone-sigfpe-fix into master

This merge request fixes a division-by-0 crash when using a gamepad deadzone of 100%.

The problem was that it checked if the hypotenuse of the X and Y axes was more than the deadzone, then lowered the hypotenuse to 100%, then subtracted the deadzone from the hypotenuse, then divided something by that, without checking if that was then 0, allowing division by 0 if the deadzone was 100%.

This merge request fixes that by making it so that if the deadzone is 100%, it'll just return 100% input if the user uses that much axis power.

This merge request additionally also fixes a deadzone of 0% resulting in no axis input at all.

Edited by Zwip-Zwap Zapony

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading