yashsingh1/xdaforums huggingface dataset:
[Xperia Play Android Development] farenheith:
Well... I think the problem is in the libinput.so, or other .so, idk... This problem happens without the fix (on FPSe, for example), but only happens in some games,.. It's very weird...

I tried to change the framework, to make less touchpad events been interpreted (1/3 and 1/5), doesn't take any difference and I don't recommend it, because some games doesn't have this problem... I really don't know what to do in this case, but I know that in ICS it doesn't happens, so, something change... but thanks for the test! I'll update the post #3 :)
[Xperia Play Android Development] bamsbamx:
Yeah its weird ! With ondemand governor, and overclocked to 1,3 GHz.... when it touch the pads, cpu skips from 138 MHz to 1300MHz...

We have to analize what is causing cpu work, maybe there are inputs in logcat...
[Xperia Play Android Development] farenheith:
I just have an idea of what can it be...

Every app I know/remember hat have lags with touchpads use this with java code (lara croft and fpse, for example). Rise of glory doesn't have lag.... let's see if it's using java implementation too...
[Xperia Play Android Development] farenheith:
I just have an idea of what can it be...

Every app I know/remember have lags with touchpads use this with java code (lara croft and fpse, for example). Rise of glory doesn't have lag.... let's see if it's using java implementation too...
[Xperia Play Android Development] bamsbamx:
See this, i have been touching pads for some seconds three times... it clearly can be seen how the cpu works... it is declared as user cpu%

Please ask over there if someone can do this with GingerBread or ICS... download cpu checker at google play an touch the pads during some seconds so we can se if this is normal...
[Xperia Play Android Development] bamsbamx:
Oh, you mean that those which are developed with NDK (c++) could have no lags?

It can be, because android docs say that it gives better performance as it makes instructions to the processor directly instead of using virtual machine... but how can you know if its developed natively or with java code?
[Xperia Play Android Development] farenheith:
There's a method called setProcessPositionEvents, that, on the sony framework, is used to activate the touchpad return on the onTouchEvent. This is the base of my fix, I create this method and the logic to it on the CM9/CM10 framework.

I do a binary search (using textpad) to see if this method is called inside the apk or inside some .so,

In the case os Rise of Glory, it's inside the .so,

I need some other game with touchpad support without lag on JB to know for sure, but can be this.

So, the problem may be the event listener that the java coded apps use... MAYBE.
[Xperia Play Android Development] bamsbamx:
So, i suppose that there is no solution for that, right?
[Xperia Play Android Development] farenheith:
There's a solution, but It's a very hard one :/

First, we need to know how the touchpad return is tracked on JB... Probably is something inside the libinput.so. Both, touchscreen and touchpad events is internally the same, a motion/pointer event, but each other is been treated different for some reason, in somewhere. On ICS there is no touchpad lag problem, so, if we found where the touchpad is captured and compare it with ICS, maybe we can find a solution.

But it's a very hard work, is probably something on the HAL Layer, it's requires a lot of code studying, I suppose
[Xperia Play Android Development] bamsbamx:
Maybe sony would help us with that... they shouldnt care of liberating code of touchpads, as they abandoned this phone...
[Xperia Play Android Development] farenheith:
Well... the best people to take a look on that is the FXP team, but they have many things to look, some of these things is more important than the touchpads, like the camera, and the touchpad is working, just have lags in some games, so...

I have an idea somewhere on this thread CosmicDan told me that we can make the touchpad act like mouse if some files is missing... So... the mouse will cause lag, too? Not in the game, of course, but in the home, Idk... Can you make some test like this?
[Xperia Play Android Development] bamsbamx:
Yeah, i can.. are there the name of those files? If not i have no idea of what files i have to delete :(

One thing more: what happens if we flash gingerbread files of touchpad,psxperia, semcsuite, etc etc to jelly bean? Files of ginger read should cause touchpad react as on gingerbread,right?
[Xperia Play Android Development] farenheith:
Probably you'll get a bootloop xD.

If the files is some of the framework files or some library, probably. It doesn't work... i already tried something like that with files of ICS and bootloop
[Xperia Play Android Development] benben972:
Hey guys !

Fight heroes and desert winds too work on 0.5, i gonna test with 0.6 later !

Bamsbamx it's for you :p
[Xperia Play Android Development] farenheith:
bamsbamx, this is the file... I don't know where it is, but I think you just need to rename it and voila.

After the test, tell me if you experience any lag while use the touchpad
[Xperia Play Android Development] bamsbamx:
System/usr/idc... but i will try tomorrow , i have to sleep and its too late
[Xperia Play Android Development] farenheith:
No problem at all!

Get some sleep and when you make the test, tell me the results :)

