Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

27138 Posts in 1555 Topics- by 2037 Members - Latest Member: Porkley

June 19, 2013, 04:41:29 AM
Team Meat ForumsSuper Meat BoyTech Supportredefine gamepad buttons Linux
Pages: [1]
Print
Author Topic: redefine gamepad buttons Linux  (Read 4851 times)
Krux
Level 0

Posts: 5


View Profile
« on: June 10, 2012, 03:31:29 AM »

Hi, I am here because I would like to know how to change the gamepad button definitions in the Linux version. The options menu doesn't support any options to do that  . Can't believe nobody asked the exact same question yet, but my search was unsuccessful.

btw
"Looking for help for bugs that prevent me from playing, requires registration in the Forum"
"Registration in the Forum asks questions about the game which requires playing the game"
do you see the deadlock?
« Last Edit: June 11, 2012, 02:43:58 PM by Krux » Logged
Krux
Level 0

Posts: 5


View Profile
« Reply #1 on: June 12, 2012, 05:24:14 AM »

ok, I found a cfg file in the installation folder of super meat boy, but there were only two button definitions, special and jump. This is the button lookup table to play the game with a Dualshock2 controller.

Code:
ID  DS2       XB36 
 0  triangle  A
 1  circle    B
 2  cross     X
 3  square    Y
 4  L2        Left Shoulder Button
 5  R2        Right Shoulder Button
 6  L1        back
 7  R1        start
 8  SELECT    left stick button
 9  START     right stick button
10  L3
11  R3

a config file to redefine this mapping would help very much.
Logged
Krux
Level 0

Posts: 5


View Profile
« Reply #2 on: June 12, 2012, 01:42:24 PM »

finally I found out what to do

Code:
jscal -u 7,0,1,5,2,16,17,40,12,290,289,291,288,294,295,296,297,298,299,292,293 /dev/input/js0
export SDL_JOYSTICK_DEVICE=/dev/input/js0
/opt/supermeatboy/SuperMeatBoy

First line does a remapping of the buttons and axis so that it matches the button and axis definitions of an xb360 controller as good as possible. Btw 7 means 7 axis, followed by seven axis ids, then a 12 for twelve button ids. You can should change that if your controller is not a Sony Dualshock 2 controller with adapter.
Second line tells SDL (used by super meat boy) to use that device with that buttonmap for input (the default is somehow different).
third line starts the game.

If you are interested in developing your own buttonmap for other controllers, feel free to post them here. jstest is your friend.

Edit: jscal -q /dev/input/js0 shows your current button mapping. here "man jscal" is your friend.
« Last Edit: June 19, 2012, 08:38:23 AM by Krux » Logged
z2011
Fresh Meat

Posts: 1


View Profile
« Reply #3 on: June 18, 2012, 03:46:55 PM »

Thank you! You're awesome!!!

Logitech Dual Action
jscal -u 6,0,1,5,2,16,17,12,289,290,288,291,292,293,296,297,298,299,294,295 /dev/input/js0
Logged
Krux
Level 0

Posts: 5


View Profile
« Reply #4 on: June 22, 2012, 03:40:59 AM »

btw this also works in Bastion and all other games that use SDL to do input.
Logged
Massa
Fresh Meat

Posts: 1


View Profile
« Reply #5 on: July 27, 2012, 11:21:01 AM »

Just wanted to thank you for this thread, this helped me get my DualShock 3 working with Super Meat Boy on Linux.

I used the following line, I think it's mostly correct now.

Code:
jscal -u 27,0,1,2,5,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,19,302,301,303,300,292,293,294,295,296,299,298,297,291,289,288,290,720,721,722 /dev/input/js0

Also edited buttonmap.cfg, keeping "1" as the button for jump and changing it to "10" for special.

For the people setting up their own controllers: keep in mind the menus and actual game use different codes. It's a mess.
Logged
singupnow
Fresh Meat

Posts: 4


View Profile
« Reply #6 on: October 08, 2012, 12:19:12 AM »

I don't have a -u option to calibrate my dualshock 3 in jscal:
http://linux.die.net/man/1/jscal

And when I try -s instead of -u It says "wrong number of axis (27 insteaf of 16), then I replace the 27 by 16 but jscal doesn't understand the correction...

Anybody using the same jscal as me?
Logged
Krux
Level 0

Posts: 5


View Profile
« Reply #7 on: October 08, 2012, 11:33:21 AM »

looks like the only important parameters of jscal are missing in your version my manpage has two additional entries:
Code:
  -q             --print-mappings    Print the current axis and button
                                       mappings as a jscal command line
  -u <n_of_axes,axmap1,axmap2,...,
      n_of_buttons,btnmap1,btnmap2,
      ...>       --set-mappings      Sets axis and button mappings to the
                                        specified values
