PaulsCode Forum

Mupen64Plus AE => General Discussion => Topic started by: Paul on April 06, 2013, 07:06:17 PM

Title: All Testers! New JNI linkage
Post by: Paul on April 06, 2013, 07:06:17 PM
Littleguy recently finished a rather significant restructuring of the JNI linkage into the new "AE Bridge" system.  We need to have this tested on a variety of devices to make sure it didn't break anything.  The focus of tests should be on areas where the front-end and core communicate with each other (things like pause, resume, speed, frame-advance, gameshark button, cheats, etc).  If you come across any problems (likely to result in the app crashing), please post the logcat output if you are able.  If you enable crash reporting in the Advanced settings, we can sometimes get the logcat that way -- just be sure to set your PaulsCode.Com username under Contact info (also in the Advanced settings) so I can look your report up easily.

AE Bridge Test (http://www.paulscode.com/source/Mupen64Plus-AE/06APR2013/Mupen64Plus-debug.apk)
Title: Re: All Testers! New JNI linkage
Post by: Blizzard64 on April 07, 2013, 03:49:26 PM
When I activate the cheat button, the emulator crashes and restarts, so I have to disable the cheats quickly.
I will send you a crash report.
Title: Re: All Testers! New JNI linkage
Post by: littleguy on April 08, 2013, 07:42:15 AM
Thanks.  Does this happen with every game, or just some games?  And by cheat button, do you mean the checkbox in the main menu, or the gameshark button in-game?
Title: Re: All Testers! New JNI linkage
Post by: Blizzard64 on April 08, 2013, 09:08:31 AM
It happens in every game in the checkbox from the menu. I don't know where I can find the GameShark button.
Actually it doesn't crash immediately. First it's taking some seconds to load the cheats (but they don't appear) then it throw me back to the menu (where I can select the game, go to the settings, language etc.) and then I get a message that the app has crashed. When I click on 'Force Quit', it restarts.
Title: Re: All Testers! New JNI linkage
Post by: littleguy on April 08, 2013, 09:27:04 AM
Odd, I can't replicate the crash on my Nexus 7.  I'll keep looking into it and double check to see if the code changed somewhere.

And just to be sure, you don't have this problem with the normal Google Play version of the app, correct?
Title: Re: All Testers! New JNI linkage
Post by: Blizzard64 on April 08, 2013, 10:39:25 AM
Yes, only in the 'AE Bridge Test' version
Title: Re: All Testers! New JNI linkage
Post by: Tom.K on April 08, 2013, 02:02:37 PM
When I activate the cheat button, the emulator crashes and restarts, so I have to disable the cheats quickly.
I will send you a crash report.
Same issue here.
Title: Re: All Testers! New JNI linkage
Post by: littleguy on April 11, 2013, 04:52:03 PM
Sorry for the delay on this.  I just downloaded this version onto my Xperia Play and indeed I get the same crash.  I found Blizzard64's report and it's the same as mine:

Code: [Select]
0 java.lang.UnsatisfiedLinkError: getHeaderCRC
1 at paulscode.android.mupen64plusae.CoreInterfaceNative.getHeaderCRC(Native Method)
2 at paulscode.android.mupen64plusae.util.Utility.getHeaderCRC(Utility.java:284)
3 at paulscode.android.mupen64plusae.PlayMenuActivity$2.run(PlayMenuActivity.java:191)
4 at paulscode.android.mupen64plusae.util.TaskHandler$2.run(TaskHandler.java:104)

These UnsatisfiedLinkErrors are the biggest cause of crashes in Mupen (38% of all crashes right now).  I have no idea what causes them.  Any ideas Paul?  I'm going to do a fresh build of the same version you posted, see if I get a different result.
Title: Re: All Testers! New JNI linkage
Post by: Paul on April 11, 2013, 04:57:46 PM
For most of these, I haven't a clue (my guess was that the device didn't have enough memory to load the natives, but that doesn't make sense here since the library is really small).  The only one that I was able to track down was on the Kindle Fire HD.  In that case, the RSP-HLE plug-in failed to link.  I solved the problem by building the library in ARM mode instead of THUMB mode.  You might try that if you haven't already.  I'll take a closer look at this later to see if I can notice anything that stands out.
Title: Re: All Testers! New JNI linkage
Post by: littleguy on April 11, 2013, 05:07:03 PM
Good suggestions, never would have thought... I'll take a look.

Good news is that I can replicate this crash from my own debug builds -- so that rules out any release/debug/build environment differences between the two of us.  Even better is that this is the first time I've been able to replicate this bug from my own debug build.  Hopefully we can get to the bottom once and for all...
Title: Re: All Testers! New JNI linkage
Post by: littleguy on April 11, 2013, 09:12:02 PM
Wasn't the arm/thumb build config.  Fortunately the published 2.2.0 release doesn't have the bug so a git-bisect should narrow it down quickly.
Title: Re: All Testers! New JNI linkage
Post by: littleguy on April 11, 2013, 09:45:09 PM
Ok, this is weird.  I did a full git-bisect and I found every single revision to be good, including the revision that was originally bad.  Then I uninstalled and reinstalled and suddenly the revision is bad again.  So something important is getting lost in the reinstallation process.  But the ae-bridge libraries are definitely being installed properly, since I can still run a game even when the cheats menu causes a crash.

So back to git-bisect, this time uninstalling between each test...
Title: Re: All Testers! New JNI linkage
Post by: littleguy on April 11, 2013, 10:37:29 PM
Ok, tracked it down.  This one at least... not sure it generalizes to the other UnsatisfiedLinkErrors.

Problem is not related to the new AE JNI bridge stuff, but was created in this commit, much earlier:
https://github.com/paulscode/mupen64plus-ae/commit/b0ddd7029fd4d0dbbb6509345e4e9d9f039a0bb9

I was thinking that all static constructors are called at app launch, but I guess it's not that simple.  Somehow the native libraries weren't staying resident (even after i started a game and returned to the menu before checking the cheats box).  Maybe something to do with dalvik getting cleared out during uninstallation or something.  Beyond my knowledge...

****

On another note, has anyone discovered any other problems with this build?  If you're not trying to use cheats, everything else should run just as before.