From 75a74486ffbf8173f7fb8f6e35199fad00ff7354 Mon Sep 17 00:00:00 2001 From: pelya Date: Mon, 25 Oct 2010 13:33:29 +0300 Subject: [PATCH] Updated Jooleem project - it crashes with HW accel enabled somewhere in SDL code but wirks in SW mode, so I've added some debug to SDL_androidvideo-1.2.c, and I'm planning to make test SDL project to check HW accel and alpha surfaces status. --- project/AndroidManifest.xml | 6 +++--- project/jni/Android.mk | 14 ++++++------- project/jni/Application.mk | 2 +- project/jni/application/commandergenius | 2 +- .../jooleem_0.1.4/AndroidAppSettings.cfg | 18 +++++++++++++++-- project/jni/application/src | 2 +- .../src/video/android/SDL_androidvideo-1.2.c | 20 ++++++++++++++++++- project/res/values/strings.xml | 2 +- project/src/Accelerometer.java | 2 +- project/src/Audio.java | 2 +- project/src/DataDownloader.java | 2 +- project/src/GLSurfaceView_SDL.java | 2 +- project/src/Globals.java | 18 ++++++++--------- project/src/MainActivity.java | 2 +- project/src/Settings.java | 2 +- project/src/Video.java | 2 +- 16 files changed, 65 insertions(+), 33 deletions(-) diff --git a/project/AndroidManifest.xml b/project/AndroidManifest.xml index 6cea5821c..9067c22e2 100644 --- a/project/AndroidManifest.xml +++ b/project/AndroidManifest.xml @@ -1,8 +1,8 @@ pitch = SDL_ANDROID_sFakeWindowWidth * ANDROID_BYTESPERPIXEL; current->pixels = NULL; current->hwdata = NULL; + HwSurfaceCount = 0; HwSurfaceList = NULL; + DEBUGOUT("ANDROID_SetVideoMode() HwSurfaceCount %d HwSurfaceList %p", HwSurfaceCount, HwSurfaceList); if( ! sdl_opengl ) { @@ -301,6 +306,7 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current, HwSurfaceCount++; HwSurfaceList = SDL_realloc( HwSurfaceList, HwSurfaceCount * sizeof(SDL_Surface *) ); HwSurfaceList[HwSurfaceCount-1] = current; + DEBUGOUT("ANDROID_SetVideoMode() HwSurfaceCount %d HwSurfaceList %p", HwSurfaceCount, HwSurfaceList); } } @@ -333,10 +339,12 @@ void ANDROID_VideoQuit(_THIS) { if( ! sdl_opengl ) { + DEBUGOUT("ANDROID_VideoQuit() in HwSurfaceCount %d HwSurfaceList %p", HwSurfaceCount, HwSurfaceList); HwSurfaceCount = 0; if(HwSurfaceList) SDL_free(HwSurfaceList); HwSurfaceList = NULL; + DEBUGOUT("ANDROID_VideoQuit() out HwSurfaceCount %d HwSurfaceList %p", HwSurfaceCount, HwSurfaceList); if( SDL_CurrentVideoSurface->hwdata ) SDL_DestroyTexture((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata); @@ -371,12 +379,14 @@ static int ANDROID_AllocHWSurface(_THIS, SDL_Surface *surface) if ( ! (surface->w && surface->h) ) return(-1); + DEBUGOUT("ANDROID_AllocHWSurface() surface %p w %d h %d", surface, surface->w, surface->h); Uint32 format = SDL_PIXELFORMAT_RGBA5551; // 1-bit alpha for color key, every surface will have colorkey so it's easier for us if( surface->format->Amask ) { SDL_PixelFormat format1; int bpp; format = SDL_PIXELFORMAT_RGBA4444; + DEBUGOUT("ANDROID_AllocHWSurface() SDL_PIXELFORMAT_RGBA4444"); SDL_zero(format1); SDL_PixelFormatEnumToMasks( format, &bpp, &format1.Rmask, &format1.Gmask, @@ -390,6 +400,7 @@ static int ANDROID_AllocHWSurface(_THIS, SDL_Surface *surface) } else { + DEBUGOUT("ANDROID_AllocHWSurface() SDL_PIXELFORMAT_RGBA5551"); // HW-accel surface should be RGB565 if( !( SDL_CurrentVideoSurface->format->BitsPerPixel == surface->format->BitsPerPixel && SDL_CurrentVideoSurface->format->Rmask == surface->format->Rmask && @@ -416,9 +427,12 @@ static int ANDROID_AllocHWSurface(_THIS, SDL_Surface *surface) } surface->flags |= SDL_HWSURFACE | SDL_HWACCEL; - + HwSurfaceCount++; + DEBUGOUT("ANDROID_AllocHWSurface() in HwSurfaceCount %d HwSurfaceList %p", HwSurfaceCount, HwSurfaceList); HwSurfaceList = SDL_realloc( HwSurfaceList, HwSurfaceCount * sizeof(SDL_Surface *) ); + DEBUGOUT("ANDROID_AllocHWSurface() out HwSurfaceCount %d HwSurfaceList %p", HwSurfaceCount, HwSurfaceList); + HwSurfaceList[HwSurfaceCount-1] = surface; return 0; @@ -430,7 +444,10 @@ static void ANDROID_FreeHWSurface(_THIS, SDL_Surface *surface) if( !surface->hwdata ) return; SDL_DestroyTexture((struct SDL_Texture *)surface->hwdata); + + DEBUGOUT("ANDROID_FreeHWSurface() surface %p w %d h %d in HwSurfaceCount %d HwSurfaceList %p", surface, surface->w, surface->h, HwSurfaceCount, HwSurfaceList); + for( i = 0; i < HwSurfaceCount; i++ ) { if( HwSurfaceList[i] == surface ) @@ -439,6 +456,7 @@ static void ANDROID_FreeHWSurface(_THIS, SDL_Surface *surface) memmove(HwSurfaceList + i, HwSurfaceList + i + 1, sizeof(SDL_Surface *) * (HwSurfaceCount - i) ); HwSurfaceList = SDL_realloc( HwSurfaceList, HwSurfaceCount * sizeof(SDL_Surface *) ); i = -1; + DEBUGOUT("ANDROID_FreeHWSurface() in HwSurfaceCount %d HwSurfaceList %p", HwSurfaceCount, HwSurfaceList); break; } } diff --git a/project/res/values/strings.xml b/project/res/values/strings.xml index 6ce5e80bc..d7285ec3f 100644 --- a/project/res/values/strings.xml +++ b/project/res/values/strings.xml @@ -1,6 +1,6 @@ - Commander Genius + Jooleem Initializing diff --git a/project/src/Accelerometer.java b/project/src/Accelerometer.java index 4c4c44a26..f3a02cd76 100644 --- a/project/src/Accelerometer.java +++ b/project/src/Accelerometer.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import android.app.Activity; import android.content.Context; diff --git a/project/src/Audio.java b/project/src/Audio.java index 210a7f040..09f29ac0c 100644 --- a/project/src/Audio.java +++ b/project/src/Audio.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import android.app.Activity; diff --git a/project/src/DataDownloader.java b/project/src/DataDownloader.java index d9d8ad87a..69e0311aa 100644 --- a/project/src/DataDownloader.java +++ b/project/src/DataDownloader.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import android.app.Activity; import android.content.Context; diff --git a/project/src/GLSurfaceView_SDL.java b/project/src/GLSurfaceView_SDL.java index eec731f61..447b95e6d 100644 --- a/project/src/GLSurfaceView_SDL.java +++ b/project/src/GLSurfaceView_SDL.java @@ -18,7 +18,7 @@ fixed with a hammer and rasp to work with libSDL port */ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import java.io.Writer; import java.util.ArrayList; diff --git a/project/src/Globals.java b/project/src/Globals.java index 689c6b06d..750661c8b 100644 --- a/project/src/Globals.java +++ b/project/src/Globals.java @@ -1,14 +1,14 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import android.app.Activity; import android.content.Context; class Globals { - public static String ApplicationName = "CommanderGenius"; + public static String ApplicationName = "Jooleem"; // Should be zip file - 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 10 Mb|http://sourceforge.net/projects/libsdl-android/files/Jooleem/jooleem_0.1.4_data.zip/download|http://sites.google.com/site/xpelyax/Home/jooleem_0.1.4_data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/jooleem_0.1.4_data.zip"; // Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D public static boolean NeedDepthBuffer = false; @@ -22,11 +22,11 @@ class Globals { // Readme text to be shown on download page public static String ReadmeText = "^You may press \"Home\" now - the data will be downloaded in background".replace("^","\n"); - public static boolean AppUsesMouse = false; + public static boolean AppUsesMouse = true; - public static boolean AppNeedsArrowKeys = true; + public static boolean AppNeedsArrowKeys = false; - public static boolean AppUsesJoystick = true; + public static boolean AppUsesJoystick = false; public static boolean AppHandlesJoystickSensitivity = false; @@ -34,9 +34,9 @@ class Globals { public static boolean NonBlockingSwapBuffers = false; - public static int AppTouchscreenKeyboardKeysAmount = 4; + public static int AppTouchscreenKeyboardKeysAmount = 0; - public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1; + public static int AppTouchscreenKeyboardKeysAmountAutoFire = 0; // Phone-specific config // It will download app data to /sdcard/alienblaster if set to true, @@ -56,5 +56,5 @@ class Globals { } class LoadLibrary { - public LoadLibrary() { System.loadLibrary("sdl-1.2"); }; + public LoadLibrary() { System.loadLibrary("sdl-1.2"); System.loadLibrary("sdl_mixer"); System.loadLibrary("sdl_image"); System.loadLibrary("sdl_ttf"); }; } diff --git a/project/src/MainActivity.java b/project/src/MainActivity.java index ee2b912fc..c11b33d6b 100644 --- a/project/src/MainActivity.java +++ b/project/src/MainActivity.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import android.app.Activity; import android.content.Context; diff --git a/project/src/Settings.java b/project/src/Settings.java index a53597e78..9d3147d94 100644 --- a/project/src/Settings.java +++ b/project/src/Settings.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import android.app.Activity; import android.content.Context; diff --git a/project/src/Video.java b/project/src/Video.java index c7daee6df..ed338d3f5 100644 --- a/project/src/Video.java +++ b/project/src/Video.java @@ -1,5 +1,5 @@ // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount -package net.sourceforge.clonekeenplus; +package net.sourceforge.jooleem; import javax.microedition.khronos.opengles.GL10;