From eda66c6d45583d3268fa2f5d9a43b00d08cf1322 Mon Sep 17 00:00:00 2001 From: pelya Date: Mon, 26 Jul 2010 18:24:57 +0300 Subject: [PATCH] THIS REVISION WILL NOT WORK! Compiled and linked SDL_renderer_gles.c into SDL 1.2 lib, no code was added to actually use it. ifdef overkill, yay! --- alienblaster/build.sh | 2 +- .../alienblaster/SdlForwardCompat.h | 1 - alienblaster/project/jni/sdl_main/sdl_main.c | 2 +- .../project/sdl/sdl-1.2/include/SDL_stdinc.h | 3 ++ .../sdl/sdl-1.2/src/video/android/SDL_blit.h | 1 + .../sdl-1.2/src/video/android/SDL_glesfuncs.h | 1 + .../sdl-1.2/src/video/android/SDL_opengles.h | 1 + .../sdl-1.2/src/video/android/SDL_pixels.c | 1 + .../sdl-1.2/src/video/android/SDL_pixels.h | 1 + .../sdl-1.2/src/video/android/SDL_pixels_c.h | 1 + .../sdl/sdl-1.2/src/video/android/SDL_rect.c | 1 + .../sdl/sdl-1.2/src/video/android/SDL_rect.h | 1 + .../sdl-1.2/src/video/android/SDL_rect_c.h | 1 + .../src/video/android/SDL_renderer_gl.h | 0 .../src/video/android/SDL_renderer_gles.c | 1 + .../src/video/android/SDL_renderer_gles.h | 1 + .../src/video/android/SDL_renderer_sw.h | 0 .../sdl-1.2/src/video/android/SDL_surface.h | 0 .../src/video/android/SDL_sysvideo-1.3.h | 1 + .../sdl-1.2/src/video/android/SDL_video-1.3.h | 1 + .../sdl/sdl-1.2/src/video/android/SDL_video.c | 1 + .../project/sdl/sdl-1.3/include/SDL_pixels.h | 15 +++++- .../project/sdl/sdl-1.3/include/SDL_rect.h | 7 ++- .../project/sdl/sdl-1.3/include/SDL_video.h | 13 +++-- .../sdl/sdl-1.3/src/video/SDL_pixels.c | 17 +++++- .../sdl/sdl-1.3/src/video/SDL_pixels_c.h | 1 + .../sdl/sdl-1.3/src/video/SDL_rect_c.h | 1 + .../sdl/sdl-1.3/src/video/SDL_renderer_gles.c | 16 +++++- .../sdl/sdl-1.3/src/video/SDL_sysvideo.h | 5 +- .../project/sdl/sdl-1.3/src/video/SDL_video.c | 53 ++++++++++++++++++- alienblaster/project/src/DataDownloader.java | 2 +- 31 files changed, 137 insertions(+), 15 deletions(-) create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_blit.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_glesfuncs.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_opengles.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.c create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels_c.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.c create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect_c.h create mode 100644 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gl.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.c create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.h create mode 100644 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_sw.h create mode 100644 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_surface.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_sysvideo-1.3.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video-1.3.h create mode 120000 alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video.c diff --git a/alienblaster/build.sh b/alienblaster/build.sh index dc2d66ca7..6842bfc81 100755 --- a/alienblaster/build.sh +++ b/alienblaster/build.sh @@ -3,5 +3,5 @@ # Set here your own NDK path if needed # export PATH=$PATH:~/src/endless_space/android-ndk-r4 -cd project && nice -n5 ndk-build -j2 V=1 && ant debug && cd bin && adb install -r DemoActivity-debug.apk +cd project && nice -n5 ndk-build V=1 && ant debug && cd bin && adb install -r DemoActivity-debug.apk diff --git a/alienblaster/project/jni/application/alienblaster/SdlForwardCompat.h b/alienblaster/project/jni/application/alienblaster/SdlForwardCompat.h index 33246a3a3..fcb0a7ab3 100644 --- a/alienblaster/project/jni/application/alienblaster/SdlForwardCompat.h +++ b/alienblaster/project/jni/application/alienblaster/SdlForwardCompat.h @@ -125,7 +125,6 @@ static inline int SDL_SetAlpha(SdlCompat_AcceleratedSurface * surface, Uint32 fl #else -// TODO: did not check if SDL 1.2 part compiles typedef SDL_Surface SdlCompat_AcceleratedSurface; static inline SdlCompat_AcceleratedSurface * SdlCompat_CreateAcceleratedSurface(SDL_Surface * surface) diff --git a/alienblaster/project/jni/sdl_main/sdl_main.c b/alienblaster/project/jni/sdl_main/sdl_main.c index a1fa40d89..efa49bfbd 100644 --- a/alienblaster/project/jni/sdl_main/sdl_main.c +++ b/alienblaster/project/jni/sdl_main/sdl_main.c @@ -33,7 +33,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz ) char curdir[512]; if( isSdcardUsed ) { - strcpy(curdir, "/sdcard/"); + strcpy(curdir, "/sdcard/app-data/"); strcat(curdir, SDL_CURDIR_PATH); } else diff --git a/alienblaster/project/sdl/sdl-1.2/include/SDL_stdinc.h b/alienblaster/project/sdl/sdl-1.2/include/SDL_stdinc.h index e1f85fb75..171246b86 100644 --- a/alienblaster/project/sdl/sdl-1.2/include/SDL_stdinc.h +++ b/alienblaster/project/sdl/sdl-1.2/include/SDL_stdinc.h @@ -258,6 +258,9 @@ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); #endif +#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) +#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) + #if defined(__GNUC__) && defined(i386) #define SDL_memset4(dst, val, len) \ do { \ diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_blit.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_blit.h new file mode 120000 index 000000000..05f2f5db9 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_blit.h @@ -0,0 +1 @@ +../SDL_blit.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_glesfuncs.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_glesfuncs.h new file mode 120000 index 000000000..040f8b699 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_glesfuncs.h @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_glesfuncs.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_opengles.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_opengles.h new file mode 120000 index 000000000..251bbf0a1 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_opengles.h @@ -0,0 +1 @@ +../../../../sdl-1.3/include/SDL_opengles.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.c b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.c new file mode 120000 index 000000000..f193b1511 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.c @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_pixels.c \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.h new file mode 120000 index 000000000..cf8db31f8 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels.h @@ -0,0 +1 @@ +../../../../sdl-1.3/include/SDL_pixels.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels_c.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels_c.h new file mode 120000 index 000000000..955a28ff3 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_pixels_c.h @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_pixels_c.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.c b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.c new file mode 120000 index 000000000..7ac4319eb --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.c @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_rect.c \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.h new file mode 120000 index 000000000..af8d2b636 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect.h @@ -0,0 +1 @@ +../../../../sdl-1.3/include/SDL_rect.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect_c.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect_c.h new file mode 120000 index 000000000..427c01e8f --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_rect_c.h @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_rect_c.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gl.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gl.h new file mode 100644 index 000000000..e69de29bb diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.c b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.c new file mode 120000 index 000000000..0b020c883 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.c @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_renderer_gles.c \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.h new file mode 120000 index 000000000..cdce4bd68 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_gles.h @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_renderer_gles.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_sw.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_renderer_sw.h new file mode 100644 index 000000000..e69de29bb diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_surface.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_surface.h new file mode 100644 index 000000000..e69de29bb diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_sysvideo-1.3.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_sysvideo-1.3.h new file mode 120000 index 000000000..0d114b5b8 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_sysvideo-1.3.h @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_sysvideo.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video-1.3.h b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video-1.3.h new file mode 120000 index 000000000..203da73fe --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video-1.3.h @@ -0,0 +1 @@ +../../../../sdl-1.3/include/SDL_video.h \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video.c b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video.c new file mode 120000 index 000000000..19ecad5a4 --- /dev/null +++ b/alienblaster/project/sdl/sdl-1.2/src/video/android/SDL_video.c @@ -0,0 +1 @@ +../../../../sdl-1.3/src/video/SDL_video.c \ No newline at end of file diff --git a/alienblaster/project/sdl/sdl-1.3/include/SDL_pixels.h b/alienblaster/project/sdl/sdl-1.3/include/SDL_pixels.h index 8c3216b07..deb82ca13 100644 --- a/alienblaster/project/sdl/sdl-1.3/include/SDL_pixels.h +++ b/alienblaster/project/sdl/sdl-1.3/include/SDL_pixels.h @@ -29,6 +29,14 @@ #ifndef _SDL_pixels_h #define _SDL_pixels_h +#include "SDL_version.h" + +#if SDL_VERSION_ATLEAST(1,3,0) +#include "SDL_video.h" +#else +#include "SDL_video-1.3.h" +#endif + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -219,6 +227,7 @@ enum SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_2101010, 32, 4), +#if SDL_VERSION_ATLEAST(1,3,0) SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */ @@ -229,8 +238,10 @@ enum SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'), SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U') +#endif }; +#if SDL_VERSION_ATLEAST(1,3,0) typedef struct SDL_Color { Uint8 r; @@ -274,6 +285,7 @@ typedef struct SDL_PixelFormat Uint32 Bmask; Uint32 Amask; } SDL_PixelFormat; +#endif /** * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks. @@ -320,6 +332,7 @@ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors); * * \sa SDL_DelPaletteWatch() */ +#if SDL_VERSION_ATLEAST(1,3,0) extern DECLSPEC int SDLCALL SDL_AddPaletteWatch(SDL_Palette * palette, SDL_PaletteChangedFunc callback, void *userdata); @@ -333,7 +346,7 @@ extern DECLSPEC int SDLCALL SDL_AddPaletteWatch(SDL_Palette * palette, extern DECLSPEC void SDLCALL SDL_DelPaletteWatch(SDL_Palette * palette, SDL_PaletteChangedFunc callback, void *userdata); - +#endif /** * \brief Set a range of colors in a palette. * diff --git a/alienblaster/project/sdl/sdl-1.3/include/SDL_rect.h b/alienblaster/project/sdl/sdl-1.3/include/SDL_rect.h index 4229d34db..9b531bff0 100644 --- a/alienblaster/project/sdl/sdl-1.3/include/SDL_rect.h +++ b/alienblaster/project/sdl/sdl-1.3/include/SDL_rect.h @@ -31,8 +31,11 @@ #include "SDL_stdinc.h" #include "SDL_error.h" -#include "SDL_pixels.h" #include "SDL_rwops.h" +#include "SDL_version.h" +#if ! SDL_VERSION_ATLEAST(1,3,0) +#include "SDL_video.h" +#endif #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -63,11 +66,13 @@ typedef struct * \sa SDL_UnionRect * \sa SDL_EnclosePoints */ +#if SDL_VERSION_ATLEAST(1,3,0) typedef struct SDL_Rect { int x, y; int w, h; } SDL_Rect; +#endif /** * \brief Returns true if the rectangle has no area. diff --git a/alienblaster/project/sdl/sdl-1.3/include/SDL_video.h b/alienblaster/project/sdl/sdl-1.3/include/SDL_video.h index 804869f69..10cf9ad33 100644 --- a/alienblaster/project/sdl/sdl-1.3/include/SDL_video.h +++ b/alienblaster/project/sdl/sdl-1.3/include/SDL_video.h @@ -26,13 +26,17 @@ * Header file for SDL video functions. */ -#ifndef _SDL_video_h -#define _SDL_video_h +#ifndef _SDL_video_1_3_h +#define _SDL_video_1_3_h #include "SDL_stdinc.h" -#include "SDL_pixels.h" #include "SDL_rect.h" +#include "SDL_pixels.h" #include "SDL_surface.h" +#include "SDL_version.h" +#if ! SDL_VERSION_ATLEAST(1,3,0) +#include "SDL_video.h" +#endif #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -256,6 +260,7 @@ typedef struct SDL_Texture SDL_Texture; */ typedef void *SDL_GLContext; +#if SDL_VERSION_ATLEAST(1,3,0) /** * \brief OpenGL configuration attributes */ @@ -281,7 +286,7 @@ typedef enum SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION } SDL_GLattr; - +#endif /* Function prototypes */ diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels.c b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels.c index 3ada76536..acb72066d 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels.c +++ b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels.c @@ -20,22 +20,32 @@ slouken@libsdl.org */ #include "SDL_config.h" +#include "SDL_version.h" /* General (mostly internal) pixel/color manipulation routines for SDL */ #include "SDL_endian.h" +#if SDL_VERSION_ATLEAST(1,3,0) #include "SDL_video.h" #include "SDL_sysvideo.h" +#else +#include "SDL_video-1.3.h" +#include "SDL_sysvideo-1.3.h" +#endif #include "SDL_blit.h" #include "SDL_pixels_c.h" +#if SDL_VERSION_ATLEAST(1,3,0) #include "SDL_RLEaccel_c.h" +#endif +#if SDL_VERSION_ATLEAST(1,3,0) struct SDL_PaletteWatch { SDL_PaletteChangedFunc callback; void *userdata; struct SDL_PaletteWatch *next; }; +#endif /* Helper functions */ @@ -288,7 +298,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, return SDL_PIXELFORMAT_UNKNOWN; } - +#if SDL_VERSION_ATLEAST(1,3,0) SDL_Palette * SDL_AllocPalette(int ncolors) { @@ -428,6 +438,8 @@ SDL_AllocFormat(int bpp, return SDL_InitFormat(format, bpp, Rmask, Gmask, Bmask, Amask); } +#endif + SDL_PixelFormat * SDL_InitFormat(SDL_PixelFormat * format, int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) @@ -508,6 +520,8 @@ SDL_InitFormat(SDL_PixelFormat * format, int bpp, Uint32 Rmask, Uint32 Gmask, return format; } +#if SDL_VERSION_ATLEAST(1,3,0) + /* * Change any previous mappings from/to the new surface format */ @@ -913,5 +927,6 @@ SDL_FreeBlitMap(SDL_BlitMap * map) SDL_free(map); } } +#endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels_c.h b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels_c.h index f307400e9..0db2f1247 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels_c.h +++ b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_pixels_c.h @@ -20,6 +20,7 @@ slouken@libsdl.org */ #include "SDL_config.h" +#include "SDL_version.h" /* Useful functions and variables from SDL_pixel.c */ diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_rect_c.h b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_rect_c.h index 2f444760f..8438a231f 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_rect_c.h +++ b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_rect_c.h @@ -20,6 +20,7 @@ slouken@libsdl.org */ #include "SDL_config.h" +#include "SDL_rect.h" typedef struct SDL_DirtyRect { diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_renderer_gles.c b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_renderer_gles.c index 3b0d9d2e0..925eddbbd 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_renderer_gles.c +++ b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_renderer_gles.c @@ -20,15 +20,23 @@ slouken@libsdl.org */ #include "SDL_config.h" +#include "SDL_version.h" #if SDL_VIDEO_RENDER_OGL_ES +#if SDL_VERSION_ATLEAST(1,3,0) #include "SDL_video.h" -#include "SDL_opengles.h" #include "SDL_sysvideo.h" +#else +#include "SDL_video-1.3.h" +#include "SDL_sysvideo-1.3.h" +#endif +#include "SDL_opengles.h" #include "SDL_pixels_c.h" #include "SDL_rect_c.h" +#if SDL_VERSION_ATLEAST(1,3,0) #include "SDL_yuv_sw_c.h" +#endif #ifdef ANDROID #include #endif @@ -221,11 +229,13 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) GLint value; int doublebuffer; +#if SDL_VERSION_ATLEAST(1,3,0) if (!(window->flags & SDL_WINDOW_OPENGL)) { if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) { return NULL; } } +#endif renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); if (!renderer) { @@ -303,11 +313,15 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } +#ifdef ANDROID + // Always double-buffered +#else if (SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer) == 0) { if (!doublebuffer) { renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; } } +#endif #if SDL_VIDEO_DRIVER_PANDORA data->GL_OES_draw_texture_supported = SDL_FALSE; data->useDrawTexture = SDL_FALSE; diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_sysvideo.h b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_sysvideo.h index 15cf4cd82..ba89f3e84 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_sysvideo.h +++ b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_sysvideo.h @@ -21,11 +21,12 @@ */ #include "SDL_config.h" -#ifndef _SDL_sysvideo_h -#define _SDL_sysvideo_h +#ifndef _SDL_sysvideo_1_3_h +#define _SDL_sysvideo_1_3_h #include "SDL_mouse.h" #include "SDL_keysym.h" +#include "SDL_rect.h" /* The SDL video driver */ diff --git a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_video.c b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_video.c index 48fed2f66..eecfedf1a 100644 --- a/alienblaster/project/sdl/sdl-1.3/src/video/SDL_video.c +++ b/alienblaster/project/sdl/sdl-1.3/src/video/SDL_video.c @@ -20,19 +20,27 @@ slouken@libsdl.org */ #include "SDL_config.h" +#include "SDL_version.h" /* The high-level video driver subsystem */ #include "SDL.h" +#if SDL_VERSION_ATLEAST(1,3,0) #include "SDL_video.h" #include "SDL_sysvideo.h" +#else +#include "SDL_video-1.3.h" +#include "SDL_sysvideo-1.3.h" +#endif #include "SDL_blit.h" #include "SDL_pixels_c.h" #include "SDL_renderer_gl.h" #include "SDL_renderer_gles.h" #include "SDL_renderer_sw.h" +#if SDL_VERSION_ATLEAST(1,3,0) #include "../events/SDL_sysevents.h" #include "../events/SDL_events_c.h" +#endif #ifdef ANDROID #include #endif @@ -183,7 +191,12 @@ SDL_GetVideoDriver(int index) * Initialize the video and event subsystems -- determine native pixel format */ int -SDL_VideoInit(const char *driver_name, Uint32 flags) +#if SDL_VERSION_ATLEAST(1,3,0) +SDL_VideoInit +#else +SDL_VideoInit_1_3 +#endif +(const char *driver_name, Uint32 flags) { SDL_VideoDevice *video; int index; @@ -290,9 +303,11 @@ SDL_VideoInit(const char *driver_name, Uint32 flags) SDL_AddRenderDriver(display, &GL_ES_RenderDriver); #endif } +#if SDL_VERSION_ATLEAST(1,3,0) if (display->num_render_drivers > 0) { SDL_AddRenderDriver(display, &SW_RenderDriver); } +#endif } /* We're ready to go! */ @@ -698,6 +713,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * } display->current_mode = display_mode; +#if SDL_VERSION_ATLEAST(1,3,0) /* Set up a palette, if necessary */ if (SDL_ISPIXELFORMAT_INDEXED(display_mode.format)) { ncolors = (1 << SDL_BITSPERPIXEL(display_mode.format)); @@ -719,6 +735,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * SDL_BITSPERPIXEL(display_mode.format)); } } +#endif return 0; } @@ -764,6 +781,8 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode) return 0; } +#if SDL_VERSION_ATLEAST(1,3,0) + static void SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt) { @@ -1036,6 +1055,7 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) return 0; } +#endif static __inline__ SDL_Renderer * SDL_GetCurrentRenderer(SDL_bool create) @@ -1056,6 +1076,7 @@ SDL_GetCurrentRenderer(SDL_bool create) return SDL_CurrentRenderer; } +#if SDL_VERSION_ATLEAST(1,3,0) Uint32 SDL_GetWindowID(SDL_Window * window) { @@ -1486,6 +1507,8 @@ SDL_DestroyWindow(SDL_Window * window) SDL_free(window); } +#endif + void SDL_AddRenderDriver(SDL_VideoDisplay * display, const SDL_RenderDriver * driver) { @@ -1706,8 +1729,13 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) } } else { if (surface->format->Amask +#if SDL_VERSION_ATLEAST(1,3,0) || !(surface->map->info.flags & (SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) { +#else + || !(surface->flags & + (SDL_SRCCOLORKEY | SDL_SRCALPHA))) { +#endif Uint32 it; int pfmt; @@ -1932,6 +1960,7 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) /* Set up a destination surface for the texture update */ SDL_InitFormat(&dst_fmt, bpp, Rmask, Gmask, Bmask, Amask); +#if SDL_VERSION_ATLEAST(1,3,0) if (SDL_ISPIXELFORMAT_INDEXED(format)) { dst_fmt.palette = SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format))); @@ -1944,14 +1973,17 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) SDL_BITSPERPIXEL(format)); } } +#endif dst = SDL_ConvertSurface(surface, &dst_fmt, 0); if (dst) { SDL_UpdateTexture(texture, NULL, dst->pixels, dst->pitch); SDL_FreeSurface(dst); } +#if SDL_VERSION_ATLEAST(1,3,0) if (dst_fmt.palette) { SDL_FreePalette(dst_fmt.palette); } +#endif if (!dst) { SDL_DestroyTexture(texture); return 0; @@ -1963,6 +1995,7 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) int blendMode; int scaleMode; +#if SDL_VERSION_ATLEAST(1,3,0) SDL_GetSurfaceColorMod(surface, &r, &g, &b); SDL_SetTextureColorMod(texture, r, g, b); @@ -1974,12 +2007,20 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) SDL_GetSurfaceScaleMode(surface, &scaleMode); SDL_SetTextureScaleMode(texture, scaleMode); +#else + if(surface->flags & SDL_SRCALPHA) { + SDL_SetTextureAlphaMod(texture, surface->format->alpha); + SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); + } +#endif } +#if SDL_VERSION_ATLEAST(1,3,0) if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) { SDL_SetTexturePalette(texture, fmt->palette->colors, 0, fmt->palette->ncolors); } +#endif return texture; } @@ -2954,6 +2995,8 @@ SDL_DisableScreenSaver() } } +#if SDL_VERSION_ATLEAST(1,3,0) + void SDL_VideoQuit(void) { @@ -3088,6 +3131,8 @@ SDL_GL_UnloadLibrary(void) } } +#endif + SDL_bool SDL_GL_ExtensionSupported(const char *extension) { @@ -3142,6 +3187,8 @@ SDL_GL_ExtensionSupported(const char *extension) #endif } +#if SDL_VERSION_ATLEAST(1,3,0) + int SDL_GL_SetAttribute(SDL_GLattr attr, int value) { @@ -3379,6 +3426,8 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) #endif /* SDL_VIDEO_OPENGL */ } +#endif /* SDL 1.3.0 */ + SDL_GLContext SDL_GL_CreateContext(SDL_Window * window) { @@ -3557,6 +3606,7 @@ SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask) } #endif +#if SDL_VERSION_ATLEAST(1,3,0) SDL_bool SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info) { @@ -3595,5 +3645,6 @@ SDL_SetTextInputRect(SDL_Rect *rect) _this->SetTextInputRect(_this, rect); } } +#endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/alienblaster/project/src/DataDownloader.java b/alienblaster/project/src/DataDownloader.java index d46913132..7aaf328a1 100644 --- a/alienblaster/project/src/DataDownloader.java +++ b/alienblaster/project/src/DataDownloader.java @@ -135,7 +135,7 @@ class DataDownloader extends Thread Status.setText( "Connecting to " + Globals.DataDownloadUrl ); outFilesDir = Parent.getFilesDir().getAbsolutePath(); if( Globals.DownloadToSdcard ) - outFilesDir = "/sdcard/" + Globals.class.getPackage().getName(); + outFilesDir = "/sdcard/app-data/" + Globals.class.getPackage().getName(); this.start(); }