cocos2d-x  3.0alpha1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ZipUtils Class Reference

#include <ZipUtils.h>

Static Public Member Functions

static CC_DEPRECATED_ATTRIBUTE int ccInflateMemory (unsigned char *in, long inLength, unsigned char **out)
 Inflates either zlib or gzip deflated memory. More...
 
local ccInflateMemory ( local in, local inLength, local out)
 Inflates either zlib or gzip deflated memory. More...
 
static int inflateMemory (unsigned char *in, long inLength, unsigned char **out)
static CC_DEPRECATED_ATTRIBUTE int ccInflateMemoryWithHint (unsigned char *in, long inLength, unsigned char **out, long outLengthHint)
 Inflates either zlib or gzip deflated memory. More...
 
local ccInflateMemoryWithHint ( local in, local inLength, local out, local outLengthHint)
 Inflates either zlib or gzip deflated memory. More...
 
static int inflateMemoryWithHint (unsigned char *in, long inLength, unsigned char **out, long outLengthHint)
local inflateMemoryWithHint ( local in, local inLength, local out, local outLengthHint)
static CC_DEPRECATED_ATTRIBUTE int ccInflateGZipFile (const char *filename, unsigned char **out)
 inflates a GZip file into memory More...
 
local ccInflateGZipFile ( local filename, local out)
 inflates a GZip file into memory More...
 
static int inflateGZipFile (const char *filename, unsigned char **out)
var inflateGZipFile ( var filename, var out)
local inflateGZipFile ( local filename, local out)
static CC_DEPRECATED_ATTRIBUTE bool ccIsGZipFile (const char *filename)
 test a file is a GZip format file or not More...
 
local ccIsGZipFile ( local filename)
 test a file is a GZip format file or not More...
 
static bool isGZipFile (const char *filename)
var isGZipFile ( var filename)
local isGZipFile ( local filename)
static CC_DEPRECATED_ATTRIBUTE bool ccIsGZipBuffer (const unsigned char *buffer, long len)
 test the buffer is GZip format or not More...
 
local ccIsGZipBuffer ( local buffer, local len)
 test the buffer is GZip format or not More...
 
static bool isGZipBuffer (const unsigned char *buffer, long len)
local isGZipBuffer ( local buffer, local len)
static CC_DEPRECATED_ATTRIBUTE int ccInflateCCZFile (const char *filename, unsigned char **out)
 inflates a CCZ file into memory More...
 
local ccInflateCCZFile ( local filename, local out)
 inflates a CCZ file into memory More...
 
static int inflateCCZFile (const char *filename, unsigned char **out)
static CC_DEPRECATED_ATTRIBUTE int ccInflateCCZBuffer (const unsigned char *buffer, long len, unsigned char **out)
 inflates a buffer with CCZ format into memory More...
 
local ccInflateCCZBuffer ( local buffer, local len, local out)
 inflates a buffer with CCZ format into memory More...
 
static int inflateCCZBuffer (const unsigned char *buffer, long len, unsigned char **out)
local inflateCCZBuffer ( local buffer, local len, local out)
static CC_DEPRECATED_ATTRIBUTE bool ccIsCCZFile (const char *filename)
 test a file is a CCZ format file or not More...
 
local ccIsCCZFile ( local filename)
 test a file is a CCZ format file or not More...
 
static bool isCCZFile (const char *filename)
var isCCZFile ( var filename)
local isCCZFile ( local filename)
static CC_DEPRECATED_ATTRIBUTE bool ccIsCCZBuffer (const unsigned char *buffer, long len)
 test the buffer is CCZ format or not More...
 
local ccIsCCZBuffer ( local buffer, local len)
 test the buffer is CCZ format or not More...
 
static bool isCCZBuffer (const unsigned char *buffer, long len)
local isCCZBuffer ( local buffer, local len)
static CC_DEPRECATED_ATTRIBUTE void ccSetPvrEncryptionKeyPart (int index, unsigned int value)
 Sets the pvr.ccz encryption key parts separately for added security. More...
 
local ccSetPvrEncryptionKeyPart ( local index, local value)
 Sets the pvr.ccz encryption key parts separately for added security. More...
 
static void setPvrEncryptionKeyPart (int index, unsigned int value)
var setPvrEncryptionKeyPart ( var index, var value)
local setPvrEncryptionKeyPart ( local index, local value)
static CC_DEPRECATED_ATTRIBUTE void ccSetPvrEncryptionKey (unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4)
 Sets the pvr.ccz encryption key. More...
 
local ccSetPvrEncryptionKey ( local keyPart1, local keyPart2, local keyPart3, local keyPart4)
 Sets the pvr.ccz encryption key. More...
 
static void setPvrEncryptionKey (unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4)
local setPvrEncryptionKey ( local keyPart1, local keyPart2, local keyPart3, local keyPart4)

Member Function Documentation

static CC_DEPRECATED_ATTRIBUTE
int ccInflateCCZBuffer
( const unsigned char *  buffer,
long  len,
unsigned char **  out 
)
inlinestatic

inflates a buffer with CCZ format into memory

Returns
the length of the deflated buffer
Since
v3.0
var ccInflateCCZBuffer ( var  buffer,
var  len,
var  out 
)
inlinestatic

inflates a buffer with CCZ format into memory

Returns
the length of the deflated buffer
Since
v3.0
local ccInflateCCZBuffer ( local  buffer,
local  len,
local  out 
)
inlinestatic

inflates a buffer with CCZ format into memory

Returns
the length of the deflated buffer
Since
v3.0
static CC_DEPRECATED_ATTRIBUTE
int ccInflateCCZFile
( const char *  filename,
unsigned char **  out 
)
inlinestatic

inflates a CCZ file into memory

Returns
the length of the deflated buffer
Since
v0.99.5
var ccInflateCCZFile ( var  filename,
var  out 
)
inlinestatic

inflates a CCZ file into memory

Returns
the length of the deflated buffer
Since
v0.99.5
local ccInflateCCZFile ( local  filename,
local  out 
)
inlinestatic

inflates a CCZ file into memory

Returns
the length of the deflated buffer
Since
v0.99.5
static CC_DEPRECATED_ATTRIBUTE
int ccInflateGZipFile
( const char *  filename,
unsigned char **  out 
)
inlinestatic

inflates a GZip file into memory

Returns
the length of the deflated buffer
Since
v0.99.5
var ccInflateGZipFile ( var  filename,
var  out 
)
inlinestatic

inflates a GZip file into memory

Returns
the length of the deflated buffer
Since
v0.99.5
local ccInflateGZipFile ( local  filename,
local  out 
)
inlinestatic

inflates a GZip file into memory

Returns
the length of the deflated buffer
Since
v0.99.5
static CC_DEPRECATED_ATTRIBUTE
int ccInflateMemory
( unsigned char *  in,
long  inLength,
unsigned char **  out 
)
inlinestatic

Inflates either zlib or gzip deflated memory.

The inflated memory is expected to be freed by the caller.

It will allocate 256k for the destination buffer. If it is not enough it will multiply the previous buffer size per 2, until there is enough memory.

Returns
the length of the deflated buffer
Since
v0.8.1
var ccInflateMemory ( var  in,
var  inLength,
var  out 
)
inlinestatic

Inflates either zlib or gzip deflated memory.

The inflated memory is expected to be freed by the caller.

It will allocate 256k for the destination buffer. If it is not enough it will multiply the previous buffer size per 2, until there is enough memory.

Returns
the length of the deflated buffer
Since
v0.8.1
local ccInflateMemory ( local  in,
local  inLength,
local  out 
)
inlinestatic

Inflates either zlib or gzip deflated memory.

The inflated memory is expected to be freed by the caller.

It will allocate 256k for the destination buffer. If it is not enough it will multiply the previous buffer size per 2, until there is enough memory.

Returns
the length of the deflated buffer
Since
v0.8.1
static CC_DEPRECATED_ATTRIBUTE
int ccInflateMemoryWithHint
( unsigned char *  in,
long  inLength,
unsigned char **  out,
long  outLengthHint 
)
inlinestatic

Inflates either zlib or gzip deflated memory.

The inflated memory is expected to be freed by the caller.

outLenghtHint is assumed to be the needed room to allocate the inflated buffer.

Returns
the length of the deflated buffer
Since
v1.0.0
var ccInflateMemoryWithHint ( var  in,
var  inLength,
var  out,
var  outLengthHint 
)
inlinestatic

Inflates either zlib or gzip deflated memory.

The inflated memory is expected to be freed by the caller.

outLenghtHint is assumed to be the needed room to allocate the inflated buffer.

Returns
the length of the deflated buffer
Since
v1.0.0
local ccInflateMemoryWithHint ( local  in,
local  inLength,
local  out,
local  outLengthHint 
)
inlinestatic

Inflates either zlib or gzip deflated memory.

The inflated memory is expected to be freed by the caller.

outLenghtHint is assumed to be the needed room to allocate the inflated buffer.

Returns
the length of the deflated buffer
Since
v1.0.0
static CC_DEPRECATED_ATTRIBUTE
bool ccIsCCZBuffer
( const unsigned char *  buffer,
long  len 
)
inlinestatic

test the buffer is CCZ format or not

Returns
true is CCZ format. false is not
Since
v3.0
var ccIsCCZBuffer ( var  buffer,
var  len 
)
inlinestatic