what OS(version) do you have?
Logged
singupnow
Fresh Meat

Posts: 4


View Profile
« Reply #8 on: October 10, 2012, 01:00:03 AM »

I'm on archlinux 64 bits...

With this package: https://aur.archlinux.org/packages.php?ID=6693 used maybe I can compile a newer version... or try this one:

https://aur.archlinux.org/packages.php?ID=60092

Which seems to have debian-based (so ubuntu) improvements...

I'll keep you posted...

Edit:

It works well with the Massa controls when plugged in USB with the other package, I will post the bluetooth setup if I find the good one, cause now I get:

jscal: joystick has 29 axes and not 27 as specified on command line
« Last Edit: October 10, 2012, 08:36:15 AM by singupnow » Logged
mikey
Fresh Meat

Posts: 2


View Profile
« Reply #9 on: December 13, 2012, 05:10:42 PM »

Just wanted to thank you for this thread, this helped me get my DualShock 3 working with Super Meat Boy on Linux.

I used the following line, I think it's mostly correct now.

Code:
jscal -u 27,0,1,2,5,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,19,302,301,303,300,292,293,294,295,296,299,298,297,291,289,288,290,720,721,722 /dev/input/js0

Also edited buttonmap.cfg, keeping "1" as the button for jump and changing it to "10" for special.

For the people setting up their own controllers: keep in mind the menus and actual game use different codes. It's a mess.

OK, so I've been trying to achieve what you've achieved in this thread here for my Sixaxis PS3 controller (Plugged in via USB).

I've made a note of what each axis number is and each button number is for my controller, but I'm unclear about how jcal maps them or what the mapping for an xbox 360 controller actually is. I'm hampered slightly by the fact "jcal -q /dev/input/js0" doesn't actually work for me:


jscal: error getting axis map: Success

Although the "-u" option appears to work.

Maybe someone here could explain how I can go about mapping the correct axes and buttons for SMB?


For reference these are my buttons:

0 = Select
1 = Click Left Stick
2 = Click Right Stick
3 = Start
4 = D-pad up
5 = D-pad right
6 = D-pad down
7 = D-pad left
8 = L2
9 = R2
10 = L1
11 = R1
12 = Triangle
13 = Circle
14 = X
15 = Square
16 = PS button
17 = ?
18 = ?

Axes:

