[Applimulator ;)] apkenv + apkenv.ui


crow_riot

Well-Known Member
Joined
Sep 21, 2009
Messages
1,763
Location
.at
THIRD RELEASE

see my post here: http://boards.openpandora.org/index.php/topic/11736-applimulator-apkenv-apkenvui/?p=251247

plants vs. zombie bugfix: http://boards.openpandora.org/index.php/topic/11736-applimulator-apkenv-apkenvui/?p=268844

--

hey just to make it public now ...

i'm working on and off on apkenv. for the one's who don't know what it is: it's a compatibility layer to run .apks natively without having to run android.

this only works for apks that use native libraries and again only for those where someone has written a support module.

the source for pandora's apkenv port can be found here: https://github.com/crowriot/apkenv

the source for the (very unfinished) interface is here: https://github.com/crowriot/apkenvui

writing support modules is really time consuming, because you need to implement all functions the native library expects to have within the java code. and once you have those function skeletonts in place you mostly get a segfault somewhere :huh:

having a working support module in place, it doesn't mean it works for all versions of the apks. you're mostly bound to a specific version the module was written for.

currently working are

- the rabbit game 2 (http://thp.io/2011/trg2/)

- fruit ninja 1.5.2 and 1.5.4

- angry birds, angry birds space (dunno which versions exactly, will find out)

i'm working to finish the cut the rope module, but it's a rather old version which works. newer versions just segfault (again).

i initially tried to get the unity player working, but again, segfault.

so you see ... the main word here is segfault :(

but it's still fun to play fruit ninja! :)

attached a screenshot from my quickhack launcher interface. the icons are extracted from the apks... oh and no jetpack joyride is not working (didnt even try), i just have the apk in the folder and so the icon gets displayed.

apkenv-ui.jpg
 
Last edited by a moderator:

MarTinazzI

Still Fresh
Joined
Jan 19, 2012
Messages
95
Age
30
Location
Brazil
Awesome job, and apparently very promising.
Now one more program to Wishlist.

- Drastic
- Applimulator [funny name =)]

Thank you and good luck.

MarTinazzI
 

mcobit

Advanced Member
Joined
Jul 28, 2008
Messages
6,910
Would be cool to have opera running.


Good progress so far :)
 

thatgui

Advanced Member
Joined
Apr 2, 2009
Messages
3,048
  • Compared to running an apk in Pandoras Android-Build, are speed improvements possible ?
  • would it be possible to "bundle" single apks into a pnd (instead of using a seperate launcher)?
  • how hard/complicated is it to get the a list of the functions that are need for a support module ?
 

Neelix

Insecticidal Maniac
Joined
Jan 8, 2011
Messages
3,238
Location
Melbourne, Australia
Bundling individual apks into PNDs would need to be done carefully with regards to licencing issues.  Most Android apps are commercial (if inexpensive) so we would not be able to distribute them as PNDs without permission from the publisher.  This has come up in the past when someone PNDed up Angry Birds in violation of the licence.

That being said, now that the repo has support for commercial software, it occurs to me that Android developers may be (very slightly) more inclined to set up an account and publish there if conversion is easy and it may get them some extra sales.

- Neelix
 

crow_riot

Well-Known Member
Joined
Sep 21, 2009
Messages
1,763
Location
.at
  • Compared to running an apk in Pandoras Android-Build, are speed improvements possible ?
 hm difficult question. you're having more resources free when running directly from xfce than from android, so maybe yes. but i can't really tell without measuring.

  • would it be possible to "bundle" single apks into a pnd (instead of using a seperate launcher)?  
yes. the launcher is just there, because i can't bundle apks for licensing reasons.

  • how hard/complicated is it to get the a list of the functions that are need for a support module
well it's not too difficult. there are tools out there helping: dex2jar and jd-gui are very useful :)
 
Last edited by a moderator:

Farox

Certified Guru
Joined
Jan 8, 2009
Messages
2,134
Age
52
Location
Italy
Website
rbnet.it
I'm start to think that this edition of compo will be very very fun.

Thank's crowriot :)
 

Askarus

Hardcore Member
Joined
Sep 28, 2011
Messages
4,416
Location
Germany
If this project is improved, will there be nearly all apps be playable then or will there always be limitations?

