Load resources form android expansion file problem

Load resources form android expansion file problem
0.0 0


Hi, I have android expansion file that include images, xml file, sounds…
I access it with CCFileUtils like this way

CCFileUtils fileUtils;
unsigned long fileSize = 0;
unsigned char
pData = fileUtils->getFileDataFromZip(obbPath.c_str(), filePath.c_str(), &fileSize);

but I guess pData is almost correct but has some data loss …
how to fix it? and how to get images from obb file and make it sprite?

I use cocos2dx 2.0.2

thanks in advance.


this is an example of CCFileUtils usage.

string fullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("sample.zip"); unsigned long pSize; unsigned char * pData = 0; pData = CCFileUtils::sharedFileUtils()->getFileDataFromZip(fullPath.c_str(), "sample1.png", &pSize); CCImage* img = new CCImage(); img->initWithImageData(pData, pSize); CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addUIImage(img, "key_name"); CCSprite* sprite = CCSprite::spriteWithTexture(texture);