开源真好,能够让我们广达开发者参与到cocos2d-x开发中来,不断的完善cocos2d-x。
今天做了一个解压工具类,用到了external/unzip里:
int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, int* level, int raw, const char* password)
{
int err=UNZ_OK;
uInt iSizeVar;
unz64_s* s;
file_in_zip64_read_info_s* pfile_in_zip_read_info;
ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
uInt size_local_extrafield; /* size of the local extra field */
# ifndef NOUNCRYPT
char source;
# else
if (password != NULL)
return UNZ_PARAMERROR;
# endif
...下面省略...
}
```
我看到要想使用解压加密压缩包,就得注释掉 #define NOUNCRYPT, 不然,上面的函数永远返回 UNZ_PARAMERROR 这个错误,于是我注释了NOUNCRYPT, 但是编译后下面这行报错了
#ifndef NOUNCRYPT
#include "crypt.h" //头文件找不到
#endif
我在 http://www.codeforge.cn/read/179227/crypt.h__html
下载了这个头文件并导入到cocos2d_libs里来, 模拟器里再编译就通过了,也成功解压了,但是我每尝试过真机里是否也能用,希望官方能在框架里完善下这块,方便大家使用。