Dualshock 3 in UAE4All
The keycodes in UAE4All (a Commodore Amiga emulator) on Retropie are hardcoded, so I recompiled it to use my Dualshock 3. Here is how it works. Initially posted by me in the retropie forum.
Description
You have to:
- ssh into your pi box
- checkout the sourcecode for uae4all
- find and change the file with the controller configuration
- recompile the sources
- copy the compiled binary over to where retropie expects it
What will you change:
- configure a deadzone for the analog stick to prevent unwanted movement to one direction
- enable the dpad on PS3 Dualshock 3 and Sixaxis controllers
- enable the X Button as primary fire button on PS3 Dualshock 3 and Sixaxis controllers
CLI history
- cd ~/RetroPie-Setup/
- sudo ./retropie_packages.sh uae4all sources
- cd tmp/build/uae4all/src
- sudo nano od-joy.cpp (see changes below)
- cd ~/RetroPie-Setup/
- sudo ./retropie_packages.sh uae4all build
- quit running uae4all
- sudo mv /opt/retropie/emulators/uae4all/uae4all /opt/retropie/emulators/uae4all/uae4all-old
- sudo cp tmp/build/uae4all/uae4all /opt/retropie/emulators/uae4all/
- start uae4all
Changes in file od-joy.cpp
Step 1
remove the following lines completely (around line 40)
extern int dpadUp;
extern int dpadDown;
extern int dpadLeft;
extern int dpadRight;
extern int buttonX;
Step 2
add
int buttonX;
int dpadUp, dpadDown, dpadLeft, dpadRight;
right before statement
SDL_Joystick *joy = nr == 0 ? uae4all_joy0 : uae4all_joy1;
Step 3
add
buttonX = SDL_JoystickGetButton(joy, 14);
dpadUp = SDL_JoystickGetButton(joy, 4);
dpadDown = SDL_JoystickGetButton(joy, 6);
dpadLeft = SDL_JoystickGetButton(joy, 7);
dpadRight = SDL_JoystickGetButton(joy, 5);
right after statement
SDL_JoystickUpdate ();
Step 4
Find this block (around Line 150)
if (dpadRight || SDL_JoystickGetAxis(joy, 0) > 0) right=1;
if (dpadLeft || SDL_JoystickGetAxis(joy, 0) < 0) left=1;
if (dpadUp || SDL_JoystickGetAxis(joy, 1) < 0) top=1;
if (dpadDown || SDL_JoystickGetAxis(joy, 1) > 0) bot=1;
and change it to
if (dpadRight || SDL_JoystickGetAxis(joy, 0) > 8192) right=1;
if (dpadLeft || SDL_JoystickGetAxis(joy, 0) < -8192) left=1;
if (dpadUp || SDL_JoystickGetAxis(joy, 1) < -8192) top=1;
if (dpadDown || SDL_JoystickGetAxis(joy, 1) > 8192) bot=1;