0 = Left stick left and right
1 = Left stick up and down
2 = Right stick left and right
3 = Right stick up and down
4 = ?
5 = ?
6 = ?
7 = ?
8 = D-pad up
9 = D=pad right
10 = D-pad down
11 = ? (don't know why this one is missing but id never moved of 0)
12 = L2
13 = R2
14 = L1
15 = R1
16 = Triangle
17 = Circle
18 = X
19 = Square
20 = ?
21 = ?
22 = ?
23 = Motion Sensor min and max when right or left side edge points towards ceiling
24 = Motion Sensor min and max when handles point toward ceiling or floor
25 = Motion Sensor min and max when sat right way up or flat on face
26 = ?

All the ? marks did not budge during jstest no matter what buttons were pressed.

Logged
mikey
Fresh Meat

Posts: 2


View Profile
« Reply #10 on: December 14, 2012, 07:03:32 AM »

Well I've managed to map all the PS3 Sixaxes controller buttons and axes to match the XBox 360 equivalents exactly as you would expect based on their positions on the controller except for the D-pad for which it seems there is an insurmountable obstacle in that the D-pad on the XBox 360 controller has 2 axes X and Y whereas the Sixaxes has 4 up, down, left and right with each button's pressure acting as an axis.

Anyway this is what I figured out and how.

Based on this page: https://sites.google.com/site/gobusto/stuff

I figured out what buttons and axes the XBox 360 controller and the PS3 Controller have, combined with using "jstest /dev/input/js0" with the PS3 controller that I have:

PS3 Axes (27):
Code:
0 = Left stick X
1 = Left stick Y
2 = Right stick X
3 = Right stick Y
4 = ?
5 = ?
6 = ?
7 = ?
8 = D-pad up
9 = D-pad right
10 = D-pad down
11 = ? (does nothing but logically should be D-pad left)
12 = L2
13 = R2
14 = L1
15 = R1
16 = Triangle
17 = Circle
18 = X
19 = Square
20 = ?
21 = ?
22 = ?
23 = Motion Sensor min and max when right or left side edge points towards ceiling
24 = Motion Sensor min and max when handles point toward ceiling or floor
25 = Motion Sensor min and max when sat right way up or flat on face
26 = ?


PS3 Buttons (19):
Code:
0 = Select
1 = Left stick click
2 = Right stick click
3 = Start
4 = D-pad up
5 = D-pad right
6 = D-pad down
7 = D-pad left
8 = L2
9 = R2
10 = L1
11 = R1
12 = Triangle
13 = Circle
14 = X
15 = Square
16 = PS button
17 = ?
18 = ?

XBox 360 Axes (8):
Code:
0 = Left stick X
1 = Left stick Y
2 = Left trigger
3 = Right stick X
4 = Right stick Y
5 = Right trigger
6 = D-pad X
7 = D-pad Y

XBox 360 Buttons (11):
Code:
0 = A
1 = B
2 = X
3 = Y
4 = Left bumper
5 = Right bumper
6 = Start
7 = Xbox logo
8 = Left stick click
9 = Right stick click
10 = back

PS3 and XBox 360 axes equivalents (based on use and position on controller):
Code:
XBox          <==> PS3          
----------------------
Left stick X  <==> Left stick X  
Left stick Y  <==> Left stick Y  
Left trigger  <==> L2            
Right stick X <==> Right stick X
Right stick Y <==> Right stick Y
Right trigger <==> L2            
D-pad X       <==> ? (unable)
D-pad Y       <==> ? (unable)

PS3 and XBox 360 button equivalents (based on use and position on controller):
Code:
XBox              <==> PS3              
--------------------------
A                 <==> X                
B                 <==> Circle            
X                 <==> Square            
Y                 <==> Triangle          
L1                <==> Left bumper      
R1                <==> Right bumper      
Start             <==> Start            
XBox logo         <==> PS logo          
Left Stick click  <==> Left Stick click  
Right Stick click <==> Right Stick click
Back              <==> Select            

Resulting map of XBox 360 to PS3 Axes:
Code:
XBox ==> PS3          
------------
0    ==> 0
1    ==> 1
2    ==> 12
3    ==> 2
4    ==> 3
5    ==> 13
6    ==> ? (9 causes problems)
7    ==> ? (8 causes problems)

Resulting map of XBox 360 to PS3 Buttons:
Code:
XBox ==> PS3          
------------
0    ==> 14
1    ==> 13
2    ==> 15
3    ==> 12
4    ==> 10
5    ==> 11
6    ==> 3
7    ==> 16
8    ==> 1
9    ==> 2
10   ==> 0

Then I had to get the output of "jscal -q /dev/input/js0" which gives me my current mapping:

Code:
jscal -u 27,0,1,2,5,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,19,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,720,721,722 /dev/input/js0

And rearange it into axes and buttons. The 27 tells you that the subsequent 27 numbers are axes, and the first number after that - 19 - tells you that the following 19 numbers are buttons (I guessed that the postions corresponded to the button or axes numbers):

Code:
Button number: #  0 1 2 3 4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Button code:   27,0,1,2,5,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,

Axes number:   #  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18
Axes code:     19,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,720,721,722

Then I had to perform swaps like button 0 on the XBox needs to be the button 14 code for the PS3 so I would swap button code 0 for button code 50:

Code:
Button number: #  0  1 2 3 4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Button code:   27,50,1,2,5,40,41,42,43,44,45,46,47,48,49,0 ,51,52,53,54,55,56,57,58,59,60,61,62,

And make sure that the code I was swapping with was the code that had originally been in the position on the PS3 not the current one as after a few swaps that has probably changed.

Which eventually gave me for my controller:

Code:
Button number: #  0 1 2  3 4 5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Button code:   27,0,1,48,2,5,49,42,43,44,45,46,47,40,41,50,51,52,53,54,55,56,57,58,59,60,61,62,

Axes number:   #  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18
Axes code:     19,302,301,303,300,298,299,291,720,289,290,288,293,294,296,292,297,295,721,722

Which I recombined into a jscal command:

Code:
jscal -u 27,0,1,48,2,5,49,42,43,44,45,46,47,40,41,50,51,52,53,54,55,56,57,58,59,60,61,62,19,302,301,303,300,298,299,291,720,289,290,288,293,294,296,292,297,295,721,722 /dev/input/js0

Which seems to work for every XBox 360 button and axis except the D-pad, which would need some kind of patch for the dev input code for the kernel.
Logged
Tak
Fresh Meat

Posts: 2


View Profile
« Reply #11 on: December 27, 2012, 01:58:25 AM »

I confirm that this mapping works for me, except, as you noted, for the d-pad.
I was also able to get the d-pad working using xboxdrv with its bundled ps3 configuration.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by padexx