Android stuff

This commit is contained in:
Vladislav Khorev 2013-05-28 15:17:21 +00:00
parent 958484416f
commit ef3e93beaf
3 changed files with 95 additions and 21 deletions

View File

@ -13,6 +13,8 @@ SQUIRREL_PATH = $(LibsPathCygwin)/sqplus
LIBPNG_PATH = $(LibsPathCygwin)/libpng_1.4.1_android
LIBJPEG_PATH = $(LibsPathCygwin)/jpeg-9
ZIP_PATH = $(LibsPathCygwin)/julienr-libzip-android/jni
#ENGINE_PATH = $(SalmonEnginePath)
@ -134,6 +136,73 @@ LOCAL_LDLIBS := -lz
include $(BUILD_STATIC_LIBRARY)
#=============== JPEG =============
LOCAL_PATH := $(LIBJPEG_PATH)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LIBJPEG_PATH)
LOCAL_C_INCLUDES += $(LIBJPEG_PATH)/vc10
LOCAL_MODULE := jpeg
LOCAL_SRC_FILES :=\
jaricom.c\
jcapimin.c\
jcapistd.c\
jcarith.c\
jccoefct.c\
jccolor.c\
jcdctmgr.c\
jchuff.c\
jcinit.c\
jcmainct.c\
jcmarker.c\
jcmaster.c\
jcomapi.c\
jcparam.c\
jcprepct.c\
jcsample.c\
jctrans.c\
jdapimin.c\
jdapistd.c\
jdarith.c\
jdatadst.c\
jdatasrc.c\
jdcoefct.c\
jdcolor.c\
jddctmgr.c\
jdhuff.c\
jdinput.c\
jdmainct.c\
jdmarker.c\
jdmaster.c\
jdmerge.c\
jdpostct.c\
jdsample.c\
jdtrans.c\
jerror.c\
jfdctflt.c\
jfdctfst.c\
jfdctint.c\
jidctflt.c\
jidctfst.c\
jidctint.c\
jmemmgr.c\
jmemnobs.c\
jquant1.c\
jquant2.c\
jutils.c
LOCAL_LDLIBS :=
#debug
#LOCAL_CFLAGS := -g -ggdb -O0
#LOCAL_LDLIBS += -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#================== SQUIRREL =================
@ -285,6 +354,7 @@ LOCAL_STATIC_LIBRARIES += ogg
LOCAL_STATIC_LIBRARIES += vorbis
LOCAL_STATIC_LIBRARIES += squirrel
LOCAL_STATIC_LIBRARIES += png_lib
LOCAL_STATIC_LIBRARIES += jpeg
LOCAL_STATIC_LIBRARIES += zip
LOCAL_SHARED_LIBRARIES := gnustl_shared
LOCAL_C_INCLUDES := $(BOOST_PATH)
@ -300,6 +370,8 @@ LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/sqplus
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/sqstdlib
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/squirrel
LOCAL_C_INCLUDES += $(LIBPNG_PATH)
LOCAL_C_INCLUDES += $(LIBJPEG_PATH)
LOCAL_C_INCLUDES += $(LIBJPEG_PATH)/vc10
LOCAL_C_INCLUDES += $(ZIP_PATH)
LOCAL_SRC_FILES := src/Utils/DataTypes/DataTypes.cpp
LOCAL_SRC_FILES += src/Utils/DataTypes/NewDataTypes.cpp
@ -310,6 +382,8 @@ LOCAL_SRC_FILES += src/Utils/Console/Console.cpp
LOCAL_SRC_FILES += src/Utils/SerializeInterface/SerializeInterface.cpp
LOCAL_SRC_FILES += src/Utils/Network/Network.cpp
LOCAL_SRC_FILES += src/Utils/PngHelper.cpp
LOCAL_SRC_FILES += src/Utils/JpegHelper.cpp
LOCAL_SRC_FILES += src/Utils/TgaLoader.cpp
LOCAL_SRC_FILES += src/Utils/SimpleTimer.cpp
LOCAL_SRC_FILES += src/Utils/ThreadUtils.cpp
LOCAL_SRC_FILES += src/TextureManager/SalmonTexture.cpp

