Config file for DualShock 4 / PS4 controller

Welcome Page Forums RetroPie Project Everything else related to the RetroPie Project Config file for DualShock 4 / PS4 controller

This topic contains 19 replies, has 8 voices, and was last updated by Profile photo of  Anonymous 1 year, 8 months ago.

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #87048
    Profile photo of AmadhiX
    AmadhiX
    Participant

    I couldn’t find one of these when I was looking, so I just thought I’d share the config file I put together for people looking to use PS4 controllers with input autodetect.

    This version uses Share + Options (the DS4’s Select + Start) as the “quit emulator” button combo.

    By default, this should go into:
    /opt/retropie/emulators/retroarch/configs/

    IMPORTANT: You will also have to rename or remove PS3ControllerBT.cfg from this folder. You can simply rename it PS3ControllerBT.cfg.bak.

    DualShock 4s and bluetooth-connected DualShock 3s have the same device id, which disables in-game controls if both config files are present You will have to decide which type of controller you’re going to use. USB-connected PS3 controllers should still work fine with PS4 controllers.

    Let me know if you find any issues. 🙂

    SonyComputerEntertainmentWirelessController.cfg

    # DualShock®4 Wireless Controller Configuration
    # ---------------------------------------------
    # For reference, the input labels are as follows:
    # Directional Buttons 		| Hat0
    # Square			| Button0
    # X				| Button1
    # Circle			| Button2
    # Triangle			| Button3
    # L1				| Button4
    # R1				| Button5
    # L2				| Button6
    # R2				| Button7
    # Left Stick Horizontal 	| Axis0 (-Left/+Right)
    # Left Stick Vertical 		| Axis1 (-Up/+Down)
    # L3				| Button10
    # Right Stick Horizontal 	| Axis2 (-Left/+Right)
    # Right Stick Vertical 		| Axis5 (-Up/+Down)
    # R3				| Button11
    # Share				| Button8
    # Options			| Button9
    # PS Button			| Button12
    # Touchpad Button		| Button13
    
    # Device Configuration
    input_device = "Sony Computer Entertainment Wireless Controller"
    input_driver = "udev"
    
    # Directional Buttons
    input_up_btn = h0up
    input_down_btn = h0down
    input_left_btn = h0left
    input_right_btn = h0right
    
    # Action Buttons
    input_a_btn = 2
    input_b_btn = 1
    input_x_btn = 3
    input_y_btn = 0
    
    # Shoulder Buttons
    input_l_btn = 4
    input_r_btn = 5
    input_l2_btn = 6
    input_r2_btn = 7
    
    # Left Analog Stick
    input_l_x_minus_axis = -0
    input_l_x_plus_axis = +0
    input_l_y_minus_axis = +1
    input_l_y_plus_axis = -1
    input_l3_btn = 10
    
    # Right Analog Stick
    input_r_x_minus_axis = -2
    input_r_x_plus_axis = +2
    input_r_y_minus_axis = +5
    input_r_y_plus_axis = -5
    input_r3_btn = 11
    
    # Start & Select
    input_select_btn = 8
    input_start_btn = 9
    
    # Hotkeys
    input_enable_hotkey_btn = 8
    input_exit_emulator_btn = 9

    #87054
    Profile photo of flippage
    flippage
    Participant

    Hey mate, I’ve been looking for something like this.

    Questions:

    1) Does this use DS4DRV to run? (Using --emulate-xpad, or without ?)

    2) Where do we put this .cfg file?

    #87067
    Profile photo of AmadhiX
    AmadhiX
    Participant

    I didn’t have to run anything extra, or use any command line arguments to get my DS4 to work. It worked for me using the stock RetroPie image and this config file. I’ve been running it plugged in, but haven’t tried it over bluetooth yet.

    I THINK the default location for the configs is:
    /opt/retropie/emulators/RetroArch/configs/

    If someone with a stock install can confirm, I’ll add that info to the first post.

    #87110
    Profile photo of flippage
    flippage
    Participant

    Hey man,

    So i have a fresh install of retropie. I’ve made the config file you suggested, and put it into the /opt/retropie/emulators/RetroArch/configs/ folder. Booting up EmulationStation, it still asks me to hold ‘A’ on the controller and map it. And when I get into a Snes rom, the controller isn’t responding. Am I missing a step here ?

    #87146
    Profile photo of windjammersfan
    windjammersfan
    Participant

    I might be wrong but I think it’s normal for Emulation Station to prompt you to configure the controller on start-up if it’s not been used with it before, regardless of whether it’s set up in the Retroarch config file or not. I’d tried setting up the PS4 pad myself and completed the “Register Retroarch Controller” setup from the Retropie config script but still had to set it up in ES too.

    I’m also getting the problem with the pad not responding in games. I’ve tried with SNES and Mega Drive/Genesis, though I doubt it actually makes a difference trying in different emulators. I also tried two different PS4 controllers, both Dualshock 4. Neither gets any response once ES has started the emulation.

    I’ll try setting up FBA or something to see if that works.

    edit: removed the quote of the previous post as the text was really big for some reason and didn’t read easily.

    #87150
    Profile photo of AmadhiX
    AmadhiX
    Participant

    Having to do the EmulationStation setup is normal. From what I understand, at boot, EmulationStation has you configure the controller to control the EmulationStation front end. The config file, and the “Register Retroarch Controller” thing, are for the emulators themselves.

    I’m not sure why your controllers aren’t working in-game though. I’ll poke around at my setup and try to figure out what I changed to make it work.

    #87177
    Profile photo of windjammersfan
    windjammersfan
    Participant

    Playing around with PiFBA I edited the config file to the correct buttons (or tried to at least…) and it works with that.

    #87183
    Profile photo of AmadhiX
    AmadhiX
    Participant

    I had been wanting to try the 2.5 beta anyway, so I used the reinstall as a chance to figure this out. It took a bit of prodding, but I sussed it. Turns out I had fixed it by accident on my previous install.

    The default location for controller config files is:
    /opt/retropie/emulators/retroarch/configs/

    However, there is a default config file, PS3ControllerBT.cfg, that conflicts with the PS4 config. Apparently, the detected input device name is the same for a PS4 controller and a bluetooth connected PS3 controller, and Retroarch can’t handle the conflict.

    The fix:
    Rename
    /opt/retropie/emulators/retroarch/configs/PS3ControllerBT.cfg
    to something like
    /opt/retropie/emulators/retroarch/configs/PS3ControllerBT.cfg.bak

    That way, retroarch won’t find it. Alternately, just get rid of it, if you know you’ll never be using a PS3 controller over bluetooth.

    Of course, this means you’ll have to choose between PS4 controllers and bluetooth connected PS3 controllers. Your setup will only work with one or the other, though all other controller types should still work. I’m not sure if there’s anything we can do about that right now.

    That SHOULD work. Let me know if you still have problems!

    I’ll update the first post in this thread with the new information.

    #87190
    Profile photo of windjammersfan
    windjammersfan
    Participant

    That did the trick. I think the change also made the ES menus a little more responsive but that may just be all in my head. I only have 1 more problem with the DS4 pad setup now, but that’s for another thread. Thanks for the help! 🙂

    #87195
    Profile photo of AmadhiX
    AmadhiX
    Participant

    Anything for a fellow Windjammers fan. 😛

    I’m glad to help get these things into greater use. I’m probably a little TOO happy with the DS4. It’s just so comfortable!

    #87202
    Profile photo of flippage
    flippage
    Participant

    Heyyyyy man that’s worked perfectly. I wouldn’t have even thought to check the configs tbh. I just assumed they would be different.

    Thanks heaps for the help. Now I have to find a working NeoGeo bios so I can actually play Metal Slug.

    #87242
    Profile photo of Karoi
    Karoi
    Participant

    Hello all,

    As I’m waiting for my Raspberry Pi 2 Model B (First Raspberry Pi, YAY!) to be delivered. I was wondering, what about using two DS4’s with RetroPie/ES? Do I need a second config file, or a second set in the config file.

    Can anyone tell me? I think it will be great if I can play together with my girlfriend (Yes, I’m that kind of guy 😉).

    Also do I use the DS4 wireless or via a USB cable? May be a dumb question, but I’m not afraid to ask.

    And the last thing, can I play N64 games with a DS4 controller? And if I can, can someone explain me how?

    Thanks!

    #87340
    Profile photo of AmadhiX
    AmadhiX
    Participant

    Hey karoi,

    You should be able to use a second DS4 without any problems. As I understand it, EmulationStation detects that a controller has been plugged in and checks for a config file that matches that controller’s “device id” name. That name should be the same for any number of the same type of controller.

    I have been using my DS4s plugged into USB. I plan to test out bluetooth eventually, but for now I’m busy seeing which games work and playing with themes. 🙂 If anyone has any experience with DS4s and bluetooth on RetroPie, I’d love to hear about it.

    I haven’t tried to emulate N64 yet, so I’m not sure on the last one. If the N64 emulator is part of retroarch (and is playable) then the DS4 should work in theory.

    #89422
    Profile photo of ska90
    ska90
    Participant

    Hey AmadhiX,

    the config file for the DS4 works perfectly, except that the joysticks cant be used for my games. Is this because i initially mapped my controller using the D-pad in emulation station?

    any help would be appreciated.

    #89433
    Profile photo of lordasshat
    lordasshat
    Participant

    nano /opt/retropie/configs/all/retroarch-core-options.cfg
    change this line from its defaults to
    pcsx_rearmed_pad1type “analog”
    pcsx_rearmed_pad2type “analog”

    also if the lines aren’t there add them.

    I am assuming you are talking about psx games. I couldn’t find this fix any where hope it helps.

    #89435
    Profile photo of ska90
    ska90
    Participant

    lordasshat

    its working great now.

    Thanks a lot

    #89443
    Profile photo of lordasshat
    lordasshat
    Participant

    lordasshat

    its working great now.

    Thanks a lot

    NP glad i could help. 🙂 hope it helps others and saves some on from the 4hr headache of trying to figure it out on their own.

    #91338
    Profile photo of j3rk
    j3rk
    Participant

    Has anyone figured out how to get the Playstation DS4 controllers to work wireless over bluetooth yet? I can get them to work if they are plugged in but haven’t been able to figure out how to get them to work wirelessly yet. I use http://ds4windows.com/ to get them to work on my PC and its nice.

    #101344
    Profile photo of lordasshat
    lordasshat
    Participant

    This still work but you must run sudo chmod 777 /opt/retropie/configs/all/retroarch-core-options.cfg and run psx emulator once to get psx_reamred* to show up in beta 3(I know 777 isnt best choice but it works.)

    nano /opt/retropie/configs/all/retroarch-core-options.cfg
    change this line from its defaults to
    pcsx_rearmed_pad1type “analog”
    pcsx_rearmed_pad2type “analog”

    also if the lines aren’t there add them.

    I am assuming you are talking about psx games. I couldn’t find this fix any where hope it helps.

    #108694
    Profile photo of
    Anonymous

    it’s work great with 1 controller in bluetooth but not with 2 controller…

    can you help me for config??

Viewing 20 posts - 1 through 20 (of 20 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar