From a9653d1e7a3b148d01834c013d4d33c0906714c3 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 8 Sep 2022 00:18:50 +0900 Subject: [PATCH] internal/gamepaddb: fix hat assignments for Android Now Ebitengine's original mapping works, but the database doesn't work due to differences of button assignments. Fix this later. Updates #2309 --- internal/gamepaddb/gamepaddb.go | 38 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/internal/gamepaddb/gamepaddb.go b/internal/gamepaddb/gamepaddb.go index 095880e10..1df318cb1 100644 --- a/internal/gamepaddb/gamepaddb.go +++ b/internal/gamepaddb/gamepaddb.go @@ -341,26 +341,30 @@ func toStandardGamepadAxis(str string) (StandardAxis, bool) { } func buttonMappings(id string) map[StandardButton]*mapping { - if m, ok := gamepadButtonMappings[id]; ok { - return m - } + // TODO: Use the database instead of the original mapping (#2308). + // The buttons and axes assignments should be fixed. if currentPlatform == platformAndroid { if addAndroidDefaultMappings(id) { return gamepadButtonMappings[id] } } + if m, ok := gamepadButtonMappings[id]; ok { + return m + } return nil } func axisMappings(id string) map[StandardAxis]*mapping { - if m, ok := gamepadAxisMappings[id]; ok { - return m - } + // TODO: Use the database instead of the original mapping (#2308). + // The buttons and axes assignments should be fixed. if currentPlatform == platformAndroid { if addAndroidDefaultMappings(id) { return gamepadAxisMappings[id] } } + if m, ok := gamepadAxisMappings[id]; ok { + return m + } return nil } @@ -711,30 +715,32 @@ func addAndroidDefaultMappings(id string) bool { } } - // TODO: Assign DPAD buttons correctly (#2308). - if buttonMask&(1<