SDL: wait for libapplication.so to load before launching main()

This commit is contained in:
Sergii Pylypenko
2015-01-15 23:43:29 +02:00
parent abef3686fe
commit f5e9ca27e6
5 changed files with 10 additions and 5 deletions

View File

@@ -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

View File

@@ -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
{

View File

@@ -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,

View File

@@ -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.