--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/EngineProtocol/PascalExports.java Sat Dec 07 16:14:27 2019 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/EngineProtocol/PascalExports.java Sat Dec 07 16:18:20 2019 +0100
@@ -23,17 +23,30 @@
public class PascalExports {
public static Object engineMutex = new Object();
+ protected final static String[] libs = {
+ "SDL2",
+ "SDL2_image",
+ "mikmod",
+ "SDL2_net",
+ "SDL2_mixer",
+ "SDL2_ttf",
+ "lua",
+ "physfs",
+ "physlayer",
+ "hwengine",
+ };
+
static{
- System.loadLibrary("SDL");
- System.loadLibrary("SDL_image");
- System.loadLibrary("mikmod");
- System.loadLibrary("SDL_net");
- System.loadLibrary("SDL_mixer");
- System.loadLibrary("SDL_ttf");
- System.loadLibrary("lua5.1");
- System.loadLibrary("physfs");
- System.loadLibrary("physlayer");
- System.loadLibrary("hwengine");
+ for (String l : libs) {
+ try {
+ android.util.Log.d("org.hedgewars.hedgeroid.EngineProtocol.PascalExports", "Hedgewars (class PascalExports) is attempting to load library '" + l + "' ...");
+ System.loadLibrary(l);
+ android.util.Log.d("org.hedgewars.hedgeroid.EngineProtocol.PascalExports", "Hedgewars (class PascalExports) successfully loaded library '" + l + "'.");
+ } catch (Exception ex) {
+ android.util.Log.e("org.hedgewars.hedgeroid.EngineProtocol.PascalExports", "Hedgewars (class PascalExports) failed to load library '" + l + "':" + ex.getMessage());
+ throw ex;
+ }
+ }
}
public static native int HWgetMaxNumberOfTeams();
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java Sat Dec 07 16:14:27 2019 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java Sat Dec 07 16:18:20 2019 +0100
@@ -87,9 +87,22 @@
private static int mGLMajor, mGLMinor;
// Load the .so
- static {
- System.loadLibrary("SDL");
- System.loadLibrary("main");
+ protected final static String[] libs = {
+ "SDL2",
+ "main",
+ };
+
+ static{
+ for (String l : libs) {
+ try {
+ android.util.Log.d("org.hedgewars.hedgeroid.SDLActivity", "Hedgewars (class SDLActivity) is attempting to load library '" + l + "' ...");
+ System.loadLibrary(l);
+ android.util.Log.d("org.hedgewars.hedgeroid.SDLActivity", "Hedgewars (class SDLActivity) successfully loaded library '" + l + "'.");
+ } catch (Exception ex) {
+ android.util.Log.e("org.hedgewars.hedgeroid.SDLActivity", "Hedgewars (class SDLActivity) failed to load library '" + l + "':" + ex.getMessage());
+ throw ex;
+ }
+ }
}
// Setup
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/frontlib/Flib.java Sat Dec 07 16:14:27 2019 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/frontlib/Flib.java Sat Dec 07 16:18:20 2019 +0100
@@ -27,14 +27,37 @@
import com.sun.jna.Native;
public class Flib {
- static {
- System.loadLibrary("SDL");
- System.loadLibrary("SDL_net");
+ protected final static String[] libs = {
+ "SDL2",
+ "SDL2_net",
+ };
+
+ static{
+ for (String l : libs) {
+ try {
+ android.util.Log.d("org.hedgewars.hedgeroid.frontlib.Flib", "Hedgewars (class Flib) is attempting to load library '" + l + "' ...");
+ System.loadLibrary(l);
+ android.util.Log.d("org.hedgewars.hedgeroid.frontlib.Flib", "Hedgewars (class Flib) successfully loaded library '" + l + "'.");
+ } catch (Exception ex) {
+ android.util.Log.e("org.hedgewars.hedgeroid.frontlib.Flib", "Hedgewars (class Flib) failed to load library '" + l + "':" + ex.getMessage());
+ throw ex;
+ }
+ }
System.setProperty("jna.encoding", "UTF8"); // Ugly global setting, but it seems JNA doesn't allow setting this per-library...
}
- public static final Frontlib INSTANCE = (Frontlib)Native.loadLibrary("frontlib", Frontlib.class, Collections.singletonMap(Library.OPTION_TYPE_MAPPER, AndroidTypeMapper.INSTANCE));
+ public static final Frontlib INSTANCE;
static {
+ String l = "frontlib";
+ try {
+ android.util.Log.d("org.hedgewars.hedgeroid.frontlib.Flib", "Hedgewars (class Flib) is attempting to singleton-load library '" + l + "' ...");
+ INSTANCE = (Frontlib)Native.loadLibrary(l, Frontlib.class, Collections.singletonMap(Library.OPTION_TYPE_MAPPER, AndroidTypeMapper.INSTANCE));
+ android.util.Log.d("org.hedgewars.hedgeroid.frontlib.Flib", "Hedgewars (class Flib) successfully loaded library '" + l + "'.");
+ } catch (Exception ex) {
+ android.util.Log.e("org.hedgewars.hedgeroid.frontlib.Flib", "Hedgewars (class Flib) failed to load library '" + l + "':" + ex.getMessage());
+ throw ex;
+ }
+
// We'll just do it here and never quit it again...
if(Flib.INSTANCE.flib_init() != 0) {
throw new RuntimeException("Unable to initialize frontlib");