Load shared libraries from a separate thread, that shuold improve app startup time somewhat
This commit is contained in:
@@ -129,28 +129,32 @@ public class MainActivity extends Activity {
|
||||
|
||||
setContentView(_videoLayout);
|
||||
|
||||
if(mAudioThread == null) // Starting from background (should not happen)
|
||||
class Callback implements Runnable
|
||||
{
|
||||
System.out.println("libSDL: Loading libraries");
|
||||
LoadLibraries();
|
||||
mAudioThread = new AudioThread(this);
|
||||
System.out.println("libSDL: Loading settings");
|
||||
Settings.Load(this);
|
||||
if(!Globals.CompatibilityHacksStaticInit)
|
||||
LoadApplicationLibrary(this);
|
||||
}
|
||||
|
||||
if( !Settings.settingsChanged )
|
||||
{
|
||||
System.out.println("libSDL: " + String.valueOf(Globals.StartupMenuButtonTimeout) + "-msec timeout in startup screen");
|
||||
class Callback implements Runnable
|
||||
MainActivity p;
|
||||
Callback( MainActivity _p ) { p = _p; }
|
||||
public void run()
|
||||
{
|
||||
MainActivity p;
|
||||
Callback( MainActivity _p ) { p = _p; }
|
||||
public void run()
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch( InterruptedException e ) {};
|
||||
|
||||
if(p.mAudioThread == null)
|
||||
{
|
||||
System.out.println("libSDL: Loading libraries");
|
||||
p.LoadLibraries();
|
||||
p.mAudioThread = new AudioThread(p);
|
||||
System.out.println("libSDL: Loading settings");
|
||||
Settings.Load(p);
|
||||
if(!Globals.CompatibilityHacksStaticInit)
|
||||
p.LoadApplicationLibrary(p);
|
||||
}
|
||||
|
||||
if( !Settings.settingsChanged )
|
||||
{
|
||||
if( Globals.StartupMenuButtonTimeout > 0 )
|
||||
{
|
||||
System.out.println("libSDL: " + String.valueOf(Globals.StartupMenuButtonTimeout) + "-msec timeout in startup screen");
|
||||
try {
|
||||
Thread.sleep(Globals.StartupMenuButtonTimeout);
|
||||
} catch( InterruptedException e ) {};
|
||||
@@ -160,11 +164,9 @@ public class MainActivity extends Activity {
|
||||
System.out.println("libSDL: Timeout reached in startup screen, process with downloader");
|
||||
p.startDownloader();
|
||||
}
|
||||
};
|
||||
Thread changeConfigAlertThread = null;
|
||||
changeConfigAlertThread = new Thread(new Callback(this));
|
||||
changeConfigAlertThread.start();
|
||||
}
|
||||
}
|
||||
};
|
||||
(new Thread(new Callback(this))).start();
|
||||
}
|
||||
|
||||
public void setUpStatusLabel()
|
||||
|
||||
@@ -809,7 +809,7 @@ static int setupScreenKeyboardButtonTexture( GLTexture_t * data, Uint8 * charBuf
|
||||
|
||||
glGenTextures(1, &data->id);
|
||||
glBindTexture(GL_TEXTURE_2D, data->id);
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "On-screen keyboard generated OpenGL texture ID %d", data->id);
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "On-screen keyboard generated OpenGL texture ID %d", data->id);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_w, texture_h, 0, GL_RGBA,
|
||||
bpp == 4 ? GL_UNSIGNED_BYTE : (format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1), NULL);
|
||||
@@ -909,16 +909,11 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboardButtons) ( JNIEnv* env, jobj
|
||||
int but, pos, count;
|
||||
memcpy(&count, charBuf, sizeof(int));
|
||||
count = ntohl(count);
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Settings_nativeSetupScreenKeyboardButtons: enter, count %d", count);
|
||||
|
||||
for( but = 0, pos = sizeof(int); pos < len; but ++ )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Settings_nativeSetupScreenKeyboardButtons: button %d pos %d", but, pos);
|
||||
pos += setupScreenKeyboardButton( but, charBuf + pos, count );
|
||||
}
|
||||
|
||||
(*env)->ReleaseByteArrayElements(env, charBufJava, (jbyte *)charBuf, 0);
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Settings_nativeSetupScreenKeyboardButtons: exit");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user