myname24
|
2012-12-14
, 21:20
|
Posts: 545 |
Thanked: 560 times |
Joined on Dec 2011
@ lebanon
|
#11
|
|
2012-12-14
, 21:42
|
|
Posts: 124 |
Thanked: 125 times |
Joined on Sep 2010
|
#12
|
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.
|
2012-12-15
, 12:53
|
Posts: 18 |
Thanked: 94 times |
Joined on Dec 2012
|
#13
|
Art-O may ask how do you compile your modules if is not to much to ask .
previous version of angry birds /seasons/space work great . only the new ones and star wars .
|
2012-12-15
, 13:15
|
|
Posts: 1,391 |
Thanked: 4,272 times |
Joined on Sep 2007
@ Vienna, Austria
|
#14
|
I started this ApkEnv support module development thread so that maybe we get more devs working on this.
The Following 13 Users Say Thank You to thp For This Useful Post: | ||
|
2012-12-19
, 20:46
|
Posts: 18 |
Thanked: 94 times |
Joined on Dec 2012
|
#15
|
Have a look at the nativeMixData function - all JNI methods take an JNIEnv * as their first method, the second one is the object on which the function is called (for our purposes, this is mostly "any" object - I usually pass a pointer to the global object there, but any random pointer should work). The third parameter is a long that you can use to pass an application-specific pointer. The fourth is a pointer to the buffer which is filled with audio data, and the fifth is the length of that buffer.
Would be great if you could submit your modules as pull request to apkenv on Github
typedef void (*angrybirds_mixdata_t)(JNIEnv *env, jobject obj, jlong paramLong, jbyteArray paramArrayOfByte, jint paramInt) SOFTFP;
/* Open the audio device */ SDL_AudioSpec *desired, *obtained; desired = malloc(sizeof(SDL_AudioSpec)); obtained = malloc(sizeof(SDL_AudioSpec)); desired->freq=44100; desired->format=AUDIO_S16SYS; desired->channels=2; desired->samples=8192; desired->callback=my_audio_callback; desired->userdata=p0; if( SDL_InitSubSystem(SDL_INIT_AUDIO) < 0 ) exit(-1); if ( SDL_OpenAudio(desired, obtained) < 0 ) exit(-1); free(desired); SDL_PauseAudio(0);
void my_audio_callback(void *ud, Uint8 *stream, int len) { printf("call mixdata (%i)\n",len); jlong tmplong = 0; jbyte* buffer = calloc(len,1); angrybirds_priv.native_mixdata(ENV(global), VM(global), (jlong)&tmplong, buffer, len); memcpy(stream,buffer,len); free(buffer); }
The Following User Says Thank You to Art-O For This Useful Post: | ||
|
2012-12-20
, 11:12
|
|
Posts: 1,391 |
Thanked: 4,272 times |
Joined on Sep 2007
@ Vienna, Austria
|
#16
|
The Following 6 Users Say Thank You to thp For This Useful Post: | ||
|
2012-12-20
, 18:42
|
Posts: 18 |
Thanked: 94 times |
Joined on Dec 2012
|
#17
|
When the AudioOutput gets created (NewObjectV), it gives you a long handle, the sample rate int, the number of channels int, the bitrate int and the buffer size int in the variable argument list. You need to use these, and especially pass the handle that you get as first parameter to the mixing function as third parameter. Also, there's no need to calloc/memcpy/free the buffer, you can directly provide the stream pointer to the mixing function.
|
2012-12-20
, 20:43
|
|
Posts: 124 |
Thanked: 125 times |
Joined on Sep 2010
|
#18
|
Thanks for help, I finally got it working
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
|
2012-12-21
, 21:38
|
|
Posts: 124 |
Thanked: 125 times |
Joined on Sep 2010
|
#19
|
|
2012-12-21
, 23:52
|
Posts: 18 |
Thanked: 94 times |
Joined on Dec 2012
|
#20
|
Hey Art-O how do you locate the Init input and the OpenGL update methods on the decompiled apk.
Not supported yet, but found JNI methods: Java_com_rovio_ka3d_MyRenderer_nativeGetPossibleOrientations Java_com_rovio_ka3d_MyRenderer_nativePause Java_com_rovio_ka3d_MyRenderer_nativeResume JNI_OnLoad Java_com_rovio_ka3d_MyRenderer_nativeResize Java_com_rovio_ka3d_MyRenderer_nativeKeyInput Java_com_rovio_ka3d_MyRenderer_nativeInput Java_com_rovio_ka3d_MyRenderer_nativeUpdate ...
Tags |
apkenv |
Thread Tools | |
|