2020-09-20 14:40 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002651FSSCPuser interfacepublic2014-07-24 22:45
ReporterZekeSulastin 
Assigned Toniffiwan 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionwon't fix 
Platformx86_64OSLinuxOS VersionArch 2012-05-13
Product Version3.6.14 RC5 
Target VersionFixed in Version3.7.2 
Summary0002651: Limited to 32 joystick buttons by io/joy.h and controlsconfig/controlsconfigcommon.cpp
DescriptionFS2_Open is limited to 32 joystick buttons (and 6 axes). Although not much of an issue when a joystick profiler/keyboard emulator is available (i.e. in Windows), this can make advanced setups in the absence of such software (i.e. in Linux) problematic.

By my (probably incomplete) investigation, this is caused by two factors:
1) io/joy.h: #define JOY_NUM_BUTTONS 32
2) controlsconfig/controlsconfigcommon.cpp: char *Joy_button_text_language[] = { "Button 1", "Button 2," ... "Button 32", "Hat Up" ...}

Changing only 1) causes 3.6.14 RC6 to crash if the button is outside what's defined by 2) (Addl Info *1). r8781 mislabels the button (Button 37= , Button 38, 39, etc. = 1, 2, etc) but saves and uses the button correctly otherwise.

However, if you also add sufficient additional entries to 2) (i.e. add "Button 37", "Button 38", etc before the Hat entries), both 3.6.14 RC6 and r8781 work normally, showing the proper button on the mapping screen, using the proper button in flight, and not crashing. I have not tested whether the hat switch works normally with this addition - on my stick the POV hat, if not defined as more buttons, is axes 8 and 9, above the limit of 6 in 1) - but it looks like it should work (and treating the hat as buttons is trivial anyways). Attached is a simple patch that does exactly that and builds against both RC6 and r8781, bringing the total usable number of buttons to 98 (so that the 6xXX list of buttons in 2) still lines up :p)

A better solution would be to take SDL's reported number of buttons and axes then populate 1) and 2) based on that, but since I have no idea how to do that I'll just fix the symptom rather than the problem!
Steps To Reproduce1) Somehow get joystick device with > 32 buttons
2) Start FS2 and attempt to bind button 33+ to a function
3) Observe crashes/mislabeling
Additional Information*1:
ERROR: EINVAL: String error. Please Report.
Trying to put into 40 byte buffer:
(null)
File: controlconfig/controlsconfig.cpp
Line: 1504

