diff --git a/project/jni/application/xserver-debian/AndroidAppSettings.cfg b/project/jni/application/xserver-debian/AndroidAppSettings.cfg index f03cb00da..2d83d502e 100644 --- a/project/jni/application/xserver-debian/AndroidAppSettings.cfg +++ b/project/jni/application/xserver-debian/AndroidAppSettings.cfg @@ -18,17 +18,17 @@ AppVersionName="14.05.01" # If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - # these files are put inside .apk package by build system # Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS -AppDataDownloadUrl="!!System image|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/dist-debug-wheezy-proot-.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall.sh" +AppDataDownloadUrl="!!System image|:data.tar.gz:http://sourceforge.net/projects/libsdl-android/files/ubuntu/14.05.01/dist-debug-wheezy-proot-.tar.gz/download^!!XSDL data files|:data-1.tar.gz:data-1.tgz^!!XSDL fonts|:DroidSansMono.ttf:DroidSansMono.ttf^!!Postinstall script|:postinstall.sh:postinstall2.sh" # Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=y # Delete application data files when upgrading (specify file/dir paths separated by spaces) -DeleteFilesOnUpgrade="%" +DeleteFilesOnUpgrade="img" # 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/ -ReadmeText='This app will download 210 Mb data,\\\\nand will use 530 Mb of internal storage.\\\\nYour old Ubuntu installation will be removed\\\\n^button:Install old version:http://sourceforge.net/projects/libsdl-android/files/ubuntu/Ubuntu.apk' +ReadmeText='This app will download 220 Mb data,\\\\nand will use 600 Mb of internal storage.\\\\nYour old installation will be removed\\\\n^button:Install old version:http://sourceforge.net/projects/libsdl-android/files/ubuntu/' # libSDL version to use (1.2/1.3/2.0) LibSdlVersion=1.2 @@ -194,7 +194,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='armeabi-v7a' +MultiABI='armeabi-v7a x86' # Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=0 @@ -223,7 +223,7 @@ AppSubdirsBuild='' AppBuildExclude='' # Application command line parameters, including app name as 0-th param -AppCmdline='XSDL -nohelp -exec $SECURE_STORAGE_DIR/img/proot.sh ./startx.sh' +AppCmdline='XSDL -nohelp -screenbuttons -exec $SECURE_STORAGE_DIR/img/proot.sh ./startx.sh' # Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens # Minimum screen size that application supports: (s)mall / (m)edium / (l)arge diff --git a/project/jni/application/xserver-debian/AndroidData/postinstall.sh b/project/jni/application/xserver-debian/AndroidData/postinstall2.sh similarity index 68% rename from project/jni/application/xserver-debian/AndroidData/postinstall.sh rename to project/jni/application/xserver-debian/AndroidData/postinstall2.sh index dbc3408ae..01cb073fd 100755 --- a/project/jni/application/xserver-debian/AndroidData/postinstall.sh +++ b/project/jni/application/xserver-debian/AndroidData/postinstall2.sh @@ -1,10 +1,12 @@ #!/system/bin/sh -rm -rf $SDCARD/ubuntu +#rm -rf $SDCARD/ubuntu +echo "Extracting XSDL data files" cd $SECURE_STORAGE_DIR ./busybox tar xzf $UNSECURE_STORAGE_DIR/data-1.tar.gz rm -f $UNSECURE_STORAGE_DIR/data-1.tar.gz export SECURE_STORAGE_DIR=$SECURE_STORAGE_DIR/img cd $SECURE_STORAGE_DIR +echo "Installation path: $SECURE_STORAGE_DIR" ./postinstall.sh diff --git a/project/jni/application/xserver-debian/AndroidPreBuild.sh b/project/jni/application/xserver-debian/AndroidPreBuild.sh new file mode 120000 index 000000000..9d3924cd3 --- /dev/null +++ b/project/jni/application/xserver-debian/AndroidPreBuild.sh @@ -0,0 +1 @@ +../xserver-gimp/AndroidPreBuild.sh \ No newline at end of file diff --git a/project/jni/application/xserver-debian/ultimatedroid.raw b/project/jni/application/xserver-debian/ultimatedroid.raw new file mode 120000 index 000000000..d6de9e0d4 --- /dev/null +++ b/project/jni/application/xserver-debian/ultimatedroid.raw @@ -0,0 +1 @@ +../xserver-gimp/ultimatedroid.raw \ No newline at end of file diff --git a/project/jni/application/xserver-gimp/AndroidPreBuild.sh b/project/jni/application/xserver-gimp/AndroidPreBuild.sh new file mode 100755 index 000000000..bb42e5e35 --- /dev/null +++ b/project/jni/application/xserver-gimp/AndroidPreBuild.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cp -f ultimatedroid.raw ../../../res/raw/ diff --git a/project/jni/application/xserver-gimp/ultimatedroid.raw b/project/jni/application/xserver-gimp/ultimatedroid.raw new file mode 100644 index 000000000..c86a54055 Binary files /dev/null and b/project/jni/application/xserver-gimp/ultimatedroid.raw differ diff --git a/project/jni/application/xserver/gfx.c b/project/jni/application/xserver/gfx.c index eacf8d480..c98c8685d 100644 --- a/project/jni/application/xserver/gfx.c +++ b/project/jni/application/xserver/gfx.c @@ -17,10 +17,9 @@ #include "gfx.h" static TTF_Font* sFont; -static int unpackProgressMb; -static int unpackProgressMbTotal = 1; -static int unpackProgressRunningScript = 0; + static int unpackFinished = 0; +static char unpackLog[4][256]; static void renderString(const char *c, int x, int y); static void renderStringColor(const char *c, int x, int y, int r, int g, int b, SDL_Surface * surf); @@ -31,26 +30,39 @@ static void showErrorMessage(const char *msg); void * unpackFilesThread(void * unused) { + int unpackProgressMb; + int unpackProgressMbTotal = 1; char fname[PATH_MAX*2]; char fname2[PATH_MAX*2]; char buf[1024 * 4]; + struct stat st; + + /* strcpy( fname, getenv("SECURE_STORAGE_DIR") ); strcat( fname, "/usr/lib/xorg/protocol.txt" ); - struct stat st; if( stat( fname, &st ) == 0 ) { unpackFinished = 1; return (void *)1; } - - __android_log_print(ANDROID_LOG_INFO, "XSDL", "Unpacking data"); + */ if( stat( "data.tar.gz", &st ) == 0 ) + { + __android_log_print(ANDROID_LOG_INFO, "XSDL", "Unpacking data"); unpackProgressMbTotal = st.st_size / 1024 / 1024; + if( unpackProgressMbTotal <= 0 ) + unpackProgressMbTotal = 1; + } else - unpackProgressMbTotal = 1; + { + unpackFinished = 1; + return (void *)1; + } unpackProgressMb = 0; + + sprintf(unpackLog[0], "Unpacking data..."); strcpy( fname, getenv("SECURE_STORAGE_DIR") ); strcat( fname, "/busybox" ); @@ -61,6 +73,7 @@ void * unpackFilesThread(void * unused) if( !ff || !fo ) { __android_log_print(ANDROID_LOG_INFO, "XSDL", "Error extracting data"); + sprintf(unpackLog[0], "Error extracting data"); unpackFinished = 1; return (void *)0; } @@ -75,6 +88,7 @@ void * unpackFilesThread(void * unused) if( cnt < 0 ) { __android_log_print(ANDROID_LOG_INFO, "XSDL", "Error extracting data"); + sprintf(unpackLog[0], "Error extracting data"); unpackFinished = 1; return (void *)1; } @@ -86,6 +100,7 @@ void * unpackFilesThread(void * unused) { unpackProgressKb = 0; unpackProgressMb++; + sprintf(unpackLog[0], "Unpacking data: %d/%d Mb, %d%%", unpackProgressMb, unpackProgressMbTotal, unpackProgressMb * 100 / (unpackProgressMbTotal > 0 ? unpackProgressMbTotal : 1)); } } __android_log_print(ANDROID_LOG_INFO, "XSDL", "FREAD %dKb DONE", unpackProgressKb); @@ -102,6 +117,8 @@ void * unpackFilesThread(void * unused) remove("data.tar.gz"); + sprintf(unpackLog[0], "Running postinstall script..."); + strcpy( fname, getenv("SECURE_STORAGE_DIR") ); strcat( fname, "/postinstall.sh" ); if( stat( fname, &st ) != 0 ) @@ -125,7 +142,6 @@ void * unpackFilesThread(void * unused) } } - unpackProgressRunningScript = 1; __android_log_print(ANDROID_LOG_INFO, "XSDL", "Setting executable permissions on postinstall scipt"); strcpy( fname2, "chmod 755 " ); @@ -143,14 +159,17 @@ void * unpackFilesThread(void * unused) } for(;;) { - char buf[1024]; if( !fgets(buf, sizeof(buf), fo) ) break; __android_log_print(ANDROID_LOG_INFO, "XSDL", "> %s", buf); + strncpy(unpackLog[3], unpackLog[2], sizeof(unpackLog[1]) - 4); + strncpy(unpackLog[2], unpackLog[1], sizeof(unpackLog[1]) - 4); + strncpy(unpackLog[1], buf, sizeof(unpackLog[1]) - 4); } __android_log_print(ANDROID_LOG_INFO, "XSDL", "Postinstall scipt exited with status %d", pclose(fo)); - + sprintf(unpackLog[0], "Running postinstall script finished"); + unpackFinished = 1; return (void *)1; } @@ -159,16 +178,18 @@ void XSDL_unpackFiles() { pthread_t thread_id; void * status; + memset(unpackLog, 0, sizeof(unpackLog)); pthread_create(&thread_id, NULL, &unpackFilesThread, NULL); while (!unpackFinished) { SDL_Delay(400); SDL_FillRect(SDL_GetVideoSurface(), NULL, 0); - char s[128]; - sprintf(s, "Unpacking data: %d/%d Mb, %d%%", unpackProgressMb, unpackProgressMbTotal, unpackProgressMb * 100 / (unpackProgressMbTotal > 0 ? unpackProgressMbTotal : 1)); - renderString(unpackProgressRunningScript ? "Running postinstall script..." : s, VID_X/2, VID_Y/3); - renderString("You may put this app to background while it's unpacking", VID_X/2, VID_Y*2/3); + renderString(unpackLog[0], VID_X/2, VID_Y*2/8); + renderString(unpackLog[1], VID_X/2, VID_Y*3/8); + renderString(unpackLog[2], VID_X/2, VID_Y*4/8); + renderString(unpackLog[3], VID_X/2, VID_Y*5/8); + renderString("You may put this app to background while it's unpacking", VID_X/2, VID_Y*7/8); SDL_Flip(SDL_GetVideoSurface()); } @@ -182,7 +203,7 @@ void XSDL_unpackFiles() void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH) { - int x, y, i, ii; + int x = 0, y = 0, i, ii; SDL_Event event; int res = -1, dpi = -1; char native[32] = "0x0", native56[32], native46[32], native36[32], native26[32]; @@ -551,6 +572,8 @@ void XSDL_deinitSDL() void renderStringColor(const char *c, int x, int y, int r, int g, int b, SDL_Surface * surf) { + if (!c || !c[0]) + return; SDL_Color fColor = {r, g, b}; SDL_Rect fontRect = {0, 0, 0, 0}; SDL_Surface* fontSurface = TTF_RenderUTF8_Solid(sFont, c, fColor); @@ -569,6 +592,8 @@ void renderString(const char *c, int x, int y) void renderStringScaled(const char *c, int size, int x, int y, int r, int g, int b, SDL_Surface * surf) { + if (!c || !c[0]) + return; SDL_Color fColor = {r, g, b}; SDL_Rect fontRect = {0, 0, 0, 0}; TTF_Font* font = TTF_OpenFont("DroidSansMono.ttf", size);