-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure gamepad on Linux #35
Comments
Is the flatpack built with the latest code from this repository? |
Well, its the Flatpak that comes with Kubuntu 22.04 by default. I installed it using Discover. It says "Source: flathub (flatpak)" and "Version: 1.0, published 03.04.22". It links to this GitHub repository. I have have no idea who maintains that flatpak. |
@drfiemost I created the flatpak image last year, mainly to make Hurrican available on the steam deck. The commit it's built off is cb4d008 Ideally the flatpak repo should get automatically updated by a CI job whenever this repo has a release tagged. I didn't set it up that way back then because there was no recent-ish release. @Silicomancer which controllers are we talking about, and what do you mean by "trigger button"? Usually, the triggers are analog and not buttons |
A Final Fantasy XIV controller. It has button numbers imprinted on it. I attached 2 images where you can see the numbers. The button I want to use as a fire button (only) is 8. The other one is a very old Saitek P220 controller: https://www.picclickimg.com/cJIAAOSws81jJuJ0/Saitek-P220-Digital-USB-PC-Controller-Pad.webp Both behave exactly the same with Hurrican. I'm sure that I used one of them (maybe both?) many years ago to play Hurrican on Windows. |
Would it be possible to add a setting for the pause/exit/escape function? This surely would allow fixing the behavior anyway. |
Ok, so the 'x' button issue is related to #27 which was merged after the flatpack build. Not sure about the gamepad, you should check in the log if there's a line mentioning 'Start function mapped to button START'. If not it defaults to button 7. |
Where can I find the log? |
For the flatpak version it should be in /tmp/ @drfiemost I'll try to update the flatpak version over the weekend |
I couldn't find it... |
The file is Game_Log.txt, the directory is not specified so it should be the current dir from where you launch the game, maybe your home? In case the start button is not correctly detected you may try tweaking your gamepad mapping to workaround the issue as mentioned here drfiemost#13 (comment). |
I just installed the updated version. Thanks a lot! I found the log here: This should probably be the relevant part:
|
Yes, that's it. I see the standard buttons are not being mapped. @thrimbor is the flatpack built with SDL2? |
Yeah, SDL 2.24.0 |
Good, so the gampad should be supported. |
Sure. How do I do that? I started the SDL2 Gamepad Mapper application and this is what it says:
Does this help? Do I need to do more? |
Ah, your controller's GUID is slightly different from the one in SDL. Try setting the following environment variable before running the game:
More details in the arch wiki. If it works it might be worth reporting to SDL for inclusion in the controller db. |
Just tried as you said. I run the export command and then started Hurrican in the same bash. Behavior didn't change. Also the name of the controller ("FUJIWORK CO., FF-GP1") in the configuration menu is the same. I guess this means the env. variable was ignored or overruled. I tried the same with that SDL2_Gamepad_Mapper tool. The tool finds the env. variable and it changes the disabled controller name from "FUJIWORK CO., FF-GP1" to "FF-GP1". So I guess your idea should work. Could it be flatpak related problem that the env. var. is not found? |
Not familiar with flatpack but flatpak-override --env seems to be what you're looking for. |
I have never used flatpak before. I tried to pass the env. var. via CLI but it didn't work. I got errors. I tried flatseal instead. It allows to permanently set an env. var. for a selected flatpak application. I added the new variable successfully but I can't see any effect in Hurrican. It still shows a "FUJIWORK CO., FF-GP1" controller. @thrimbor Any ideas? |
Any idea how to proceed? I guess I should report the missing controller to the SDL team but currently I don't think this will resolve the issue. I suppose something else is wrong as well. The fact that two completely different game-pads suffer from the same problem is a strong indicator that the issue is not (only) controller related. Has someone tried to reproduce my issue using another kind of game-pad? |
My gamepad (a cheap xbox controler clone) is recognized out of the box
and the GUID is not even in the DB
I also notice that there are kernel drivers loaded, including the force-feedback one
I'm clueless at this point, guess you'd better ask the SDL guys for advice. |
You are right, Hurrican reacts in a different way. I don't see those mapping messages. But why? There must be some condition in the Hurrican code... what condition causes Hurrican to do the mapping? I am afraid that asking the SDL guys will result in a "Hurrican? We don't know what Hurrican does internally. Your problem doesn't look like a SDL issue. Ask the Hurrican guys!". I guess we need to understand more of what is going on in Hurrican before I can ask the SDL people. Have you tried to use the right shoulder button #8 as fire button? Does it definitely work for you? |
There is just a call to SDL_IsGameController, which in your case returns false: Hurrican/Hurrican/src/DX8Joystick.cpp Line 115 in 5f5039d
We also use SDL_JoystickHasRumble to detect if force-feedback is supported.
Hmm, both L2 and R2 are not recognized, maybe they're treated as analog and not handled, need to check... |
Hm. Not much information in the web. But looks like this issue actually could be caused by missing controller mapping. Which would mean I had the luck to use two controllers without supported mapping. I tried to find more about that. And I looked into the SDL database header you linked above and I looked into SDL2 Gamepad Mapper tool again. This confused me a lot. The mapper tool detects the controllers as "FUJIWORK CO., FF-GP1" (03005036852100000201000010010000) and "SAITEK P220" (03003d0ba30600000701000000010000). But I could not find the controllers in the header file. There is nothing like "P220" in the header. There is a "FF-GP1" in the header. But nothing like "FUJIWORK". So where does the SDL2 Gamepad Mapper tool take the full names of my controller from? Additionally the tool says "mapping available" for both controllers. But I could not find the IDs in the header. So where does the SDL2 Gamepad Mapper tool take the mappings from? It feels like the mapping tool works different compared to Hurrican. Are there any external databases the tool could use additionally to the compiled header? Or maybe a local file? A system file? An online DB? |
It seems Gamepad Mapper downloads the file from https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt BTW as I supposed L2 and R2 are handled as axis and not as buttons so there's some work to do to support them. |
Could be a good idea for Hurrican anyway. I saw there is a special function in the SDL API for loading mappings from a file easily.
I found two mappings for "Saitek P220". But you are right that my controller IDs aren't mentioned there as well. Are those IDs monolithic or do they contain sub-fields with specials meanings so that they could be matched like patterns? |
It looks like the GUID contains sub-fields, if there's no exact match a partial match is tried. The FF-GP1 is included in the SDL2 db so it should be supported out of the box and the P220 could be configured with the SDL_GAMECONTROLLERCONFIG env variable. Maybe trying with a minimal test program that calls SDL_IsGameController could help. If it still doesn't work it should be reported upstream. |
Very good. This could also explain where the vendor name came from. Well, since the mapping tool already matches both of my controllers I would like suggest to enable Hurrican to load the Text file in the same way first. This seems a good idea anyway and it would improve Hurrican independently of this issue. And I could re-test the behavior of both controllers easily. I guess the chances are good to fix this issue this way. |
Fine, we can provide a copy of the game controller db in the data dir and load it at startup, it wouldn't hurt. |
Thanks a lot. I can't wait to test it :-) BTW, since I already tried the environment variable and it didn't work for me... would it be possible for me to edit the text file in the released flatpak? This would be a way to test mappings in case the default database text file doesn't solve the problems entirely. |
The change is ready (see #38), I want to give it another spin in the weekend before merging. I have no clue if it's possible to edit files inside a flatpak, you'd better refer to the docs for this. |
Ok, looks good. I will try it as soon as I can see a new flatpak in the repo. |
Ok, the problems should be fixed now (#38). There is still a pending issue (#39) that will be merged in the upcoming days but it seems the Linux version is not affected for some reason. |
Flatpak update is out. |
Ok, good news and bad news. For the P220 controller I can see the mapping log messages now. I guess it is an SDL database issue that my other controller isn't detected in the same way. However the behavior didn't change. The game still exits AND shoots when pressing button 8. For both controllers. I guess there is another bug luring in the code. Am I right that button 3 should exit an active game with the P220 now? I tried it and button 3 doesn't do anything. Also there is no other button (except button 8) that exits.
|
That's a nice step forward! The remaining problem is the P220 has no start button so the default button with id 7 is used. This can be fixed by using a fallback mechanism, something like:
I'm not a gamer so this may not be the best choice but at least it seems tha buttons A, B, X and Y are always available. As for the other controller you'd better contact the SDL_GameControllerDB project, they sure know better what to do. |
What about adding new entries to the configuration menu where users can select the corresponding button(s)? |
Regarding the controller: |
There's not enough space left in the controller menu, also I don't think it would belong there.
Cool, GCDB updated! If @thrimbor can rebiuld the flatpak (hopefully the last time for now) you should be able to enjoy the game with your controllers. |
Update is out now |
Tried it. For the FF-GP1 behavior didn't change. For the Saitek the behavior changed. But not better, only different. The exit button now is hard wired to button 1 which should be the jump button. So now whenever I try to jump, it exits the game. This is my current log:
|
Hmmm, maybe using button X as a fallback was not a good idea :/
As for the FF-GP1 I don't know, there are 273 mapping loaded on more than five hundred lines in the GCDB, maybe it's being skipped for some reason? |
Well, I don't know much about game controllers variants. But I guess the safest thing would be some configuration settings. I simply have no idea if it is possible at all to find a fall back or default that works for all controllers.
I guess this is a good question for the GCDB project... I suppose the people there can answer this easily. Would you like to open an issue there? I would prefer you to ask because you wrote the GCDB code. |
Added a follow-up on your issue. |
Opened libsdl-org/SDL#7700 |
@Silicomancer any way you can check the proposed patch? libsdl-org/SDL#7700 (comment) |
Also add Final Fantasy XIV mapping as suggested at libsdl-org/SDL#7700
Added the suggested mapping to the GCDB. If @thrimbor could update the flatpak and @Silicomancer test it we can report back if it works, thanks. |
Done |
@drfiemost Did you include any change regarding the default button issue? |
I can't see any changes in the log:
|
I tought I did but I was wrong. I should remove the fallback to X button since it was a bad idea. Not sure how to improve the situation though, I was thinking of a --start-button command line option but it could cause trouble when using two gamepads.
Not sure what to think, guess you should handle the issue with the SDL team. |
The start function is required in game too and it may conflict with the usage of X button
I tried to install the fantastic Hurrican game on Kubuntu 22.04 via flatpak. The game seems to run fine but I'm unable to configure my game pad (I tried two completely different pads) in a usable way.
I could select all my desired mappings just fine. This includes using the right trigger button (displayed as button 8 in the game settings) as fire button (this mapping is important for me).
The configuration works completely. However whenever I press the selected fire button the game exits to the main menu like when pressing the escape button. It appears to me that the trigger button now has two functions: Fire (as selected by myself) and some pause/exit/escape function (I could not find a way to modify this function).
Is this a bug? Is there a workaround?
BTW In case of keyboard configuration I noticed that I can not select 'x' as a fire button at all. I simply don't get any reaction. I can use virtually any key... except 'x'. Maybe this is connected to the game pad issue?
The text was updated successfully, but these errors were encountered: