Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android

This commit is contained in:
Gerhard Stein
2013-11-17 15:33:51 +01:00
11 changed files with 62 additions and 21 deletions

View File

@@ -27,6 +27,14 @@ if [ "$#" -gt 0 -a "$1" = "release" ]; then
build_release=true
fi
if [ "$#" -gt 0 -a "$1" = "-h" ]; then
echo "Usage: $0 [-s] [-i] [-r] [release]"
echo " -s: sign APK file after building"
echo " -i: install APK file to device after building"
echo " -r: run APK file on device after building"
echo " release: build release package instead of debug"
fi
[ -e project/local.properties ] || {
android update project -p project || exit 1
rm -f project/src/Globals.java

View File

@@ -526,6 +526,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
MainActivity.LoadApplicationLibrary(context);
Settings.Apply(context);
Settings.nativeSetEnv( "DISPLAY_RESOLUTION_WIDTH", String.valueOf(Math.max(mWidth, mHeight)) );
Settings.nativeSetEnv( "DISPLAY_RESOLUTION_HEIGHT", String.valueOf(Math.min(mWidth, mHeight)) ); // In Kitkat with immersive mode, getWindowManager().getDefaultDisplay().getMetrics() return inaccurate height
accelerometer = new AccelerometerReader(context);
// Tweak video thread priority, if user selected big audio buffer
if(Globals.AudioBufferConfig >= 2)

View File

@@ -175,10 +175,10 @@ MultiABI=armeabi-v7a
AppMinimumRAM=0
# Application version code (integer)
AppVersionCode=28203
AppVersionCode=28207
# Application user-visible version name (string)
AppVersionName="2.8.2.03"
AppVersionName="2.8.2.07"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y

View File

@@ -7,10 +7,21 @@ PACKAGE_NAME=`grep AppFullName AndroidAppSettings.cfg | sed 's/.*=//'`
../setEnvironment-armeabi-v7a.sh sh -c '\
$CC $CFLAGS -c main.c gfx.c' || exit 1
[ -e xserver/android ] || git submodule update --init xserver || exit 1
[ -e xserver/android ] || {
CURDIR=`pwd`
cd ../../../..
git submodule update --init project/jni/application/xserver/xserver || exit 1
cd $CURDIR
} || exit 1
cd xserver
[ -e configure ] || autoreconf --force -v --install || exit 1
[ -e android/android-shmem/LICENSE ] || git submodule update --init android/android-shmem || exit 1
cd android
[ -e android-shmem/libancillary/ancillary.h ] || {
cd android-shmem
git submodule update --init libancillary || exit 1
cd ..
} || exit 1
[ -e libfontenc-*/Makefile ] && {
grep "/data/data/$PACKAGE_NAME" libfontenc-*/Makefile || \
git clean -f -d -x .
@@ -47,7 +58,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' \
-lpixman-1 -lXfont -lXau -lXdmcp -lfontenc -lts -lfreetype -landroid-shmem' \
|| exit 1
#-lfreetype is inside -lsdl_ttf

View File

@@ -36,7 +36,7 @@ void * unpackFilesThread(void * unused)
if( stat( fname, &st ) == 0 )
{
unpackFinished = 1;
return 1;
return (void *)1;
}
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Unpacking data");
@@ -49,7 +49,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Cannot copy busybox");
unpackFinished = 1;
return 0;
return (void *)0;
}
for(;;)
@@ -60,7 +60,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Cannot copy busybox");
unpackFinished = 1;
return 1;
return (void *)1;
}
fwrite( buf, 1, cnt, fo );
if( cnt < sizeof(buf) )
@@ -74,7 +74,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Cannot chmod busybox");
unpackFinished = 1;
return 0;
return (void *)0;
}
if( stat( "data.tar.gz", &st ) == 0 )
@@ -92,7 +92,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Error extracting data");
unpackFinished = 1;
return 0;
return (void *)0;
}
int unpackProgressKb = 0;
@@ -104,7 +104,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Error extracting data");
unpackFinished = 1;
return 1;
return (void *)1;
}
fwrite( buf, 1, cnt, fo );
if( cnt < sizeof(buf) )
@@ -122,7 +122,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Error extracting data");
unpackFinished = 1;
return 0;
return (void *)0;
}
remove("data.tar.gz");
@@ -135,7 +135,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "No postinstall script");
unpackFinished = 1;
return 1;
return (void *)1;
}
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Running postinstall scipt");
@@ -145,7 +145,7 @@ void * unpackFilesThread(void * unused)
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "ERROR: Cannot launch postinstall scipt");
unpackFinished = 1;
return 0;
return (void *)0;
}
for(;;)
{
@@ -158,7 +158,7 @@ void * unpackFilesThread(void * unused)
__android_log_print(ANDROID_LOG_INFO, "XSDL", "Postinstall scipt exited with status %d", pclose(fo));
unpackFinished = 1;
return 1;
return (void *)1;
}
void XSDL_unpackFiles()
@@ -394,7 +394,7 @@ void showErrorMessage(const char *msg)
void XSDL_initSDL()
{
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(VID_X, VID_Y, 24, SDL_SWSURFACE);
SDL_SetVideoMode(VID_X, VID_Y, 0, SDL_SWSURFACE);
TTF_Init();
sFont = TTF_OpenFont("DroidSansMono.ttf", 12);
if (!sFont)

View File

@@ -95,6 +95,25 @@ int main( int argc, char* argv[] )
close(s);
}
*/
FILE * ff = fopen("/proc/net/unix", "rb");
if( ff )
{
char buf[512], name[512];
int found = 0;
sprintf(name, "/tmp/.X11-unix/X%d", i);
while( fgets(buf, sizeof(buf), ff) )
{
if( strstr(buf, name) != NULL )
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "UNIX path %s already used, trying next one", name);
found = 1;
break;
}
}
fclose(ff);
if( found )
continue;
}
sprintf( port, ":%d", i );
break;
@@ -111,7 +130,7 @@ int main( int argc, char* argv[] )
XSDL_deinitSDL();
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, 24 );
sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, SDL_GetVideoInfo()->vfmt->BitsPerPixel );
if( argc > 1 )
{