View File

@ -13,21 +13,21 @@ const int CONST_TGA_OUTER_HEADER_SIZE = 12;
typedef struct
{
GLubyte Header[CONST_TGA_OUTER_HEADER_SIZE]; // TGA File Header
unsigned char Header[CONST_TGA_OUTER_HEADER_SIZE]; // TGA File Header
} TGAHeader;
const int CONST_TGA_INNER_HEADER_SIZE = 6;
typedef struct
{
GLubyte header[CONST_TGA_INNER_HEADER_SIZE]; // First 6 Useful Bytes From The Header
GLuint bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File
GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram
GLuint temp; // Temporary Variable
GLuint type;
GLuint Height; //Height of Image
GLuint Width; //Width ofImage
GLuint Bpp; // Bits Per Pixel
unsigned char header[CONST_TGA_INNER_HEADER_SIZE]; // First 6 Useful Bytes From The Header
unsigned int bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File
unsigned int imageSize; // Used To Store The Image Size When Setting Aside Ram
unsigned int temp; // Temporary Variable
unsigned int type;
unsigned int Height; //Height of Image
unsigned int Width; //Width ofImage
unsigned int Bpp; // Bits Per Pixel
} TGA;
@ -36,8 +36,8 @@ typedef struct
extern GLubyte uTGAcompare[12]; // Uncompressed TGA Header
extern GLubyte cTGAcompare[12]; // Compressed TGA Header
extern unsigned char uTGAcompare[12]; // Uncompressed TGA Header
extern unsigned char cTGAcompare[12]; // Compressed TGA Header
struct TTextureData; // Find it in SalmonTexture.h

View File

@ -9,8 +9,8 @@ namespace SE
GLubyte uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0}; // Uncompressed TGA Header
GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; // Compressed TGA Header
unsigned char uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0}; // Uncompressed TGA Header
unsigned char cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; // Compressed TGA Header
@ -97,7 +97,7 @@ bool LoadUncompressedTGA(TTextureData& texture, boost::shared_array<char> fTGA)
// Byte Swapping Optimized By Steve Thomas
for(GLuint cswap = 0; cswap < (int)tga.imageSize; cswap += tga.bytesPerPixel)
for(unsigned int cswap = 0; cswap < (int)tga.imageSize; cswap += tga.bytesPerPixel)
{
texture.Data[cswap] ^= texture.Data[cswap+2] ^=
texture.Data[cswap] ^= texture.Data[cswap+2];
@ -162,21 +162,21 @@ bool LoadCompressedTGA(TTextureData& texture, boost::shared_array<char> fTGA) /
texture.DataSize = tga.imageSize;
texture.Data = boost::shared_array<char>(new char [texture.DataSize]);
GLuint pixelcount = tga.Height * tga.Width; // Nuber of pixels in the image
GLuint currentpixel = 0; // Current pixel being read
GLuint currentbyte = 0; // Current byte
unsigned int pixelcount = tga.Height * tga.Width; // Nuber of pixels in the image
unsigned int currentpixel = 0; // Current pixel being read
unsigned int currentbyte = 0; // Current byte
//GLubyte* colorbuffer = (GLubyte *)malloc(tga.bytesPerPixel); // Storage for 1 pixel
boost::shared_array<GLubyte> colorbuffer(new GLubyte[tga.bytesPerPixel]);
boost::shared_array<unsigned char> colorbuffer(new unsigned char[tga.bytesPerPixel]);
do
{
GLubyte chunkheader = 0; // Storage for "chunk" header
unsigned char chunkheader = 0; // Storage for "chunk" header
chunkheader = static_cast<GLubyte>(fTGA[shift]);
shift += sizeof(GLubyte);
chunkheader = static_cast<unsigned char>(fTGA[shift]);
shift += sizeof(unsigned char);
if(chunkheader < 128) // If the ehader is < 128, it means the that is the number of RAW color packets minus 1
{ // that follow the header