Reply
Thread Tools
Posts: 18 | Thanked: 88 times | Joined on Dec 2012
#1
Hello all devs (and non devs).

I started this ApkEnv support module development thread so that maybe we get more devs working on this.

Original thread: http://talk.maemo.org/showthread.php?t=87496
Web page: http://thp.io/2012/apkenv/

This is what I have learned from studying ApkEnv sources, please correct me if I am wrong.

First little about ApkEnv and these support modules, what are they and why are they needed.

ApkEnv is not Java VM so it can't run programs that are made completely with Java JDK.

Some programs however are made with NDK that allows programmers to develop programs with C language but even these programs need small java code that handles all Android related stuff for example OpenGL, touch screen, network and audio related code.

ApkEnv can run this native C code but it can't run this small Java program what handles all important stuff. This is where support modules come into play.

APKs are basically zip files and Java code that needs to be ported to these modules is inside classes.dex file.
Here is pretty good info how to read this file:
http://stackoverflow.com/questions/1...ava-sourcecode

I have written modules for Angry Birds Space and Fruit Ninja (attached) which both lack sound support and I hope somebody could help with these].

I would like to remind people before they start spamming "[insert APK here] doesn't work" that if there is no support module for APK file it probably doesn't work.

PS. If you want to find out if APK is made with NDK then check if it contains lib/armeabi folder. If folder exists then there is hope that it can be run under ApkEnv and proper module.

Edit: Both Angry Birds and Fruit Ninja got sound support now! (attachments updated) Thanks to thp for support.

From now on I upload my modules to https://github.com/Art-O/apkenv and make pull request to thp git when I think they are ready

Next I start working on my favourite Android & desktop game World of Goo (that one seems much more challenging than AB or FN)


Art-O
Attached Files
File Type: gz module_fruitninja.tar.gz (10.1 KB, 215 views)
File Type: gz module_angrybirds.tar.gz (6.9 KB, 144 views)

Last edited by Art-O; 2012-12-22 at 18:34. Reason: Updated Fruit Ninja module
 

The Following 34 Users Say Thank You to Art-O For This Useful Post:
Posts: 53 | Thanked: 44 times | Joined on Dec 2012
#2
mmm... let me get this stright...

The modules work the same as the dead "iced-robot" project, on top of the jvm?
Or the modules reimplement small Dalvik pices?

Could you explain how this modules work?
 
Posts: 18 | Thanked: 88 times | Joined on Dec 2012
#3
Originally Posted by xvan View Post
The modules work the same as the dead "iced-robot" project, on top of the jvm?
Or the modules reimplement small Dalvik pices?
Modules reimplement Dalvik (java) code.

One thing that I should point out is that we don't have to implement every function inside classes.dex file. Only basic functions like Init, input, file access and OpenGL update methods.

For example Angry Birds Space input function is declared inside classes.dex file:
Code:
public native void nativeInput(int paramInt1, float paramFloat1, float paramFloat2, int paramInt2);
This translates to C module (JNIEnv and jobject needs to be there every time):
Code:
typedef void (*angrybirds_input_t)(JNIEnv *env, jobject obj, jint paramInt1, jfloat paramFloat1, jfloat paramFloat2, jint paramInt2) SOFTFP;

self->priv->native_input = (angrybirds_input_t)LOOKUP_M("MyRenderer_nativeInput");
That "MyRenderer_nativeInput" is what apkenv reports as "Not supported yet, but found JNI methods: [something]_MyRenderer_nativeInput"

ApkEnv handles Harmattan/Fremantle screen input but it needs modules to pass this information correctly to native APK.
Code in module:
Code:
static void
angrybirds_input(struct SupportModule *self, int event, int x, int y, int finger)
{
    self->priv->native_input(ENV_M, GLOBAL_M, event, x, y, finger);
}
I also like to point out that this is first time I have ever developed anything in C (I really think that I should have started with Hello World examples instead of this) so there might be lots of errors in my code.
This is also why I need help to develop sound support for AB and Fruit Ninja.


Art-O
 

The Following 12 Users Say Thank You to Art-O For This Useful Post:
Posts: 110 | Thanked: 65 times | Joined on Apr 2012
#4
Does that mean that apkenv isn't a compatibility layer, but a framework that doesn't completely obviate the need for porting, even if it does, like, 90% of it?
 
Posts: 18 | Thanked: 88 times | Joined on Dec 2012
#5
Originally Posted by evujumenuk View Post
Does that mean that apkenv isn't a compatibility layer, but a framework that doesn't completely obviate the need for porting, even if it does, like, 90% of it?
I think this is correct as we need to port custom Java functions of every APK into modules in order to get then working.

One thing I should add is that ApkEnv natively sets up OpenGL viewport(?) for modules and this means that we can only run OpenGL based games with ApkEnv. For this reason Android UI applications that don't use OpenGL cannot be run inside ApkEnv.
I am not sure if it is possible to make fork of ApkEnv that would support UI elements.


Art-O
 

The Following 4 Users Say Thank You to Art-O For This Useful Post:
Posts: 521 | Thanked: 517 times | Joined on Dec 2011 @ lebanon
#6
thanks work as expected . but for newer version it say missing dependencies (same as original apkenv )
 
B-RUNO's Avatar
Posts: 124 | Thanked: 124 times | Joined on Sep 2010
#7
Sorry Art-O but doesnt the wrapper-generator extract all the infomation required to build the modules? Sorry if I'm wrong or if I didnt understand the whole point of the thead.
__________________
Proud owner of a Nokia N900
If you like my post hit the Thanks button!
 
Posts: 18 | Thanked: 88 times | Joined on Dec 2012
#8
Originally Posted by myname24 View Post
thanks work as expected . but for newer version it say missing dependencies (same as original apkenv )
What version of Angry Birds Space are you trying to run and are you using apkenv from git?

Originally Posted by B-RUNO View Post
Sorry Art-O but doesnt the wrapper-generator extract all the infomation required to build the modules? Sorry if I'm wrong or if I didnt understand the whole point of the thead.
I think that wrapper-generator is only used to make wrappers for
Android built in libraries (libc, gles, pthread etc. check apkenv source/compat directory) and it has nothing to do with modules.

Last edited by Art-O; 2012-12-14 at 19:36.
 

The Following 2 Users Say Thank You to Art-O For This Useful Post:
Posts: 521 | Thanked: 517 times | Joined on Dec 2011 @ lebanon
#9
angry birds 3.0 and angry birds seasons 3.1 and yes the new source version from git .
 
Posts: 18 | Thanked: 88 times | Joined on Dec 2012
#10
Originally Posted by myname24 View Post
angry birds 3.0 and angry birds seasons 3.1 and yes the new source version from git .
I have Angry Birds Space version 1.2.3 so this probably doesn't work with any other versions.

But suprisingly it seems to work with Amazing Alex (i don't remember version)
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 12:53.