synthy10 / pifba

Automatically exported from code.google.com/p/pifba
0 stars 0 forks source link

DPAD HAT controls not working for ps3 controller #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the Pi's O/S?
Version B

Please provide any additional information below. Also attach the output.log
if you can.

Original issue reported on code.google.com by tekkenh...@hotmail.co.uk on 2 Jan 2014 at 7:11

GoogleCodeExporter commented 8 years ago
Hi! PS3 DPAD uses:

LEFT_1=7
RIGHT_1=5
UP_1=4
DOWN_1=6

I searched into the code and it seems that is not posible to map DPAD like 
this. Do you know a solution for this?

Thanks in advance!

Original comment by raulferr...@gmail.com on 7 Jan 2014 at 8:23

GoogleCodeExporter commented 8 years ago
Same issue here, would be nice to have this feature.

Thanks in advance!

Original comment by BarbuDre...@gmail.com on 3 Jul 2014 at 8:10

GoogleCodeExporter commented 8 years ago
To use joystick DPAD, you need to modify rpi/gp2xsdk.cpp and add the following 
lines in function pi_initialize_input:
...
pi_joy[LEFT_1] = get_integer_conf("Joystick", "LEFT_1", 31);
pi_joy[RIGHT_1] = get_integer_conf("Joystick", "RIGHT_1", 31);
pi_joy[UP_1] = get_integer_conf("Joystick", "UP_1", 31);
pi_joy[DOWN_1] = get_integer_conf("Joystick", "DOWN_1", 31);
pi_joy[LEFT_2] = get_integer_conf("Joystick", "LEFT_2", 31);
pi_joy[RIGHT_2] = get_integer_conf("Joystick", "RIGHT_2", 31);
pi_joy[UP_2] = get_integer_conf("Joystick", "UP_2", 31);
pi_joy[DOWN_2] = get_integer_conf("Joystick", "DOWN_2", 31);
----------

And the following lines in function pi_joystick_read:
1) Inside "if (which1 == 0) {":
  if (joy_buttons[0][pi_joy[LEFT_1]])   val |= GP2X_LEFT;
  if (joy_buttons[0][pi_joy[RIGHT_1]])  val |= GP2X_RIGHT;
  if (joy_buttons[0][pi_joy[UP_1]]) val |= GP2X_UP;
  if (joy_buttons[0][pi_joy[DOWN_1]])   val |= GP2X_DOWN;
2) Inside "} else {"
  if (joy_buttons[1][pi_joy[LEFT_2]])   val |= GP2X_LEFT;
  if (joy_buttons[1][pi_joy[RIGHT_2]])  val |= GP2X_RIGHT;
  if (joy_buttons[1][pi_joy[UP_2]]) val |= GP2X_UP;
  if (joy_buttons[1][pi_joy[DOWN_2]])   val |= GP2X_DOWN;

Also, in the config file fba2x.cfg, you must map inside [joystick] tag the 
following fields (example for PS3 controller), and the corresponding for player 
2:
LEFT_1=7
RIGHT_1=5
UP_1=4
DOWN_1=6

Original comment by luis.ose...@gmail.com on 25 Feb 2015 at 7:30