libretro / libretro-prboom

Port of prboom to libretro - plays Doom, Doom II, Final Doom and other Doom IWAD mods.
GNU General Public License v2.0
68 stars 48 forks source link

Add a new xbox or ps4 controller style layouts for better weapon switching? #178

Open palmerj opened 2 years ago

palmerj commented 2 years ago

Would it be possible to add a new layout for something more like xbox or ps4 style layouts? The key benefit is having better weapon buttons or quick weapon switches. e.g

PS3:

Screen Shot 2022-08-03 at 3 05 28 pm

PS4:

image

Xbox OG (what the current modern layout controls are pretty close too, but not what I want):

Screen Shot 2022-08-08 at 5 48 08 pm

XBox 360 style:

image

or even better this custom setup

image

I understand that the PS4 button switching modes might not be possible as they use each d-pad direction for a weapon group (2 weapons each) and you need to toggle each direction to bring up each weapon.

Thanks!

palmerj commented 2 years ago

I know I might be asking too much to get another layout added, but can we at least add more key options for customisation? Or is that not possible, and you can only map game key to number of virtual retropad buttons?

At the moment we have:

{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT,   "D-Pad Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP,     "D-Pad Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN,   "D-Pad Down" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT,  "D-Pad Right" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B,      "Show Last Message" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A,      "Next Weapon" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X,      "Previous Weapon" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y,      "Use" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L,      "Quick Load" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R,      "Quick Save" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2,     "Run" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2,     "Fire" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3,     "Toggle Run" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3,     "180 Turn" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Show/Hide Map" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START,  "Show/Hide Menu" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X, "Strafe" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y, "Move" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X, "Turn" 

Would be nice to have all of the weapon buttons from 0-9 available for customisation, especially 0 for the best weapon selection. I also find it's really useful to have the zoom in (+) and zoom out (-) options for the map.

If supported, I'm happy to help create a PR to do this, but just need some guidance on what would make sense here.

hizzlekizzle commented 2 years ago

Unfortunately, it looks like it's using pretty much every available input, aside from ANALOG_RIGHT's Y axis.

It would be possible to add another emulated "device type" that has the PS/Xbox controls as a basis (call it classic vs modern or whatever). You can look at pretty much any core with multiple device types (snes9x for example) to see how that's typically achieved.

palmerj commented 2 years ago

Ok thanks.

Note that this core already has multiple device types:

"Gamepad Modern" Based on Original XBOX Doom 3 Collection "Gamepad Classic" Based on PS1 Doom Port! "RetroKeyboard/Mouse"

hizzlekizzle commented 2 years ago

Oh, in that case, yeah, just spin up another one and give it a fancy name :)