[gnome-games] gamepad-mapping-builder: Add a comment explaining X/Y swap
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gamepad-mapping-builder: Add a comment explaining X/Y swap
- Date: Thu, 27 Feb 2020 20:11:53 +0000 (UTC)
commit 320e9c11bcc437e5fd0f638c23d05901911ad2ca
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Feb 28 01:09:58 2020 +0500
gamepad-mapping-builder: Add a comment explaining X/Y swap
Input is messy, make it a bit less of a mess.
src/gamepad/gamepad-mapping-builder.vala | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/src/gamepad/gamepad-mapping-builder.vala b/src/gamepad/gamepad-mapping-builder.vala
index 6533119a..2550f708 100644
--- a/src/gamepad/gamepad-mapping-builder.vala
+++ b/src/gamepad/gamepad-mapping-builder.vala
@@ -6,6 +6,14 @@ private class Games.GamepadMappingBuilder : Object {
string source;
}
+ // SDL strings are based on XBox button order unlike libretro, e.g.
+ // A is the bottom button rather than the right one.
+ //
+ // At the same time, /usr/include/linux/input-event-codes.h uses XBox order
+ // for A and B, and Nintendo order for X and Y: X is the top button, and Y
+ // is the left one.
+ //
+ // As a result, we swap X and Y again to match XBox order.
private const GamepadInputSource[] INPUT_SOURCES = {
{ { EventCode.EV_ABS, EventCode.ABS_X }, "leftx" },
{ { EventCode.EV_ABS, EventCode.ABS_Y }, "lefty" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]