Skip to content

Commit b00e1bd

Browse files
committed
Updated controller implementation to handle dead zone properly
1 parent b1c4bd1 commit b00e1bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sdl_frontend/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ fn handle_gamepad_event(cpu: &mut CPU, event: Event, event_param: &mut EventPara
14731473
if joystick_id < 2 {
14741474
match axis {
14751475
Axis::LeftX | Axis::RightX => {
1476-
if value == 0 {
1476+
if value.abs() < 128 {
14771477
cpu.bus.reset_paddle_latch(2 * joystick_id as usize);
14781478
} else {
14791479
let u = entry.1.axis(axis) as f32 / 32768.0;
@@ -1501,7 +1501,7 @@ fn handle_gamepad_event(cpu: &mut CPU, event: Event, event_param: &mut EventPara
15011501
}
15021502
}
15031503
Axis::LeftY | Axis::RightY => {
1504-
if value == 0 {
1504+
if value.abs() < 128 {
15051505
cpu.bus.reset_paddle_latch(2 * joystick_id as usize + 1);
15061506
} else {
15071507
let v = entry.1.axis(axis) as f32 / 32768.0;

0 commit comments

Comments
 (0)