mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 08:31:04 +02:00
Apply the current love-specific patches.
This commit is contained in:
+33
-8
@@ -98,6 +98,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
public static NativeState mNextNativeState;
|
||||
public static NativeState mCurrentNativeState;
|
||||
|
||||
public static boolean mExitCalledFromJava; // love2d-mod: allow restarting of the native thread
|
||||
|
||||
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
||||
public static boolean mBrokenLibraries = true;
|
||||
|
||||
@@ -201,6 +203,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
mCursors = new Hashtable<Integer, PointerIcon>();
|
||||
mLastCursorID = 0;
|
||||
mSDLThread = null;
|
||||
mExitCalledFromJava = false; // love2d-mod: allow restarting of the native thread
|
||||
mIsResumedCalled = false;
|
||||
mHasFocus = true;
|
||||
mNextNativeState = NativeState.INIT;
|
||||
@@ -259,6 +262,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
return;
|
||||
}
|
||||
|
||||
startNative(); // love2d-mod: allow restarting of the native thread
|
||||
}
|
||||
|
||||
// love2d-mod-start: allow restarting of the native thread
|
||||
public void startNative() {
|
||||
// Set up JNI
|
||||
SDL.setupJNI();
|
||||
|
||||
@@ -309,6 +317,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
}
|
||||
}
|
||||
}
|
||||
// love2d-mod-end: allow restarting of the native thread
|
||||
|
||||
protected void pauseNativeThread() {
|
||||
mNextNativeState = NativeState.PAUSED;
|
||||
@@ -471,6 +480,20 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
return;
|
||||
}
|
||||
|
||||
appQuitFinish(); // love2d-mod: allow restarting of the native thread
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
// love2d-mod-start: allow restarting of the native thread
|
||||
public void resetNative() {
|
||||
Log.v("SDL", "resetNative()");
|
||||
|
||||
SDLActivity.mExitCalledFromJava = true; // love2d-mod: allow restarting of the native thread
|
||||
|
||||
appQuitFinish();
|
||||
}
|
||||
|
||||
private void appQuitFinish() {
|
||||
if (SDLActivity.mSDLThread != null) {
|
||||
|
||||
// Send Quit event to "SDLThread" thread
|
||||
@@ -485,9 +508,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
}
|
||||
|
||||
SDLActivity.nativeQuit();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
// love2d-mod-end: allow restarting of the native thread
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
@@ -1655,12 +1677,15 @@ class SDLMain implements Runnable {
|
||||
|
||||
Log.v("SDL", "Finished main function");
|
||||
|
||||
if (SDLActivity.mSingleton != null && !SDLActivity.mSingleton.isFinishing()) {
|
||||
// Let's finish the Activity
|
||||
SDLActivity.mSDLThread = null;
|
||||
SDLActivity.mSingleton.finish();
|
||||
} // else: Activity is already being destroyed
|
||||
|
||||
// love2d-mod-start: allow restarting of the native thread
|
||||
if (!SDLActivity.mExitCalledFromJava) {
|
||||
if (SDLActivity.mSingleton != null && !SDLActivity.mSingleton.isFinishing()) {
|
||||
// Let's finish the Activity
|
||||
SDLActivity.mSDLThread = null;
|
||||
SDLActivity.mSingleton.finish();
|
||||
} // else: Activity is already being destroyed
|
||||
}
|
||||
// love2d-mod-end: allow restarting of the native thread
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,8 @@
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#define SDL_AUDIO_DRIVER_ANDROID 1
|
||||
#define SDL_AUDIO_DRIVER_OPENSLES 1
|
||||
/* love2d-mod: Audio is handled by OpenAL */
|
||||
/* #define SDL_AUDIO_DRIVER_OPENSLES 1 */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
|
||||
Reference in New Issue
Block a user