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 2036 Members - Latest Member: tyleryarnelli

June 18, 2013, 01:03:19 PM
  Show Posts
Pages: [1]
1  Super Meat Boy / Tech Support / Re: redefine gamepad buttons Linux 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.
2  Super Meat Boy / Tech Support / Re: redefine gamepad buttons Linux 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.

Pages: [1]
Theme orange-lt created by padexx