Thanks for the help!
[Xperia Play Android Development] CosmicDan:
You can either delete the file, or change touch.deviceType = pointer - full docs on the idc format can be found here = http://source.android.com/tech/input/touch-devices.html
[Xperia Play Android Development] farenheith:
I download some source code of the jerpelea github, but I can' find where this idc file is readed :/

Do you know something about, CosmicDan?
[Xperia Play Android Development] farenheith:
Wow, this thread is pretty awesome.

Maybe it can help to detect what's wrong with touchpad on JB, but now I'm pretty confused with somethings... I really don't know anymore if the problem is the framework or the libs...

But, I have an idea to test it... I'll make a framework.jar that avoid every single touchpad event just when it'll begin to be processed. Then, I'll execute FPSe and see if I got lag when touch the touchpad... if so... then the probably is outsite the framework.jar for sure.
[Xperia Play Android Development] farenheith:
The problem is inside the JB framework.jar, I'm pretty sure. If is in the libraries, every single game would get touchpad lags, but when I use the touchpad on the gallery 3D (always activated) no lag... Dead space, max payne, rise of glory. Each one doesn't have lag. Just a few games that implement the touchpad via java, not NDK, have lags.. I don't know if is the case of the modern combat 3, but is the case of FPSe and the Lara croft game.

Maybe the touchpad treatment have some problem, maybe the the event listener have some problem. I couldn't 'cancel' all the touchpad events because the app just freeze when I tried. But it must be on the framework,jar... I'm done for now with it... I got a few things to carry on, but in another moment I can investigate again...
[Xperia Play Android Development] CosmicDan:
Hmm, maybe it's just because CM10 is still alpha. As bamsbamx said, and I did a while back too, CPU usage spikes on touchpad events... does the same happen on touchscreen events? If not, it could still be a CM10 issue, like a function that needs optimizing somewhere.
[Xperia Play Android Development] farenheith:
I can't determine for sure what was making the CPU works on full frequence, because event without touch the touchpad, the cpu was already on full with me, but the game was running on 60 FPS.... The problem is that the framework is in theory an generic component, isn't it? That is, you "don't need" to modify it for some hardware adaptation... I just did a test right now... I changed my build.prop to the FPSe doesn't recognize the phone as an Xperia Play, the touchpad didn't respond then, but the lag was still there...

Internally, there's a long way from the touchpad interaction to the genericmotionevent, so... Maybe it can happens with every possible GenericMotion, like a external controller :/..
[Xperia Play Android Development] CosmicDan:
Maybe it can't be be fixed in smali alone, like the dalvikVM isn't quite optimized for ARMv7 thumb instructions or some such complicated thing lol.... or just a bad function in source code, like I said.... I would do a full logcat from boot until you start FPSe and touch the pads, and check every single line for warnings and interesting info to do with dalvik and stuff. Maybe it is a kernel issue, compiling a kernel with debugging and timers could help... but that's beyond me lol.
[Xperia Play Android Development] farenheith:
Well...

Actually I had enough of this :P...

