HOWTO: Multiple controller configs in ScummVM + virtual kbd!
-
Although I don't use multiple controllers myself, I have to say great tutorial. I wonder if it would be possible to gather all infos for different controllers and create a file that can be downloaded by others or (if thats even possible) can be directly imported when building it from the RetroPie menu. I have not looked at the entire code, but does this have a fallback option if an unknown controller is attached? If that's the case, you probably should make a pull request to the main scummvm github.
I even would suggest to add more bindings to this. I personally have added some keys and have this layout on my Logitech F710 controller now:
#define JOY_BUT_LMOUSE 0 // A #define JOY_BUT_RMOUSE 1 // B #define JOY_BUT_ESCAPE 3 // Y #define JOY_BUT_PERIOD 5 // RB #define JOY_BUT_SPACE 2 // X #define JOY_BUT_F5 10 // Home/Guide #define JOY_BUT_F1 9 // Start #define JOY_BUT_RETURN 8 // Back/Select #define JOY_BUT_y 6 // LT #define JOY_BUT_n 7 // RT
The default keybings mostly cover only Lucas Arts games. I added F1 for Discworld, Y and N for Simon the Sorcerer and to input simple names for savegames (not perfect but at least I don't need a keyboard). I also added ENTER because I thought it could be useful in some cases where I have to confirm something.
I can see problems with controllers that don't have that much buttons, but maybe there is a way to configure a modifier button that can be hold/toggle to change the bindings of the face buttons. I did that before when we had to use xboxdrv for scummvm, but I'm lacking the knowledge if it can be done here.
-
@EctoOne I'll look into adding more bindings to controllers that support it. Thanks for the suggestion.
If none of the controller strings match then it falls back to the default buttons as set in the original source.
Yep, it could be the basis of a larger file that contains configurations for lots of controller types. On the other hand, a better and more comprehensive solution would be some method of either letting users set the binds themselves in a config file (this seems to be some kind of heresy in ScummVM land) or reads the ES or RA configs and uses that instead. This is well outside of my capabilities at the moment.
I'd need to read more of the code to determine how they handle modifier buttons.
ScummVM is an awesome project and does what it does extremely well, but for some reason their work on the UX side appears, to a casual external observer like me, to be haphazard and extremely slow. I mean 10+ years of debate about whether or not to allow users to set their own controls in the config file! 10+ years of a "kinda usable" on-screen keyboard implementation. The documentation on the Wiki is also really outdated in parts, and again I suspect that's because actually finding out what's what is difficult.
I don't know if this is because the internal politics of ScummVM makes it change-resistant or (more likely) that reverse-engineering game engines and interpreters is more fun and sexy than mundane backend work.
This hack would never survive a PR for many reasons,
but the main one is it uses a standard C++ lib which is frowned upon in ScummVM. Why does it use a C++ lib? Because I don't know any better.Removed C++ lib dependency!It is ultimately my hope that a ScummVM dev sees this hack and is horrified enough to do something about it. :D
-
I'm rebuilding ScummVM with the keymapper and virtual keyboard enabled to see if/how they work. Maybe some useful functionality is in here already but disabled. Probably not, but we'll see.
-
@stoo Of course having a way to change bindings with the gui would be awesome. I mean I installed Amiberry again last night because they managed to get custom controls working and it is just so good to find the perfect mapping while playing.
I also have to agree that the front end development seems to be not that important. The fact that there aren't even simple things like working themes around since they changed the theme engine is kinda sad. Also, even though I'm not really following the development very hard, but when they released version 2.0 and I was looking for the Android SDL version, I believe that someone said that he is the only maintainer of that port and that's why it will take some time to get it working.Yet again I'm happy enough that the game engine development is so active and that there are ways to work around the small issues. I grew up with the Lucas Arts games and in general Point and Click games is my favorite genre. I'm looking forward to play some of the recently added SCI games because there are some I missed when they were initially released. And nowadays I don't enjoy it to sit in front of my PC to play games but I like to play console games and scummvm on the Pi is just that.
-
@ectoone I just checked the Master branch of ScummVM on Github and it looks like someone has recently started preliminary work on proper gamepad support.
Obviously, they might never actually finish it, but the recent activity on that front gives me hope that this hack will not be needed in the nearish future.
-
@stoo said in HOWTO: Multiple controller configs in ScummVM:
Obviously, they might never actually finish it
I've been pretty impressed with how extensive scummvm development is. I have high hopes for this
-
@herb_fargus As I noted above, they're awesome when it comes to the engine side...
...the backends are slightly more hit-and-miss :P
-
The current scummvm master branch has a branch for SDL2 controller support (PR1088) merged in. This maps most of the buttons to keyboard+mouse functions.
If you want to try it out you can compile from current master or wait till the next non-bug-fix release (2.1.0).
-
@dafioram Sounds good. Depends, of course, on:
- How is button/axis mapping performed? (i.e. ES uses SDL2 but, of course, you still have to provide the controller mapping)
- Is it configurable in the UI or .ini file? This is more important than actually having SDL2 controller functionality enabled.
I'll take a look at the branch and see what the progress is like.
On a semi-related note:
@EctoOne The built-in keymapping stuff is quite unfinished and would require a lot of work that I'm not qualified to do to make it usable in the sdl2 backend.
On the other hand, I enabled virtual keyboard support in ScummVM and bound a button to it in sdl-events.cpp and it works!
It's a little bit cumbersome, and the way it works is it simply pauses the game, displays the keyboard and you enter characters (remembering to press Return/Enter on the virtual keyboard at the end!) and when you press the green tick button it unpauses the game and sends the respective keystrokes as input.
It works well enough that you could use it in SCI/AGI games to enter keywords with a joypad. You can't really use it to directly control the character's movements, etc, for obvious reasons.
Afterthought: it would be awesome if it had a list of built-in general keywords for each game and had a rudimentary predictive engine based on them (being careful to exclude potential puzzle-spoiling words, item names, etc). This feature appears to exist in the Nintendo DS port.
Edit: stupid youtube embedding thing screwed up my markdown.
-
@dafioram Lol, I only just now realised you're the same guy from the ScummVM forums where I mentioned the vkbd speed bug. /wave
-
Hey,
I just did this tutorial and built and installed from source twice after making said adjustments and my PS3 controller STILL is using the default mappings. What am i missing here? Do i need to first remove previous existing installed Scummvm by retropie before doing this one or what is the thing i am missing?
Cheers
-
Nevermind i figured it out. The guide dosen't it make it noob clear that after you have built your own version you still have to actually move the binary to the appropriate folder but as i said in the end i figured it out :)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.