-
Notifications
You must be signed in to change notification settings - Fork 96
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
Accelerometer not working on Android on some phones #151
Comments
gotta name it v0.0.0.0.2 to get the point across some people apparently |
This emulator will never work with all early iPhone OS titles, and supporting a large number of them requires a huge amount of work. If someone told you that this emulator can run any iOS game, then please complain to them, not me. Obviously, I want to support more titles, but it's not like I can just snap my fingers and suddenly the entire library is available. Emulator development is not fast or easy.
The accelerometer is supposed to work, and it does for me. Can you tell me what phone you have, and what version of Android it's running? |
Apparently someone has this issue on the “Redmi Note 9 4GB/128GB, running Android 12 and MIUI 13”. The highest Android version I've tested myself was Android 11, so perhaps that could be the problem. |
I was about to open an issue myself and found this, and yes accelerometer doesn't work on Redmi Note 12, Android 13 MIUI 14. I'm starting to think it's a Xiaomi issue but it does work in other apps. Please let me know if there's any way I could help. Great job on the emulator btw, nice progress y'all |
Seems like a MIUI issue because it doesnt work for me as well (MIUI 14 with Android 12, Mi10T with Snapdragon 865), please let me know as well if there's any way I can help |
If anyone can test on an older MIUI version, that'd be helpful. |
It seems to be a specific issue with MIUI 14. |
Accelerometer doesn't work for me as well (Redmi 10C, MIUI 14, Android 13) |
Someone with “Android 10 on Redmi Note 7” also had problems. Very consistent Xiaomi pattern here… |
Someone with a “ZTE A7040” reported the same issue. That's the first non-Xiaomi, non-MIUI device. Huh. |
Based on the logs obtained by some of MIUI user on Android I think the problem is that a fingerprint device is detected as a controller and take a precedence over accelerometer (same issue as libgdx/libgdx#5596) I think filtering out |
Log file from that user: log.txt |
If i could test i could test the android 12 version, but i cant use the app since it crashes |
Can confirm this issue still exists on 0.2.2 on HyperOS (miui) 1.0.4.0 (android 14) Poco F5 |
On a Redmi Note 11 Pro+, with MIUI 14.0.7 and Android 13, the accelerometer won't work either. It might just be broken on models with fingerprint sensors on the power button. |
I managed to fix the problem, at least partially on some devices. modifying the file in touchHLE/vendor/SDL/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java I added a filter to check that the fingerprint sensor is not a jostick: // Check if a given device is considered a possible SDL joystick
public static boolean isDeviceSDLJoystick(int deviceId) {
InputDevice device = InputDevice.getDevice(deviceId);
String deviceName = device.getName();
// We cannot use InputDevice.isVirtual before API 16, so let's accept
// only nonnegative device ids (VIRTUAL_KEYBOARD equals -1)
if ((device == null) || (deviceId < 0) || deviceName.equals("uinput-fpc") || deviceName.equals("uinput-fortsense")) {
return false;
} Or Alternatively // Check if a given device is considered a possible SDL joystick
public static boolean isDeviceSDLJoystick(int deviceId) {
InputDevice device = InputDevice.getDevice(deviceId);
String deviceName = device.getName();
// We cannot use InputDevice.isVirtual before API 16, so let's accept
// only nonnegative device ids (VIRTUAL_KEYBOARD equals -1)
if ((device == null) || (deviceId < 0) || deviceName.matches("uinput-.*")) {
return false;
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I have hidden the comments about Steam Deck, it does not run Android so that's off-topic. |
I do not have an affected device to confirm if it's working. Regardless, I think we would prefer to not modify SDL Android code as it's currently just symlinked to the repo. |
@ciciplusplus My device is a Redmi 12c with Android 12 which is affected by this problem and the solution I proposed works modify the controller_added() method in the window.rs file for not touch the SDL files as you suggested. fn controller_added(&mut self, joystick_idx: u32) {
let Ok(controller) = self.controller_ctx.open(joystick_idx) else {
log!("Warning: A new controller was connected, but it couldn't be accessed!");
return;
};
let controller_name = controller.name();
if env::consts::OS == "android" {
if controller_name.starts_with("uinput-") {
return;
}
}
log!(
"New controller connected: {}. Left stick = device tilt. Right stick = touch input (press the stick or shoulder button to tap/hold).",
controller_name
);
self.controllers.push(controller);
} |
@Oscar1640 Nice! Please follow https://github.com/touchHLE/touchHLE/blob/trunk/CONTRIBUTING.md to submit your patch set if you want it to be merged. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
A fix by @Oscar1640 has being merged here a5e501c Many thanks for that! Could someone with an impacted device confirm that problem is indeed fixed in the last trunk Android build? |
I can confirm this build fixed the accelerometer issue |
Thanks for confirmation! |
@ciciplusplus Will this be added to the changelog? I think it is the headline feature for a lot of Android users. |
@hikari-no-yume yes, it should be there. will do chanelog update later |
It feels like version v0.2.0 is not very complete, some games like some games are not compatible and only some games are in the active list and there are a few versions that don't work, can't tilt the phone left or right to play racing and play games that require tilting and shaking the phone. Hopefully v0.3.0 will fix these 2 bugs
The text was updated successfully, but these errors were encountered: