From f5e9ca27e6bffd6439793ee282ba66bafb9bd0de Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Thu, 15 Jan 2015 23:43:29 +0200 Subject: [PATCH] SDL: wait for libapplication.so to load before launching main() --- checkExports.sh | 2 +- project/java/MainActivity.java | 3 +++ project/java/Video.java | 6 ++++-- project/jni/application/xserver/xserver | 2 +- readme.txt | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/checkExports.sh b/checkExports.sh index 00384d795..053d09ee5 100755 --- a/checkExports.sh +++ b/checkExports.sh @@ -1,4 +1,4 @@ #!/bin/sh # Check if any of exported symbols in application clash with symbol from system libraries # Internal compiler things like '__aeabi_ddiv' or '___Unwind_Resume' may be safely ignored, but 'regcomp' will cause your app to fail. -nm -g -p --defined-only project/obj/local/armeabi/*.so | cut -b 12- | sort | uniq | cat - exports-eclair.txt | sort | uniq -d +nm -g -p --defined-only project/obj/local/armeabi-v7a/*.so | cut -b 12- | sort | uniq | cat - exports-eclair.txt | sort | uniq -d diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java index 57522611b..99ce8fe3c 100644 --- a/project/java/MainActivity.java +++ b/project/java/MainActivity.java @@ -1235,6 +1235,8 @@ public class MainActivity extends Activity } } } + Log.v("SDL", "libSDL: loaded all libraries"); + ApplicationLibraryLoaded = true; } public int getApplicationVersion() @@ -1310,6 +1312,7 @@ public class MainActivity extends Activity private String _screenKeyboardHintMessage = null; static boolean keyboardWithoutTextInputShown = false; private boolean sdlInited = false; + public static boolean ApplicationLibraryLoaded = false; public interface TouchEventsListener { diff --git a/project/java/Video.java b/project/java/Video.java index abe426e78..53115008c 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -675,8 +675,10 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer mGlContextLost = false; - if(Globals.CompatibilityHacksStaticInit) + if( Globals.CompatibilityHacksStaticInit ) MainActivity.LoadApplicationLibrary(context); + while( !MainActivity.ApplicationLibraryLoaded ) + try { Thread.sleep(200); } catch (InterruptedException eeee) {} Settings.Apply(context); Settings.nativeSetEnv( "DISPLAY_RESOLUTION_WIDTH", String.valueOf(Math.max(mWidth, mHeight)) ); @@ -686,7 +688,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer if( Globals.MoveMouseWithGyroscope ) startAccelerometerGyroscope(1); // Tweak video thread priority, if user selected big audio buffer - if(Globals.AudioBufferConfig >= 2) + if( Globals.AudioBufferConfig >= 2 ) Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal // Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code nativeInit( Globals.DataDir, diff --git a/project/jni/application/xserver/xserver b/project/jni/application/xserver/xserver index d0bceab14..4a358c88b 160000 --- a/project/jni/application/xserver/xserver +++ b/project/jni/application/xserver/xserver @@ -1 +1 @@ -Subproject commit d0bceab1467d6d58e6481503ce248e7c04b3628a +Subproject commit 4a358c88bfe8c7bbbf88dd501dc7477a82f77369 diff --git a/readme.txt b/readme.txt index 7ac975635..8e4faa162 100644 --- a/readme.txt +++ b/readme.txt @@ -14,7 +14,7 @@ Install latest Android SDK and NDK from http://developer.android.com/index.html You'll need to install Java Ant too. Since for building apk files some java classes are needed as well, it is recommended to install OpenJDK and its development files. (On RPM based distros usually called java-x.x.x-openjdk and java-x.x.x-openjdk-devel) -The application will run on Android 3.0 and above, but will use features from Android 5.0 if available. +The application will run on Android 1.6 and above, but will use features from Android 5.0 if available. The most supported environment for this port is Linux, MacOs should be okay too. If you're developing under Windows you'd better install Portable Ubuntu, to get proper Linux environment running inside Windows, then install Linux toolchain on it.