Merge branch 'sdl_android' of github.com:pelya/commandergenius
This commit is contained in:
4
build.sh
4
build.sh
@@ -180,14 +180,14 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
|
||||
./AndroidPostBuild.sh `pwd`/../../../bin/MainActivity-release-unsigned.apk || exit 1 ; \
|
||||
cd ../../.. ; \
|
||||
} || exit 1 ; \
|
||||
jarsigner -tsa http://timestamp.digicert.com -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-release-unsigned.apk androiddebugkey || exit 1 ; \
|
||||
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-release-unsigned.apk androiddebugkey || exit 1 ; \
|
||||
rm -f bin/MainActivity-debug.apk ; \
|
||||
zipalign 4 bin/MainActivity-release-unsigned.apk bin/MainActivity-debug.apk || exit 1 ; \
|
||||
else \
|
||||
$quick_rebuild && { \
|
||||
ln -s -f libs lib ; \
|
||||
zip -u -r bin/MainActivity-debug-unaligned.apk lib assets || exit 1 ; \
|
||||
jarsigner -tsa http://timestamp.digicert.com -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-debug-unaligned.apk androiddebugkey || exit 1 ; \
|
||||
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-debug-unaligned.apk androiddebugkey || exit 1 ; \
|
||||
rm -f bin/MainActivity-debug.apk ; \
|
||||
zipalign 4 bin/MainActivity-debug-unaligned.apk bin/MainActivity-debug.apk || exit 1 ; \
|
||||
} || ant debug || exit 1 ; \
|
||||
|
||||
@@ -373,7 +373,7 @@ echo "# GCC version, or 'clang' for CLANG" >> AndroidAppSettings.cfg
|
||||
echo NDK_TOOLCHAIN_VERSION=$NDK_TOOLCHAIN_VERSION >> AndroidAppSettings.cfg
|
||||
echo >> AndroidAppSettings.cfg
|
||||
echo "# Specify architectures to compile, 'all' or 'y' to compile for all architectures." >> AndroidAppSettings.cfg
|
||||
echo "# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a x86_64" >> AndroidAppSettings.cfg
|
||||
echo "# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a" >> AndroidAppSettings.cfg
|
||||
echo MultiABI=\'$MultiABI\' >> AndroidAppSettings.cfg
|
||||
echo >> AndroidAppSettings.cfg
|
||||
echo "# Optional shared libraries to compile - removing some of them will save space" >> AndroidAppSettings.cfg
|
||||
|
||||
@@ -53,6 +53,9 @@ import android.text.SpannedString;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
|
||||
class CountingInputStream extends BufferedInputStream
|
||||
{
|
||||
@@ -328,6 +331,19 @@ class DataDownloader extends Thread
|
||||
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
|
||||
if( url.indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
|
||||
{
|
||||
int permissionCheck = Parent.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !Parent.writeExternalStoragePermissionDialogAnswered)
|
||||
{
|
||||
Parent.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
|
||||
while( !Parent.writeExternalStoragePermissionDialogAnswered )
|
||||
{
|
||||
try{ Thread.sleep(300); } catch (InterruptedException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
url = getObbFilePath(url);
|
||||
InputStream stream1 = null;
|
||||
try {
|
||||
|
||||
@@ -1580,6 +1580,11 @@ public class MainActivity extends Activity
|
||||
{
|
||||
Log.i("SDL", "libSDL: Record audio permission: " + (grantResults[0] == PackageManager.PERMISSION_GRANTED ? "GRANTED" : "DENIED"));
|
||||
}
|
||||
if (Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0]))
|
||||
{
|
||||
Log.i("SDL", "libSDL: Write external storage permission: " + (grantResults[0] == PackageManager.PERMISSION_GRANTED ? "GRANTED" : "DENIED"));
|
||||
writeExternalStoragePermissionDialogAnswered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public FrameLayout getVideoLayout() { return _videoLayout; }
|
||||
@@ -1620,6 +1625,7 @@ public class MainActivity extends Activity
|
||||
|
||||
public LinkedList<Integer> textInput = new LinkedList<Integer> ();
|
||||
public static MainActivity instance = null;
|
||||
public boolean writeExternalStoragePermissionDialogAnswered = false;
|
||||
}
|
||||
|
||||
// *** HONEYCOMB / ICS FIX FOR FULLSCREEN MODE, by lmak ***
|
||||
|
||||
@@ -63,6 +63,8 @@ import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.Display;
|
||||
import android.net.Uri;
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
|
||||
class Mouse
|
||||
@@ -947,6 +949,18 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
Settings.setConfigOptionFromSDL(option, value);
|
||||
}
|
||||
|
||||
public void requestExternalStorageRuntimePermissionFromSDL()
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
|
||||
{
|
||||
int permissionCheck = context.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !context.writeExternalStoragePermissionDialogAnswered)
|
||||
{
|
||||
context.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int PowerOf2(int i)
|
||||
{
|
||||
int value = 1;
|
||||
|
||||
@@ -5,4 +5,4 @@ include jni/Settings.mk
|
||||
APP_STL := gnustl_static
|
||||
APP_CFLAGS := -O3 -DNDEBUG -g # arm-linux-androideabi-4.4.3 crashes in -O0 mode on SDL sources
|
||||
APP_PLATFORM := android-14 # Android 4.0, it should be backward compatible to previous versions
|
||||
APP_PIE := true
|
||||
APP_PIE := true # This feature makes executables incompatible to Android API 15 or lower, but executables without PIE will not run on Android 5.0 and newer
|
||||
|
||||
@@ -170,7 +170,7 @@ AppUsesMultitouch=y
|
||||
AppRecordsAudio=n
|
||||
|
||||
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
|
||||
AccessSdCard=
|
||||
AccessSdCard=y
|
||||
|
||||
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
|
||||
AccessInternet=
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_image.h>
|
||||
#include <SDL/SDL_screenkeyboard.h>
|
||||
#include <SDL/SDL_android.h>
|
||||
|
||||
#define fprintf(X, ...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
|
||||
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
|
||||
@@ -686,7 +687,10 @@ int main(int argc, char* argv[])
|
||||
if(evt.key.keysym.sym == SDLK_0)
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 1);
|
||||
if(evt.key.keysym.sym == SDLK_1)
|
||||
{
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0);
|
||||
SDL_ANDROID_RequestExternalStorageRuntimePermission();
|
||||
}
|
||||
if(evt.key.keysym.sym == SDLK_2)
|
||||
{
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, 1);
|
||||
|
||||
@@ -7,10 +7,10 @@ AppName="Commander Genius"
|
||||
AppFullName=net.sourceforge.clonekeenplus
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=193000
|
||||
AppVersionCode=195000
|
||||
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="1.9.3.0 Beta"
|
||||
AppVersionName="1.9.5.0 Beta"
|
||||
|
||||
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
|
||||
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
|
||||
@@ -201,7 +201,7 @@ FirstStartMenuOptions=''
|
||||
|
||||
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
|
||||
# but .apk size is 2x bigger (y) / (n) / (x86) / (all)
|
||||
MultiABI='all'
|
||||
MultiABI='n'
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
AppMinimumRAM=64
|
||||
@@ -209,18 +209,19 @@ AppMinimumRAM=64
|
||||
# Optional shared libraries to compile - removing some of them will save space
|
||||
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
|
||||
# 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="ogg sdl_image boost_system"
|
||||
CompiledLibraries="sdl_image boost_system crypto ssl curl vorbis ogg"
|
||||
|
||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||
CustomBuildScript=n
|
||||
|
||||
# Aditional CFLAGS for application
|
||||
AppCflags='-frtti -fexceptions -finline-functions -DOGG=1 -DANDROID=1 -DREFKEEN_VER_KDREAMS -DGRMODE=EGAGR -DREFKEEN_VER_KDREAMS_ANYEGA_ALL -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -DNOTYPESAVE -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c++11 -Ijni/../jni/application/commandergenius/commandergenius/lib/GsKit -Ijni/vorbis/include/vorbis'
|
||||
AppCflags='-frtti -fexceptions -finline-functions -DOGG=1 -DDOWNLOADER=1 -DANDROID=1 -DREFKEEN_VER_KDREAMS -DGRMODE=EGAGR -DREFKEEN_VER_KDREAMS_ANYEGA_ALL -DIOAPI_NO_64 -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -DNOTYPESAVE -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c++11 -Ijni/../jni/application/commandergenius/commandergenius/lib/GsKit -Ijni/vorbis/include/vorbis -Ijni/curl/include'
|
||||
|
||||
|
||||
# Additional LDFLAGS for application
|
||||
#AppLdflags='-ltremor'
|
||||
AppLdflags='-lvorbis -logg'
|
||||
#AppLdflags='-lvorbis -logg -lcrypto -lssl -lcurl'
|
||||
AppLdflags='-lz -lvorbis -logg'
|
||||
|
||||
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
|
||||
AppOverlapsSystemHeaders=
|
||||
|
||||
BIN
project/jni/application/commandergenius/banner.png
Normal file
BIN
project/jni/application/commandergenius/banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -21,6 +21,7 @@ fi
|
||||
# Do not generate shared game logic libs - QVM files are used instead
|
||||
# ../setEnvironment-armeabi.sh sh -c "cd vm/build/release-android-$1/baseq3 && \$STRIP --strip-unneeded *.so && zip ../../../../AndroidData/binaries.zip *.so"
|
||||
|
||||
env PATH=`pwd`/..:$PATH \
|
||||
../setEnvironment-$1.sh make -j8 -C engine release \
|
||||
PLATFORM=android ARCH=$1 USE_GLES=1 USE_LOCAL_HEADERS=0 BUILD_CLIENT_SMP=0 \
|
||||
USE_OPENAL=1 USE_OPENAL_DLOPEN=0 USE_VOIP=1 USE_CURL=1 USE_CURL_DLOPEN=0 USE_CODEC_VORBIS=1 USE_MUMBLE=0 USE_FREETYPE=1 \
|
||||
|
||||
@@ -88,11 +88,21 @@ while test $# -gt 0; do
|
||||
--cflags)
|
||||
echo -I${prefix}/include
|
||||
;;
|
||||
--libs)
|
||||
echo -l$PKG
|
||||
;;
|
||||
--static-libs)
|
||||
echo -l$PKG
|
||||
--libs|--static-libs)
|
||||
case $PKG in
|
||||
curl|libcurl)
|
||||
echo -lcurl-sdl -l:libssl.so.sdl.0.so -l:libcrypto.so.sdl.0.so
|
||||
;;
|
||||
crypto|libcrypto)
|
||||
echo -l:libcrypto.so.sdl.0.so
|
||||
;;
|
||||
openssl|ssl|libssl)
|
||||
echo -l:libssl.so.sdl.0.so -l:libcrypto.so.sdl.0.so
|
||||
;;
|
||||
*)
|
||||
echo -l$PKG
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
||||
@@ -4,13 +4,13 @@ CURDIR=`pwd`
|
||||
|
||||
PACKAGE_NAME=`grep AppFullName AndroidAppSettings.cfg | sed 's/.*=//'`
|
||||
|
||||
[ -e pulseaudio/android-build.sh ] && {
|
||||
if [ -e pulseaudio/android-build.sh ]; then
|
||||
[ -e pulseaudio/$1/install/bin/pulseaudio ] || {
|
||||
cd pulseaudio
|
||||
./android-build.sh || exit 1
|
||||
cd ..
|
||||
} || exit 1
|
||||
} || exit 1
|
||||
fi
|
||||
|
||||
../setEnvironment-$1.sh sh -c '\
|
||||
$CC $CFLAGS -Werror=format -c main.c -o main-'"$1.o" || exit 1
|
||||
@@ -72,7 +72,7 @@ xkb/.libs/libxkbstubs.a \
|
||||
composite/.libs/libcomposite.a \
|
||||
os/.libs/libos.a \
|
||||
hw/kdrive/linux/.libs/liblinux.a \
|
||||
-lpixman-1 -lXfont -lXau -lXdmcp -lfontenc -lts -lfreetype -landroid-shmem -lcrypto' \
|
||||
-lpixman-1 -lXfont -lXau -lXdmcp -lfontenc -lts -lfreetype -landroid-shmem -l:libcrypto.so.sdl.0.so' \
|
||||
|| exit 1
|
||||
|
||||
rm -rf $CURDIR/tmp-$1
|
||||
|
||||
@@ -118,8 +118,8 @@ extern "C" {
|
||||
|
||||
#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
|
||||
#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
|
||||
#define ENGINESDIR "/home/pelya/src/endless_space/SDL-android/project/jni/openssl/build/armeabi-v7a/dist/lib/engines"
|
||||
#define OPENSSLDIR "/home/pelya/src/endless_space/SDL-android/project/jni/openssl/build/armeabi-v7a/dist/ssl"
|
||||
#define ENGINESDIR "/home/gerstrong/workspace/SDLAndroid/project/jni/openssl/build/armeabi-v7a/dist/lib/engines"
|
||||
#define OPENSSLDIR "/home/gerstrong/workspace/SDLAndroid/project/jni/openssl/build/armeabi-v7a/dist/ssl"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -134,6 +134,9 @@ enum {
|
||||
/* Set SDL Android-specifc option, such as video depth or mouse emulation mode. Most options require restarting the app. */
|
||||
extern DECLSPEC void SDLCALL SDL_ANDROID_SetConfigOption(int option, int value);
|
||||
|
||||
/* Show runtime permission dialog for accessing SD card on Android 6.0 and above */
|
||||
extern DECLSPEC void SDLCALL SDL_ANDROID_RequestExternalStorageRuntimePermission();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -88,6 +88,7 @@ static jmethodID JavaRequestCloudLoad = NULL;
|
||||
static jmethodID JavaRequestOpenExternalApp = NULL;
|
||||
static jmethodID JavaRequestRestartMyself = NULL;
|
||||
static jmethodID JavaRequestSetConfigOption = NULL;
|
||||
static jmethodID JavaRequestExternalStorageRuntimePermission = NULL;
|
||||
static int glContextLost = 0;
|
||||
static int showScreenKeyboardDeferred = 0;
|
||||
static const char * showScreenKeyboardOldText = "";
|
||||
@@ -361,6 +362,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject t
|
||||
JavaRequestOpenExternalApp = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "openExternalApp", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
JavaRequestRestartMyself = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "restartMyself", "(Ljava/lang/String;)V");
|
||||
JavaRequestSetConfigOption = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setConfigOptionFromSDL", "(II)V");
|
||||
JavaRequestExternalStorageRuntimePermission = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "requestExternalStorageRuntimePermissionFromSDL", "()V");
|
||||
|
||||
ANDROID_InitOSKeymap();
|
||||
}
|
||||
@@ -607,6 +609,11 @@ void SDLCALL SDL_ANDROID_OpenExternalWebBrowser(const char *url)
|
||||
SDL_ANDROID_OpenExternalApp(NULL, NULL, url);
|
||||
}
|
||||
|
||||
void SDLCALL SDL_ANDROID_RequestExternalStorageRuntimePermission()
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaRequestExternalStorageRuntimePermission );
|
||||
}
|
||||
|
||||
// Dummy callback for SDL2 to satisfy linker
|
||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||
void SDL_Android_Init(JNIEnv* env, jclass cls)
|
||||
|
||||
2
sign.sh
2
sign.sh
@@ -15,7 +15,7 @@ zip -d Signed.apk "META-INF/*"
|
||||
# Sign with the new certificate
|
||||
echo Using keystore $ANDROID_KEYSTORE_FILE and alias $ANDROID_KEYSTORE_ALIAS
|
||||
stty -echo
|
||||
jarsigner -verbose -keystore $ANDROID_KEYSTORE_FILE -sigalg MD5withRSA -digestalg SHA1 Signed.apk $ANDROID_KEYSTORE_ALIAS || exit 1
|
||||
jarsigner -verbose -tsa http://timestamp.digicert.com -keystore $ANDROID_KEYSTORE_FILE -sigalg MD5withRSA -digestalg SHA1 Signed.apk $ANDROID_KEYSTORE_ALIAS || exit 1
|
||||
stty echo
|
||||
echo
|
||||
rm -f MainActivity-debug.apk
|
||||
|
||||
Reference in New Issue
Block a user