diff --git a/ChangeAppSettings.sh b/ChangeAppSettings.sh index c2fd13431..13836fd01 100755 --- a/ChangeAppSettings.sh +++ b/ChangeAppSettings.sh @@ -26,7 +26,7 @@ echo "If you will supply empty string as answer the previous value will be used" if [ -z "$LibSdlVersion" -o -z "$AUTO" ]; then echo -echo -n "libSDL version to use (1.2 or 1.3) ($LibSdlVersion): " +echo -n "libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) ($LibSdlVersion): " read var if [ -n "$var" ] ; then LibSdlVersion="$var" diff --git a/project/jni/application/alienblaster/7.15-Alien Blaster.zip b/project/jni/application/alienblaster/7.15-Alien Blaster.zip deleted file mode 100644 index 20654d27d..000000000 Binary files a/project/jni/application/alienblaster/7.15-Alien Blaster.zip and /dev/null differ diff --git a/project/jni/application/alienblaster/AndroidAppSettings.cfg b/project/jni/application/alienblaster/AndroidAppSettings.cfg index afb6bc026..fabced88a 100644 --- a/project/jni/application/alienblaster/AndroidAppSettings.cfg +++ b/project/jni/application/alienblaster/AndroidAppSettings.cfg @@ -14,6 +14,7 @@ SwVideoMode=n SdlVideoResize=y SdlVideoResizeKeepAspect=n CompatibilityHacks= +CompatibilityHacksStaticInit=n AppUsesMouse=n AppNeedsTwoButtonMouse=n ShowMouseCursor=n @@ -35,6 +36,7 @@ MultiABI=n AppVersionCode=110014 AppVersionName="1.1.0.14" ResetSdlConfigForThisVersion=n +DeleteFilesOnUpgrade="%" CompiledLibraries="sdl_mixer sdl_image" CustomBuildScript=n AppCflags='-O3' diff --git a/project/jni/application/alienblaster/AndroidData/alienblaster110_data2.zip b/project/jni/application/alienblaster/AndroidData/alienblaster110_data2.zip index 301433f18..323796ee4 100644 Binary files a/project/jni/application/alienblaster/AndroidData/alienblaster110_data2.zip and b/project/jni/application/alienblaster/AndroidData/alienblaster110_data2.zip differ diff --git a/project/jni/application/alienblaster/SdlForwardCompat.h b/project/jni/application/alienblaster/SdlForwardCompat.h index deae69cf6..0d20617db 100644 --- a/project/jni/application/alienblaster/SdlForwardCompat.h +++ b/project/jni/application/alienblaster/SdlForwardCompat.h @@ -22,6 +22,10 @@ struct SdlCompat_AcceleratedSurface SDL_PixelFormat * format; }; +enum { SDL_SRCALPHA = 8, SDL_SRCCOLORKEY = 16 }; // Some dummy non-zero values + +typedef SDL_Keycode SDLKey; + extern SDL_Renderer * SDL_global_renderer; static inline SdlCompat_AcceleratedSurface * SdlCompat_CreateAcceleratedSurface(SDL_Surface * surface) @@ -29,6 +33,8 @@ static inline SdlCompat_AcceleratedSurface * SdlCompat_CreateAcceleratedSurface( SdlCompat_AcceleratedSurface * ret = new SdlCompat_AcceleratedSurface(); // Allocate accelerated surface even if that means loss of color quality Uint32 format; + Uint32 colorkey; + Uint8 alpha; ret->w = surface->w; ret->h = surface->h; @@ -36,7 +42,7 @@ static inline SdlCompat_AcceleratedSurface * SdlCompat_CreateAcceleratedSurface( memcpy(ret->format, surface->format, sizeof(SDL_PixelFormat)); format = SDL_PIXELFORMAT_RGB565; - if( surface->flags & SDL_SRCCOLORKEY ) + if( SDL_GetColorKey(surface, &colorkey) == 0 ) { format = SDL_PIXELFORMAT_RGBA4444; } @@ -52,13 +58,8 @@ static inline SdlCompat_AcceleratedSurface * SdlCompat_CreateAcceleratedSurface( SDL_SetTextureBlendMode( ret->t, SDL_BLENDMODE_BLEND ); //SDL_SetTextureAlphaMod( ret->t, SDL_ALPHA_OPAQUE ); SDL_SetTextureAlphaMod( ret->t, 128 ); - if( surface->flags & SDL_SRCALPHA ) - { - Uint8 alpha = 128; - if( SDL_GetSurfaceAlphaMod( surface, &alpha ) < 0 ) - alpha = 128; + if( SDL_GetSurfaceAlphaMod(surface, &alpha) == 0 ) SDL_SetTextureAlphaMod( ret->t, alpha ); - } return ret; }; @@ -90,7 +91,7 @@ static inline int SDL_Flip(SdlCompat_AcceleratedSurface * unused) static inline int SDL_SetAlpha(SdlCompat_AcceleratedSurface * surface, Uint32 flag, Uint8 alpha) { - if( ! (flag & SDL_SRCALPHA) ) + if( ! flag ) alpha = SDL_ALPHA_OPAQUE; return SDL_SetTextureAlphaMod(surface->t, alpha); }; diff --git a/project/jni/application/alienblaster/input.h b/project/jni/application/alienblaster/input.h index 9ccb0aaaf..b4b88c6cf 100644 --- a/project/jni/application/alienblaster/input.h +++ b/project/jni/application/alienblaster/input.h @@ -21,6 +21,7 @@ #define INPUT_H #include "SDL.h" +#include "SdlForwardCompat.h" class Input; diff --git a/project/jni/application/alienblaster/mixer.cpp b/project/jni/application/alienblaster/mixer.cpp index 30b7673ab..0f0121bc8 100644 --- a/project/jni/application/alienblaster/mixer.cpp +++ b/project/jni/application/alienblaster/mixer.cpp @@ -130,6 +130,7 @@ int Mixer::loadSample(string fileName, int volume) { if ( 0 <= volume && volume < 128 ) { Mix_VolumeChunk( mixChunks[ mixChunks.size() - 1 ], volume ); } + __android_log_print(ANDROID_LOG_INFO, "Alien Blaster", (string( "Loading sound " ) + fn1 + " done").c_str() ); return mixChunks.size() - 1; } return fn2snd[ fileName ]; @@ -180,7 +181,7 @@ int Mixer::loadMusic( string fn ) { if (enabled) { if (fn2mus.find(fn) == fn2mus.end()) { - __android_log_print(ANDROID_LOG_INFO, "Alien Blaster", (string( "Loading sound " ) + fn).c_str() ); + __android_log_print(ANDROID_LOG_INFO, "Alien Blaster", (string( "Loading music " ) + fn).c_str() ); string fn1 = fn; // Check if file exist @@ -213,6 +214,7 @@ int Mixer::loadMusic( string fn ) { musics.push_back(newSound); fn2mus[ fn ] = musics.size() - 1; + __android_log_print(ANDROID_LOG_INFO, "Alien Blaster", (string( "Loading music " ) + fn1 + " done").c_str() ); return musics.size() - 1; } return fn2mus[ fn ]; diff --git a/project/jni/application/alienblaster/surfaceDB.cpp b/project/jni/application/alienblaster/surfaceDB.cpp index 5bd4f1158..544dd2ec2 100644 --- a/project/jni/application/alienblaster/surfaceDB.cpp +++ b/project/jni/application/alienblaster/surfaceDB.cpp @@ -80,19 +80,19 @@ SDL_Surface *SurfaceDB::loadSurfaceInternal( string fn, bool alpha ) { if (!inputFile) { cout << "ERROR: file " << fn1 << " does not exist!" << endl; #ifdef ANDROID - __android_log_print(ANDROID_LOG_ERROR, "Alien Blaster", (string( "Cannot load image " ) + fn1).c_str() ); + __android_log_print(ANDROID_LOG_ERROR, "Alien Blaster", (string( "Cannot load image " ) + fn1 + " - file does not exist").c_str() ); #endif exit(1); } } fclose(inputFile); - SDL_Surface *newSurface = isPNG ? IMG_Load( fn1.c_str() ) : SDL_LoadBMP( fn1.c_str() ); + SDL_Surface *newSurface = IMG_Load( fn1.c_str() ); if( newSurface == NULL ) { cout << "ERROR: Cannot load image " << fn1 << endl; #ifdef ANDROID - __android_log_print(ANDROID_LOG_ERROR, "Alien Blaster", (string( "Cannot load image " ) + fn1).c_str() ); + __android_log_print(ANDROID_LOG_ERROR, "Alien Blaster", (string( "Cannot load image " ) + fn1 + " - file is in invalid format").c_str() ); #endif exit(1); } diff --git a/project/jni/application/frogatto b/project/jni/application/frogatto deleted file mode 160000 index 03540e804..000000000 --- a/project/jni/application/frogatto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 03540e8047f2f51fe6192c44af9dd57fb26991c5 diff --git a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h deleted file mode 120000 index f01dbb712..000000000 --- a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h +++ /dev/null @@ -1 +0,0 @@ -../../sdl-1.3/include/SDL_screenkeyboard.h \ No newline at end of file diff --git a/project/jni/sdl-1.2/include/SDL_screenkeyboard.h b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h new file mode 100644 index 000000000..c8bd79d4a --- /dev/null +++ b/project/jni/sdl-1.2/include/SDL_screenkeyboard.h @@ -0,0 +1,108 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_screenkeyboard_h +#define _SDL_screenkeyboard_h + +#include "SDL_stdinc.h" +#include "SDL_video.h" +#if SDL_VERSION_ATLEAST(1,3,0) +#include "SDL_keyboard.h" +#include "SDL_keycode.h" +#include "SDL_scancode.h" +#else +#include "SDL_keysym.h" +#endif + +/* On-screen keyboard exposed to the application, it's available on Android platform only */ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Button IDs */ +enum { + + SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD = 0, /* Joystick/D-Pad button */ + + SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, /* Main (usually Fire) button */ + SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, + SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, + SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, + SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, + SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, + + SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, /* Button to show screen keyboard */ + + SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM +}; + +/* All functions return 0 on failure and 1 on success, contrary to other SDL API */ + +extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos); +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos); + +extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonKey(int buttonId, +#if SDL_VERSION_ATLEAST(1,3,0) + SDL_Keycode +#else + SDLKey +#endif + key); +/* Returns SDLK_UNKNOWN on failure */ +extern DECLSPEC +#if SDL_VERSION_ATLEAST(1,3,0) + SDL_Keycode +#else + SDLKey +#endif + SDLCALL SDL_ANDROID_GetScreenKeyboardButtonKey(int buttonId); + +/* Buttons 0 and 1 may have auto-fire state */ +extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons); +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount(); + +extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardShown(int shown); +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardShown(); + +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardSize(); + +/* Show Android on-screen keyboard, and pass entered text back to application as SDL keypress events, +previousText is UTF-8 encoded, it may be NULL, only 256 first bytes will be used, and this call will not block */ +extern DECLSPEC int SDLCALL SDL_ANDROID_ToggleScreenKeyboardTextInput(const char * previousText); + +/* Show Android on-screen keyboard, and pass entered text back to application in a buffer, +using buffer contents as previous text (UTF-8 encoded), the buffer may be of any size - +this call will block until user typed all text. */ +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardTextInput(char * textBuf, int textBufSize); + +/* Whether user redefined on-screen keyboard layout via SDL menu, app should not enforce it's own layout in that case */ +extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardRedefinedByUser(); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif diff --git a/project/jni/sdl-1.2/src/video/android/SDL_scalemode.h b/project/jni/sdl-1.2/src/video/android/SDL_scalemode.h deleted file mode 120000 index 2672fb813..000000000 --- a/project/jni/sdl-1.2/src/video/android/SDL_scalemode.h +++ /dev/null @@ -1 +0,0 @@ -../../../../sdl-1.3/include/SDL_scalemode.h \ No newline at end of file diff --git a/project/jni/sdl-1.2/src/video/android/SDL_scalemode.h b/project/jni/sdl-1.2/src/video/android/SDL_scalemode.h new file mode 100644 index 000000000..a658c68bb --- /dev/null +++ b/project/jni/sdl-1.2/src/video/android/SDL_scalemode.h @@ -0,0 +1,69 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/** + * \file SDL_scalemode.h + * + * Header file declaring the SDL_ScaleMode enumeration + */ + +#ifndef _SDL_scalemode_h +#define _SDL_scalemode_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief The texture scale mode used in SDL_RenderCopy(). + */ +typedef enum +{ + SDL_SCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must + match dimensions */ + + SDL_SCALEMODE_FAST = 0x00000001, /**< Point sampling or + equivalent algorithm */ + + SDL_SCALEMODE_SLOW = 0x00000002, /**< Linear filtering or + equivalent algorithm */ + + SDL_SCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or + equivalent algorithm */ +} SDL_ScaleMode; + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/project/jni/sdl-1.3/include/SDL_opengles.h b/project/jni/sdl-1.3/include/SDL_opengles.h index 32ee2378f..97e497a5f 100644 --- a/project/jni/sdl-1.3/include/SDL_opengles.h +++ b/project/jni/sdl-1.3/include/SDL_opengles.h @@ -29,6 +29,7 @@ #include #include #else +#define GL_GLEXT_PROTOTYPES 1 #include #include #endif diff --git a/project/jni/sdl-1.3/include/SDL_opengles2.h b/project/jni/sdl-1.3/include/SDL_opengles2.h index e034959ae..8db5f707d 100644 --- a/project/jni/sdl-1.3/include/SDL_opengles2.h +++ b/project/jni/sdl-1.3/include/SDL_opengles2.h @@ -29,6 +29,7 @@ #include #include #else +#define GL_GLEXT_PROTOTYPES 1 #include #include #endif diff --git a/project/jni/sdl-1.3/include/SDL_screenkeyboard.h b/project/jni/sdl-1.3/include/SDL_screenkeyboard.h new file mode 120000 index 000000000..394a970f3 --- /dev/null +++ b/project/jni/sdl-1.3/include/SDL_screenkeyboard.h @@ -0,0 +1 @@ +../../sdl-1.2/include/SDL_screenkeyboard.h \ No newline at end of file diff --git a/project/jni/sdl-1.3/src/file/SDL_rwops.c b/project/jni/sdl-1.3/src/file/SDL_rwops.c index d4868cc7a..6361c770e 100755 --- a/project/jni/sdl-1.3/src/file/SDL_rwops.c +++ b/project/jni/sdl-1.3/src/file/SDL_rwops.c @@ -32,7 +32,7 @@ #endif /* __APPLE__ */ #ifdef ANDROID -#include "../core/android/SDL_android.h" +/* #include "../core/android/SDL_android.h" */ #endif #ifdef __NDS__ @@ -445,7 +445,8 @@ SDL_RWFromFile(const char *file, const char *mode) SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); return NULL; } -#if defined(ANDROID) +#if defined(ANDROID) && 0 + rwops = SDL_AllocRW(); if (!rwops) return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.h b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.h index 18d4f672c..f32810470 100644 --- a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.h +++ b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.h @@ -38,7 +38,7 @@ #include "../../events/SDL_mouse_c.h" #include "SDL_keycode.h" #include "SDL_scancode.h" -#include "SDL_compat.h" +//#include "SDL_compat.h" #else #include "SDL_keysym.h" #include "../../events/SDL_events_c.h" @@ -61,6 +61,9 @@ #define SDL_KEY2(X) SDL_SCANCODE_ ## X #define SDL_KEY(X) SDL_KEY2(X) +typedef SDL_Scancode SDL_scancode; +typedef SDL_Keycode SDLKey; +typedef SDL_Keysym SDL_keysym; #else