xboxdrv dpad-as-axis: is it possible? (ps3 controller + intellivision)
-
Hi all,
I've been trying to write an xboxdrv configuration to make my DualShock3 controller work for intellivision games using jzintv. It's so close to perfect, but I cannot figure out how to map the D-PAD correctly.
Pi Model: 4b 2GB ram
Power supply: Official 5.1v 3A
RetroPie Version: official image: retropie-buster-4.7.1-rpi4_400.img
Emulator: jzintvAfter sleuthing these forums for awhile, I found a good controller setup for using Playstation controllers with Intellivision, thanks to Dudleydes. He was able to have the right analog stick send the numeric keypresses 1-9, left stick handle the direction disc, and the d-pad also handle the direction disc.
The core of this comes from the xboxdrv config section (swapping d-pad/right analog):
[evdev-absmap]
ABS_X = x1
ABS_Y = y1
ABS_Z = DPAD_X
ABS_RZ = DPAD_Y
ABS_HAT0X = x2
ABS_HAT0Y = y2(There is something about the right analog stick sending xbox d-pad codes to jzintv that allows it to work with the numeric key presses. When trying to use the xbox's analog x2/y2 it will not work. I suspect because it just outputs a series of directional "down" presses instead of the "up"/"down" presses you get with the DPAD_X/DPAD_Y (HAT).)
This works perfectly when I use my PS4 controller, however the PS3 controller does not output ABS_HAT0X / ABS_HAT0Y. It outputs BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT.
For the life of me I cannot figure out how to map these 4 discrete directional buttons to the xbox's 2nd analog stick (x2/y2). As I am using all of the other available buttons that the xbox controller can output (Start, Guide, Back, A, B, X, Y, LB, RB, LT, RT, TL, TR, DU, DD, DL, DR), I have nothing else to map to. I can't map to DU, DD, DL, DR since jzintv will be mapping d-pad (Hat) inputs to the 1-9 keypad.
Is there any way to map BTN_DPAD_UP to axismap? I tried the following, but it doesn't work.
[evdev-absmap]
BTN_DPAD_UP -= y2
BTN_DPAD_DOWN += y2I have read the xboxdrv man page (3 times):
man xboxdrv
The docs for mapping an intellivision controller:
Mapping a Controller for Intellivision
The docs for Universal mapping with xboxdrv:
Universal Controller Calibration & Mapping Using xboxdrvAt this point, it would be smarter to just buy another PS4 controller and call it a day, but I've been wracking my brain over this for days and am fixated on figuring it out. It HAS to be possible. I don't really understand it all well enough, particularly how UI-AXISMAP, UI-BUTTONMAP, EV_REL work.
If I could just make the D-pad send 4 distinct codes, I could map them appropriately in jzintv, but there are no xbox buttons left to map to. Is it possible to send keyboard keys when using the d-pad? I noticed that jzintv recognizes when I press stuff on my keyboard, and maybe I could bind to those.
I know that xboxdrv is powerful enough to handle this, I just cannot figure out how; have been completely stuck. Here is what I have so far, and it works perfectly, except the d-pad doesn't do anything since there is no mapping.
xboxdrv config:
[xboxdrv] evdev = /dev/input/event1 silent = true detach-kernel-driver = true deadzone-trigger = 15% deadzone = 4000 mimic-xpad = true trigger-as-button = true #dpad-as-button=true [evdev-absmap] ABS_X = x1 ABS_Y = y1 ABS_RX = DPAD_X ABS_RY = DPAD_Y [evdev-keymap] #BTN_DPAD_DOWN = DD #BTN_DPAD_UP = DU #BTN_DPAD_LEFT = DL #BTN_DPAD_RIGHT = DR BTN_SOUTH = a BTN_EAST = b BTN_WEST = x BTN_NORTH = y BTN_TL = lb BTN_TR = rb BTN_TL2 = lt BTN_TR2 = rt BTN_THUMBL = tl BTN_THUMBR = tr BTN_SELECT = back BTN_MODE = guide BTN_START = start [axismap] -y1 = y1 -y2 = y2 [calibration] x1 = -32767:0:32767 y1 = -32767:0:32767 x2 = -32767:0:32767 y2 = -32767:0:32767
jzintv 'hackfile':
MAP 0 ; Game interface ADD_COMBO 2 JS1_BTN_08 JS1_BTN_09 COMBO2 QUIT ; Select + Start JS1_BTN_10 RESET ; PS button JS1_BTN_09 PAUSE ; Start ; Keypad JS1_BTN_04 PD0L_KPC ; Clear key mapped to L1 JS1_BTN_05 PD0L_KPE ; Enter key mapped to R1 JS1_BTN_03 PD0L_KP0 ; Key 0 mapped to Triangle JS1_BTN_06 PD0L_KP0 ; Key 0 also mapped to L2 JS1_BTN_11 PD0L_KP0 ; left analog stick btn press also 0 JS1_BTN_07 PD0L_KP5 ; Key 5 R2 JS1_BTN_12 PD0L_KP5 ; right analog stick btn press also 5 JS1_BTN_00 PD0L_A_T ; Top Action button mapped to Cross JS1_BTN_02 PD0L_A_L ; Bottom left Action button mapped to Square JS1_BTN_01 PD0L_A_R ; Bottom Right Action button mapped to Circle ; Hat / D-Pad (Right analog stick because xboxdrv) ; Keypad 1 to 9 (except 5) JS1_HAT0_NW PD0L_KP1 JS1_HAT0_N PD0L_KP2 JS1_HAT0_NE PD0L_KP3 JS1_HAT0_W PD0L_KP4 JS1_HAT0_E PD0L_KP6 JS1_HAT0_SW PD0L_KP7 JS1_HAT0_S PD0L_KP8 JS1_HAT0_SE PD0L_KP9 ; Left analog stick mapped to Direction Disc JS1A_E PD0L_J_E JS1A_ENE PD0L_J_ENE JS1A_NE PD0L_J_NE JS1A_NNE PD0L_J_NNE JS1A_N PD0L_J_N JS1A_NNW PD0L_J_NNW JS1A_NW PD0L_J_NW JS1A_WNW PD0L_J_WNW JS1A_W PD0L_J_W JS1A_WSW PD0L_J_WSW JS1A_SW PD0L_J_SW JS1A_SSW PD0L_J_SSW JS1A_S PD0L_J_S JS1A_SSE PD0L_J_SSE JS1A_SE PD0L_J_SE JS1A_ESE PD0L_J_ESE ; D-pad also mapped to Direction Disc ;?? PD0L_J_N ;?? PD0L_J_E ;?? PD0L_J_S ;?? PD0L_J_W
Any help would be greatly appreciate so I can sleep at night again :)
-
@mustangfanatic01 said in xboxdrv dpad-as-axis: is it possible? (ps3 controller + intellivision):
BTN_DPAD
Same problem. I was trying to follow this guide:
https://gist.github.com/dudleydes/dae86816bcc504ff6ee8e0451e09ef36But my PS3 controller does not have any Hat, the dpad outputs BTN_DPAD_[.] for everything. I don't know how to map those to the xbox specs, because the file will throw an error if I try to set the BTN_DPAD_[whatever] to an axis. Trying the du/dl/dd/dr solution doesn't work for me either.
@dudleydes any thoughts? I think this was your solution...it seems like not all PS3 controllers are created equally?
Another thing I just don't get about this process is that there seem to be three different ways of reading the controller inputs that give me three different sets of names. event_diag for the intellivison games I want to remap, evtest for xboxdrv, and jstest. I wish I knew how these all connected, other than the apparent need to use xboxdrv to make event_diag recognize certain things in my PS3 controller.
I also know that my PS3 controller shows nothing for any buttons in event_diag, no matter what I seem to do -- only the axes show up. My other controller buttons (buffalo and arcade) show up fine in there.
TLDR:
- I mapping BTN_DPAD_[.] to dl/du/dr/dd doesn't work -- none of them register in event_diag, none of them work in Tron Deadly Discs.
- if we can get them to work, how would we swap them with the RX/RY axis the way you do with hat PS3 controllers?
-
Okay, I may have fixed the issue by doing a full RetroPie update from source. Now I can see the button presses! Of course, my intellivision screen looks tiny now even with the smallest resolution....
-
I had that weird resolution issue also. I "fixed" it by manually specifying the resolution for anything that wasn't the default jzintv (which seems to auto-find the resolution just fine)
This is my emulators.cfg (non-default jzintv gets a tiny/weird screen resolution for some reason. So we have to specify it manually in that case. This will obviously cause issues if it doesn't match (particularly if exceeds) the tv/screen):
lr-freeintv = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-freeintv/freeintv_libretro.so --config /opt/retropie/configs/intellivision/retroarch.cfg %ROM%"
default = "jzintv"
jzintv = "/opt/retropie/emulators/jzintv/bin/jzintv -p /home/pi/RetroPie/BIOS -q --kbdhackfile=/home/pi/RetroPie/roms/intellivision/tron.kbd -f1 %ROM%;"
jzintv-std = "/opt/retropie/emulators/jzintv/bin/jzintv -p /home/pi/RetroPie/BIOS -q --kbdhackfile=/home/pi/RetroPie/roms/intellivision/hackfile.kbd -z1280x720 -f1 %ROM%;"
jzintv-alt = "/opt/retropie/emulators/jzintv/bin/jzintv -p /home/pi/RetroPie/BIOS -q --kbdhackfile=/home/pi/RetroPie/roms/intellivision/hackfile-alt.kbd -z1280x720 -f1 %ROM%;" -
@mustangfanatic01 said in xboxdrv dpad-as-axis: is it possible? (ps3 controller + intellivision):
This is my emulators.cfg (non-default jzintv gets a tiny/weird screen resolution for some reason. So we have to specify it manually in that case. This will obviously cause issues if it doesn't match (particularly if exceeds) the tv/screen):
You're not running the latest version of
jzintv
or RetroPie. The latest version should havedisplaysize
parameters which would be filled in automatically with your resolution:jzintv = "/opt/retropie/emulators/jzintv/bin/jzintv --displaysize=%XRES%x%YRES% --quiet --rom-path=/home/pi/RetroPie/BIOS %ROM%"
-
@mitu said in xboxdrv dpad-as-axis: is it possible? (ps3 controller + intellivision):
--displaysize=%XRES%x%YRES%
Yes. So this needs to go, I think, after the -config option for those custom jzintv commands. It wasn't working for me until I did that. If all else fails, this version of the xboxdrv line worked for me:
jzintv-xboxdrv = "sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --config /opt/retropie/configs/xboxdrv/intellivision.xboxdrv >>/dev/shm/runcommand.log & /opt/retropie/emulators/jzintv/bin/jzintv -p /home/pi/RetroPie/BIOS -q --displaysize=%XRES%x%YRES% --kbdhackfile=/opt/retropie/configs/intellivision/hackfile_trondd.cfg %ROM%; sudo killall >/dev/null xboxdrv"
But you will need to update RetroPie from source for the PS3 buttons to show up in event_diag.
Now if I could figure out why the config menus no longer work with controllers (I need my keyboard to use them)...
For updaters: RetroPie -> Run Command Configuration -> set Joy2Key version to udev (instead of sdl) and then re-enabling the launch menu from the same set of options will fix this
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.