View Single Post
Posts: 18 | Thanked: 94 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 13 Users Say Thank You to Art-O For This Useful Post: