Emulator Issues #11662
closedGamepad doesn't work on ChromeOS [includes fix]
0%
Description
Game Name?
Game-independent but I tried with Super Mario Sunshine
What's the problem? Describe what went wrong.
When using Android version on ChromeOS GamePad can be configured but in the game no reaction to button presses
What steps will reproduce the problem?
- Get a Chromebook with Android apps support and a bluetooth gamepad
- Install Dolphin from Play Store
- Add any game
- Go to config and bind the buttons to a bluetooth gamepad
- Start a game
- Press any buttons on gamepad
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
yes
Is the issue present in the latest stable version?
yes
What are your PC specifications? (CPU, GPU, Operating System, more)
Pixelbook.
Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)
The issue comes from the fact that getDescriptor on ChromeOS returns "" for gamepad which is actually within the specs as the speconly guarantees the stability of ID, and "" is a valid ID. Then in Source/Android/jni/ButtonManager.cpp we have lines like:
sscanf(value.c_str(), "Device '%127[^\']'-Axis %d%c", dev, &bindnum, &modifier);
Unfortunately %127[^\'] doesn't accept empty string, so you need something like:
if (value.find(""Device ''") == 0) {
dev[0] = '\0';
sscanf(value.c_str(), "Device ''-Axis %d%c", &bindnum, &modifier);
} else {
sscanf(value.c_str(), "Device '%127[^\']'-Axis %d%c", dev, &bindnum, &modifier);
}
This needs to be modified in 4 places in Source/Android/jni/ButtonManager.cpp: 2 time with -Button and 2 times wit -Axis.
With this changes gamepad and Dolphin work perfectly on ChromeOS.