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
731 stars 61 forks source link

RetroArch's autoconfig mappings run alongside custom mappings #468

Closed unixatch closed 4 months ago

unixatch commented 5 months ago

OS: Android 12 RetroArch version: nightly Core version: 0.9.9 Controller: DualShock 4


Autoconfig mappings coming from RetroArch run at the same time with the custom mappings

Example: I'm playing one of the expansions of Wolfenstein 3D, let's say I have these: Custom mappings_example and the autoconfig is like: Screenshot_2024-02-04-00-05-31-50_a845f06d2c9842610668be6995f9e34f Whenever I press D-Pad up, I'm not only pressing the emulated "Keyboard 3" but also RetroArch's autoconfig "Key up", in this case the arrow key up and it shouldn't do that because it causes unwanted movement in games like Wolfenstein (the player moves with the arrow keys by default).

This is happening mainly on the D-Pad buttons from what i've tested but I might be wrong.


When the controller isn't connected or the RetroArch's autoconfig isn't enabled for the specific game, it works as it should.

This bug can also be seen in 0.9.8 if i'm not wrong, 0.9.7 seems to have way less issues with controls in general (which i'm not too surprised).

schellingb commented 5 months ago

So am I right that you have a real keyboard's keys bound to the RetroPad in RetroArch and want to not have the emulated keyboard in DOS to be controlled by your actual keyboard? RetroArch has a feature called 'Game Focus' but that does the exact opposite thing you seem to want. It disables hotkeys and RetroPad inputs caused by an actual keyboard so a full emulated keyboard can be used without double inputs like that. So it would end up pressing "Key Up" but not the mapped "Keyboard 3" anymore in your case. As far as I know there is no feature in RetroArch to disable raw keyboard event forwarding so pressing a key on the real keyboard will always also press it on the emulated one.

We do have a way to disable inputs from a real mouse (or touchscreen) which originally was intended for running on mobile phones where one uses the touchscreen for on-screen buttons. This seems similar where we would need to add a new core option to ignore all real keyboard inputs and only do what is mapped on the RetroPad.

unixatch commented 4 months ago

There seems to be a misunderstanding (it was midnight in bed when I wrote this after all).

I don't have an actual real and physical keyboard attached to my phone (be it Bluetooth or cable), the bindings you see from my RetroArch screenshot are automatically generated when you try to connect the DualShock, autoconfigs. I didn't create or changed them in anyway, RetroArch did the work for me, I can't remove the damn bindings on the D-Pad buttons even if I tried, for the RetroArch's autoconfig.


Something that I didn't mention tho is that this bug isn't present in 0.9.7, it is in later versions like 0.9.9 (my bad, sorry).

Anyway if you want I can provide some footage whenever I can do that, so that everyone is on the same page. Or the files needed to reproduce the bug (.rmp, PADMAP.DBP and the save file .zip, .cfg, .opt).

Let me know if there are other things to ask, I usually don't explain myself perfectly even if I try my hardest sometimes.

schellingb commented 4 months ago

Sorry for the confusion, I saw "Button B = Key z" and thought backwards that it meant a physical keyboard Z key was bound to button B.

Ok, but now I'm maybe even more confused :-) There seems to be a bug in RetroArch where the settings screen Settings -> Input -> RetroPad Binds -> Port X Controls shows old labels (in the left column). It will show the functions as they were at core startup, not current. If things change (either with the in-core gamepad mapper or under Quick Menu -> Controls -> Port X Controls) it won't refresh until the next time the core is loaded (just doing Quick Menu -> Restart is not enough). That said, if the in-core Gamepad Mapper says "D-Pad Up" on Controller 1 is "Keyboard 3", that really should be the only function done by "D-Pad Up" on RetroPad 1. Can you please check (either with the in-core gamepad mapper or under Quick Menu -> Controls -> Port X Controls) what other ports are configured to? For example it might be possible that Port 2 is mapped with the auto mapping and that Port 2 is somehow also bound to the same DualShock controller. If that doesn't show any issue, can you go to Settings -> Input and set Maximum Users to 1 and fully restart RetroArch and see if things change.

unixatch commented 4 months ago

I've done some further testing and it selects "Generic Keyboard" on port 2 (which is fine, not a bad thing) BUT for some reasons when I'm in port 1 it also uses the bindings present in port 2, at the same time!


So in short, let's say the same example: "Keyboard 3" on D-Pad Up on the controller in port 1, In port 2 i've noticed that it selects "Keyboard NP-8" which I assume it is number 8 on the numpad on a keyboard and I know that it also means arrow up if you enable NUM LOCK.

It uses both port 1 and 2 at the same time when it should only use port 1 if I'm in port 1. 0.9.7 seems to correctly use port 1 bindings and not port 2, as it should.


It seems like a little regression that can be fixed easily but I know next to nothing about C++ or C so I can't really comment on that.

schellingb commented 4 months ago

Can you go to Settings -> Input -> RetroPad Binds -> Port 2 Controls and check what Device Index is set to? It is possible to set the same physical controller device to control multiple ports. I did try to set things up the same way but I can only get double inputs when I associate a physical controller to both RetroPad ports. It all seems to work as I expect. Though I am testing only on a Windows desktop. I can look into connecting a controller to an Android phone I have.

unixatch commented 4 months ago

It is the same index, 1 and that is my DualShock.

Screenshot_2024-02-04-19-08-07-29_a845f06d2c9842610668be6995f9e34f

And ok, it is my fault but this is the first time that I see it working this way on a core, it's the only one that I've noticed.

Now that I understood the problem where it was, I can close this one if you want it.

RetroArch's so complex that it's easy making mistakes like this, even for experienced users so no biggies, I'll play with 1 port only from now on.


~~Edit: Now that I thought about it, when RetroArch gets freshly installed (1st time ever) for a new user, it automatically sets by default more than 1 max port available and also binds the controller's index to both ports from what I've noticed.~~

~~So if this is a feature, I have to say that it might confuse some people and maybe it should be written somewhere that it is like this.~~

Edit 2: I did this for the Psycho Mantis boss fight in MGS1 and most likely forgot to disable it, so what I wrote in the 1st edit doesn't count at all and it's completely horses**t, I'll close it down.

schellingb commented 4 months ago

Glad we figured this one out. I totally agree with RetroArch being very complex especially when it comes to input. Of course the complexity is what allows it being so versatile. But it is very tough to "debug" issues a user has. But I think things are slowly getting better. I feel like a year or two ago I had more issues. Or maybe I just got used to it 😨

Anyway thanks for closing this issue, I'm more positive now that in the end the core does everything correctly.