From e18b44c88ddc84d478d372b783e9e93191494dfa Mon Sep 17 00:00:00 2001 From: Ivan Izaguirre Date: Mon, 5 Oct 2020 22:17:19 +0200 Subject: [PATCH] Use all pair and even buttons of the joysticks as buttons 0 and 1 (one of the buttons of my controller broke) --- izapple2sdl/sdlJoysticks.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/izapple2sdl/sdlJoysticks.go b/izapple2sdl/sdlJoysticks.go index 5d88044..16c73aa 100644 --- a/izapple2sdl/sdlJoysticks.go +++ b/izapple2sdl/sdlJoysticks.go @@ -71,12 +71,12 @@ func (j *sdlJoysticks) putAxisEvent(e *sdl.JoyAxisEvent) { } func (j *sdlJoysticks) putButtonEvent(e *sdl.JoyButtonEvent) { - if e.Which >= 2 || e.Button >= 2 { - // Process only the first two buttons of the first two joysticks + if e.Which >= 2 { + // Process only the buttons of the first two joysticks return } - j.button[uint8(e.Which)*2+e.Button] = (e.State != 0) + j.button[uint8(e.Which)*2+(e.Button%2)] = (e.State != 0) } func mouseToJoyFull(x int32, w int32) uint8 {