Class ZipUtils

#include <Geode/cocos/support/zip_support/ZipUtils.h>
classZipUtils{ ... }
No description provided
Examples0
Public static methods19
staticintccInflateMemory(,
uintinLength
,)

Since v0.8.1

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.

Return value
the length of the deflated buffer
staticintccInflateMemoryWithHint(,
uintinLength
,,
uintoutLenghtHint
)

Since v1.0.0

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.

Return value
the length of the deflated buffer
staticintccInflateGZipFile(
charconst*filename
,)

Since v0.99.5

inflates a GZip file into memory

Return value
the length of the deflated buffer
staticintccInflateCCZFile(
charconst*filename
,)

Since v0.99.5

inflates a CCZ file into memory

Return value
the length of the deflated buffer
staticvoidccSetPvrEncryptionKeyPart(
intindex
,
uintvalue
)

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::ccSetPvrEncryptionKeyPart(0, 0xaaaaaaaa); ZipUtils::ccSetPvrEncryptionKeyPart(1, 0xbbbbbbbb); ZipUtils::ccSetPvrEncryptionKeyPart(2, 0xcccccccc); ZipUtils::ccSetPvrEncryptionKeyPart(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 ccSetPvrEncryptionKey or ccSetPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters

index

part of the key [0..3]

value

value of the key part
staticvoidccSetPvrEncryptionKey(
uintkeyPart1
,
uintkeyPart2
,
uintkeyPart3
,
uintkeyPart4
)

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::ccSetPvrEncryptionKey(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 ccSetPvrEncryptionKey or ccSetPvrEncryptionKeyPart with all of the key parts before loading the spritesheet or decryption will fail and the spritesheet will fail to load.

Parameters

keyPart1

the key value part 1.

keyPart2

the key value part 2.

keyPart3

the key value part 3.

keyPart4

the key value part 4.
staticgd::stringbase64DecodeEnc(,)
No description provided
staticgd::stringbase64EncodeEnc(,)
No description provided
staticgd::stringbase64URLDecode()
No description provided
staticgd::stringbase64URLEncode()
No description provided
staticintccDeflateMemory(
uchar*data
,
uintsize
,)
No description provided
staticintccDeflateMemoryWithHint(,,,)
No description provided
staticgd::stringcompressString(,
boolencrypt
,
intencryptionKey
)
No description provided
staticgd::stringdecompressString(,
boolencrypt
,
intencryptionKey
)
No description provided
staticgd::stringdecompressString2(
uchar*data
,
boolencrypt
,
intsize
,
intencryptionKey
)
No description provided
staticgd::stringencryptDecrypt(,
intencryptionKey
)
No description provided
staticgd::stringencryptDecryptWKey(,)
No description provided
staticucharhexToChar()
No description provided
staticgd::stringurlDecode()
No description provided
Public member functions0
Fields0
Protected member functions0
Protected fields0