Skip to content

Commit

Permalink
Don't use the hid mapping from libretro
Browse files Browse the repository at this point in the history
Not sure if the button order is the same.
  • Loading branch information
amadvance committed Jun 2, 2018
1 parent df063d2 commit 342b25c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 203 deletions.
11 changes: 8 additions & 3 deletions advance/linux/jevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,15 @@ static adv_error joystickb_setup(struct joystick_item_context* item, int f)
if (override_begin != override_end) {
log_std(("event: override %04x:%04x '%s' %u %u\n", item->vendor, item->product, item->desc, override_begin, override_end));

/* iterate over all possible buttons */
/*
* Iterate over all possible buttons
*
* Start from BTN_MISC like libretro to be compatible with its mapping:
* See: https://github.com/libretro/RetroArch/blob/master/input/drivers_joypad/udev_joypad.c
*/
unsigned index = 0;
item->button_mac = 0;
for (i = 1; i < KEY_MAX; ++i) {
for (i = BTN_MISC; i < KEY_MAX; ++i) {
if (event_test_bit(i, key_bitmask)) {
unsigned j;

Expand Down Expand Up @@ -561,7 +566,7 @@ static adv_error joystickb_setup(struct joystick_item_context* item, int f)
}
}

/* sort the button in the listed order */
/* sort the button in the defined order */
qsort(item->button_map, item->button_mac, sizeof(item->button_map[0]), button_compare);
} else {
/* iterate only over recognized buttons */
Expand Down
197 changes: 0 additions & 197 deletions advance/linux/joverride.dat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* UDEV */
/* 8Bitdo 8Bitdo SF30 Wireless Controller */
{ 0x2dc8, 0x3001, "8Bitdo 8Bitdo SF30 Wireless Controller", 0, "a", JOYB_A },
{ 0x2dc8, 0x3001, "8Bitdo 8Bitdo SF30 Wireless Controller", 1, "b", JOYB_B },
Expand Down Expand Up @@ -1817,199 +1816,3 @@
{ 0x05ac, 0x033d, "xiaoji Gamesir-G3v 1.00", 10, "select", JOYB_SELECT },
{ 0x05ac, 0x033d, "xiaoji Gamesir-G3v 1.00", 11, "start", JOYB_START },

/* HID */
/* 8Bitdo SF30 Pro */
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 0, "a", JOYB_A },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 1, "b", JOYB_B },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 3, "x", JOYB_X },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 4, "y", JOYB_Y },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 6, "tl", JOYB_TL },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 7, "tr", JOYB_TR },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 8, "tl2", JOYB_TL2 },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 9, "tr2", JOYB_TR2 },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 10, "select", JOYB_SELECT },
{ 0x2dc8, 0x6000, "8Bitdo SF30 Pro", 11, "start", JOYB_START },
/* USB,2-axis 8-button gamepad */
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 0, "a", JOYB_A },
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 1, "b", JOYB_B },
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 2, "x", JOYB_X },
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 3, "y", JOYB_Y },
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 4, "tl", JOYB_TL },
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 5, "tr", JOYB_TR },
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 6, "select", JOYB_SELECT },
{ 0x0583, 0x2060, "USB,2-axis 8-button gamepad ", 7, "start", JOYB_START },
/* Generic NES USB Controller */
{ 0x0079, 0x0011, "Generic NES USB Controller", 8, "a", JOYB_A },
{ 0x0079, 0x0011, "Generic NES USB Controller", 0, "b", JOYB_B },
{ 0x0079, 0x0011, "Generic NES USB Controller", 2, "select", JOYB_SELECT },
{ 0x0079, 0x0011, "Generic NES USB Controller", 3, "start", JOYB_START },
{ 0x0079, 0x0011, "Generic NES USB Controller", 16, "mode", JOYB_MODE },
/* Generic SNES USB Controller */
{ 0x081f, 0xe401, "Generic SNES USB Controller", 8, "a", JOYB_A },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 0, "b", JOYB_B },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 9, "x", JOYB_X },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 1, "y", JOYB_Y },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 10, "tl", JOYB_TL },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 11, "tr", JOYB_TR },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 2, "select", JOYB_SELECT },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 3, "start", JOYB_START },
{ 0x081f, 0xe401, "Generic SNES USB Controller", 16, "mode", JOYB_MODE },
/* Logitech RumblePad 2 USB */
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 2, "a", JOYB_A },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 1, "b", JOYB_B },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 3, "x", JOYB_X },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 0, "y", JOYB_Y },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 4, "tl", JOYB_TL },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 5, "tr", JOYB_TR },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 6, "tl2", JOYB_TL2 },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 7, "tr2", JOYB_TR2 },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 8, "select", JOYB_SELECT },
{ 0x046d, 0xc218, "Logitech RumblePad 2 USB", 9, "start", JOYB_START },
/* Dual Box WII */
{ 0x1d79, 0x0301, "Dual Box WII", 2, "a", JOYB_A },
{ 0x1d79, 0x0301, "Dual Box WII", 3, "b", JOYB_B },
{ 0x1d79, 0x0301, "Dual Box WII", 1, "x", JOYB_X },
{ 0x1d79, 0x0301, "Dual Box WII", 4, "y", JOYB_Y },
{ 0x1d79, 0x0301, "Dual Box WII", 7, "tl", JOYB_TL },
{ 0x1d79, 0x0301, "Dual Box WII", 8, "tr", JOYB_TR },
{ 0x1d79, 0x0301, "Dual Box WII", 5, "tl2", JOYB_TL2 },
{ 0x1d79, 0x0301, "Dual Box WII", 6, "tr2", JOYB_TR2 },
{ 0x1d79, 0x0301, "Dual Box WII", 9, "select", JOYB_SELECT },
{ 0x1d79, 0x0301, "Dual Box WII", 10, "start", JOYB_START },
{ 0x1d79, 0x0301, "Dual Box WII", 11, "mode", JOYB_MODE },
/* Microsoft® SideWinder® Game Pad USB */
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 1, "a", JOYB_A },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 0, "b", JOYB_B },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 4, "x", JOYB_X },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 3, "y", JOYB_Y },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 5, "tl", JOYB_TL },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 2, "tr", JOYB_TR },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 6, "tl2", JOYB_TL2 },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 7, "tr2", JOYB_TR2 },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 9, "select", JOYB_SELECT },
{ 0x045e, 0x0007, "Microsoft® SideWinder® Game Pad USB", 8, "start", JOYB_START },
/* Nimbus */
{ 0x0111, 0x1420, "Nimbus", 1, "a", JOYB_A },
{ 0x0111, 0x1420, "Nimbus", 0, "b", JOYB_B },
{ 0x0111, 0x1420, "Nimbus", 3, "x", JOYB_X },
{ 0x0111, 0x1420, "Nimbus", 2, "y", JOYB_Y },
{ 0x0111, 0x1420, "Nimbus", 6, "tl2", JOYB_TL2 },
{ 0x0111, 0x1420, "Nimbus", 7, "tr2", JOYB_TR2 },
{ 0x0111, 0x1420, "Nimbus", 4, "select", JOYB_SELECT },
{ 0x0111, 0x1420, "Nimbus", 5, "start", JOYB_START },
/* Nintendo RVL-CNT-01 */
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 20, "a", JOYB_A },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 22, "b", JOYB_B },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 19, "x", JOYB_X },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 21, "y", JOYB_Y },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 29, "tl", JOYB_TL },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 25, "tr", JOYB_TR },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 23, "tl2", JOYB_TL2 },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 18, "tr2", JOYB_TR2 },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 28, "select", JOYB_SELECT },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 26, "start", JOYB_START },
{ 0x057e, 0x0330, "Nintendo RVL-CNT-01", 27, "mode", JOYB_MODE },
/* Wii U GC Controller Adapter */
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 8, "a", JOYB_A },
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 0, "b", JOYB_B },
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 9, "x", JOYB_X },
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 1, "y", JOYB_Y },
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 10, "tl", JOYB_TL },
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 11, "tr", JOYB_TR },
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 2, "select", JOYB_SELECT },
{ 0x057e, 0x0337, "Wii U GC Controller Adapter", 3, "start", JOYB_START },
/* POKKEN CONTROLLER */
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 2, "a", JOYB_A },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 1, "b", JOYB_B },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 3, "x", JOYB_X },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 0, "y", JOYB_Y },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 4, "tl", JOYB_TL },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 5, "tr", JOYB_TR },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 6, "tl2", JOYB_TL2 },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 7, "tr2", JOYB_TR2 },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 8, "select", JOYB_SELECT },
{ 0x0f0d, 0x0092, "POKKEN CONTROLLER", 9, "start", JOYB_START },
/* PS2/PSX Controller Adapter */
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 8, "a", JOYB_A },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 0, "b", JOYB_B },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 9, "x", JOYB_X },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 1, "y", JOYB_Y },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 10, "tl", JOYB_TL },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 11, "tr", JOYB_TR },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 12, "tl2", JOYB_TL2 },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 13, "tr2", JOYB_TR2 },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 2, "select", JOYB_SELECT },
{ 0x0810, 0x0001, "PS2/PSX Controller Adapter", 3, "start", JOYB_START },
/* PSX to PS3 Controller Adapter */
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 8, "a", JOYB_A },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 0, "b", JOYB_B },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 9, "x", JOYB_X },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 1, "y", JOYB_Y },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 10, "tl", JOYB_TL },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 11, "tr", JOYB_TR },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 12, "tl2", JOYB_TL2 },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 13, "tr2", JOYB_TR2 },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 2, "select", JOYB_SELECT },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 3, "start", JOYB_START },
{ 0x0810, 0x0003, "PSX to PS3 Controller Adapter", 16, "mode", JOYB_MODE },
/* Pro Controller */
{ 0x057e, 0x2009, "Pro Controller", 1, "a", JOYB_A },
{ 0x057e, 0x2009, "Pro Controller", 0, "b", JOYB_B },
{ 0x057e, 0x2009, "Pro Controller", 3, "x", JOYB_X },
{ 0x057e, 0x2009, "Pro Controller", 2, "y", JOYB_Y },
{ 0x057e, 0x2009, "Pro Controller", 4, "tl", JOYB_TL },
{ 0x057e, 0x2009, "Pro Controller", 5, "tr", JOYB_TR },
{ 0x057e, 0x2009, "Pro Controller", 6, "tl2", JOYB_TL2 },
{ 0x057e, 0x2009, "Pro Controller", 7, "tr2", JOYB_TR2 },
{ 0x057e, 0x2009, "Pro Controller", 8, "select", JOYB_SELECT },
{ 0x057e, 0x2009, "Pro Controller", 9, "start", JOYB_START },
/* RetroUSB Genesis Retroport */
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 3, "a", JOYB_A },
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 2, "b", JOYB_B },
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 6, "x", JOYB_X },
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 1, "y", JOYB_Y },
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 5, "tl", JOYB_TL },
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 7, "tr", JOYB_TR },
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 4, "select", JOYB_SELECT },
{ 0xf000, 0x0008, "RetroUSB Genesis Retroport", 0, "start", JOYB_START },
/* Retrolink Nintento 64 Classic USB */
{ 0x0079, 0x0006, "Retrolink Nintento 64 Classic USB", 6, "a", JOYB_A },
{ 0x0079, 0x0006, "Retrolink Nintento 64 Classic USB", 8, "b", JOYB_B },
{ 0x0079, 0x0006, "Retrolink Nintento 64 Classic USB", 4, "tl", JOYB_TL },
{ 0x0079, 0x0006, "Retrolink Nintento 64 Classic USB", 5, "tr", JOYB_TR },
{ 0x0079, 0x0006, "Retrolink Nintento 64 Classic USB", 7, "tl2", JOYB_TL2 },
{ 0x0079, 0x0006, "Retrolink Nintento 64 Classic USB", 9, "start", JOYB_START },
/* Wireless Controller */
{ 0x054c, 0x05c4, "Wireless Controller", 8, "a", JOYB_A },
{ 0x054c, 0x05c4, "Wireless Controller", 0, "b", JOYB_B },
{ 0x054c, 0x05c4, "Wireless Controller", 9, "x", JOYB_X },
{ 0x054c, 0x05c4, "Wireless Controller", 1, "y", JOYB_Y },
{ 0x054c, 0x05c4, "Wireless Controller", 10, "tl", JOYB_TL },
{ 0x054c, 0x05c4, "Wireless Controller", 11, "tr", JOYB_TR },
{ 0x054c, 0x05c4, "Wireless Controller", 12, "tl2", JOYB_TL2 },
{ 0x054c, 0x05c4, "Wireless Controller", 13, "tr2", JOYB_TR2 },
{ 0x054c, 0x05c4, "Wireless Controller", 2, "select", JOYB_SELECT },
{ 0x054c, 0x05c4, "Wireless Controller", 3, "start", JOYB_START },
{ 0x054c, 0x05c4, "Wireless Controller", 31, "mode", JOYB_MODE },
/* PLAYSTATION(R)3 Controller */
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 8, "a", JOYB_A },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 0, "b", JOYB_B },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 9, "x", JOYB_X },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 1, "y", JOYB_Y },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 10, "tl", JOYB_TL },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 11, "tr", JOYB_TR },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 12, "tl2", JOYB_TL2 },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 13, "tr2", JOYB_TR2 },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 2, "select", JOYB_SELECT },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 3, "start", JOYB_START },
{ 0x054c, 0x0268, "PLAYSTATION(R)3 Controller", 16, "mode", JOYB_MODE },
/* Xbox 360 Wireless Receiver */
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 1, "a", JOYB_A },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 0, "b", JOYB_B },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 3, "x", JOYB_X },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 2, "y", JOYB_Y },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 4, "tl", JOYB_TL },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 5, "tr", JOYB_TR },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 9, "select", JOYB_SELECT },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 8, "start", JOYB_START },
{ 0x045e, 0x028e, "Xbox 360 Wireless Receiver", 10, "mode", JOYB_MODE },
5 changes: 2 additions & 3 deletions advance/linux/joverride.python
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
#

#
# Convert files from:
# Convert files from libretro udev mapping:
#
# https://github.com/libretro/retroarch-joypad-autoconfig/udev
# https://github.com/libretro/retroarch-joypad-autoconfig/hid
# https://github.com/libretro/retroarch-joypad-autoconfig/tree/master/udev
#

import sys
Expand Down

0 comments on commit 342b25c

Please sign in to comment.