I really think the problem is on the listener or in the "talker", I mean, or the guy that is forwarding the events to the framework is causing the rouble (maybe when you use NDK the events doesn't go directly to the framework, you intercep then I do what you want, that explain why games with NDK implementation of the touchpad doesn't get lag when use it), OR, the listener is causing the trouble... I test all the ideas I had of thing in the framework that can be causing some trouble, and the lags was still there... So, unfortunately I have to accept this problem again without solution :(.

Probably you're rightm, it can't be fixed just in the smali
[Xperia Play Android Development] bamsbamx:
Deleted synaptics_touchpas.idc, I can see how a circle is appearing as cursor like in the pc... tried with modern combat 3 the cursor moves smoothly, but the game is still lagging... its weird again, cursor is smooth, but game not?

However, i have seen how good is GB for performance , gaming and battery.... And testing games made me want to play... so i will try maybe try out Xperia NXT 1.3 ROM, but i will be still following this thread and if neccesary go back to jelly bean to test more things !!!!!!

However,i will wait a bit before flashing it to make more tests

---------- Post added at 10:36 AM ---------- Previous post was at 09:53 AM ----------

I have emailed sony, to try if they help us:
[Xperia Play Android Development] farenheith:
So...

The problem or is the event listener, or the component that send the events to the listener, that is it.

About the touchpads I really think Sony will not help because it's a Jelly bean issue, and until now they have only ICS ROMs :/... but I think we get the best we could with the touchpads until now. On the ICS is almost perfectly, I think, a lot of game works and the only problem we have now is about a driver or structure performance on JB, that is a paint in the ass because is out of my knowledge to solve.

But let me tell you... why you not try game on ICS? Using the JB adreno drivers V3 I'm playing very well games like dead space and Max payne. Maybe you can try with the CM9 or CosmicDan MIUI ROM.

Edit: So, just to point the things we find out... maybe someone read this and have some good idea :P

Touchpad lags on games that listen to the event via java, but not via NDK, as far as we tested

Even with the mouse driver the touchpad is lagging, so, probably this happens so, maybe it's happening with every genericevent treated via java (if we test a external gamepad interaction will be very good to make sure)

The problem may be in the class that receive the events, or in the component (maybe library or another framework file) that is sending the events
[Xperia Play Android Development] clivejefferies:
It makes sense that ndk has less lag. I'm surprised games use java.
[Xperia Play Android Development] farenheith:
Actually It's not a problem use java for some operations. A game entirely in java maybe can be very limited, but if you just want to track the touchpads (using the genericMotionEvent, the ICS AOSP way, or using the onTouchEvent, the Sony's way), then it can't be a problem, but it is on JB, apparently.

On ICS and GB there's no lag at all with this,

Oh, and I almost forgot, FPSe is great part writed in java. That's why they couldn't implement the touchpads on GB in the first place (as I read in a thread in somewhere). But with the research I did to this fix I found a way to implement it on GB via java too (only for Sony stock), I send a mail to him but he didn't answer me :/
[Xperia Play Android Development] f3w1n:
Few day ago they release a beta implementing touchpads in gingerbread, but didnt work very well and they remove it, you can see it in the changelog.

- f3w1n -
[Xperia Play Android Development] farenheith:
Yeah, I know.

I was following a thread that someone suggest him to use the Mupen64 as an example. But I think the way I suggest is much easier and is quite differente from the Mupen64 one. I'll tell you why:

1 - The mupen64 uses the NDK to do the implementation and a class called "NativeActivity", a class that we use like a bridge between NDK and java. This implementation gives very good results, because the touchpad will work on every Xperia Play Rom, doesn't matter what version of android it is.

2 - I think was not very known on the community until now, but the Sony framework also have a java implementation way too, you don't need to use any such of NDK resource. BUT it will only work in Sony stock GB and Sony beta ICS based ROMs. Also, if you implement this like a mo*on, it will work only on Sony GB (like the guys of Rockstar did. They check if the SDK version is lesser than 13 in Max Payne, otherwise the touchpads is not used ¬¬)

The way I suggested to the FPSe guy is the second one. I think is much more safe to implement than the first one and have touchpads on stock GB is better than don't have touchpad on GB at all xD.
[Xperia Play Android Development] farenheith:
I think I did the FPSe work with the touchpads on GB LOL... I made a test (on ICS) and now it's working with the always activated behavior (a modded version)

I'll flash the gb to make a test, I just can't pass this version to anyone for obvious reasons, but I can post instructions of how to mod it if my test works.

