Skip to content

Commit

Permalink
Reverse conditional for hat switch null state check
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored and SiegeLord committed Aug 15, 2023
1 parent 6526843 commit 75d0b67
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/macosx/hidjoy.m
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,12 @@ static void value_callback(
int int_value = IOHIDValueGetIntegerValue(value);

if (joy->dpad == elem){
if (int_value > 0 && int_value <= MAX_HAT_DIRECTIONS) {
osx_joy_generate_axis_event(joy, joy->dpad_stick, joy->dpad_axis_vert, (float)hat_mapping[int_value-1].axisV);
osx_joy_generate_axis_event(joy, joy->dpad_stick, joy->dpad_axis_horiz, (float)hat_mapping[int_value-1].axisH);
} else if (joy->min[joy->dpad_stick][1] > int_value || joy->max[joy->dpad_stick][1] < int_value) {
if (joy->min[joy->dpad_stick][1] > int_value || joy->max[joy->dpad_stick][1] < int_value) {
osx_joy_generate_axis_event(joy, joy->dpad_stick, joy->dpad_axis_vert, 0);
osx_joy_generate_axis_event(joy, joy->dpad_stick, joy->dpad_axis_horiz, 0);
} else if (int_value > 0 && int_value <= MAX_HAT_DIRECTIONS) {
osx_joy_generate_axis_event(joy, joy->dpad_stick, joy->dpad_axis_vert, (float)hat_mapping[int_value-1].axisV);
osx_joy_generate_axis_event(joy, joy->dpad_stick, joy->dpad_axis_horiz, (float)hat_mapping[int_value-1].axisH);
}
goto done;
}
Expand Down

0 comments on commit 75d0b67

Please sign in to comment.