Question

Using Texture Packer, I am placing my iPhone5 background images in a pvr.ccz file and saving the output files in the Resources folder of my cocos2d project. When I attempt to load the pvr.ccz file, I get the following series of errors:

cocos2d: Filename(StoreMenuBackground_iPhone5-hd.pvr.ccz) contains -hd suffix.
cocos2d: CCFileUtils: Warning HD file not found: StoreMenuBackground_iPhone5-hd.pvr.ccz
cocos2d: Error loading CCZ compressed file

and then the code crashes with EXC_BAD_ACCESS in a method called ccInflateCCZFile (in the cocos2D file ZipUtils.m). My line of code that I am executing is:

backgroundBgNode = [CCSpriteBatchNode batchNodeWithFile:@"StoreMenuBackground_iPhone5-hd.pvr.ccz"];

Now the strange thing is that if I recreate the pvr.ccz file in Texture Packer without the -hd extension on either the pvr.ccz or the background png image that I am trying to load, and then place the resultant output files in the Resources folder and rerun the code, then no error is detected. If I then delete this pvr.ccz and associated .plist file (the one without the -hd extension) from the Resources folder, everything is fine. Being skeptical, I then did a Clean and a new Build, and it is still working.

Why am I getting this error to start with? And why does it go away when I do the steps outlined above. Can I trust that the end result is valid?

I am using Cocos2d V1.0. I have tried this on multiple background images, and they all behave the same. I also do not have this problem for iPad or iPad-hd.

Was it helpful?

Solution

Because cocos2d searches for the -hd suffixed files automatically on Retina devices. You're not supposed to use filenames using any of the -hd/-ipad#/-ipadhd/-wide/-widehd suffixes directly.

You can tweak the suffix mappings with CCFileUtils, though that's very limited in cocos2d-iphone v1.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top