test the buffer is CCZ format or not

Returns
true is CCZ format. false is not
Since
v3.0
local ccIsCCZBuffer ( local  buffer,
local  len 
)
inlinestatic

test the buffer is CCZ format or not

Returns
true is CCZ format. false is not
Since
v3.0
static CC_DEPRECATED_ATTRIBUTE
bool ccIsCCZFile
( const char *  filename)
inlinestatic

test a file is a CCZ format file or not

Returns
true is a CCZ format file. false is not
Since
v3.0
var ccIsCCZFile ( var  filename)
inlinestatic

test a file is a CCZ format file or not

Returns
true is a CCZ format file. false is not
Since
v3.0
local ccIsCCZFile ( local  filename)
inlinestatic

test a file is a CCZ format file or not

Returns
true is a CCZ format file. false is not
Since
v3.0
static CC_DEPRECATED_ATTRIBUTE
bool ccIsGZipBuffer
( const unsigned char *  buffer,
long  len 
)
inlinestatic

test the buffer is GZip format or not

Returns
true is GZip format. false is not
Since
v3.0
var ccIsGZipBuffer ( var  buffer,
var  len 
)
inlinestatic

test the buffer is GZip format or not

Returns
true is GZip format. false is not
Since
v3.0
local ccIsGZipBuffer ( local  buffer,
local  len 
)
inlinestatic

test the buffer is GZip format or not

Returns
true is GZip format. false is not
Since
v3.0
static CC_DEPRECATED_ATTRIBUTE
bool ccIsGZipFile
( const char *  filename)
inlinestatic

test a file is a GZip format file or not

Returns
true is a GZip format file. false is not
Since
v3.0
var ccIsGZipFile ( var  filename)
inlinestatic

test a file is a GZip format file or not

Returns
true is a GZip format file. false is not
Since
v3.0
local ccIsGZipFile ( local  filename)
inlinestatic

test a file is a GZip format file or not

Returns
true is a GZip format file. false is not
Since
v3.0
static CC_DEPRECATED_ATTRIBUTE
void ccSetPvrEncryptionKey
( unsigned int  keyPart1,
unsigned int  keyPart2,
unsigned int  keyPart3,
unsigned int  keyPart4 
)
inlinestatic

Sets the pvr.ccz encryption key.

Example: If the key used to encrypt the pvr.ccz file is 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function with the key split into 4 parts as follows

ZipUtils::setPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd);

Note that using this function makes it easier to reverse engineer and discover the complete key because the key parts are present in one function call.

IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters
keyPart1the key value part 1.
keyPart2the key value part 2.
keyPart3the key value part 3.
keyPart4the key value part 4.
var ccSetPvrEncryptionKey ( var  keyPart1,
var  keyPart2,
var  keyPart3,
var  keyPart4 
)
inlinestatic

Sets the pvr.ccz encryption key.

Example: If the key used to encrypt the pvr.ccz file is 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function with the key split into 4 parts as follows

ZipUtils::setPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd);

Note that using this function makes it easier to reverse engineer and discover the complete key because the key parts are present in one function call.

IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters
keyPart1the key value part 1.
keyPart2the key value part 2.
keyPart3the key value part 3.
keyPart4the key value part 4.
local ccSetPvrEncryptionKey ( local  keyPart1,
local  keyPart2,
local  keyPart3,
local  keyPart4 
)
inlinestatic

Sets the pvr.ccz encryption key.

Example: If the key used to encrypt the pvr.ccz file is 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function with the key split into 4 parts as follows

ZipUtils::setPvrEncryptionKey(0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd);

Note that using this function makes it easier to reverse engineer and discover the complete key because the key parts are present in one function call.

IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters
keyPart1the key value part 1.
keyPart2the key value part 2.
keyPart3the key value part 3.
keyPart4the key value part 4.
static CC_DEPRECATED_ATTRIBUTE
void ccSetPvrEncryptionKeyPart
( int  index,
unsigned int  value 
)
inlinestatic

Sets the pvr.ccz encryption key parts separately for added security.

Example: If the key used to encrypt the pvr.ccz file is 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function 4 different times, preferably from 4 different source files, as follows

ZipUtils::setPvrEncryptionKeyPart(0, 0xaaaaaaaa); ZipUtils::setPvrEncryptionKeyPart(1, 0xbbbbbbbb); ZipUtils::setPvrEncryptionKeyPart(2, 0xcccccccc); ZipUtils::setPvrEncryptionKeyPart(3, 0xdddddddd);

Splitting the key into 4 parts and calling the function from 4 different source files increases the difficulty to reverse engineer the encryption key. Be aware that encrpytion is never 100% secure and the key code can be cracked by knowledgable persons.

IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters
indexpart of the key [0..3]
valuevalue of the key part
var ccSetPvrEncryptionKeyPart ( var  index,
var  value 
)
inlinestatic

Sets the pvr.ccz encryption key parts separately for added security.

Example: If the key used to encrypt the pvr.ccz file is 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function 4 different times, preferably from 4 different source files, as follows

ZipUtils::setPvrEncryptionKeyPart(0, 0xaaaaaaaa); ZipUtils::setPvrEncryptionKeyPart(1, 0xbbbbbbbb); ZipUtils::setPvrEncryptionKeyPart(2, 0xcccccccc); ZipUtils::setPvrEncryptionKeyPart(3, 0xdddddddd);

Splitting the key into 4 parts and calling the function from 4 different source files increases the difficulty to reverse engineer the encryption key. Be aware that encrpytion is never 100% secure and the key code can be cracked by knowledgable persons.

IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters
indexpart of the key [0..3]
valuevalue of the key part
local ccSetPvrEncryptionKeyPart ( local  index,
local  value 
)
inlinestatic

Sets the pvr.ccz encryption key parts separately for added security.

Example: If the key used to encrypt the pvr.ccz file is 0xaaaaaaaabbbbbbbbccccccccdddddddd you will call this function 4 different times, preferably from 4 different source files, as follows

ZipUtils::setPvrEncryptionKeyPart(0, 0xaaaaaaaa); ZipUtils::setPvrEncryptionKeyPart(1, 0xbbbbbbbb); ZipUtils::setPvrEncryptionKeyPart(2, 0xcccccccc); ZipUtils::setPvrEncryptionKeyPart(3, 0xdddddddd);

Splitting the key into 4 parts and calling the function from 4 different source files increases the difficulty to reverse engineer the encryption key. Be aware that encrpytion is never 100% secure and the key code can be cracked by knowledgable persons.

IMPORTANT: Be sure to call setPvrEncryptionKey or setPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters
indexpart of the key [0..3]
valuevalue of the key part
static int inflateCCZBuffer ( const unsigned char *  buffer,
long  len,
unsigned char **  out 
)
static
var inflateCCZBuffer ( var  buffer,
var  len,
var  out 
)
static
local inflateCCZBuffer ( local  buffer,
local  len,
local  out 
)
static
static int inflateCCZFile ( const char *  filename,
unsigned char **  out 
)
static
var inflateCCZFile ( var  filename,
var  out 
)
static
local inflateCCZFile ( local  filename,
local  out 
)
static
static int inflateGZipFile ( const char *  filename,
unsigned char **  out 
)
static
var inflateGZipFile ( var  filename,
var  out 
)
static
local inflateGZipFile ( local  filename,
local  out 
)
static
static int inflateMemory ( unsigned char *  in,
long  inLength,
unsigned char **  out 
)
static
var inflateMemory ( var  in,
var  inLength,
var  out 
)
static
local inflateMemory ( local  in,
local  inLength,
local  out 
)
static
static int inflateMemoryWithHint ( unsigned char *  in,
long  inLength,
unsigned char **  out,
long  outLengthHint 
)
static
var inflateMemoryWithHint ( var  in,
var  inLength,
var  out,
var  outLengthHint 
)
static
local inflateMemoryWithHint ( local  in,
local  inLength,
local  out,
local  outLengthHint 
)
static
static bool isCCZBuffer ( const unsigned char *  buffer,
long  len 
)
static
var isCCZBuffer ( var  buffer,
var  len 
)
static
local isCCZBuffer ( local  buffer,
local  len 
)
static
static bool isCCZFile ( const char *  filename)
static
var isCCZFile ( var  filename)
static
local isCCZFile ( local  filename)
static
static bool isGZipBuffer ( const unsigned char *  buffer,
long  len 
)
static
var isGZipBuffer ( var  buffer,
var  len 
)
static
local isGZipBuffer ( local  buffer,
local  len 
)
static
static bool isGZipFile ( const char *  filename)
static
var isGZipFile ( var  filename)
static
local isGZipFile ( local  filename)
static
static void setPvrEncryptionKey ( unsigned int  keyPart1,
unsigned int  keyPart2,
unsigned int  keyPart3,
unsigned int  keyPart4 
)
static
var setPvrEncryptionKey ( var  keyPart1,
var  keyPart2,
var  keyPart3,
var  keyPart4 
)
static
local setPvrEncryptionKey ( local  keyPart1,
local  keyPart2,
local  keyPart3,
local  keyPart4 
)
static
static void setPvrEncryptionKeyPart ( int  index,
unsigned int  value 
)
static
var setPvrEncryptionKeyPart ( var  index,
var  value 
)
static
local setPvrEncryptionKeyPart ( local  index,
local  value 
)
static

The documentation for this class was generated from the following file: