mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.29k stars 117 forks source link

macOS gamepads not recognized #842

Closed tompacyk closed 3 years ago

tompacyk commented 3 years ago

Are there any docs or tips on how to set up or debug the controller support? I have a couple of Buffalo SNES USB controllers and a Retro-Bit Genesis controller that both work fine in RetroArch, but give zero response inside of Pegasus.

If I navigate to the Change gamepad layout screen neither of them show any activity when I'm mashing on the buttons (side question: is the visual there supposed to be showing button activity? I'm not clear if I'm looking at a static picture or a real-time representation of what's happening.)

My lastrun file says something like "SDL2: Using default layout for gamepad #0"

I can get the SDL2 Gamepad Tool to recognize both and spit out a mapping file, but I can't find any docs on how I could manually put that config in to Pegasus. Is there a separate file for gamepad configs that doesn't get created until you can successfully customize one? Is there an example posted somewhere?

mmatyas commented 3 years ago

Thanks for the report! I'm surprised to hear the Gamepad Tool recognizes the devices while Pegasus doesn't; after all they are both based on the same code. If the tool has some logs, could you post it here?

The custom controller configurations are stored in sdl_controllers.txt inside your config directory. If it doesn't exist, you can create it manually too. You can then add the config created with the Gamepad Tool here, one line per config. You will see a log message on Pegasus' startup if it has been found.

After that, yes, the gamepad screen should show you the button presses and stick movement in real time, even if not all of the buttons are correct the first time.

There's also a --disable-gamepad-autoconfig command line parameter for Pegasus that disables using the default layout, though it might not help if the gamepad is not well detected in the first place.

tompacyk commented 3 years ago

Building the sdl_controllers.txt file worked — that was the secret sauce I was missing and couldn't find in the docs. Thanks!

2 of my 3 controllers work great this way. One of them (Retrobit Sega Genesis 8-Button), listed first here, does not get recognized at all. I see the error in the last run and have double-checked the config was copied correctly a few times now. Any ideas where to look next on that one?

sdl_controllers.txt

030000000d0f0000c100000072050000,RetrobitSega,platform:Mac OS X,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpdown:+a1,dpleft:-a0,dpright:+a0,
03000000830500006020000002010000,Buffalo SNES,platform:Mac OS X,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpdown:+a1,dpleft:-a0,dpright:+a0,
0300000000f000000300000000000000,Nintendo,platform:Mac OS X,a:b2,b:b0,back:b4,start:b6,dpup:-a1,dpdown:+a1,dpleft:-a0,dpright:+a0,

lastrun.log

2021-05-29T15:26:57 [i] SDL version 2.0.10
2021-05-29T15:26:57 [i] SDL: loading controller mappings from `/Users/tom/Library/Preferences/pegasus-frontend/sdl_controllers.txt`
2021-05-29T15:26:58 [i] Gamepad: Connected device 0x0 (Buffalo SNES)
2021-05-29T15:26:59 [e] SDL2: could not open gamepad #1
2021-05-29T15:26:59 [e] Error reported by SDL2: Couldn't load stick calibration
mmatyas commented 3 years ago

I've just updated Pegasus with a more recent SDL version. Could you check the latest release whether it improves compatibility for your gamepads?

tompacyk commented 3 years ago

Will do. I'm trying to follow the build doc guidance and muddle through the SDL installation and flag setting, but it looks like those files you edited pull the latest version dynamically. Is there a better/newer way to do the build that takes advantage of those YAML files?

mmatyas commented 3 years ago

Oh, you can just get the latest version from https://pegasus-frontend.org with these changes. Or would you like to build it manually? The build docs should still be fairly up to date.

mmatyas commented 3 years ago

I was in a bit of a hurry, but in more detail, the YAML files are the scripts the build server runs; if you have the same environment set up, you can run the same steps locally to produce the build. This is why the recent changes were only made in those files.

The documentation here https://pegasus-frontend.org/docs/dev/build/ should be up to date; for the SDL part, you can copy the flags from the YAML, though depending on the system and libraries, some changes might be necessary.

tompacyk commented 3 years ago

Ah, I missed the download link to the latest. That's working for me now — I have all of the controllers functioning with the latest change.

mmatyas commented 3 years ago

Great!