The best is the developer make the changes on the official version, but I think if it works on Stock GB, then he can consider :P
[Xperia Play Android Development] chery2k:
With this kind of fix for the touchpads is it possible have touchpad controls on epsxe in ics and gb?
[Xperia Play Android Development] farenheith:
The epsxe have touchpad support in some system?
[Xperia Play Android Development] chery2k:
Not yet. They havent added touchpad support yet but they can if you have a fix and its worth a shot. :/
[Xperia Play Android Development] farenheith:
If they add touchpad support to GB, then will work with ICS with this fix. The opposite is not true, unfortunately. I'm studying the GB framework right now to see if I can get the FPSe working with touchpad on it and send some feedback to the developer
[Xperia Play Android Development] farenheith:
I did the touchpad work with FPSe in stock GB :3

Edit: I sent a mail to the FPSe developer explaining him the steps to make it work. I hope he read the mail and put it on a official release
[Xperia Play Android Development] jimmyvau:
I just want to chime in and say thank you for all the work that you put into this. Lack of touchpad support is pretty much the major reason I hadn't moved to CM9 and now I can legitimately try it out for daily use and know that I won't be missing the reason I bought the phone in the first place.
[Xperia Play Android Development] farenheith:
Well XD, the best way to thank us is giving some feedback about what games is working :)
[Xperia Play Android Development] farenheith:
OP updated! Version 1.0

I changed the status of the development to BETA, because now I'm very secure about the stability of the fix.

The version 1.0 have a big change on the sourcecode, but a small change on the effects that it'll cause. Now the code is following the source of the sony framework. Before that is what I was deducing for the games analysis.

I tested the folowing games with the fix to CM9 V 1.0

FPse

Lara Croft and the guardian of light

Max Payne (Touchpad always activated)

Need for speed hot pursuit

Rise of glory

Those games is like checkpoints to me, so, if is working with it, probably will work with the rest.

Testers always welcome!
[Xperia Play Android Development] CosmicDan:
You are a legend! Big hugs! xD

EDIT: Crap, the APK broke my kitchen build lol.... you should probably not have dots or spaces in the APK file name :P just a tip for future. I renamed mine to "TouchpadActivator_v1_1.apk"
[Xperia Play Android Development] chery2k:
Im reporting 100% functional Call of duty zombies on cm9 with the v6 fix. Touchpads no lag during gameplay plus gamepad is recognized. This game was not playable on marks beta ics rom. U sir are a legend. :)
[Xperia Play Android Development] farenheith:
Thanks for the info!

Did you used touchpad always activated?
[Xperia Play Android Development] chery2k:
Nope i didnt use the apk.
[Xperia Play Android Development] f3w1n:
You made it! The fpse update is out!

- f3w1n -
[Xperia Play Android Development] chery2k:
After updating fpse gameplay was so smooth. It wasnt like that the past week. :)
[Xperia Play Android Development] farenheith:
Yeah :)

He answered my mail, I spent the entery night discussing with him about the implementations, but I was very tired and fall in sleep before the last result
[Xperia Play Android Development] jimmyvau:
So far I've tested Dead Trigger, ShadowGun, Max Payne, Dungeon Defenders Second Wave and Dead on Arrival. They all work great, except DD, with touchpads always active enabled. DD force closes when gameplay starts whether the touchpads are app activated or always active.
[Xperia Play Android Development] f3w1n:
Maybe is a ics problem. Have you tested it without the fix?

- f3w1n -
[Xperia Play Android Development] jimmyvau:
Yeah. Without the fix I can use the touchscreen controls to play it, but it lags so badly that it is unplayable. I also tried the Xperia Play version of DD and it force closes on open whether the touchpads are active or not.
[Xperia Play Android Development] f3w1n:
I dont think dd will work in ics.

- f3w1n -
[Xperia Play Android Development] farenheith:
Send me a logcat of the DD FC. Also, try it with fix v0.6 and 1.0 to see if in both you have the same error.
[Xperia Play Android Development] gopin:
Ok. Flashed miui again. Fifa is working with app side activation. (It probably works always activated, but I didnt try it) thanks man. Now I have everything that I want in my phone. Miui, touchpad and wifi tethering. U guys are the best!
[Xperia Play Android Development] farenheith:
Very good to know! Thanks for the tests you made for us!
[Xperia Play Android Development] farenheith:
Shctruck posted it on his forum:

About the Xperia play analog pad support, it works, but there is flood of calls, which slowdown a bit emulation,

Well... maybe this flood of calls can be well treated on GB and ICS, but in JB we feel the big difference.

The input of touchscreen and touchpad is almost the same type, but with one difference: the resolution of the touchpad is almost the same of the screen, BUT, the area is much less. That is, the density of the touchpad is very high, and the minimal swype can cause much more event than a swype of the same distance on the screen.

Maybe, to get a better performance on JB, we can edit the touchpad driver or stuff. Well, edit the library that send the event in the first place, and put somekind of time and distance threshold.

Example:

if the last sent event was a 0.03 secs ago, then I can send this event

OR

if the distance between the point of the last sent event and the current one is greater than 5, then I can send this event (

sqrt((x2 - x1)^2 + (y2 - y1)^2) > 5 is the calculus)

)

Change this is beyond my current knowledge, but maybe works :/
[Xperia Play Android Development] chery2k:
I've tested a new game that needs to have the gamepad fixed. (I used all the latest fixes changing my build prop, v6, and the touchpad apk) Im playing the game called King of Figthers which is a xperia play optimized that has a sole purpose of only using the gamepads. (Note the game doesnt touchpads just the gamepad). Please bear with me the buttons on the screens corresponds the gamepad butttons on the xperia play.

Incorrect already.

When I press the square button nothing happens. (it should press the e button)

When I press the triangle button it uses the s & p buttons at the same time. (the triangle button should only use the p button)

Correct already.

When I press the circle button it uses the k button correctly.

When I press the x button it uses the button p correctly

The correct configuration is

x uses p

triangle uses s

circle uses k

square uses e

Logcat posted link below and idk if I did correctly.

http://www.mediafire.com/view/?kldoc8779q8ove9
[Xperia Play Android Development] farenheith:
The key mapping of the xperia play buttons on CM9 is the same of stock and the games doesn't have problems to detect and use it... Probably the phone is not recognizing as a Xperia play to the game. Maybe we need to do some other change on the build.prop... Probably this is the problem. Oh... and did you edit your build.prop?
[Xperia Play Android Development] chery2k:
Heres a copy of my build.prop.

http://www.mediafire.com/?qxyn7w9799fnawi
[Xperia Play Android Development] farenheith:
Yeah, you did the changes we said....

Maybe some other change must to be done, or the game look to the SDK version... and in this case we can't do anything :/

The game doesn't have any keymap setting?
[Xperia Play Android Development] chery2k:
The game doesnt allow me to remap the hardkeys. It only recognizes the play and the touchscreen controls. :(
[Xperia Play Android Development] CosmicDan:
Sounds like the game is not compatible with ICS, like GTA3.
[Xperia Play Android Development] farenheith:
What ROM are you using?

Edit: wait a minute... I just realize something

When you press the circle button the behavior is OK? Well, tell me what happens when you press the back button
[Xperia Play Android Development] chery2k:
Sorry i shouldve been more clear im using the latest fxp cm9 rom . When i pressed the circle button it behaved correctly. Currently square and triangle however are giving me issues. When i pressed the square button no action happens but if i press the triangle button it pressed 2 buttons or 2 actions at the same time during a fight.
[Xperia Play Android Development] farenheith:
I understood the thing about the gamepad buttons, but what happens when you press the back button?

Edit:

I'll explain my point: the circle and back button have the same key code. The game can see the difference between both by the state of the alt key. If the alt key is on, then the circle button was pressed, if is not, then was the back button.

If the game have different behavior between the back and circle button, then probably it recognized the phone as an Xperia PLAY and the key mapping problem get more mysterious.

Do you know what can you try? You can try the Markphyton ROM to see if the game works well in this ROM, then we'll know if we have to do something else to fix some games.

This is not the first game with gamepad problems. The Galaxy on Fire 2 have these problems either, as you can see on the post #3. If you try on the Markphyton ROM the King of fighters and the gamepad works okay, you can give a try on galaxy on Fire 2 and say to us the results
[Xperia Play Android Development] f3w1n:
Hi farenheit, theres a app called joystic center that map touchpas and hardkeys, the team make it working on the ics beta for the xplay, do you think you can do the same that you did fpse to get it working with gb? I dont know in whats coded.

Ps: we can get kof working with GK

- f3w1n -