android: rework loadLibrary function to fix bugs and report errors

This commit is contained in:
Sebastian Krzyszkowiak 2019-04-02 23:38:37 +02:00
parent 1e7fe215c4
commit c3096eee7b
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -10,19 +10,20 @@ public class Activity extends AllegroActivity {
static void loadLibrary(String name) {
try {
// try loading the debug library first.
Log.d("loadLibrary", name + "-debug");
System.loadLibrary(name + "-debug");
Log.d("loadLibrary", name + "-debug");
} catch (UnsatisfiedLinkError e) {
try {
// If it fails load the release library.
Log.d("loadLibrary", name);
System.loadLibrary(name);
Log.d("loadLibrary", name);
} catch (UnsatisfiedLinkError e2) {
// We still continue as failing to load an addon may
// not be a fatal error - for example if the TTF was
// not built we can still run an example which does not
// need that addon.
Log.d("loadLibrary", name + " FAILED");
Log.d("loadLibrary", name + "-debug FAILED", e);
Log.d("loadLibrary", name + " FAILED", e2);
}
}
}
@ -43,8 +44,8 @@ public class Activity extends AllegroActivity {
loadLibrary("allegro_memfile");
loadLibrary("allegro_physfs");
loadLibrary("allegro_video");
loadLibrary("libsuperderpy");
loadLibrary("lib${LIBSUPERDERPY_GAMENAME}");
loadLibrary("superderpy");
loadLibrary("${LIBSUPERDERPY_GAMENAME}");
}
/* By default, AllegroActivity.onCreate will cause Allegro to load the