schellingb / dosbox-pure

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
GNU General Public License v2.0
751 stars 62 forks source link

[Feature Request] A way to bind all eight "directions" of the number pad to a gamepad analog stick #523

Open Banjo-Oz opened 1 month ago

Banjo-Oz commented 1 month ago

Is there any feasible way to map the full number pad (all eight "direction keys, including diagonals") to an analog stick?

I suspect this is impossible to implement, but it's a huge pain when it comes to many early DOS games that use the number pad for movement and require diagonal movement precision.

Currently if you bind NUM-8 to "Analog Up" and NUM-4 to "Analog Left", pushing the stick diagonally up+left will not move a character diagonally because the game expects NUM-7 for that. Even pressing NUM-8 and NUM-4 together won't work, again because Up+Left does not equal "diagonal up-left" in such games. This is obviously because of how mapping works: one button/direction mapped to one key.

I have no idea how this could be solved, and probably it can't, but it was just something I was thinking about today and wishing it could be somehow done.

PoloniumRain commented 1 month ago

I'm almost positive there's no way to do this.

With the Gamepad Mapper which can be accessed by pressing L3 on the controller and going on Pad Mapper, you can bind as many keys as you like to the up/down/left/right directions on each analog stick (shown below with Additional Bindings).

So multiple bindings on a single direction/button is possible, but not diagonally because there's no diagonal binding options. It would be a nice feature to have.

Action_Wheel

schellingb commented 1 month ago

While this might work for numpad diagonals I feel like players would end up being confused or frustrated were they try to use this for other functions.

Because (unlike players might think) the time between pressing UP and then LEFT is not zero. So the core would see the UP, cause the key mapped to UP be pressed in the game. Then later, it'll see UP+LEFT, release the previously pressed key and then press the key mapped to UP+LEFT. Same will happen again in reverse when releasing the pressed d-pad directions.

We can't make it so a d-pad/analog stick mapped to numpad 8426 always does the full 8 directions because it isn't always desired. I guess it could detect mapped numpad 8426 and offer an option to extend it to all 8, but I don't know where that option would be.

Banjo-Oz commented 1 month ago

Yeah, I figured it would be hard to do, if not impossible.

Being able to specifically map - for example - NUM7 to "analog stick is pushed diagonally to upper left" is the sort of thing I was wanting, though, since the games that need this don't use the more modern/expected "press both up+left" combo even if the timing worked, but rather only the NUM7 key. Pressing both up+left doesn't work on those games.

For specific examples that need this, see the games "Bruce Lee" or "Flightmare".

In theory, I kind of like the idea of having a checkbox/toggle for "8 direction" that opens up the four extra diagonals to an analog mapping as the "best" UI solution; like you say, you wouldn't want it always active as more often than not four directions are enough.

Incidentally, Flightmare is a unique example to my knowledge that would greatly benefit from doing this to BOTH analog sticks; with the 8-direction number pad mapped to one, and the QWEASDZXC (WASD but with "diagonals" too!) mapped to the other stick!

PoloniumRain commented 1 month ago

I think the example below is what you'd like @Banjo-Oz? I made this graphic because it's way easier to explain lol.

So basically all of the thousands of possible axis directions on an analog stick are converted into just 8 directions. The 8 directions that these old games use on the keyboard numpad is basically trying to replicate an 8-way arcade joystick anyway. I'd imagine this would work perfectly if there isn't some limitation with RetroArch or something.

I like your idea of a toggle. The Gamepad Mapper could have "Enable 8-way directional input" or whatever. Obviously it would only work with the analog sticks, not a 4 button D-pad, which isn't a problem anyway.

Analog

Banjo-Oz commented 1 month ago

Yes, @PoloniumRain! That's exactly what I was imagining, with the full rotation of an analog stick divided into 8 "sections" to map keys to (e.g. the number pad, or, as in Flightmare's case, QWEASDZXC; I can also see the use of mapping 123456789 clockwise rather than as the number pad layout). These extra four diagonal directions would only be mappable if "8-way direction for Left/Right Analog Stick" was checked/enabled, to avoid confusion, Your image conveys this well.