SDL2: custom activity that overrides SDLActivity
This commit is contained in:
@@ -48,10 +48,6 @@ fi
|
|||||||
|
|
||||||
var=""
|
var=""
|
||||||
|
|
||||||
if [ "$LibSdlVersion" = "2.0" ]; then
|
|
||||||
JAVA_SRC_PATH=project/javaSDL2
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CompatibilityHacks" = y ]; then
|
if [ "$CompatibilityHacks" = y ]; then
|
||||||
SwVideoMode=y
|
SwVideoMode=y
|
||||||
fi
|
fi
|
||||||
@@ -196,7 +192,7 @@ echo "# Here you may type readme text, which will be shown during startup. Forma
|
|||||||
echo "# Text in English, use \\\\\\\\\\\\\\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/" >> AndroidAppSettings.cfg
|
echo "# Text in English, use \\\\\\\\\\\\\\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/" >> AndroidAppSettings.cfg
|
||||||
echo ReadmeText=\'$ReadmeText\' | sed 's/\\\\n/\\\\\\\\n/g' >> AndroidAppSettings.cfg
|
echo ReadmeText=\'$ReadmeText\' | sed 's/\\\\n/\\\\\\\\n/g' >> AndroidAppSettings.cfg
|
||||||
echo >> AndroidAppSettings.cfg
|
echo >> AndroidAppSettings.cfg
|
||||||
echo "# libSDL version to use (1.2/2.0)" >> AndroidAppSettings.cfg
|
echo "# libSDL version to use (1.2/2)" >> AndroidAppSettings.cfg
|
||||||
echo LibSdlVersion=$LibSdlVersion >> AndroidAppSettings.cfg
|
echo LibSdlVersion=$LibSdlVersion >> AndroidAppSettings.cfg
|
||||||
echo >> AndroidAppSettings.cfg
|
echo >> AndroidAppSettings.cfg
|
||||||
echo "# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape" >> AndroidAppSettings.cfg
|
echo "# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape" >> AndroidAppSettings.cfg
|
||||||
@@ -415,7 +411,7 @@ echo >> AndroidAppSettings.cfg
|
|||||||
echo "# How long to show startup menu button, in msec, 0 to disable startup menu" >> AndroidAppSettings.cfg
|
echo "# How long to show startup menu button, in msec, 0 to disable startup menu" >> AndroidAppSettings.cfg
|
||||||
echo StartupMenuButtonTimeout=$StartupMenuButtonTimeout >> AndroidAppSettings.cfg
|
echo StartupMenuButtonTimeout=$StartupMenuButtonTimeout >> AndroidAppSettings.cfg
|
||||||
echo >> AndroidAppSettings.cfg
|
echo >> AndroidAppSettings.cfg
|
||||||
echo "# Menu items to hide from startup menu, available menu items:" >> AndroidAppSettings.cfg
|
echo "# Menu items to hide from startup menu, available menu items (SDL 1.2 only):" >> AndroidAppSettings.cfg
|
||||||
echo "# $MenuOptionsAvailable" >> AndroidAppSettings.cfg
|
echo "# $MenuOptionsAvailable" >> AndroidAppSettings.cfg
|
||||||
echo HiddenMenuOptions=\'$HiddenMenuOptions\' >> AndroidAppSettings.cfg
|
echo HiddenMenuOptions=\'$HiddenMenuOptions\' >> AndroidAppSettings.cfg
|
||||||
echo >> AndroidAppSettings.cfg
|
echo >> AndroidAppSettings.cfg
|
||||||
@@ -498,14 +494,12 @@ AppSharedLibrariesPath=/data/data/$AppFullName/lib
|
|||||||
ScreenOrientation1=sensorPortrait
|
ScreenOrientation1=sensorPortrait
|
||||||
HorizontalOrientation=false
|
HorizontalOrientation=false
|
||||||
|
|
||||||
UsingSdl13=false
|
UsingSdl2=false
|
||||||
if [ "$LibSdlVersion" = "1.3" ] ; then
|
|
||||||
UsingSdl13=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
UsingSdl20=false
|
|
||||||
if [ "$LibSdlVersion" = "2.0" ] ; then
|
if [ "$LibSdlVersion" = "2.0" ] ; then
|
||||||
UsingSdl20=true
|
"$LibSdlVersion" = "2"
|
||||||
|
fi
|
||||||
|
if [ "$LibSdlVersion" = "2" ] ; then
|
||||||
|
UsingSdl2=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ScreenOrientation" = "h" -o "$ScreenOrientation" = "l" ] ; then
|
if [ "$ScreenOrientation" = "h" -o "$ScreenOrientation" = "l" ] ; then
|
||||||
@@ -790,7 +784,8 @@ else
|
|||||||
MultiABI="$MultiABI"
|
MultiABI="$MultiABI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LibrariesToLoad="\\\"sdl_native_helpers\\\", \\\"sdl-$LibSdlVersion\\\""
|
LibrariesToLoad="\\\"sdl_native_helpers\\\", \\\"`$UsingSdl2 && echo SDL2 || echo sdl-1.2`\\\""
|
||||||
|
|
||||||
StaticLibraries="`echo '
|
StaticLibraries="`echo '
|
||||||
include project/jni/SettingsTemplate.mk
|
include project/jni/SettingsTemplate.mk
|
||||||
all:
|
all:
|
||||||
@@ -811,8 +806,11 @@ for lib in $CompatibilityHacksAdditionalPreloadedSharedLibraries; do
|
|||||||
MainLibrariesToLoad="$MainLibrariesToLoad \\\"$lib\\\","
|
MainLibrariesToLoad="$MainLibrariesToLoad \\\"$lib\\\","
|
||||||
done
|
done
|
||||||
|
|
||||||
MainLibrariesToLoad="$MainLibrariesToLoad \\\"application\\\", \\\"sdl_main\\\""
|
if $UsingSdl2; then
|
||||||
|
MainLibrariesToLoad="$MainLibrariesToLoad \\\"application\\\""
|
||||||
|
else
|
||||||
|
MainLibrariesToLoad="$MainLibrariesToLoad \\\"application\\\", \\\"sdl_main\\\""
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$CustomBuildScript" = "n" ] ; then
|
if [ "$CustomBuildScript" = "n" ] ; then
|
||||||
CustomBuildScript=
|
CustomBuildScript=
|
||||||
@@ -840,37 +838,51 @@ if uname -s | grep -i "darwin" > /dev/null ; then
|
|||||||
SEDI="sed -i.killme.tmp" # MacOsX version of sed is buggy, and requires a mandatory parameter
|
SEDI="sed -i.killme.tmp" # MacOsX version of sed is buggy, and requires a mandatory parameter
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
rm -rf project/src
|
rm -rf project/src
|
||||||
mkdir -p project/src
|
mkdir -p project/src
|
||||||
|
|
||||||
|
if $UsingSdl2; then
|
||||||
|
JAVA_SRC_PATH=project/javaSDL2
|
||||||
|
fi
|
||||||
|
|
||||||
cd $JAVA_SRC_PATH
|
cd $JAVA_SRC_PATH
|
||||||
for F in *.java; do
|
for F in *.java; do
|
||||||
echo '// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under $JAVA_SRC_PATH dir' | cat - $F > ../src/$F
|
echo '// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN, edit the file under '$JAVA_SRC_PATH' dir' | cat - $F > ../src/$F
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -e ../jni/application/src/java.diff ]; then patch -d ../src --no-backup-if-mismatch < ../jni/application/src/java.diff || exit 1 ; fi
|
|
||||||
if [ -e ../jni/application/src/java.patch ]; then patch -d ../src --no-backup-if-mismatch < ../jni/application/src/java.patch || exit 1 ; fi
|
|
||||||
if ls ../jni/application/src/*.java > /dev/null 2>&1; then cp -f ../jni/application/src/*.java ../src ; fi
|
|
||||||
|
|
||||||
for F in ../src/*.java; do
|
for F in ../src/*.java; do
|
||||||
echo Patching $F
|
echo Patching $F
|
||||||
$SEDI "s/^package .*;/package $AppFullName;/" $F
|
$SEDI "s/^package .*;/package $AppFullName;/" $F
|
||||||
done
|
done
|
||||||
|
|
||||||
cd ../..
|
if $UsingSdl2; then
|
||||||
|
# Keep package name org.libsdl.app, it's hardcoded inside libSDL2.so
|
||||||
# In case we use SDL2 let simlink the SDLActivity source file
|
for F in `ls ../jni/sdl2/android-project/app/src/main/java/org/libsdl/app/`; do
|
||||||
if [ "$LibSdlVersion" = "2.0" ] ; then
|
echo '// DO NOT EDIT THIS FILE - it is automatically generated, ALL YOUR CHANGES WILL BE OVERWRITTEN,' \
|
||||||
ln -s ../jni/sdl-2.0/android-project/src/org/libsdl/app/SDLActivity.java project/src/SDLActivity.java
|
'edit the file under project/jni/sdl2/android-project/app/src/main/java/org/libsdl/app dir' | \
|
||||||
|
cat - ../jni/sdl2/android-project/app/src/main/java/org/libsdl/app/$F > ../src/$F
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e ../jni/application/src/java.diff ]; then patch -d ../src --no-backup-if-mismatch < ../jni/application/src/java.diff || exit 1 ; fi
|
||||||
|
if [ -e ../jni/application/src/java.patch ]; then patch -d ../src --no-backup-if-mismatch < ../jni/application/src/java.patch || exit 1 ; fi
|
||||||
|
if ls ../jni/application/src/*.java > /dev/null 2>&1; then cp -f ../jni/application/src/*.java ../src ; fi
|
||||||
|
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
if $UsingSdl2; then
|
||||||
|
ANDROID_MANIFEST_TEMPLATE=project/jni/sdl2/android-project/app/src/main/AndroidManifest.xml
|
||||||
|
else
|
||||||
|
ANDROID_MANIFEST_TEMPLATE=project/AndroidManifestTemplate.xml
|
||||||
|
fi
|
||||||
|
|
||||||
echo Patching project/AndroidManifest.xml
|
echo Patching project/AndroidManifest.xml
|
||||||
cat project/AndroidManifestTemplate.xml | \
|
cat $ANDROID_MANIFEST_TEMPLATE | \
|
||||||
sed "s/package=.*/package=\"$AppFullName\"/" | \
|
sed "s/package=.*/package=\"$AppFullName\"/" | \
|
||||||
sed "s/android:screenOrientation=.*/android:screenOrientation=\"$ScreenOrientation1\"/" | \
|
sed "s/android:screenOrientation=.*/android:screenOrientation=\"$ScreenOrientation1\"/" | \
|
||||||
sed "s^android:versionCode=.*^android:versionCode=\"$AppVersionCode\"^" | \
|
sed "s^android:versionCode=.*^android:versionCode=\"$AppVersionCode\"^" | \
|
||||||
sed "s^android:versionName=.*^android:versionName=\"$AppVersionName\"^" > \
|
sed "s^android:versionName=.*^android:versionName=\"$AppVersionName\"^" | \
|
||||||
|
sed "s^activity android:name=.*^activity android:name=\"MainActivity\"^" > \
|
||||||
project/AndroidManifest.xml
|
project/AndroidManifest.xml
|
||||||
if [ "$AdmobPublisherId" = "n" -o -z "$AdmobPublisherId" ] ; then
|
if [ "$AdmobPublisherId" = "n" -o -z "$AdmobPublisherId" ] ; then
|
||||||
$SEDI "/==ADMOB==/ d" project/AndroidManifest.xml
|
$SEDI "/==ADMOB==/ d" project/AndroidManifest.xml
|
||||||
@@ -980,9 +992,8 @@ fi
|
|||||||
|
|
||||||
echo Patching project/src/Globals.java
|
echo Patching project/src/Globals.java
|
||||||
$SEDI "s/public static String ApplicationName = .*;/public static String ApplicationName = \"$AppShortName\";/" project/src/Globals.java
|
$SEDI "s/public static String ApplicationName = .*;/public static String ApplicationName = \"$AppShortName\";/" project/src/Globals.java
|
||||||
$SEDI "s/public static final boolean Using_SDL_1_3 = .*;/public static final boolean Using_SDL_1_3 = $UsingSdl13;/" project/src/Globals.java
|
|
||||||
|
|
||||||
$SEDI "s/public static final boolean Using_SDL_2_0 = .*;/public static final boolean Using_SDL_2_0 = $UsingSdl20;/" project/src/Globals.java
|
$SEDI "s/public static final boolean UsingSDL2 = .*;/public static final boolean UsingSDL2 = $UsingSdl2;/" project/src/Globals.java
|
||||||
|
|
||||||
# Work around "Argument list too long" problem when compiling VICE
|
# Work around "Argument list too long" problem when compiling VICE
|
||||||
#$SEDI "s@public static String DataDownloadUrl = .*@public static String DataDownloadUrl = \"$AppDataDownloadUrl1\";@" project/src/Globals.java
|
#$SEDI "s@public static String DataDownloadUrl = .*@public static String DataDownloadUrl = \"$AppDataDownloadUrl1\";@" project/src/Globals.java
|
||||||
@@ -1045,11 +1056,10 @@ $SEDI "s%public static String GooglePlayGameServicesId = .*%public static String
|
|||||||
$SEDI "s/public static String AppLibraries.*/public static String AppLibraries[] = { $LibrariesToLoad };/" project/src/Globals.java
|
$SEDI "s/public static String AppLibraries.*/public static String AppLibraries[] = { $LibrariesToLoad };/" project/src/Globals.java
|
||||||
$SEDI "s/public static String AppMainLibraries.*/public static String AppMainLibraries[] = { $MainLibrariesToLoad };/" project/src/Globals.java
|
$SEDI "s/public static String AppMainLibraries.*/public static String AppMainLibraries[] = { $MainLibrariesToLoad };/" project/src/Globals.java
|
||||||
|
|
||||||
|
|
||||||
echo Patching project/jni/Settings.mk
|
echo Patching project/jni/Settings.mk
|
||||||
echo '# DO NOT EDIT THIS FILE - it is automatically generated, edit file SettingsTemplate.mk' > project/jni/Settings.mk
|
echo '# DO NOT EDIT THIS FILE - it is automatically generated, edit file SettingsTemplate.mk' > project/jni/Settings.mk
|
||||||
cat project/jni/SettingsTemplate.mk | \
|
cat project/jni/SettingsTemplate.mk | \
|
||||||
sed "s/APP_MODULES := .*/APP_MODULES := sdl-$LibSdlVersion sdl_native_helpers jpeg png ogg flac vorbis freetype $CompiledLibraries/" | \
|
sed "s/APP_MODULES := .*/APP_MODULES := `$UsingSdl2 && echo SDL2 || echo sdl-1.2` sdl_native_helpers jpeg png ogg flac vorbis freetype $CompiledLibraries/" | \
|
||||||
sed "s/APP_ABI := .*/APP_ABI := $MultiABI/" | \
|
sed "s/APP_ABI := .*/APP_ABI := $MultiABI/" | \
|
||||||
sed "s/SDL_JAVA_PACKAGE_PATH := .*/SDL_JAVA_PACKAGE_PATH := $AppFullNameUnderscored/" | \
|
sed "s/SDL_JAVA_PACKAGE_PATH := .*/SDL_JAVA_PACKAGE_PATH := $AppFullNameUnderscored/" | \
|
||||||
sed "s^SDL_CURDIR_PATH := .*^SDL_CURDIR_PATH := $DataPath^" | \
|
sed "s^SDL_CURDIR_PATH := .*^SDL_CURDIR_PATH := $DataPath^" | \
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
>
|
>
|
||||||
<activity android:name=".MainActivity"
|
<activity android:name="MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:alwaysRetainTaskState="true"
|
android:alwaysRetainTaskState="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/google_play_game_services_app_id" />
|
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/google_play_game_services_app_id" />
|
||||||
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
|
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
|
||||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" /> <!-- Samsung's multiwindow -->
|
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" /> <!-- Samsung's multiwindow -->
|
||||||
<activity android:name=".RestartMainActivity"
|
<activity android:name="RestartMainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:alwaysRetainTaskState="true"
|
android:alwaysRetainTaskState="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
|||||||
@@ -338,54 +338,6 @@ class DataDownloader extends Thread
|
|||||||
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
|
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
|
||||||
if( url.equals("assetpack") )
|
if( url.equals("assetpack") )
|
||||||
{
|
{
|
||||||
Log.i("SDL", "Checking for asset pack");
|
|
||||||
/*
|
|
||||||
try
|
|
||||||
{
|
|
||||||
AssetPackManager assetPackManager = AssetPackManagerFactory.getInstance(Parent.getApplicationContext());
|
|
||||||
Log.i("SDL", "Parent.getApplicationContext(): " + Parent.getApplicationContext() + " assetPackManager " + assetPackManager);
|
|
||||||
if( assetPackManager != null )
|
|
||||||
{
|
|
||||||
Log.i("SDL", "assetPackManager.getPackLocation(): " + assetPackManager.getPackLocation("assetpack"));
|
|
||||||
if( assetPackManager.getPackLocation("assetpack") != null )
|
|
||||||
{
|
|
||||||
String assetPackPath = assetPackManager.getPackLocation("assetpack").assetsPath();
|
|
||||||
Parent.assetPackPath = assetPackPath;
|
|
||||||
if( assetPackPath != null )
|
|
||||||
{
|
|
||||||
Log.i("SDL", "Asset pack is installed at: " + assetPackPath);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
Log.i("SDL", "Asset pack exception: " + e);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP )
|
|
||||||
{
|
|
||||||
ApplicationInfo info = Parent.getPackageManager().getApplicationInfo(Parent.getPackageName(), 0);
|
|
||||||
if( info.splitSourceDirs != null )
|
|
||||||
{
|
|
||||||
for( String apk: info.splitSourceDirs )
|
|
||||||
{
|
|
||||||
Log.i("SDL", "Package apk: " + apk);
|
|
||||||
if( apk.endsWith("assetpack.apk") )
|
|
||||||
{
|
|
||||||
Parent.assetPackPath = apk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
Log.i("SDL", "Asset pack exception: " + e);
|
|
||||||
}
|
|
||||||
if( Parent.assetPackPath != null )
|
if( Parent.assetPackPath != null )
|
||||||
{
|
{
|
||||||
Log.i("SDL", "Found asset pack: " + Parent.assetPackPath);
|
Log.i("SDL", "Found asset pack: " + Parent.assetPackPath);
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ class Globals
|
|||||||
{ "expat", "expat-sdl" },
|
{ "expat", "expat-sdl" },
|
||||||
{ "sqlite3", "sqlite3-sdl" },
|
{ "sqlite3", "sqlite3-sdl" },
|
||||||
}; // Because some libraries are named differently to not clash with system libs
|
}; // Because some libraries are named differently to not clash with system libs
|
||||||
public static final boolean Using_SDL_1_3 = false;
|
public static final boolean UsingSDL2 = false;
|
||||||
public static final boolean Using_SDL_2_0 = false;
|
|
||||||
public static String[] DataDownloadUrl = { "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download", "High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download" };
|
public static String[] DataDownloadUrl = { "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download", "High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download" };
|
||||||
public static boolean SwVideoMode = false;
|
public static boolean SwVideoMode = false;
|
||||||
public static boolean NeedDepthBuffer = false;
|
public static boolean NeedDepthBuffer = false;
|
||||||
|
|||||||
@@ -188,6 +188,31 @@ public class MainActivity extends Activity
|
|||||||
_videoLayout.requestFocus();
|
_videoLayout.requestFocus();
|
||||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||||
|
|
||||||
|
Log.i("SDL", "Checking for asset pack");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP )
|
||||||
|
{
|
||||||
|
ApplicationInfo info = this.getPackageManager().getApplicationInfo(Parent.getPackageName(), 0);
|
||||||
|
if( info.splitSourceDirs != null )
|
||||||
|
{
|
||||||
|
for( String apk: info.splitSourceDirs )
|
||||||
|
{
|
||||||
|
Log.i("SDL", "Package apk: " + apk);
|
||||||
|
if( apk.endsWith("assetpack.apk") )
|
||||||
|
{
|
||||||
|
this.assetPackPath = apk;
|
||||||
|
Log.i("SDL", "Found asset pack: " + this.assetPackPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( Exception eee )
|
||||||
|
{
|
||||||
|
Log.i("SDL", "Asset pack exception: " + eee);
|
||||||
|
}
|
||||||
|
|
||||||
class Callback implements Runnable
|
class Callback implements Runnable
|
||||||
{
|
{
|
||||||
MainActivity p;
|
MainActivity p;
|
||||||
|
|||||||
@@ -1001,6 +1001,7 @@ public class Settings
|
|||||||
Save(MainActivity.instance);
|
Save(MainActivity.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// libsdl-1.2.so, does not exist in SDL2
|
||||||
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
|
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
|
||||||
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
|
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
|
||||||
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
|
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
|
||||||
@@ -1035,6 +1036,7 @@ public class Settings
|
|||||||
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
|
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
|
||||||
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
|
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
|
||||||
public static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
|
public static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
|
||||||
|
// libsdl_native_helpers.so, exists in both versions
|
||||||
public static native void nativeSetEnv(final String name, final String value);
|
public static native void nativeSetEnv(final String name, final String value);
|
||||||
public static native int nativeChmod(final String name, int mode);
|
public static native int nativeChmod(final String name, int mode);
|
||||||
public static native void nativeChdir(final String dir);
|
public static native void nativeChdir(final String dir);
|
||||||
|
|||||||
1
project/javaSDL2/Globals.java
Symbolic link
1
project/javaSDL2/Globals.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/Globals.java
|
||||||
87
project/javaSDL2/MainActivity.java
Normal file
87
project/javaSDL2/MainActivity.java
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.sourceforge.clonekeenplus;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MainActivity extends org.libsdl.app.SDLActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
Globals.DataDir = this.getFilesDir().getAbsolutePath();
|
||||||
|
Settings.LoadConfig(this); // Load Globals.DataDir from SDL 1.2 installation, we never save config file
|
||||||
|
|
||||||
|
Log.i("SDL", "Checking for asset pack");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP )
|
||||||
|
{
|
||||||
|
ApplicationInfo info = this.getPackageManager().getApplicationInfo(Parent.getPackageName(), 0);
|
||||||
|
if( info.splitSourceDirs != null )
|
||||||
|
{
|
||||||
|
for( String apk: info.splitSourceDirs )
|
||||||
|
{
|
||||||
|
Log.i("SDL", "Package apk: " + apk);
|
||||||
|
if( apk.endsWith("assetpack.apk") )
|
||||||
|
{
|
||||||
|
this.assetPackPath = apk;
|
||||||
|
Log.i("SDL", "Found asset pack: " + this.assetPackPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( Exception eee )
|
||||||
|
{
|
||||||
|
Log.i("SDL", "Asset pack exception: " + eee);
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings.setEnvVars(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String[] getLibraries() {
|
||||||
|
ArrayList<String> ret = new ArrayList<String>();
|
||||||
|
for (String l: Globals.AppLibraries) {
|
||||||
|
ret.add(GetMappedLibraryName(l));
|
||||||
|
}
|
||||||
|
return ret.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String[] getArguments() {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String GetMappedLibraryName(final String s) {
|
||||||
|
for (int i = 0; i < Globals.LibraryNamesMap.length; i++) {
|
||||||
|
if (Globals.LibraryNamesMap[i][0].equals(s))
|
||||||
|
return Globals.LibraryNamesMap[i][1];
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String ObbMountPath = null; // Deprecated, always empty
|
||||||
|
public String assetPackPath = null; // Not saved to the config file
|
||||||
|
}
|
||||||
1
project/javaSDL2/Settings.java
Symbolic link
1
project/javaSDL2/Settings.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/Settings.java
|
||||||
1
project/javaSDL2/translations
Symbolic link
1
project/javaSDL2/translations
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/translations
|
||||||
1
project/jni/SDL2/include
Symbolic link
1
project/jni/SDL2/include
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sdl2/include
|
||||||
@@ -6,7 +6,9 @@ LOCAL_MODULE := application
|
|||||||
|
|
||||||
APPDIR := $(shell readlink $(LOCAL_PATH)/src)
|
APPDIR := $(shell readlink $(LOCAL_PATH)/src)
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := sdl-$(SDL_VERSION) $(filter-out $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
SDL_LIB := $(if $(filter 1.2, $(SDL_VERSION)), sdl-1.2, SDL2)
|
||||||
|
|
||||||
|
LOCAL_SHARED_LIBRARIES := $(SDL_LIB_NAME) $(filter-out $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES := $(filter $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
LOCAL_STATIC_LIBRARIES := $(filter $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ LOCAL_CFLAGS += $(foreach D, $(LOCAL_C_INCLUDES), -iquote$(D))
|
|||||||
LOCAL_C_INCLUDES :=
|
LOCAL_C_INCLUDES :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../sdl-$(SDL_VERSION)/include
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../$(SDL_LIB_NAME)/include
|
||||||
LOCAL_C_INCLUDES += $(foreach L, $(COMPILED_LIBRARIES), $(LOCAL_PATH)/../$(L)/include)
|
LOCAL_C_INCLUDES += $(foreach L, $(COMPILED_LIBRARIES), $(LOCAL_PATH)/../$(L)/include)
|
||||||
|
|
||||||
LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS)
|
LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS)
|
||||||
|
|||||||
@@ -36,21 +36,21 @@ AppDataDownloadUrl="!!SSL certificates|:ca-certificates.crt:ca-certificates.crt"
|
|||||||
ResetSdlConfigForThisVersion=y
|
ResetSdlConfigForThisVersion=y
|
||||||
|
|
||||||
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
|
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
|
||||||
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag"
|
DeleteFilesOnUpgrade=""
|
||||||
|
|
||||||
# Here you may type readme text, which will be shown during startup. Format is:
|
# Here you may type readme text, which will be shown during startup. Format is:
|
||||||
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
||||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||||
|
|
||||||
# libSDL version to use (1.2/1.3/2.0)
|
# libSDL version to use (1.2/2)
|
||||||
LibSdlVersion=1.2
|
LibSdlVersion=2
|
||||||
|
|
||||||
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
|
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
|
||||||
ScreenOrientation=h
|
ScreenOrientation=h
|
||||||
|
|
||||||
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
|
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
|
||||||
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
|
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
|
||||||
VideoDepthBpp=16
|
VideoDepthBpp=24
|
||||||
|
|
||||||
# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
|
# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
|
||||||
NeedDepthBuffer=n
|
NeedDepthBuffer=n
|
||||||
@@ -60,14 +60,14 @@ NeedStencilBuffer=n
|
|||||||
|
|
||||||
# Use GLES 2.x context
|
# Use GLES 2.x context
|
||||||
# you need this option only if you're developing 3-d app (y) or (n)
|
# you need this option only if you're developing 3-d app (y) or (n)
|
||||||
NeedGles2=n
|
NeedGles2=y
|
||||||
|
|
||||||
# Use GLES 3.x context
|
# Use GLES 3.x context
|
||||||
# you need this option only if you're developing 3-d app (y) or (n)
|
# you need this option only if you're developing 3-d app (y) or (n)
|
||||||
NeedGles3=
|
NeedGles3=n
|
||||||
|
|
||||||
# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
|
# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
|
||||||
UseGl4es=
|
UseGl4es=n
|
||||||
|
|
||||||
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
|
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
|
||||||
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
|
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
|
||||||
@@ -91,7 +91,7 @@ CompatibilityHacksForceScreenUpdate=n
|
|||||||
|
|
||||||
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
|
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
|
||||||
# force screen update by moving mouse cursor a little after each click (y) or (n)
|
# force screen update by moving mouse cursor a little after each click (y) or (n)
|
||||||
CompatibilityHacksForceScreenUpdateMouseClick=y
|
CompatibilityHacksForceScreenUpdateMouseClick=n
|
||||||
|
|
||||||
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
|
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
|
||||||
CompatibilityHacksStaticInit=n
|
CompatibilityHacksStaticInit=n
|
||||||
@@ -285,13 +285,12 @@ APP_PLATFORM=
|
|||||||
|
|
||||||
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
|
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
|
||||||
# Available architectures: armeabi-v7a arm64-v8a x86 x86_64
|
# Available architectures: armeabi-v7a arm64-v8a x86 x86_64
|
||||||
MultiABI='armeabi-v7a x86 x86_64 arm64-v8a'
|
MultiABI='arm64-v8a'
|
||||||
MultiABI=arm64-v8a
|
|
||||||
|
|
||||||
# Optional shared libraries to compile - removing some of them will save space
|
# Optional shared libraries to compile - removing some of them will save space
|
||||||
# MP3 patents are expired, but libmad license is GPL, not LGPL
|
# MP3 patents are expired, but libmad license is GPL, not LGPL
|
||||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||||
CompiledLibraries="c++_shared sdl_image sdl_ttf glm boost_filesystem boost_system boost_date_time boost_locale icuuc icudata iconv charset crypto ssl curl openal vorbis ogg"
|
CompiledLibraries="c++_shared SDL2_image glm boost_filesystem boost_system boost_date_time boost_locale icuuc icudata iconv charset crypto ssl curl openal vorbis ogg"
|
||||||
|
|
||||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||||
CustomBuildScript=n
|
CustomBuildScript=n
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
include include/Android.mk
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
include include/Android.mk
|
|
||||||
1
project/res/mipmap-nodpi/ic_launcher.png
Symbolic link
1
project/res/mipmap-nodpi/ic_launcher.png
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../drawable/icon.png
|
||||||
Reference in New Issue
Block a user