Open pckeller29 opened 3 years ago
Just an update. I can press 2 buttons on the same on screen button group. I mean I can press up and left together for example. Or fire and jump. But I can't press left and jump.
Hi. Is it a multi-touch issue or are you trying to press multiple buttons using the same finger?
The first has always been possible, but the second one was introduced with Lemuroid 1.9.0. If you press right in the middle of two controls (such as the buttons A and B) they should both be fired, but maybe we can tweak the threshold a bit to make it easier.
I think it's a multitouch issue. For example, in Super Marioland on Game boy, my left thumb controls the direction of Mario while the right thumb makes him jump or shoot. this does not work. If I want to move while jumping, first I press 'A' on right button group to jump, then, immediately AFTER (not during, doesn't work) I press 'right' on left button group to change the jump direction.
And yes, you're right. If I press between left and right with one finger, both trigger.
Hi! It happens the same on my emulator (pizza boy). event.getX() and event.getY() return bad coordinates if two fingers touch the screen simultaneously. It seems most of the recent Samsung devices are affected after the update to android 11.
I've filed a bug to samsung but they asked for a demo video and a debug dump. Unfortunately I don't own a samsung device :(
OK thx for the update. Will think about that. Actually, I don't know how I could make a video of this. Also for a debug log ? How ? What ?
Don't see any solution. Too bad. Thx
Actually @davideberra just made a fix for his Pizza Boy emulator. It now works perfectly for Samsung with Android 11. Maybe a similar solution can be used for Lemuroid?
I think we should keep the issue open!
Ok, I was actually sure we were dealing with an Android 11 or manufacturer regression here, but I'm no longer sure about it.
Thank you @davideberra for giving some insight on the matter. Were you able to fix the issue or at least find a suitable workaround?
Oh looks promising. Thanx for having it reopened.
Hi!
On a Samsung Galaxy S10 with the Play Store version, I'm facing a similar issue. Like mentioned above, it is only possible to use multi-touch for only one group of controls at the time. I've created some gifs to illustrate the problem. Hope this will help. Here, notice I'm using only one group of controls at the time.
If I'm trying to use both at the same time, it doesn't work.
I've experimented a little and found that it is actually possible to press both control groups at the same time in certain conditions. When I'm pressing on one control it seems like the touch events of the second one are offset. I've tried to show this behaviour in this gif. Notice also the d-pad changing to down will doing this.
Keep the good work! This is an amazing project.
Great explanation. Looks exactly like my issue. Thank you.
Thank you very much @GbBrou, this is very helpful. It's very strange. It looks like subsequent events are reported relative to the first touch (as opposed to the parent view).
I've tried a small fix in this apk: https://drive.google.com/file/d/11sr53Bxs4K-FDUNT7NaMzpMzpbZb6NoB/view?usp=sharing
It's a small sample application that uses RadialGamePad, are you guys able to reproduce the issue there?
Seems to work perfectly.
Even more then necessary 😆
@GbBrou That looks promising. Thank you very much for testing it out! I'll push out an update over the weekend on the beta channel to address this.
Seems good on mine too.
Ok guys. As promised I pushed an update on beta channel, if nothing breaks I'm gonna promote it to production in a couple of days.
For posterity (or for anyone else facing a similar issue), this is the fix: https://github.com/Swordfish90/RadialGamePad/commit/24bfa4ab8cd4fb61ce7d6f5582ece541c323adf7 .
Basically, MotionEvent.getX(index) on some devices, returns coordinates relative to the first touch (and we have no way of knowing when that happens). The solution is to use on API >= 29 MotionEvent.getRawX(index), which returns coordinates in screen space, and offset using View.getLocationOnScreen to retrieve coordinates relative to the View.
Thank you so much for looking into this @Swordfish90. The apk you attached earlier worked perfectly for me as well. However the new update on the beta channel is not doing anything good for me. It seems like the button offset is wrong. If I want to press the D-Pad I have to press a bit above the button. And if I press A and B button I get no reaction and cannot find anywhere on the screen that activates A and B.
Just checked the same update on one of my other phones running Android 10. Here it works perfectly. It is only a problem with Android 11 Samsung devices.
@coestergaard That's very unexpected... Maybe I built the package with the non-updated library. Can you confirm that you're running on version 1.9.1?
@Swordfish90. Yes, if I look at the app information it says 1.9.1. It is the same problem on both my S10+ and S20FE running Android 11 and both running 1.9.1.
Ok @coestergaard, thank you for double-checking that. Could you describe the issue? Is it behaving like it was before? Does it affect both single-touch and multi-touch or just multitouch?
Sadly I'm not able to reproduce it on my devices (or on the Android 11 emulator) so I can basically only rely on your reports.
Well @Swordfish90 it is different from before for sure. It now also affects single touch.
I cannot activate any buttons on the screen at all. Regardless where on the screen I single touch nothing happens. If I hoover my finger on the screen and moves around on the screen it suddenly triggers a button - but not on the right place.
Ok @coestergaard . I think the best way to tackle this is trying to understand the differences with the sample application I posted before (which I made sure uses the same code for handling touch events).
Is it possible that you're running Lemuroid with Game Mode or something that reduces the screen resolution?
No @Swordfish90, I am not aware that I should run any Game Mode or similar. I see a Game Launcher standard installed by Samsung and I have tried to disable this but that didn't change anything unfortunately.
Actually @Swordfish90 I just found out that a part of the Android 11 update for Samsung includes a default app called "Game Booster Plus" by Samsung. This is a standard bloatware app from Samsung which I really didn't ask for. Fortunately this app can be uninstalled from Samsung Galaxy Store. After having done that on both my Samsung S20FE and Samsung S10 and rebooted the phone everything works perfectly! Thanks for your hint about Game Mode which led me to this Samsung app.
Hmm, this is getting more and more weird. This morning when I woke up the problem was back on both my phones. Game Booster Plus is still uninstalled. After a reboot of my phones it worked again. It seems like the first time I run Lemuroid after a phone reboot it works perfectly. But if I then shut down Lemuroid totally (by closing it in the task overview) it will fail the next time I run it.
Just tried the same with the sample application you posted before. (the RadialGamePad app). This works even though I shut it down in task list and start it again. But for Lemuroid it consistently fails the second time I start it after a phone reboot.
Hey guys!
Two days ago I've made a little video which try to explain exactly what I think it's going on with this issue.
I used debug mode to display the outlines of the views. This allowed me to see where I'm supposed to start the touchs events. I also added, in post-prod, an outline to see where the offset buttons seems to be located.
Notice also there's a hidden issue in the video. While in the setup menu, I can hold the touch event and trigger the menu button several times. Menu views seems to stack up and I must press back multiple times to came back in the game.
Google Drive - Lemuroid Multitouch Offset Issue
Then I discovered something very interesting. By exploring the app Samsung GameBooster Plus, which is accessible in the Game Plugins app, I noticed there was different profile which allows user to prioritize performance or battery saving. By default, the profile for Lemuroid is to to Max FPS. I noticed there was a custom profile which allows to tweak each settings ourself. As you can see, the quality setting seems to be set to 75% by default. Which, I guess, is what the Max FPS Profile correspond to. By modifying this setting, I immediately notice the difference. At 50%, the multi-touch seemed to be even more offset. But guess what? At 100%, there was no more offset and everything seemed fine. 😁 So enjoyable! This problem seems to be related to the quality setting, which probably change the internal resolution or something to save performance. The Radial GamePad App does not seem to be listed in GameBooster Plus as a game. Which probably explain why it doesn't suffer of the same multi-touch problem.
Regarding the uninstallation of Samsung Game Plugins, it's possible that Samsung is still using those profiles in the background and GameBooster Plus only allows us to display and control those hidden parameters in the background. There's may be a delay, when rebooting, before the game profile system start. This is only speculation though.
Hope this will be helpful.
I still think changing the setting in Samsung GameBooster Plus apps is not the solution. It is just a workaround.
Hi @GbBrou Thanks. Yes you are right. Uninstalling this Game Booster Plus is not solving the problem. But changing the paramter as you described does solve the problem. Also after shutting down the application and starting again. So this issue can definetely be solved like that. It is a bit weird that other apps don't have the same issue though. Lemuroird must do something special. But at least we now have a workaround. Thanks for that!
Thank you @GbBrou, that was great. Not only you managed to clarify the issue, but you even found a workaround! It looks like raw coordinates are not scaled when the resolution is set to lower values.
Can @GbBrou or @coestergaard give a go to this apk: https://drive.google.com/file/d/192gprO8fuWovc3vUTCHHRr-9zyPCvhXN/view?usp=sharing
It's a debug version of Lemuroid which you can install next to it (with a flashy red icon), you can safely remove it when the tests are done.
Here it tries to estimate the display scaling by relying on the touch down event (which apparently is the only "safe" one).
I've also reported the issue to Samsung and I'll let you know if something comes out of this.
Thanks @Swordfish90. I tried to install this but I have a problem. It does not appear among the apps that can be handled by Game Booster Plus. I don't find anywhere to add apps manually in Game Booster Plus. Your debug version is working perfectly on my phone but I don't have the option to set the graphics quality. I haven't been able to figure out what makes an app to be handled by Game Booster Plus and I never manually added any apps.
Maybe if you could publish it on the beta channel instead. That would make it possible for me to test it. As I mentioned, it is working just fine but I cannot test it with Game Booster Plus where Graphics quality set to 75% unfortunately.
Hi @coestergaard sorry for the delay, but it has been a couple of crazy days.
I just finished up these changes and published a new version in beta, so you should find a new update in a few hours. Feel free to let me know if now everything works correctly.
Hi @Swordfish90. Thanks! No rush. I know this is all voluntary work.
The new version is working perfect if I set the "Graphics quality" to 100% in Game Booster Plus. However if I set the quality to eg. 75% it is still arcting a bit weird. All buttons except the D-Pad works. For the D-pad only the "Down" button works properly. If I press "Up", "Left" and "Right" briefly it works, but if I press and hold "Up", "Left" and "Right" it shortly triggers the correct button but shortly after it changes to "Down" being activated. So if I hold eg. "Up" for a second I end up having "Down" active instead.
Finally the multi touch pressing more than one button at a time is also not working when quality is set to 75%. E.g. if I hold the A button with one finger I can find the D-Pad with the finger quite a bit higher up on the screen than where it is actually drawn on the screen. Sorry about that!
I have made an example. First single touch where touch and hold on D-Pad doesn't quite work:
Next an example of multitouch where second touch is off:
This is with graphic quality set to 75%, With 100% i works fine.
thanx @GbBrou. It works for me too.
The workaround has not worked for me, using a samsung galaxy s20fe on android 11. The app was actually working fine on my phone prior to the newest update but now Im getting issues with single and multitouch
Hi guys. Yesterday I got an email from Samsung stating that they fixing the touchscreen coordinates in the latest OTA update. Can you take a look at it and confirm that's the case for you?
@sam-gilroy I also have a friend with the same device who reported the issue, so it seems that the Galaxy S20FE has a separate issue. I'll investigate it a bit and provide a switch for the two behaviours if I can't find a reasonable solution.
Hi @Swordfish90 I have just tested again on both my Galaxy S10+, S20FE and Galaxy Tab S6. They still have the same problem. I have received updates for all three of them recently. They all work if I set the quality to 100% but doesn't work if the quality is set to eg. 75%, which is default quality. I don't think the solution from Samsung works for Lemuriod I am afraid.
Hi guys. Yesterday I got an email from Samsung stating that they fixing the touchscreen coordinates in the latest OTA update. Can you take a look at it and confirm that's the case for you?
I have a Galaxy A70 device where I noticed this same problem some days ago. I can't say for sure because I didn't use Lemuroid for a while, but I think it started indeed since my device upgraded to Android 11 not so long ago.
Nevertheless, I just got an OTA update for my device some minutes ago and I can confirm that the touchscreen started to work fine after updating. Note that I don't have any Game Booster Plus app, only the stock Samsung Game Booster.
So at least for my Galaxy A70, the latest OTA update from Samsung fixed the issue without touching Lemuroid. The update is dated May 12, 2021.
UPDATE: It happened again for me :/ However I can confirm now that rebooting the phone fixes it again. So there is something else affecting the touch controls coordinates. I will keep an eye to see it I can figure out what it is for my case and report back. Sorry for the red herring.
Interesting development, after building and running from source, the debug version of Lemuroid doesn't have the button issue! Although it doesn't let you push multiple direction buttons together, every other combination works great. is the version on F-droid out of date or is the debug version different somehow?
Also how do you select the build flavor? it isn't immediately obvious, everything is quite convoluted. bit of a soup of one project built on another, it's probably worth mentioning in the readme that to build you need to embed the Lemuroid-cores project too.
is this where the touch detection code is? because I can't find anything: /Lemuroid-master/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/game/GameActivity.kt
Hi @smellymoo, thank you for taking a look into this.
Yes, the debug version works fine because Samsung Game Mode is not active. If you try a release build you should be able to reproduce the issue.
Considering the issue you're trying fix, I suggest you to build the "freeDynamic" variant. It downloads cores directly from github so you don't need to bundle them with your APK.
Not sure what you mean with one project built on another (are you referring to the multi-module or the origin from retrograde?). Also if you clone the project with --recursive, it should take care of all the submodules. Feel free to let me know if you have any other issue with it.
All the touch related code is actually in the RadialGamePad library here: https://github.com/Swordfish90/RadialGamePad/
only had a hour before bed to look at this, maybe more tomorrow...
got it building with "freeDynamicDebug", but didn't instantly build with "freeDynamicRelease", I'll look into the fails.
Not sure what you mean with one project built on another
sorry, I said that in a rude way, I am super impressed with your work and how you have managed to pull it all together! it's just hard getting your head round someone else's project :).
the debug version works fine because Samsung Game Mode is not active.
can you explain this, that really confused me! I don't understand how you have opted in to Samsung Game Mode in release mode and not debug mode (and why you would want to if that is true). I assumed it was automatic, I just tried my app, and it activates Game Mode, and I have never done anything special to do that. confused.
had a little look at radialGamePad, I honestly assumed it was only an overlay and you handled multi-touch manually / directly, but your using the layouts to detect button clicks? (only glanced at it so far).
got it building with "freeDynamicDebug", but didn't instantly build with "freeDynamicRelease", I'll look into the fails.
Is it possible you're missing a keystore for signing?
can you explain this, that really confused me! I don't understand how you have opted in to Samsung Game Mode in release mode and not debug mode (and why you would want to if that is true). I assumed it was automatic, I just tried my app, and it activates Game Mode, and I have never done anything special to do that. confused.
Sadly you can't opt-in or out from this and even setting the flag "isGame" inside manifest doesn't do the trick. I think they infer it from the category in which the application is published on Google Play, but that's my speculation. I also asked them to add Lemuroid to a blacklist (assuming there is one) until they fix the issue but got no reply.
had a little look at radialGamePad, I honestly assumed it was only an overlay and you handled multi-touch manually / directly, but your using the layouts to detect button clicks? (only glanced at it so far).
The first implementations used Layouts, but there were issues with customization and managing events across Views. I wrote RadialGamePad using a single custom View. This way we can have full control over touch events and customize it by simply passing a Kotlin configuration.
got it building with "freeDynamicDebug", but didn't instantly build with "freeDynamicRelease", I'll look into the fails.
Is it possible you're missing a keystore for signing?
nah fixed signing, problem with java.lang.ClassNotFoundException: com.android.tools.lint.client.api.Vendor
Sadly you can't opt-in or out from this and even setting the flag "isGame" inside manifest doesn't do the trick...
That is infuriating, as RadialGamePad doesn't activate the game-booster in release mode. Which is making debugging this issue unnecessarily convoluted. Is there a simple way to copy RadialGamePad into the Lemuroid project and get it building all together?
I am convinced that this issue is with RadialGamePad and not game-booster and that I can fix it. My theory is the process of computing the scaling is using the wrong value for total size, one that game-booster changes... My reason for thinking this is that my app is unaffected by game-booster, and it doesn't rescale the touch coordinates in the same way. leave it with me bud.
could you add me as a contributor to this and RadialGamePad? I would like to do housekeeping / green busting on the issues. I won't do any direct commits, I'll raise pull requests I promise.
Galaxy S21 on U1 firmware, Android 12, can confirm this issue still persists through the fdroid variant.
Having this issue as well on fold 3 with Android 12. Doing the fix above works. It's a odd issue...
Still having this problem on my s20FE with android 11
And my phone doesn't have game booster plus there is only one option on game launcher which is set to performance mode and I tried battery economy mode and it doesn't fix this either
Also can someone post the link to the apk?
All the links above are dead
Ok, I've tried to dig a bit deeper in this. I've cloned the RadialGamePad project and started digging. There are my findings and questions after a few late night hours:
getX()
method, it fixes this for me.But the fun starts when in portrait and using multitouch on both halfs. Then it breaks. So, I've added more logging in extractRawFingersPositions
method. The log string looks like this:
"$it ${event.getRawX(index)}-$offsetX ${event.getRawY(index)}-$offsetY $id->$index"
and behold what it logs when reproducing the bug:
FingerPosition(pointerId=0, x=-1513.0, y=254.0) -309.0-1204 328.0-74 0->0
FingerPosition(pointerId=1, x=-1825.0, y=746.5) -1699.0-126 820.5-74 1->0
Why is the X suddently negative?! And what's weirder, the X=0 coordinate is on the right side of the screen. So, the phone thinks we are sudenly touching outside to the left of the screen! And why is Y corrdinate still correct and only X is broken? So many WTFs...
Phone: Samsung Note 10+ Android: 11 Lemuroid: 1.9
Hi Don't know if it's my phone with the Samsung game stuff layer but I can't use more than one button at the same time. For example, in any game/rom/core, I can't run and jump at the same time or move and shoot... It's a pity for this really makes any game unplayable. I'm very sad ;-) I guess I'm the only one with this issue and it is probably because of my phone. I'd be happy to know about other Samsung/Note10 users. Is there a way to log this behavior ? Thank you