Reply
Thread Tools
Posts: 545 | Thanked: 560 times | Joined on Dec 2011 @ lebanon
#11
Originally Posted by Art-O View Post
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)
previous version of angry birds /seasons/space work great . only the new ones and star wars .
 
B-RUNO's Avatar
Posts: 124 | Thanked: 125 times | Joined on Sep 2010
#12
Originally Posted by Art-O View Post
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.
Thanks Art-O your modules are working here, as you mentioned its missing sound but here follows the screenshot for The Amazing Alex running on the N900.

Art-O may ask how do you compile your modules if is not to much to ask .

Thanks for your contribution.
Regards
Attached Images
  
__________________
Proud owner of a Nokia N900
If you like my post hit the Thanks button!
 

The Following 3 Users Say Thank You to B-RUNO For This Useful Post:
Posts: 18 | Thanked: 94 times | Joined on Dec 2012
#13
Originally Posted by B-RUNO View Post
Art-O may ask how do you compile your modules if is not to much to ask .
Just drop [modulename].c into apkenv sources / modules folder and they get compiled with apkenv.

Originally Posted by myname24 View Post
previous version of angry birds /seasons/space work great . only the new ones and star wars .
New games use GLES2 so one needs to compile apkenv with:
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?
 

The Following 5 Users Say Thank You to Art-O For This Useful Post:
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#14
Originally Posted by Art-O View Post
I started this ApkEnv support module development thread so that maybe we get more devs working on this.
Nice work there! Glad that somebody finally created a working module

Originally Posted by Art-O View Post
which both lack sound support and I hope somebody could help with these.
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.

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
 

The Following 13 Users Say Thank You to thp For This Useful Post:
Posts: 18 | Thanked: 94 times | Joined on Dec 2012
#15
Originally Posted by thp View Post
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
Hi, and thanks again for providing apkenv for us.

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;
Start audio output when CallVoidMethodV(startOutput) calls:
Code:
        /* 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);
I can see that this works as my_audio_callback function calls for more data:
Code:
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);
}
But buffer seems to be completely empty (no audio data returned). Is that application-specific pointer important and is audio format correct or is problem with something else here?

PS. I do that pull request if I ever get this audio stuff working
 

The Following User Says Thank You to Art-O For This Useful Post:
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#16
Originally Posted by Art-O View Post
But buffer seems to be completely empty (no audio data returned). Is that application-specific pointer important and is audio format correct or is problem with something else here?
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.
 

The Following 6 Users Say Thank You to thp For This Useful Post:
Posts: 18 | Thanked: 94 times | Joined on Dec 2012
#17
Originally Posted by thp View Post
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.
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
 

The Following 7 Users Say Thank You to Art-O For This Useful Post:
B-RUNO's Avatar
Posts: 124 | Thanked: 125 times | Joined on Sep 2010
#18
Originally Posted by Art-O View Post
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
Cheers Art-O you rock my friend the latest module work perfectly.
Appreciate regards
__________________
Proud owner of a Nokia N900
If you like my post hit the Thanks button!
 
B-RUNO's Avatar
Posts: 124 | Thanked: 125 times | Joined on Sep 2010
#19
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.
Attached Images
 
__________________
Proud owner of a Nokia N900
If you like my post hit the Thanks button!
 
Posts: 18 | Thanked: 94 times | Joined on Dec 2012
#20
Originally Posted by B-RUNO View Post
Hey Art-O how do you locate the Init input and the OpenGL update methods on the decompiled apk.
When you start apkenv without proper module it reports needed methods for example angry birds:
Code:
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
    ...
So just browse that treeview to com/rovio/ka3d/MyRenderer and there you can find all needed code written in java. Look for functions that start with "public native ..."
 

The Following 4 Users Say Thank You to Art-O For This Useful Post:
Reply

Tags
apkenv


 
Forum Jump


All times are GMT. The time now is 18:32.