(I don't mean multi touch and that stuff)
 
Last edited by a moderator:

EvilDragon

Administrator
Staff member
Joined
Mar 4, 2003
Messages
29,481
Age
42
Location
Ingolstadt
If this project is improved, will there be nearly all apps be playable then or will there always be limitations?

(I don't mean multi touch and that stuff)
Unless someone writes a couple of hundredthousand modules for all these apps out there, it will not run them ;)
 

ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
writing support modules is really time consuming, because you need to implement all functions the native library expects to have within the java code. and once you have those function skeletonts in place you mostly get a segfault somewhere :huh:
Can you give some examples of support modules? I would like to better understand how this works. 
 

crow_riot

Well-Known Member
Joined
Sep 21, 2009
Messages
1,763
Location
.at
writing support modules is really time consuming, because you need to implement all functions the native library expects to have within the java code. and once you have those function skeletonts in place you mostly get a segfault somewhere :huh:
Can you give some examples of support modules? I would like to better understand how this works. 
there are more steps involved, i'll explain:

- first you need to take a look into the .apk and see if it links to some native library, i.e. thats easy, if there's a lib/armeabi or the like folder, there's at least a starting point. if not, then you can just stop trying at this early stage.

- next, you can just throw the .apk at apkenv and see if it can handle it: it first tries to link the contained lib, but sometimes functions that are available on android are not directly available on the pandora (or any other supporting device). apkenv tells you the names and then you've got to write wrapper functions for them. most of them are already there, but sometimes not. not difficult, but well IIRC it just stops at the first function not found and tells you that it's not available. you repeatingly need to do that until the lib finally links.

- knowing the the lib is linkable, you need to start reversing the java code. that is the classes.dex file that comes with each apk - tools used are dex2jar+jd-gui. having some decompiled sources you can start searching for native labeled functions definitions, these are the one that are called from the java side. mostly, thats a handful (like nativeInit, nativeRender, nativeInput, ...).

- knowing all native functions, you can actually start writing a module, first all native function definitions need to be translated to c function definitions, which is easy. it's step-by-step, first do the JNI_OnLoad if it's there, then nativeInit is usually called. and then you can start watching the console for java functions that are called. and every little java call needs to be emulated. then continue with nativeUpdate and see what java calls are there and so on.

- sounds simple but is time consuming, and it may happen that if you've got half of the stuff running, you just get a segfault. and you dont know where and why. and then you've spent hours for nothing.

a simple module is here: the rabbit game 2. thats the sample project of apkenv's author. and of course does everything natively without any calls back to java.

one of the harder ones is here: cuttherope. i'm working on this - but it only works for one of the early cut the rope versions (i think it's 1.0.0 or so). what they do, and you need to find that out, in the early version, they're loading images using java. so i had to implement a jpeg and a png loader to get all the textures working. now, cut the rope loads and you can at least see something. but then comes sound. in every apk i've looked at, sound is played using java. so you need to wrap all the sound code and implement it using SDL_mixer (which i haven't done as of yet).

i had a big problem with jd-gui, which was showing me messy code of the input, so i wasn't able to get the input working for a long time. i then found JAD (another java decompiler) which could handle the code better and was at least giving me the correct code. now i've got cut the rope playable but without sound. then next, they're storing scores using java, too. so what i need to do is writing some sort of key/value save file system to get that correctly... and so on.

the most frustrating point is, that even, if you've got the game working for one version, they might have changed so much, that with a later version, your module does not work anymore and you can start over again. take fruit ninja, version 1.5.4 works very well, but they've changed so much in a later version, that you can go and rewrite 90% from scratch (if it wouldn't segfault at the very beginning ;) ). the same with cut the rope, it works with 1.0.0 but later versions use totally different approaches.
 
Last edited by a moderator:

ingoreis

Advanced Member
Staff member
Joined
Jan 18, 2010
Messages
8,095
Age
39
Location
49.491276,8.423518
Cool idea.


Wow so many cool Entrys this year.


Byside doesnt work that when you use a chroot of the Pandora Android? Maybe you can use Files from the Pandora Android Port?
 

crow_riot

Well-Known Member
Joined
Sep 21, 2009
Messages
1,763
Location
.at
Cool idea.


Wow so many cool Entrys this year.


Byside doesnt work that when you use a chroot of the Pandora Android? Maybe you can use Files from the Pandora Android Port?
it already uses libraries extracted from the gingerbread pnd. the linker needs them.
 

crow_riot

Well-Known Member
Joined
Sep 21, 2009
Messages
1,763
Location
.at
just found the compatibility list for maemo - which also applies to pandora: http://wiki.maemo.org/Apkenv/Game_Compatibility

for multitouch: i've implemented multitouch faking (which is needed in angrybirds for zooming): pressing the left shoulder simulates pressing on the middle of the screen with a second finger.
 
Last edited by a moderator:

_wb_

Microbe
Staff member
Joined
Apr 5, 2012
Messages
5,387
Age
38
Location
Brussels, Belgium
Multitouch faking is a really clever idea! I guess many multitouch gestures would work with one static finger, and are arguably even easier to perform accurately in this way!

Suggestion: I believe some multitouch applications use two-finger swiping or tapping; this would also be possible to fake (e.g. right shoulder button adds a cloned finger at some fixed offset)

(for cut the ropes you would need real multitouch though, although perhaps it is possible to solve all puzzles by rapidly doing the "simultaneous" cuts sequentially)
 

ingoreis

Advanced Member
Staff member
Joined
Jan 18, 2010
Messages
8,095
Age
39
Location
49.491276,8.423518
A Android Wrapper like this is cooool.


This Multitouch solution is a great idea.


When you want a Video for your Presentation make i a few Videos for you.


When you need a closet Beta Tester would i am happy to test this.


Greetings fromm Germany.
 
Top