*2:
Saitek X52 Pro w/ stickshift (https://github.com/petechap/stickshift) to add arbitrary shift and button/axis remap functionality
TagsNo tags attached.
Attached Files
  • patch file icon increase_joy_buttons_fixed.patch (5,792 bytes) 2012-05-14 06:32 -
    Index: code/controlconfig/controlsconfigcommon.cpp
    ===================================================================
    --- code/controlconfig/controlsconfigcommon.cpp	(revision 8781)
    +++ code/controlconfig/controlsconfigcommon.cpp	(working copy)
    @@ -233,12 +233,23 @@
     };
     
     char *Joy_button_text_german[] = {
    -	"Knopf 1",		"Knopf 2",		"Knopf 3",		"Knopf 4",		"Knopf 5",		"Knopf 6",
    -	"Knopf 7",		"Knopf 8",		"Knopf 9",		"Knopf 10",		"Knopf 11",		"Knopf 12",
    -	"Knopf 13",		"Knopf 14",		"Knopf 15",		"Knopf 16",		"Knopf 17",		"Knopf 18",
    -	"Knopf 19",		"Knopf 20",		"Knopf 21",		"Knopf 22",		"Knopf 23",		"Knopf 24",
    -	"Knopf 25",		"Knopf 26",		"Knopf 27",		"Knopf 28",		"Knopf 29",		"Knopf 30",
    -	"Knopf 31",		"Knopf 32",		"Hut Hinten",	"Hut Vorne",	"Hut Links",	"Hut Rechts"
    +	"Knopf 1",	"Knopf 2",	"Knopf 3",	"Knopf 4",	"Knopf 5",	"Knopf 6",
    +	"Knopf 7",	"Knopf 8",	"Knopf 9",	"Knopf 10",	"Knopf 11",	"Knopf 12",
    +	"Knopf 13",	"Knopf 14",	"Knopf 15",	"Knopf 16",	"Knopf 17",	"Knopf 18",
    +	"Knopf 19",	"Knopf 20",	"Knopf 21",	"Knopf 22",	"Knopf 23",	"Knopf 24",
    +	"Knopf 25",	"Knopf 26",	"Knopf 27",	"Knopf 28",	"Knopf 29",	"Knopf 30",
    +	"Knopf 31",	"Knopf 32",	"Knopf 33",	"Knopf 34",	"Knopf 35",	"Knopf 36",
    +	"Knopf 37",	"Knopf 38",	"Knopf 39",	"Knopf 40",	"Knopf 41",	"Knopf 42",
    +	"Knopf 43",	"Knopf 44",	"Knopf 45",	"Knopf 46",	"Knopf 47",	"Knopf 48",
    +	"Knopf 49",	"Knopf 50",	"Knopf 51",	"Knopf 52",	"Knopf 53",	"Knopf 54",
    +	"Knopf 55",	"Knopf 56",	"Knopf 57",	"Knopf 58",	"Knopf 59",	"Knopf 60",
    +	"Knopf 61",	"Knopf 62",	"Knopf 63",	"Knopf 64",	"Knopf 65",	"Knopf 66",
    +	"Knopf 67",	"Knopf 68",	"Knopf 69",	"Knopf 70",	"Knopf 71",	"Knopf 72",
    +	"Knopf 73",	"Knopf 74",	"Knopf 75",	"Knopf 76",	"Knopf 77",	"Knopf 78",
    +	"Knopf 79",	"Knopf 80",	"Knopf 81",	"Knopf 82",	"Knopf 83",	"Knopf 84",
    +	"Knopf 85",	"Knopf 86",	"Knopf 87",	"Knopf 88",	"Knopf 89",	"Knopf 90",
    +	"Knopf 91",	"Knopf 92",	"Knopf 93",	"Knopf 94",	"Knopf 95",	"Knopf 96",
    +	"Knopf 97",	"Knopf 98",	"Hut Hinten",	"Hut Vorne",	"Hut Links",	"Hut Rechts"
     };
     
     char *Scan_code_text_french[] = {
    @@ -285,11 +296,22 @@
     
     char *Joy_button_text_french[] = {
     	"Bouton 1",		"Bouton 2",		"Bouton 3",		"Bouton 4",		"Bouton 5",		"Bouton 6",
    -	"Bouton 7",		"Bouton 8",		"Bouton 9",		"Bouton 10",		"Bouton 11",		"Bouton 12",
    -	"Bouton 13",		"Bouton 14",		"Bouton 15",		"Bouton 16",		"Bouton 17",		"Bouton 18",
    -	"Bouton 19",		"Bouton 20",		"Bouton 21",		"Bouton 22",		"Bouton 23",		"Bouton 24",
    -	"Bouton 25",		"Bouton 26",		"Bouton 27",		"Bouton 28",		"Bouton 29",		"Bouton 30",
    -	"Bouton 31",		"Bouton 32",		"Chapeau Arriere",		"Chapeau Avant",		"Chapeau Gauche",		"Chapeau Droite"
    +	"Bouton 7",		"Bouton 8",		"Bouton 9",		"Bouton 10",	"Bouton 11",	"Bouton 12",
    +	"Bouton 13",	"Bouton 14",	"Bouton 15",	"Bouton 16",	"Bouton 17",	"Bouton 18",
    +	"Bouton 19",	"Bouton 20",	"Bouton 21",	"Bouton 22",	"Bouton 23",	"Bouton 24",
    +	"Bouton 25",	"Bouton 26",	"Bouton 27",	"Bouton 28",	"Bouton 29",	"Bouton 30",
    +	"Bouton 31",	"Bouton 32",	"Bouton 33",	"Bouton 34",	"Bouton 35",	"Bouton 36",
    +	"Bouton 37",	"Bouton 38",	"Bouton 39",	"Bouton 40",	"Bouton 41",	"Bouton 42",
    +	"Bouton 43",	"Bouton 44",	"Bouton 45",	"Bouton 46",	"Bouton 47",	"Bouton 48",
    +	"Bouton 49",	"Bouton 50",	"Bouton 51",	"Bouton 52",	"Bouton 53",	"Bouton 54",
    +	"Bouton 55",	"Bouton 56",	"Bouton 57",	"Bouton 58",	"Bouton 59",	"Bouton 60",
    +	"Bouton 61",	"Bouton 62",	"Bouton 63",	"Bouton 64",	"Bouton 65",	"Bouton 66",
    +	"Bouton 67",	"Bouton 68",	"Bouton 69",	"Bouton 70",	"Bouton 71",	"Bouton 72",
    +	"Bouton 73",	"Bouton 74",	"Bouton 75",	"Bouton 76",	"Bouton 77",	"Bouton 78",
    +	"Bouton 79",	"Bouton 80",	"Bouton 81",	"Bouton 82",	"Bouton 83",	"Bouton 84",
    +	"Bouton 85",	"Bouton 86",	"Bouton 87",	"Bouton 88",	"Bouton 89",	"Bouton 90",
    +	"Bouton 91",	"Bouton 92",	"Bouton 93",	"Bouton 94",	"Bouton 95",	"Bouton 96",
    +	"Bouton 97",	"Bouton 98",	"Chapeau Arriere",		"Chapeau Avant",		"Chapeau Gauche",		"Chapeau Droite"
     };
     
     //	This is the text that is displayed on the screen for the keys a player selects
    @@ -341,7 +363,18 @@
     	"Button 13",	"Button 14",	"Button 15",	"Button 16",	"Button 17",	"Button 18",
     	"Button 19",	"Button 20",	"Button 21",	"Button 22",	"Button 23",	"Button 24",
     	"Button 25",	"Button 26",	"Button 27",	"Button 28",	"Button 29",	"Button 30",
    -	"Button 31",	"Button 32",	"Hat Back",		"Hat Forward",	"Hat Left",		"Hat Right"
    +	"Button 31",	"Button 32",	"Button 33",	"Button 34",	"Button 35",	"Button 36",
    +	"Button 37",	"Button 38",	"Button 39",	"Button 40",	"Button 41",	"Button 42",
    +	"Button 43",	"Button 44",	"Button 45",	"Button 46",	"Button 47",	"Button 48",
    +	"Button 49",	"Button 50",	"Button 51",	"Button 52",	"Button 53",	"Button 54",
    +	"Button 55",	"Button 56",	"Button 57",	"Button 58",	"Button 59",	"Button 60",
    +	"Button 61",	"Button 62",	"Button 63",	"Button 64",	"Button 65",	"Button 66",
    +	"Button 67",	"Button 68",	"Button 69",	"Button 70",	"Button 71",	"Button 72",
    +	"Button 73",	"Button 74",	"Button 75",	"Button 76",	"Button 77",	"Button 78",
    +	"Button 79",	"Button 80",	"Button 81",	"Button 82",	"Button 83",	"Button 84",
    +	"Button 85",	"Button 86",	"Button 87",	"Button 88",	"Button 89",	"Button 90",
    +	"Button 91",	"Button 92",	"Button 93",	"Button 94",	"Button 95",	"Button 96",
    +	"Button 97",	"Button 98",	"Hat Back",		"Hat Forward",	"Hat Left",		"Hat Right"	
     };
     
     char **Scan_code_text = Scan_code_text_english;
    
    Index: code/io/joy.h
    ===================================================================
    --- code/io/joy.h	(revision 8781)
    +++ code/io/joy.h	(working copy)
    @@ -12,7 +12,7 @@
     #ifndef __JOY_H__
     #define __JOY_H__
     
    -#define JOY_NUM_BUTTONS		32
    +#define JOY_NUM_BUTTONS		98
     #define JOY_NUM_HAT_POS		4
     #define JOY_TOTAL_BUTTONS	(JOY_NUM_BUTTONS + JOY_NUM_HAT_POS)
     #define JOY_NUM_AXES			6
    
    patch file icon increase_joy_buttons_fixed.patch (5,792 bytes) 2012-05-14 06:32 +
  • patch file icon 2651.patch (5,300 bytes) 2014-07-17 20:54 -
    Index: code/controlconfig/controlsconfigcommon.cpp
    ===================================================================
    --- code/controlconfig/controlsconfigcommon.cpp	(revision 10922)
    +++ code/controlconfig/controlsconfigcommon.cpp	(working copy)
    @@ -242,7 +242,18 @@
     	"Knopf 13",		"Knopf 14",		"Knopf 15",		"Knopf 16",		"Knopf 17",		"Knopf 18",
     	"Knopf 19",		"Knopf 20",		"Knopf 21",		"Knopf 22",		"Knopf 23",		"Knopf 24",
     	"Knopf 25",		"Knopf 26",		"Knopf 27",		"Knopf 28",		"Knopf 29",		"Knopf 30",
    -	"Knopf 31",		"Knopf 32",		"Hut Hinten",	"Hut Vorne",	"Hut Links",	"Hut Rechts"
    +	"Knopf 31",		"Knopf 32",		"Knopf 33",		"Knopf 34",		"Knopf 35",		"Knopf 36",
    +	"Knopf 37",		"Knopf 38",		"Knopf 39",		"Knopf 40",		"Knopf 41",		"Knopf 42",
    +	"Knopf 43",		"Knopf 44",		"Knopf 45",		"Knopf 46",		"Knopf 47",		"Knopf 48",
    +	"Knopf 49",		"Knopf 50",		"Knopf 51",		"Knopf 52",		"Knopf 53",		"Knopf 54",
    +	"Knopf 55",		"Knopf 56",		"Knopf 57",		"Knopf 58",		"Knopf 59",		"Knopf 60",
    +	"Knopf 61",		"Knopf 62",		"Knopf 63",		"Knopf 64",		"Knopf 65",		"Knopf 66",
    +	"Knopf 67",		"Knopf 68",		"Knopf 69",		"Knopf 70",		"Knopf 71",		"Knopf 72",
    +	"Knopf 73",		"Knopf 74",		"Knopf 75",		"Knopf 76",		"Knopf 77",		"Knopf 78",
    +	"Knopf 79",		"Knopf 80",		"Knopf 81",		"Knopf 82",		"Knopf 83",		"Knopf 84",
    +	"Knopf 85",		"Knopf 86",		"Knopf 87",		"Knopf 88",		"Knopf 89",		"Knopf 90",
    +	"Knopf 91",		"Knopf 92",		"Knopf 93",		"Knopf 94",		"Knopf 95",		"Knopf 96",
    +	"Knopf 97",		"Knopf 98",		"Hut Hinten",	"Hut Vorne",	"Hut Links",	"Hut Rechts"
     };
     
     char *Scan_code_text_french[] = {
    @@ -289,11 +300,22 @@
     
     char *Joy_button_text_french[] = {
     	"Bouton 1",		"Bouton 2",		"Bouton 3",		"Bouton 4",		"Bouton 5",		"Bouton 6",
    -	"Bouton 7",		"Bouton 8",		"Bouton 9",		"Bouton 10",		"Bouton 11",		"Bouton 12",
    -	"Bouton 13",		"Bouton 14",		"Bouton 15",		"Bouton 16",		"Bouton 17",		"Bouton 18",
    -	"Bouton 19",		"Bouton 20",		"Bouton 21",		"Bouton 22",		"Bouton 23",		"Bouton 24",
    -	"Bouton 25",		"Bouton 26",		"Bouton 27",		"Bouton 28",		"Bouton 29",		"Bouton 30",
    -	"Bouton 31",		"Bouton 32",		"Chapeau Arri\x8Are",		"Chapeau Avant",		"Chapeau Gauche",		"Chapeau Droite"
    +	"Bouton 7",		"Bouton 8",		"Bouton 9",		"Bouton 10",	"Bouton 11",	"Bouton 12",
    +	"Bouton 13",	"Bouton 14",	"Bouton 15",	"Bouton 16",	"Bouton 17",	"Bouton 18",
    +	"Bouton 19",	"Bouton 20",	"Bouton 21",	"Bouton 22",	"Bouton 23",	"Bouton 24",
    +	"Bouton 25",	"Bouton 26",	"Bouton 27",	"Bouton 28",	"Bouton 29",	"Bouton 30",
    +	"Bouton 31",	"Bouton 32",	"Bouton 33",	"Bouton 34",	"Bouton 35",	"Bouton 36",
    +	"Bouton 37",	"Bouton 38",	"Bouton 39",	"Bouton 40",	"Bouton 41",	"Bouton 42",
    +	"Bouton 43",	"Bouton 44",	"Bouton 45",	"Bouton 46",	"Bouton 47",	"Bouton 48",
    +	"Bouton 49",	"Bouton 50",	"Bouton 51",	"Bouton 52",	"Bouton 53",	"Bouton 54",
    +	"Bouton 55",	"Bouton 56",	"Bouton 57",	"Bouton 58",	"Bouton 59",	"Bouton 60",
    +	"Bouton 61",	"Bouton 62",	"Bouton 63",	"Bouton 64",	"Bouton 65",	"Bouton 66",
    +	"Bouton 67",	"Bouton 68",	"Bouton 69",	"Bouton 70",	"Bouton 71",	"Bouton 72",
    +	"Bouton 73",	"Bouton 74",	"Bouton 75",	"Bouton 76",	"Bouton 77",	"Bouton 78",
    +	"Bouton 79",	"Bouton 80",	"Bouton 81",	"Bouton 82",	"Bouton 83",	"Bouton 84",
    +	"Bouton 85",	"Bouton 86",	"Bouton 87",	"Bouton 88",	"Bouton 89",	"Bouton 90",
    +	"Bouton 91",	"Bouton 92",	"Bouton 93",	"Bouton 94",	"Bouton 95",	"Bouton 96",
    +	"Bouton 97",	"Bouton 98",	"Chapeau Arri\x8Are",	"Chapeau Avant",	"Chapeau Gauche",	"Chapeau Droite"
     };
     
     //!	This is the text that is displayed on the screen for the keys a player selects
    @@ -345,7 +367,18 @@
     	"Button 13",	"Button 14",	"Button 15",	"Button 16",	"Button 17",	"Button 18",
     	"Button 19",	"Button 20",	"Button 21",	"Button 22",	"Button 23",	"Button 24",
     	"Button 25",	"Button 26",	"Button 27",	"Button 28",	"Button 29",	"Button 30",
    -	"Button 31",	"Button 32",	"Hat Back",		"Hat Forward",	"Hat Left",		"Hat Right"
    +	"Button 31",	"Button 32",	"Button 33",	"Button 34",	"Button 35",	"Button 36",
    +	"Button 37",	"Button 38",	"Button 39",	"Button 40",	"Button 41",	"Button 42",
    +	"Button 43",	"Button 44",	"Button 45",	"Button 46",	"Button 47",	"Button 48",
    +	"Button 49",	"Button 50",	"Button 51",	"Button 52",	"Button 53",	"Button 54",
    +	"Button 55",	"Button 56",	"Button 57",	"Button 58",	"Button 59",	"Button 60",
    +	"Button 61",	"Button 62",	"Button 63",	"Button 64",	"Button 65",	"Button 66",
    +	"Button 67",	"Button 68",	"Button 69",	"Button 70",	"Button 71",	"Button 72",
    +	"Button 73",	"Button 74",	"Button 75",	"Button 76",	"Button 77",	"Button 78",
    +	"Button 79",	"Button 80",	"Button 81",	"Button 82",	"Button 83",	"Button 84",
    +	"Button 85",	"Button 86",	"Button 87",	"Button 88",	"Button 89",	"Button 90",
    +	"Button 91",	"Button 92",	"Button 93",	"Button 94",	"Button 95",	"Button 96",
    +	"Button 97",	"Button 98",	"Hat Back",		"Hat Forward",	"Hat Left",		"Hat Right"
     };
     
     char **Scan_code_text = Scan_code_text_english;
    Index: code/io/joy.h
    ===================================================================
    --- code/io/joy.h	(revision 10922)
    +++ code/io/joy.h	(working copy)
    @@ -12,7 +12,7 @@
     #ifndef __JOY_H__
     #define __JOY_H__
     
    -#define JOY_NUM_BUTTONS		32
    +#define JOY_NUM_BUTTONS		98
     #define JOY_NUM_HAT_POS		4
     #define JOY_TOTAL_BUTTONS	(JOY_NUM_BUTTONS + JOY_NUM_HAT_POS)
     #define JOY_NUM_AXES			6
    
    patch file icon 2651.patch (5,300 bytes) 2014-07-17 20:54 +
  • patch file icon mantis2651-mk2.patch (6,793 bytes) 2014-07-21 05:25 -
    diff --git a/code/controlconfig/controlsconfigcommon.cpp b/code/controlconfig/controlsconfigcommon.cpp
    index 618de52..da45c10 100644
    --- a/code/controlconfig/controlsconfigcommon.cpp
    +++ b/code/controlconfig/controlsconfigcommon.cpp
    @@ -118,10 +118,10 @@ config_item Control_config[CCFG_MAX + 1] = {
     	{                           KEY_PADPLUS,		-1, COMPUTER_TAB,	true, "Increase View Distance", CC_TYPE_CONTINUOUS },
     	{                           KEY_PADMINUS,		-1, COMPUTER_TAB,	true, "Decrease View Distance", CC_TYPE_CONTINUOUS },
     	{                           KEY_PAD5,			-1, COMPUTER_TAB,	true, "Center View", CC_TYPE_CONTINUOUS },
    -	{							-1,					33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS },
    -	{							-1,					32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS },
    -	{							-1,					34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS },
    -	{							-1,					35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS },
    +	{							-1,					99, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS },
    +	{							-1,					98, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS },
    +	{							-1,					100, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS },
    +	{							-1,					101, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS },
     
     	{                           KEY_RAPOSTRO,		-1, COMPUTER_TAB,	true, "Cycle Radar Range" },
     	{                           KEY_C,				-1, COMPUTER_TAB, true, "Communications Menu" },
    @@ -242,7 +242,18 @@ char *Joy_button_text_german[] = {
     	"Knopf 13",		"Knopf 14",		"Knopf 15",		"Knopf 16",		"Knopf 17",		"Knopf 18",
     	"Knopf 19",		"Knopf 20",		"Knopf 21",		"Knopf 22",		"Knopf 23",		"Knopf 24",
     	"Knopf 25",		"Knopf 26",		"Knopf 27",		"Knopf 28",		"Knopf 29",		"Knopf 30",
    -	"Knopf 31",		"Knopf 32",		"Hut Hinten",	"Hut Vorne",	"Hut Links",	"Hut Rechts"
    +	"Knopf 31",		"Knopf 32",		"Knopf 33",		"Knopf 34",		"Knopf 35",		"Knopf 36",
    +	"Knopf 37",		"Knopf 38",		"Knopf 39",		"Knopf 40",		"Knopf 41",		"Knopf 42",
    +	"Knopf 43",		"Knopf 44",		"Knopf 45",		"Knopf 46",		"Knopf 47",		"Knopf 48",
    +	"Knopf 49",		"Knopf 50",		"Knopf 51",		"Knopf 52",		"Knopf 53",		"Knopf 54",
    +	"Knopf 55",		"Knopf 56",		"Knopf 57",		"Knopf 58",		"Knopf 59",		"Knopf 60",
    +	"Knopf 61",		"Knopf 62",		"Knopf 63",		"Knopf 64",		"Knopf 65",		"Knopf 66",
    +	"Knopf 67",		"Knopf 68",		"Knopf 69",		"Knopf 70",		"Knopf 71",		"Knopf 72",
    +	"Knopf 73",		"Knopf 74",		"Knopf 75",		"Knopf 76",		"Knopf 77",		"Knopf 78",
    +	"Knopf 79",		"Knopf 80",		"Knopf 81",		"Knopf 82",		"Knopf 83",		"Knopf 84",
    +	"Knopf 85",		"Knopf 86",		"Knopf 87",		"Knopf 88",		"Knopf 89",		"Knopf 90",
    +	"Knopf 91",		"Knopf 92",		"Knopf 93",		"Knopf 94",		"Knopf 95",		"Knopf 96",
    +	"Knopf 97",		"Knopf 98",		"Hut Hinten",	"Hut Vorne",	"Hut Links",	"Hut Rechts"
     };
     
     char *Scan_code_text_french[] = {
    @@ -289,11 +300,22 @@ char *Scan_code_text_french[] = {
     
     char *Joy_button_text_french[] = {
     	"Bouton 1",		"Bouton 2",		"Bouton 3",		"Bouton 4",		"Bouton 5",		"Bouton 6",
    -	"Bouton 7",		"Bouton 8",		"Bouton 9",		"Bouton 10",		"Bouton 11",		"Bouton 12",
    -	"Bouton 13",		"Bouton 14",		"Bouton 15",		"Bouton 16",		"Bouton 17",		"Bouton 18",
    -	"Bouton 19",		"Bouton 20",		"Bouton 21",		"Bouton 22",		"Bouton 23",		"Bouton 24",
    -	"Bouton 25",		"Bouton 26",		"Bouton 27",		"Bouton 28",		"Bouton 29",		"Bouton 30",
    -	"Bouton 31",		"Bouton 32",		"Chapeau Arri\x8Are",		"Chapeau Avant",		"Chapeau Gauche",		"Chapeau Droite"
    +	"Bouton 7",		"Bouton 8",		"Bouton 9",		"Bouton 10",	"Bouton 11",	"Bouton 12",
    +	"Bouton 13",	"Bouton 14",	"Bouton 15",	"Bouton 16",	"Bouton 17",	"Bouton 18",
    +	"Bouton 19",	"Bouton 20",	"Bouton 21",	"Bouton 22",	"Bouton 23",	"Bouton 24",
    +	"Bouton 25",	"Bouton 26",	"Bouton 27",	"Bouton 28",	"Bouton 29",	"Bouton 30",
    +	"Bouton 31",	"Bouton 32",	"Bouton 33",	"Bouton 34",	"Bouton 35",	"Bouton 36",
    +	"Bouton 37",	"Bouton 38",	"Bouton 39",	"Bouton 40",	"Bouton 41",	"Bouton 42",
    +	"Bouton 43",	"Bouton 44",	"Bouton 45",	"Bouton 46",	"Bouton 47",	"Bouton 48",
    +	"Bouton 49",	"Bouton 50",	"Bouton 51",	"Bouton 52",	"Bouton 53",	"Bouton 54",
    +	"Bouton 55",	"Bouton 56",	"Bouton 57",	"Bouton 58",	"Bouton 59",	"Bouton 60",
    +	"Bouton 61",	"Bouton 62",	"Bouton 63",	"Bouton 64",	"Bouton 65",	"Bouton 66",
    +	"Bouton 67",	"Bouton 68",	"Bouton 69",	"Bouton 70",	"Bouton 71",	"Bouton 72",
    +	"Bouton 73",	"Bouton 74",	"Bouton 75",	"Bouton 76",	"Bouton 77",	"Bouton 78",
    +	"Bouton 79",	"Bouton 80",	"Bouton 81",	"Bouton 82",	"Bouton 83",	"Bouton 84",
    +	"Bouton 85",	"Bouton 86",	"Bouton 87",	"Bouton 88",	"Bouton 89",	"Bouton 90",
    +	"Bouton 91",	"Bouton 92",	"Bouton 93",	"Bouton 94",	"Bouton 95",	"Bouton 96",
    +	"Bouton 97",	"Bouton 98",	"Chapeau Arri\x8Are",	"Chapeau Avant",	"Chapeau Gauche",	"Chapeau Droite"
     };
     
     //!	This is the text that is displayed on the screen for the keys a player selects
    @@ -345,7 +367,18 @@ char *Joy_button_text_english[] = {
     	"Button 13",	"Button 14",	"Button 15",	"Button 16",	"Button 17",	"Button 18",
     	"Button 19",	"Button 20",	"Button 21",	"Button 22",	"Button 23",	"Button 24",
     	"Button 25",	"Button 26",	"Button 27",	"Button 28",	"Button 29",	"Button 30",
    -	"Button 31",	"Button 32",	"Hat Back",		"Hat Forward",	"Hat Left",		"Hat Right"
    +	"Button 31",	"Button 32",	"Button 33",	"Button 34",	"Button 35",	"Button 36",
    +	"Button 37",	"Button 38",	"Button 39",	"Button 40",	"Button 41",	"Button 42",
    +	"Button 43",	"Button 44",	"Button 45",	"Button 46",	"Button 47",	"Button 48",
    +	"Button 49",	"Button 50",	"Button 51",	"Button 52",	"Button 53",	"Button 54",
    +	"Button 55",	"Button 56",	"Button 57",	"Button 58",	"Button 59",	"Button 60",
    +	"Button 61",	"Button 62",	"Button 63",	"Button 64",	"Button 65",	"Button 66",
    +	"Button 67",	"Button 68",	"Button 69",	"Button 70",	"Button 71",	"Button 72",
    +	"Button 73",	"Button 74",	"Button 75",	"Button 76",	"Button 77",	"Button 78",
    +	"Button 79",	"Button 80",	"Button 81",	"Button 82",	"Button 83",	"Button 84",
    +	"Button 85",	"Button 86",	"Button 87",	"Button 88",	"Button 89",	"Button 90",
    +	"Button 91",	"Button 92",	"Button 93",	"Button 94",	"Button 95",	"Button 96",
    +	"Button 97",	"Button 98",	"Hat Back",		"Hat Forward",	"Hat Left",		"Hat Right"
     };
     
     char **Scan_code_text = Scan_code_text_english;
    @@ -862,4 +895,4 @@ void control_config_common_load_overrides()
     	if (Control_config_presets.size() > 0) {
     		std::copy(Control_config_presets[0], Control_config_presets[0] + CCFG_MAX + 1, Control_config);
     	}
    -}
    \ No newline at end of file
    +}
    diff --git a/code/io/joy.h b/code/io/joy.h
    index bcba33c..675cf00 100644
    --- a/code/io/joy.h
    +++ b/code/io/joy.h
    @@ -12,7 +12,7 @@
     #ifndef __JOY_H__
     #define __JOY_H__
     
    -#define JOY_NUM_BUTTONS		32
    +#define JOY_NUM_BUTTONS		98
     #define JOY_NUM_HAT_POS		4
     #define JOY_TOTAL_BUTTONS	(JOY_NUM_BUTTONS + JOY_NUM_HAT_POS)
     #define JOY_NUM_AXES			6
    
    patch file icon mantis2651-mk2.patch (6,793 bytes) 2014-07-21 05:25 +

-Relationships
+Relationships

-Notes

~0013558

ZekeSulastin (reporter)

Last edited: 2012-05-14 06:34

View 3 revisions

I am bad and should feel bad.

When making the simple patch, I edited and tested the files in RC6 first before copying and testing them in svn trunk. Unfortunately, there was a line (std::...) in the RC that was changed in trunk, and because I was bad I let that become part of the patch. It didn't impact apparent functionality (but does probably explain why RC6 crashed and r8781 mislabeled), aiding its unnoticability.

Attached is a fixed patch and my apologies for being bad.

(Also, thank you ni1s from #scp, for helping start this whole report :)

~0013559

CommanderDJ (developer)

Old patch removed to avoid confusion.

~0013631

z64555 (developer)

Maybe?
 string Joy_button_text_language[button_number] = "Button " + button_number;

I don't like how the hat is grouped together with the buttons, though.

~0013635

Mastadon (reporter)

How many buttons does your joystick have?!

In all seriousness though, why would you or anyone else need 32 joystick button bindings?

~0013636

ZekeSulastin (reporter)

Last edited: 2012-06-07 14:08

View 2 revisions

I briefly explained it in the start of the description; overlong version to follow:

Because joystick profiling software and specialized drivers for button-laden sticks like the Saitek x52 Pro HOTAS generally don't exist for Linux: there's only the generic HID driver available, and while it does see everything on the stick that everything includes 11 axes (joystick, twist, throttle, one of the hats, the slider, the three knobs, and the little mouse-stick thingy) and 39 buttons (buttons, toggles, the other two hats, the scrollwheels, and the mode selector). Indeed, the Windows driver doesn't actually see all of these as separate mappable buttons.

To be honest, if all you want is a basic config that still isn't too much of an issue - a lot of the extra stuff is stuff that wouldn't be used much in FS (like the mousewheels). However, if you want to do fancy profiler stuff (i.e. a shift-function button that changes what all the others do while held, mapping axes to commands, etc), things become more difficult. For instance, I have the mouse-stick on the throttle mapped to weapon selection unshifted and power distribution shifted, one stick hat as shield distro unshifted and basic comms shifted, the other as two different types of targeting, etc. As there's no profiler for Linux to do shifts or map buttons to keyboard keys, things become a bit more ... complicated.

The solution I found was a little program written by an X-Plane fan called stickshift (https://github.com/petechap/stickshift). This program implements the remap, shift, and mode elements of the Windows profiler by letting you map axes to buttons and define arbitrary shift states; you can look at his example .xml config to see how fine-grained you can get the control. To accomplish this, his program takes input from the real joystick, interprets it, then outputs final commands to a virtual joystick device. After remapping and adding shift-states from my config, FreeSpace2 sees 7 axes (of which only 4 are needed - the little knobs aren't that useful :p) and 61 buttons.

Thankfully, FS2 already works with maor butanz - all that "patch" does is add labels for a lot more. The whole process isn't that pretty, but in the end supporting HOTAS and such are always "hacky" - in both Windows and Linux you're essentially adding a virtual input device; they just happen to work differently.

~0016089

MageKing17 (developer)

I've uploaded a patch that applies this to current trunk. Is there any reason to leave this issue open, instead of either committing the patch or closing it in expectation of antipodes solving the problem?

~0016106

niffiwan (developer)

Commit now should be fine, I'll do that tonight or tomorrow night.

~0016112

niffiwan (developer)

Hmmm - just noticed that the patch changes the hat "button" indexes but doesn't update the defaults hat mapping. Patch attached that does that. When this is committed there should also be a post on the forum explaining the change, because any existing pilots that use the hat will need to rebind their controls.

~0016118

niffiwan (developer)

Fix committed to trunk@10933.

~0016120

Goober5000 (administrator)

Reopening because that hat remapping issue needs a bit more than a forum post.

~0016130

Goober5000 (administrator)

Closing as WONTFIX since this will be overcome by events once the new SDL code is completed.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2012-05-14 06:11 ZekeSulastin New Issue
2012-05-14 06:11 ZekeSulastin File Added: increase_joy_buttons.patch
2012-05-14 06:32 ZekeSulastin Note Added: 0013558
2012-05-14 06:32 ZekeSulastin File Added: increase_joy_buttons_fixed.patch
2012-05-14 06:33 ZekeSulastin Note Edited: 0013558 View Revisions
2012-05-14 06:34 ZekeSulastin Note Edited: 0013558 View Revisions
2012-05-15 03:29 CommanderDJ File Deleted: increase_joy_buttons.patch
2012-05-15 03:29 CommanderDJ Note Added: 0013559
2012-06-03 00:24 z64555 Note Added: 0013631
2012-06-07 12:19 Mastadon Note Added: 0013635
2012-06-07 14:07 ZekeSulastin Note Added: 0013636
2012-06-07 14:08 ZekeSulastin Note Edited: 0013636 View Revisions
2012-12-11 09:01 Echelon9 Status new => code review
2014-07-17 20:54 MageKing17 File Added: 2651.patch
2014-07-17 20:55 MageKing17 Note Added: 0016089
2014-07-20 17:50 niffiwan Note Added: 0016106
2014-07-21 05:25 niffiwan Note Added: 0016112
2014-07-21 05:25 niffiwan File Added: mantis2651-mk2.patch
2014-07-23 06:33 niffiwan Changeset attached => fs2open trunk r10933
2014-07-23 06:33 niffiwan Note Added: 0016118
2014-07-23 06:33 niffiwan Status code review => resolved
2014-07-23 06:33 niffiwan Resolution open => fixed
2014-07-23 20:50 Goober5000 Note Added: 0016120
2014-07-23 20:50 Goober5000 Assigned To => niffiwan
2014-07-23 20:50 Goober5000 Status resolved => code review
2014-07-23 20:50 Goober5000 Resolution fixed => reopened
2014-07-24 22:42 Goober5000 Changeset attached => fs2open trunk r10937
2014-07-24 22:45 Goober5000 Note Added: 0016130
2014-07-24 22:45 Goober5000 Status code review => closed
2014-07-24 22:45 Goober5000 Resolution reopened => won't fix
2014-07-24 22:45 Goober5000 Fixed in Version => 3.7.2
+Issue History