Gamepad APIs: Cross-Platform Button Support

that one might think if i had to play games on playstation 4 but isn’t this requires pro instead of normal ?, so if we had any chances to put on 4 days to go to be here in playing, but i have no idea how will work on normal and pro, also you guys have great detail on how api will work on ps4 and ps5 will be on :slight_smile:

Hi,

Sorry I don’t quite understand what you mean by this - I still don’t see how I can distinguish between the share button on PS4 and PS5 with UserInputService:GetStringForKeyCode(KeyCode.ButtonSelect) since it returns the same value “ButtonShare” on both PS4 and PS5?

The problem with this is that we can’t override the different looking share button image for the PS4 and PS5.

1 Like

Currently making changes to my games’ gamepad mapping and controls, however I need to know if the changes and support will only apply to PS4 controllers because in the original post, there are no notes about PS5 controller support.

Is this intentional? I’m planning to buy a PlayStation 5 controller but I have no clue whether or not studio will support it. Any information would be helpful in my purchase decision.

From what it sounds like, you’d like to distinguish a PS4 controller from a PS5 controller in your code. From what I know, this is not possible.

The layouts for the controllers, by PlayStation, are below. I am assuming Roblox treats the button labeled ‘B’ on the PS5 layout as the same return value and keycode as the button labeled ‘B’ on the PS4 layout.

Additionally, the PS4 and PS5 controllers both have a ‘TouchPad’. (D’ on PS5 layout, ‘C’ on PS4 layout.) Thus, the two buttons on the different controllers cannot be distinguished from one another. (As I’m assuming the keycode and return value are the same for PS4 and PS5.)


Layout of PS5 Controller

Source: DualSense wireless controller part names


Layout of PS4 Controller

Source: DUALSHOCK™4 wireless controller | PlayStation®4 User's Guide


I have a PS4 controller but not a PS5 controller. So, I don’t think I can verify this myself. I’d test this by printing the values that are returned from the UserInputService APIs.

Hope that all makes sense, it is quite confusing.

Adding on to Cooliotommio’s report that Roblox Dialog doesn’t have support for Playstation Icons.
I also noticed that Proximity Prompts also show Xbox icons in PS4 emulation mode.

I’ve updated my game, Abyssal, to use PS4 icons, and Proximity Prompts and Dialog are the only places where you still see Xbox icons.

1 Like

By this do you mean from the device emulator in the ‘Test’ tab in Studio? I see Xbox One, but not PS4.

1 Like

because only certain people can see it for now

I have not known whether will be on ps4 like if we had both ps4 and ps4 pro would come out or will be both like every type of devices from ranging ps4 to ps5? I haven’t answered any question will it go on which type of device ?

As PlayStation comes out tomorrow hopefully more developers are implementing this in their experiences

Unfortunately the official way to override button images via userInputService:GetStringForKeyCode won’t work if you want to be able to distinguish between PS4 and PS5 buttons like the share button.

A workaround is to use userInputService:GetImageForKeyCode instead since it returns a different button image for PS4 and PS5.

e.g.

local mappings = {
    ["rbxasset://textures/ui/Controls/PlayStationController/PS4/ButtonShare@2x.png"] = "rbxasset://PS4_SHARE_BUTTON_ASSET",
    ["rbxasset://textures/ui/Controls/PlayStationController/PS5/ButtonShare@2x.png"] = "rbxasset://PS5_SHARE_BUTTON_ASSET"
}

local mappedKey = userInputService:GetImageForKeyCode(key)
local image = mappings[mappedKey] or mappedKey

imageLabel.Image = image

Not the safest way since if roblox decides to change the image path then it’ll fail, though at worst it’ll just revert back to using the default image supplied by roblox.

1 Like

PlayStation 5 controller should be supported.

1 Like

In the drop down for the emulated type, there should be PS4. Please ensure you’re on the latest studio.

1 Like

This would work I agree but is not the cleanest solution, I’ll leave a ticket to investigate it more.

@MauroNr1 this answers your middle question too.

As for the triggers and gyroscope, those are not currently supported.

1 Like

What should expect emulating ps5 , like in same behavior of emulating ps4 ? I’d that would be cool if everyone would kindly emulating ps4 and ps5 at what best at kind.

Thanks for releasing these APIs for public use my games are now ready for PlayStation release tomorrow! Also, how do I make the controller rumble?

After uninstalling and reinstalling Roblox Studio, I still don’t see PS4 as an option.

Image of device emulator dropdown

Version Info:
image

Maybe it’s not on public release. It could just be a bug on my end though.

I’m having the same issue, on the same version. Would love to have a solution soon since playstation release is tomorrow.

Hello, I noted that the PS4 option doesn’t appear if I opt-in to the beta Notched Screen Support.

Opt-In
image
image

Opt-Out
image
image

6 Likes

Ah, will you plan to support controller gyroscope in the future? I was hoping for this to be added day 1 so developers can implement gyro aiming in their first person shooter games. Energy Assault already has gyro aiming on mobile devices.

1 Like

I think most people don’t see a game app on ps4 console like i cannot see myself on brothers ps4 console, and i think that problem persist me from not having a ps4 pro, we only have normal ps4, and that’s how the problem occured when i don’t see it on playstation store :slightly_frowning_face: