dosbox-pure
dosbox-pure copied to clipboard
[Enhancement] Add options to keyboard mapping
Hello @schellingb, there's still a few options that I wonder whether they could be added to keyboard mapping.
Custom Keybord Bindings
- Add option to map on-screen keyboard
- Allow mapping left and right analog stick axes (X+/X-/Y+/Y-)
The above options are available in other keyboard mapping profiles, e.g., "Generic Keyboard Bindings
All other keyboard bindings
- Add more keys to bind, e.g. Tab
Sadly none of these I can accomplish in just the core. These would need both libretro API additions as well as changes in the reference frontend (RetroArch).
Custom Keybord Bindings
- Add option to map on-screen keyboard
I was thinking of using the keyboard key "Keyboard Compose" as the key to open the on-screen keyboard. But it would be hard to communicate that to a user so I dropped that idea. Currently (if enabled in the options) it's fixed to L3 in the 'Custom Keyboard Bindings' mode.
- Allow mapping left and right analog stick axes (X+/X-/Y+/Y-)
That would be a RetroArch addition. But ideally the axes could also be mapped to mouse movement as well as joystick axes but RetroArch doesn't know about DOS joysticks.
All other keyboard bindings -Add more keys to bind, e.g. Tab
The number of binds for the the device modes that aren't custom keyboard are limited to exactly 24 (actually 16 buttons + 4 axes) bind options. So I can't add more options, only change existing ones. The generic keyboard bindings are meant for games that either are fairly simple (think Crystal Caves) or games that have configurable controls.
Interestingly everything becomes possible when using the keyb2joypad based automappings. So maybe instead of perusing (or abusing) more possibilities through the frontend, a way to add new or modify existing automappings would be the best. Maaaaaybe something like the start menu as a mapping editor? One could freely assign mouse and joystick movement to sticks and have all key, mouse and joystick buttons selectable. Or a way to define a mapping in a text file or some other intermediate way maybe. I am open to suggestions.
Hmm, regarding adding more keys to bind (e.g. Tab), you mention that it's only possible to bind 16 buttons + 4 axes per stick, totalling 24. That's cool, too, I was just wondering whether it's possible to map different keyboard keys to those 24 buttons/axes?
The start menu could be a really good alternative, yes! I can totally imagine key/mouse/joystick to button binding as an extra option in that menu. Only thing is, that would then make the key binding options in RA's "Controls" menu redundant, but if they come at least partly from RA, then they'd still be there, confusing users...
Here's the current generic bindings:
BUTTON | Port 1 | Port 2 | Port 3 | Port 4 |
---|---|---|---|---|
UP | Up | 8 | Q | Backspace |
DOWN | Down | 2 | A | Backslash |
LEFT | Left | 4 | Z | Semicolon |
RIGHT | Right | 6 | X | Quote |
SELECT | Escape | Period | G | O |
START | Enter | Enter | H | P |
X | Space | 5 | D | Slash |
Y | Left Shift | 1 | F | Right Shift |
B | Left Ctrl | 0 | C | Right Ctrl |
A | Left Alt | 3 | S | Right Alt |
L | 1 | 7 | W | Left Bracket |
R | 2 | 9 | E | Right Bracket |
L2 | 3 | Minus | R | Comma |
R2 | 4 | Plus | T | Period |
L3 | F1 | Divide | V | Minus |
R3 | F2 | Multiply | B | Equals |
AXIS | Port 1 | Port 2 | Port 3 | Port 4 |
---|---|---|---|---|
Left X | Left/Right | 4/6 | Z/X | Semicolon/Quote |
Left Y | Up/Down | 8/2 | Q/A | Backspace/Backslash |
Right X | Home/End | Minus/Plus | J/L | Left/Right Bracket |
Right Y | PgUp/PgDn | Divide/Multiply | I/K | Minus/Equals |
These are also used for other device modes if the option Input > Bind Unused Buttons
is enabled (enabled by default). For those the assignments will shift down depending on the modes default mappings. For example, in 'Mouse with Right Analog' the X
button is used for the middle mouse button so the Space
key now goes to Y
instead.
It's not great, and was made well before I even knew about keyb2joypad, but it was the best I could come up with for the first release. The only "solution" would be to add a core option for every of these with hundreds of choices but I want to keep the amount of options low and control settings should stay in the controls menu of RetroArch as much as possible.
Moving the configuration inside a custom UI into the core is also not perfect but I feel with the automapping we're already halfway there at doing things very DOS specific for a better overall user experience.
Tell ya the truth, shortly after you released the first Beta of Pure, I looked into your generic bindings and I'm now using them as default. I think they're really good.
I used to have my own custom bindings when I was using DOSBox-Core (you can check them out in my screenshots here), and yours are honestly better, not least because you mapped the stick axes as well, which DOSBox-Core can't do.
So from my end, I think being able to map keys different from those you chose for "generic" isn't so important, it's a "nice-to-have" but if it's a lot of trouble and/or causes a ton of redundancy, I don't think it's worth it. Certainly cramming them all into the core options doesn't make sense, I agree.
(btw, perhaps those tables you posted above should go into the eventual DOSBox Pure guide doc for Libretro Docs (#50)?)
Re. offering mapping options in a custom UI inside the core: I see it the same way you do. I'm just thinking we need a way to distinguish those core-inherent mapping options from the Controls settings in RA, i.e. set them apart in a way that users will intuitively understand: "oh, this is where I do this and this is where I do that".
In other words, I guess eliminate the overlap.
I'll rack my brain about this and let you know if I come up with anything.
Oh, cool that generic bindings work so well for you. It just seems so awkward that if only a single important key isn't available it's pretty much useless. Well, guess the on-screen-keyboard can help if it's not needed in very hectic gameplay situations.
I found the on-screen-keyboard to be somewhat usable for switching weapons in DOOM, but that is another issue that needs some thought. I was thinking of a customizable next/previous button that cycles through a given list of keys.
Yeah I want to approach the custom UI as a way to modify/tweak the automatic mappings in the first place. But it would also end up allowing tweaks to generic bindings for games than don't have automatic mappings. And someone on reddit asked how to play Master of Orion which wants mouse movement but also a few specific hostkeys which just aren't covered in the generic bindings. That would become possible as well.
Btw. speaking of, sorry that I haven't replied to #50 yet, quite a few things that are fairly different from DOSBox-SVN... I'm very happy about you helping out in that regard for sure!!
No worries man, one step at a time. I understand and appreciate we're all doing this in our free time :-)
Hey, perhaps you can just bring over the original DOSBox key mapper (cf. this video)? It can do everything except map mouse movement/buttons, which, perhaps, is something you could add to it. And perhaps it's also possible to add the key cycling functionality you mentioned for DOOM-likes.
As you envisioned, it would then appear as an extra option in the DOSBox Pure start menu: we might call it "Remap game controls". That way, a user would (I guess/hope :-)) understand that from here, they can remap controls specifically for this one game they're about to run.
Then, we'd just need to add a small section about it to the readme explaining that this is specifically for games that need controls that can't be adjusted in the RA Controls menu.
EDIT: oh, and if a remap is present, the option in the start menu could change to "Edit/reset remapped game controls". That way, a user will instantly remember they have a custom DOSBox Pure mapping applied.
EDIT 2: alternately or additionally, a popup notification: "This game uses custom DOSBox Pure remapping."
Hm, I might have created a duplicate for this with #113 if so we could just mark that as such. Not sure how easy it would be to bring that into RetroArch (load a DosBoxKey.map file from game's root if there) but it's something that is already in the standalone DosBox so at least it's not reinventing the wheel. It also allows for key combinations so it could extend the 24 button limit for specific games that need more as well.
Why not try it the other way round? You have mapped L3 to the virtual keyboard... maybe it is possible to map other buttons to activate the keyboard and also triggers a button press on this virtual keyboard?! Something like a batch file for the keyboard... Sorry if this is stupid. I have no clue on developement, but I’m also looking for a way to map let’s say „x“ under „mouse with right analoge stick.
if this is not possible, is there maybe a way to add known games to keyb2joypad? So that we can map the buttons there?
Great work mate!
Another option could be how Amiga PUAE core has input mapping options for each retropad button inside the core options menu.
I just committed a new big feature, a built-in full gamepad mapper.
It's not the most beautiful menu but functionality wise I think it's pretty sweet. Allows any mixture of keyboard, mouse and joystick to be bound to every part of the RetroPad. The mapping is stored inside the savegame data.
This should help with this issue as well as a few others:
- #54
- #92
- #113
- #142
- #179
- #185
- #219
- #232
- #233
This looks awesome!!
Very cool. Will this also allow remaps to key combinations? Also, will adjustments take immediate affect without having to restart a game?
Yes and yes. The mapper is opened via the on-screen-keyboard and available any time and changes are immediately saved and applied when closing the mapper (even the controls menu in RetroArch updates). As of now, it isn't available if the on-screen-keyboard is disabled.
As shown in the screenshot there is a "[Additional Binding]" option which allows the creation of up to 4 bindings per key/axis. Anything can be mapped and combined to anything. For example it is possible to make moving the right analog stick down press a keyboard key, click the mouse and move the joystick and mouse in any direction at the same time. So it should be way more useful and flexible than anything that is possible with just the frontend while avoiding a need to add hundreds of core options.
Fantastic, I look forward to this. DOSBox Pure is revolutionary; I picked a really good time to start getting back into DOS gaming. Thanks for this and keep up the extraordinary work.
This new gamepad mapper tool is now out as part of the freshly released 0.9.0 beta!
Please try it out, any feedback would be welcome.
I am running macOS so will need to wait to try this, I think?
I will give this a spin as well. I suppose I can figure it out by using it, but I was just wondering if the remapper contains the option to use buttons to speed up/slow down the mouse as well. It's useful in some games so having the option to retain that functionality would be preferable.
You, Sir, are genius!! Works like a charme. Completely solved the remapping (turning/strafing) problem in DOS games like Lands of Lore. I cannot begin to imagine all the other possibilities that open up with your mapper addition. Thanks again so much for all the effort you put into that wonderful core.
@chinagreenelvis Yes, there is two actions "Speed Up" and "Slow Down" under the "Mouse" device in the Gamepad Mapper that can be bound to anything you want. Though if bound to an analog axis it won't gradually speed up or slow down the mouse, it still is just 3 fixed speed settings.
I had a moment today to take a quick glance at the new mapper. Damn it's sweet. I didn't get to spend much time with it, but one thing I'd like is to be able to quickly cycle up and down through options (e.g. through all the keys available when selecting to map a keyboard) by holding the d-pad or analogue stick up or down. Right now, when I hold the d-pad/stick up or down, the selection only moves one spot, then stops.
Awesome feature! Did some testing, you can even play MS flight simulator on a tablet now!
It seems that when setting new keys to L and R they actually map to the L2 and R2 buttons, and L2/R2 map to L/R buttons, at least when testing on android.
I also second @mrmatteastwood, being able to scroll down/up by holding the button would be nice, both in the pad mapper and the start menu for the core, as having to scroll for the executable file by file in a big directory to start a game is a bit annoying.
That aside, I'm super happy with the core! Thank you for your work!
Cannot map Mouse Left Click on Pad Mapper menu.
Some suggestions:
- Add transparency adjustement for the Pad Mapper menu. I cannot clearly see the game screen in the background (when you are on a Customize Keyboard ingame menu)
- Add their own symbols beside the Grave, Minus, Equals, Backslash, Left-Bracket, Right-Bracket, Semicolon, Quote, Period, Comma, Slash, Extra-Lt-Gt, NP-Divide, NP-Multiply, NP-Minus, NP-Plus and NP-Period. Useful for non-english users.
Thanks everyone for the feedback so far! I implemented the suggestions for the next version, so look forward to that. @mrmatteastwood Scrolling by holding down/up is also in, but in the meantime you can use left/right or L/R to jump 12 rows up/down.
Nice! Thanks!
The fixes are now in the new 0.9.1 release. Get it while it's hot!
Juat fantastic! :-) I'm about to go on vacation for 10 days, so I'll finally have time to tinker with this some more. I'm hoping this'll make MDK playable! I don't know how I put up with those asinine controls back in the 90s, lol.
Hey @schellingb, do you think this is a good moment to finish up that readme and submit it to the RA team for inclusion in the official docs?
https://github.com/schellingb/dosbox-pure/issues/50
With my vacation coming up, I'll be more than happy to work together on that and get it out.
I would wish 2 things exist Im always pro choice/option
So like some people don't have L/R 3 not even 2 sometimes not even 1 I am fully aware we can set which button opens virtual keyboard yet when you have such limited button choice it's simply not an option So my ideas for improvements are
1 - Simple option we could choose like "show on screen keyboard" and it would simply close the menu and go back to the game bringing up that virtual keyboard
2 - Ability to set combo keys like press this two keys to show on screen keyboard where we could choose combos like for example select and something
1 - Simple option we could choose like "show on screen keyboard" and it would simply close the menu and go back to the game bringing up that virtual keyboard
2 - Ability to set combo keys like press this two keys to show on screen keyboard where we could choose combos like for example select and something
It's unfortunate that RetroArch was clearly not designed with combination buttons in mind. You might be able to do what you want on your gamepad by setting the "hotkey enable" option, though.
For example, few games rely on button combinations that involve the back/select button, and no game that I know of relies on using the select button in combination with a d-pad direction. So you could set that button as your hotkey-enabler and then d-pad up to open the menu and d-pad down to bring up the virtual keyboard. These are button combos you'll never accidentally hit since they require hitting the select button with your right hand and the d-pad with your left.
That being said, DOS games often use so many different keyboard keys that I can't imagine playing on anything less than my 360 controller, and even that gets tricky. But I hope the aforementioned suggestions are helpful.
1 - Simple option we could choose like "show on screen keyboard" and it would simply close the menu and go back to the game bringing up that virtual keyboard 2 - Ability to set combo keys like press this two keys to show on screen keyboard where we could choose combos like for example select and something
It's unfortunate that RetroArch was clearly not designed with combination buttons in mind. You might be able to do what you want on your gamepad by setting the "hotkey enable" option, though.
For example, few games rely on button combinations that involve the back/select button, and no game that I know of relies on using the select button in combination with a d-pad direction. So you could set that button as your hotkey-enabler and then d-pad up to open the menu and d-pad down to bring up the virtual keyboard. These are button combos you'll never accidentally hit since they require hitting the select button with your right hand and the d-pad with your left.
That being said, DOS games often use so many different keyboard keys that I can't imagine playing on anything less than my 360 controller, and even that gets tricky. But I hope the aforementioned suggestions are helpful.
I don't need a fix that was just a suggestion since i sit in retroarch discord and ppl come there with dosbox configuration problems where most common one is getting controls to work properly But i gonna suggest them your solution instead of my one which is switching device input to custom keyboard and mouse and simply configuring everything from scratch
Anyone who is dedicated to using a controller that has no thumbsticks and/or r/l buttons/triggers would probably have to resort to using a hotkey-enable button if they aren't sitting next to a keyboard.
Again, in terms of DOS gaming, that sounds silly to me, but a lot of the things I want or prefer probably sound silly to others. So again, hopefully that setup suggestion helps.