![]() |
ApkEnv support module development
2 Attachment(s)
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) 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) :D Art-O |
Re: ApkEnv support module development
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? |
Re: ApkEnv support module development
Quote:
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); Code:
typedef void (*angrybirds_input_t)(JNIEnv *env, jobject obj, jint paramInt1, jfloat paramFloat1, jfloat paramFloat2, jint paramInt2) SOFTFP; ApkEnv handles Harmattan/Fremantle screen input but it needs modules to pass this information correctly to native APK. Code in module: Code:
static void This is also why I need help to develop sound support for AB and Fruit Ninja. Art-O |
Re: ApkEnv support module development
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?
|
Re: ApkEnv support module development
Quote:
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 |
Re: ApkEnv support module development
thanks work as expected . but for newer version it say missing dependencies (same as original apkenv )
|
Re: ApkEnv support module development
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.
|
Re: ApkEnv support module development
Quote:
Quote:
Android built in libraries (libc, gles, pthread etc. check apkenv source/compat directory) and it has nothing to do with modules. |
Re: ApkEnv support module development
angry birds 3.0 and angry birds seasons 3.1 and yes the new source version from git .
|
Re: ApkEnv support module development
Quote:
But suprisingly it seems to work with Amazing Alex (i don't remember version) |
Re: ApkEnv support module development
Quote:
|
Re: ApkEnv support module development
2 Attachment(s)
Quote:
Art-O may ask how do you compile your modules if is not to much to ask :D. Thanks for your contribution. Regards |
Re: ApkEnv support module development
Quote:
Quote:
GLES=2 make But even when compiled with this they currently doesn't work and just SigFault when native_init is called. Does anyone have any ideas why this happens? |
Re: ApkEnv support module development
Quote:
Quote:
SDL has audio output built-in: SDL_OpenAudio() with the right parameters. At some point each game might open an AudioOutput and request a specific format (sample rate, channels, bitrate, buffer size, etc..). The SDL_AudioSpec "callback" then is a simple callback function that will be called by SDL and that should probably call some "native (audio) mixing data" function to fill the buffer. Would be great if you could submit your modules as pull request to apkenv on Github :) |
Re: ApkEnv support module development
Quote:
I have tryed to study this sound output for angry birds but I can't seem to figure out how to get it working. Thus far my code is this: Typedef for nativeMixData: Code:
typedef void (*angrybirds_mixdata_t)(JNIEnv *env, jobject obj, jlong paramLong, jbyteArray paramArrayOfByte, jint paramInt) SOFTFP; Code:
/* Open the audio device */ Code:
void my_audio_callback(void *ud, Uint8 *stream, int len) PS. I do that pull request if I ever get this audio stuff working :) |
Re: ApkEnv support module development
Quote:
|
Re: ApkEnv support module development
Quote:
I started new fork at https://github.com/Art-O/apkenv and made that pull request for this one. Also updated attachment on front page. Next stop Fruit Ninja audio ;) |
Re: ApkEnv support module development
Quote:
Appreciate regards |
Re: ApkEnv support module development
1 Attachment(s)
Hey Art-O how do you locate the Init input and the OpenGL update methods on the decompiled apk.
Here is the screenshot of my decompiled apk. |
Re: ApkEnv support module development
Quote:
Code:
Not supported yet, but found JNI methods: |
Re: ApkEnv support module development
compiled, copied but still printing Not supported yet and exited.
what can be wrong? |
Re: ApkEnv support module development
Code:
Not supported yet, but found JNI methods: |
Re: ApkEnv support module development
Quote:
Code:
static int |
Re: ApkEnv support module development
okay. almost same:
Code:
[shlib] Found symbol: Java_com_rovio_ka3d_MyRenderer_nativeInit |
Re: ApkEnv support module development
Quote:
Code:
self->priv->native_gpo = (angrybirds_gpo_t)LOOKUP_M("ka3d_MyRenderer_nativeGetPossibleOrientations"); Code:
self->priv->native_loadfromurl = (angrybirds_loadfromurl_t)LOOKUP_M("ka3d_MyRenderer_nativeLoadFromUrl"); |
Re: ApkEnv support module development
Working now, thanks :)
|
Re: ApkEnv support module development
can i place this module as second? will them work both for diffferent versions?
|
Re: ApkEnv support module development
I am not sure.. But those removed lines are not needed for my version either. They are basically just left over methods when I started working on this module and they were never needed. I will post updated version to git and front page where these methods are removed.
|
Re: ApkEnv support module development
Quote:
By the way thanks for sharing once again. Bruno |
Re: ApkEnv support module development
I really don't know why sound won't work for you. Perhaps something needs to be coded differently in N900. I don't have one so I can't test that.
Intresting question would be that does sound work for anyone else but me? |
Re: ApkEnv support module development
Hi Art-O if you have a time could you try to run that file
http://dox.bg/files/dw?a=80af969fc0 regards edit: I did't notes this before Quote:
|
Re: ApkEnv support module development
i have fruitninja sound.
also a question to @thp: can you force media volume to be changed when apkenv launched? |
Re: ApkEnv support module development
also to @thp and @Art-0:
where to get init and try_init? i cant understand java classes yet :) |
Re: ApkEnv support module development
Quote:
Regards Bruno |
Re: ApkEnv support module development
N9 of course :)
|
Re: ApkEnv support module development
Quote:
Quote:
|
Re: ApkEnv support module development
Quote:
But there seems to be libsdl-mixer1.2 version 1.2.6-5+0m5+ogg+mp3 in extras(?) repository. Can you get this version installed and test fruit ninja with that? |
Re: ApkEnv support module development
Probably been covered before, why won't the linux android/dalvik dev environemtn compile for Maemo5? Or is it too much a resource hog?
|
Re: ApkEnv support module development
Is it possible to have binary file for n9 with added suport for those modules?
|
Re: ApkEnv support module development
@thp, thanks, i understang that.
but where to get functions to put inside init? AB anf FN calling native_init but FN also calling native_initfilemanager and native_setapplicensed. i'm checking World Of Goo and it have no any "init" function inside classes. i cant find any functions getting args: width, height, apk path. |
All times are GMT. The time now is 01:12. |
vBulletin® Version 3.8.8