diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 308a3b1be..8d60200b4 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -839,6 +839,10 @@ echo >> AndroidAppSettings.cfg echo "# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL" >> AndroidAppSettings.cfg echo CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=$CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState >> AndroidAppSettings.cfg echo >> AndroidAppSettings.cfg +echo "# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects." >> AndroidAppSettings.cfg +echo "# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)" >> AndroidAppSettings.cfg +echo CompatibilityHacksProperUsageOfSDL_UpdateRects=$CompatibilityHacksProperUsageOfSDL_UpdateRects >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg echo "# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user" >> AndroidAppSettings.cfg echo AppUsesMouse=$AppUsesMouse >> AndroidAppSettings.cfg echo >> AndroidAppSettings.cfg @@ -1101,6 +1105,12 @@ else CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= fi +if [ "$CompatibilityHacksProperUsageOfSDL_UpdateRects" = "y" ]; then + CompatibilityHacksProperUsageOfSDL_UpdateRects=-DSDL_COMPATIBILITY_HACKS_PROPER_USADE_OF_SDL_UPDATERECTS=1 +else + CompatibilityHacksProperUsageOfSDL_UpdateRects= +fi + if [ "$AppUsesMouse" = "y" ] ; then AppUsesMouse=true else @@ -1378,7 +1388,15 @@ cat project/jni/SettingsTemplate.mk | \ sed "s^APPLICATION_ADDITIONAL_CFLAGS :=.*^APPLICATION_ADDITIONAL_CFLAGS := $AppCflags^" | \ sed "s^APPLICATION_ADDITIONAL_LDFLAGS :=.*^APPLICATION_ADDITIONAL_LDFLAGS := $AppLdflags^" | \ sed "s^APPLICATION_OVERLAPS_SYSTEM_HEADERS :=.*^APPLICATION_OVERLAPS_SYSTEM_HEADERS := $AppOverlapsSystemHeaders^" | \ - sed "s^SDL_ADDITIONAL_CFLAGS :=.*^SDL_ADDITIONAL_CFLAGS := $RedefinedKeycodes $RedefinedKeycodesScreenKb $RedefinedKeycodesGamepad $CompatibilityHacksPreventAudioChopping $CompatibilityHacksAppIgnoresAudioBufferSize $CompatibilityHacksSlowCompatibleEventQueue $CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState^" | \ + sed "s^SDL_ADDITIONAL_CFLAGS :=.*^SDL_ADDITIONAL_CFLAGS := \ + $RedefinedKeycodes \ + $RedefinedKeycodesScreenKb \ + $RedefinedKeycodesGamepad \ + $CompatibilityHacksPreventAudioChopping \ + $CompatibilityHacksAppIgnoresAudioBufferSize \ + $CompatibilityHacksSlowCompatibleEventQueue \ + $CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState \ + $CompatibilityHacksProperUsageOfSDL_UpdateRects^" | \ sed "s^APPLICATION_SUBDIRS_BUILD :=.*^APPLICATION_SUBDIRS_BUILD := $AppSubdirsBuild^" | \ sed "s^APPLICATION_BUILD_EXCLUDE :=.*^APPLICATION_BUILD_EXCLUDE := $AppBuildExclude^" | \ sed "s^APPLICATION_CUSTOM_BUILD_SCRIPT :=.*^APPLICATION_CUSTOM_BUILD_SCRIPT := $CustomBuildScript^" | \ diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 07c011b6c..30e98be35 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 07c011b6ccb275fc2b69dbd6e7ee8dba6223e59a +Subproject commit 30e98be3582cca3009f371ca2f9a7334e24e1582 diff --git a/project/jni/application/openarena/vm b/project/jni/application/openarena/vm index 4b83db91a..278f04520 160000 --- a/project/jni/application/openarena/vm +++ b/project/jni/application/openarena/vm @@ -1 +1 @@ -Subproject commit 4b83db91ab39b9cae27f087fe1a0a8ba9f30d43d +Subproject commit 278f045202ff1bc0c1911b6c3d441909ba93ee87 diff --git a/project/jni/application/teeworlds/src b/project/jni/application/teeworlds/src index 34b64249c..e5489c8c0 160000 --- a/project/jni/application/teeworlds/src +++ b/project/jni/application/teeworlds/src @@ -1 +1 @@ -Subproject commit 34b64249c46a90ce127f32b3ef41a565b8a70a61 +Subproject commit e5489c8c089e57d88bbaa90df0176d5e5d4c6351 diff --git a/project/jni/application/xserver/AndroidAppSettings.cfg b/project/jni/application/xserver/AndroidAppSettings.cfg index 9f9317a2c..f3a0f3914 100644 --- a/project/jni/application/xserver/AndroidAppSettings.cfg +++ b/project/jni/application/xserver/AndroidAppSettings.cfg @@ -75,6 +75,8 @@ CompatibilityHacksSlowCompatibleEventQueue=n # Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= +CompatibilityHacksProperUsageOfSDL_UpdateRects=y + # Application uses mouse (y) or (n), this will show mouse emulation dialog to the user AppUsesMouse=y diff --git a/project/jni/application/xserver/gfx.c b/project/jni/application/xserver/gfx.c index ad241293a..88a83c8db 100644 --- a/project/jni/application/xserver/gfx.c +++ b/project/jni/application/xserver/gfx.c @@ -247,7 +247,7 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i *displayH = *displayH * (dpiScale / fontsVal[dpi]); } -void XSDL_generateHelp(const char * port) +void XSDL_generateBackground(const char * port, int showHelp) { int sd, addr, ifc_num, i; struct ifconf ifc; @@ -255,10 +255,19 @@ void XSDL_generateHelp(const char * port) SDL_Surface * surf; int y = 40; - surf = SDL_CreateRGBSurface(SDL_SWSURFACE, VID_X, VID_Y, 24, 0x0000ff, 0x00ff00, 0xff0000, 0); - SDL_FillRect(surf, NULL, 0xffffff); + if( !showHelp ) + { + surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, 24, 0x0000ff, 0x00ff00, 0xff0000, 0); + SDL_FillRect(surf, NULL, 0x00003f); + SDL_SaveBMP(surf, "background.bmp"); + SDL_FreeSurface(surf); + return; + } - renderStringColor("Launch these commands on your Linux PC:", VID_X/2, 15, 0, 0, 0, surf); + surf = SDL_CreateRGBSurface(SDL_SWSURFACE, VID_X, VID_Y, 24, 0x0000ff, 0x00ff00, 0xff0000, 0); + SDL_FillRect(surf, NULL, 0x00003f); + + renderStringColor("Launch these commands on your Linux PC:", VID_X/2, 15, 255, 255, 255, surf); sd = socket(PF_INET, SOCK_DGRAM, 0); if (sd > 0) @@ -288,10 +297,10 @@ void XSDL_generateHelp(const char * port) if (strcmp(saddr, "127.0.0.1") == 0) continue; sprintf (msg, "env DISPLAY=%s%s metacity &", saddr, port); - renderStringColor(msg, VID_X/2, y, 0, 0, 0, surf); + renderStringColor(msg, VID_X/2, y, 255, 255, 255, surf); y += 15; sprintf (msg, "env DISPLAY=%s%s gimp", saddr, port); - renderStringColor(msg, VID_X/2, y, 0, 0, 0, surf); + renderStringColor(msg, VID_X/2, y, 255, 255, 255, surf); y += 20; } } @@ -299,7 +308,7 @@ void XSDL_generateHelp(const char * port) close(sd); } - SDL_SaveBMP(surf, "help.bmp"); + SDL_SaveBMP(surf, "background.bmp"); SDL_FreeSurface(surf); } diff --git a/project/jni/application/xserver/gfx.h b/project/jni/application/xserver/gfx.h index 6a2765ded..c0e0c44a0 100644 --- a/project/jni/application/xserver/gfx.h +++ b/project/jni/application/xserver/gfx.h @@ -7,6 +7,6 @@ void XSDL_initSDL(); void XSDL_deinitSDL(); void XSDL_unpackFiles(); void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, int * displayH); -void XSDL_generateHelp(const char * port); +void XSDL_generateBackground(const char * port, int showHelp); #endif diff --git a/project/jni/application/xserver/icon.png b/project/jni/application/xserver/icon.png index 46e51ce08..b5ba6a2ba 100644 Binary files a/project/jni/application/xserver/icon.png and b/project/jni/application/xserver/icon.png differ diff --git a/project/jni/application/xserver/main.c b/project/jni/application/xserver/main.c index c65685f76..527f9cd37 100644 --- a/project/jni/application/xserver/main.c +++ b/project/jni/application/xserver/main.c @@ -29,6 +29,7 @@ int main( int argc, char* argv[] ) clientcmd }; char * envp[] = { NULL }; + int printHelp = 1; int resolutionW = atoi(getenv("DISPLAY_RESOLUTION_WIDTH")); int resolutionH = atoi(getenv("DISPLAY_RESOLUTION_HEIGHT")); @@ -61,16 +62,26 @@ int main( int argc, char* argv[] ) close(s); } - XSDL_generateHelp(port); + if( argc > 1 && strcmp(argv[1], "-nohelp") == 0 ) + { + printHelp = 0; + argc--; + argv++; + } + + XSDL_generateBackground(port, printHelp); XSDL_deinitSDL(); sprintf( screenres, "%d/%dx%d/%dx%d", resolutionW, displayW, resolutionH, displayH, 24 ); - if( argc >= 2 ) - cmd = argv[2]; - sprintf( clientcmd, "%s/usr/bin/xhost + ; %s/usr/bin/xli -onroot -fullscreen help.bmp ; %s", - getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR"), cmd ); + sprintf( clientcmd, "%s/usr/bin/xhost + ; %s/usr/bin/xli -onroot -fullscreen background.bmp ;", + getenv("SECURE_STORAGE_DIR"), getenv("SECURE_STORAGE_DIR") ); + for( ; argc > 1; argc--, argv++ ) + { + strcat(clientcmd, " "); + strcat(clientcmd, argv[1]); + } __android_log_print(ANDROID_LOG_INFO, "XSDL", "XSDL video resolution %s", screenres); diff --git a/project/jni/application/xserver/xserver b/project/jni/application/xserver/xserver index df21ddcbd..4f937a66d 160000 --- a/project/jni/application/xserver/xserver +++ b/project/jni/application/xserver/xserver @@ -1 +1 @@ -Subproject commit df21ddcbdf0e4bbf3c3bb445ac94dc0a7c1fb362 +Subproject commit 4f937a66dd6c81674c0d6b8a61d94e115448fc9f diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c index 442217554..53788200b 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c @@ -964,9 +964,14 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects) SDL_UpdateTexture((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rect, SDL_CurrentVideoSurface->pixels, SDL_CurrentVideoSurface->pitch); else { - int i = 0; + int i; for(i = 0; i < numrects; i++) - SDL_UpdateTexture((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rects[i], SDL_CurrentVideoSurface->pixels, SDL_CurrentVideoSurface->pitch); + { + //printf("SDL_UpdateTexture: rect %d: %04d:%04d:%04d:%04d", i, rects[i].x, rects[i].y, rects[i].w, rects[i].h); + SDL_UpdateTexture((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rects[i], + SDL_CurrentVideoSurface->pixels + rects[i].y * SDL_CurrentVideoSurface->pitch + rects[i].x, + SDL_CurrentVideoSurface->pitch); + } } if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_NONE || SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER ) { @@ -1125,8 +1130,11 @@ static void ANDROID_UpdateRects(_THIS, int numrects, SDL_Rect *rects) return; } - // ANDROID_FlipHWSurfaceInternal(numrects, rects); // Fails for fheroes2, I'll add a compatibility option later. +#ifdef SDL_COMPATIBILITY_HACKS_PROPER_USADE_OF_SDL_UPDATERECTS + ANDROID_FlipHWSurfaceInternal(numrects, rects); // Fails for fheroes2, I'll add a compatibility option later. +#else ANDROID_FlipHWSurfaceInternal(0, NULL); +#endif SDL_ANDROID_CallJavaSwapBuffers(); }