Forum > C++ > pvr.ccz files

pvr.ccz files

By dakiki Posted 2011-07-25 05:57 Comments 13
dakiki
  • Posts: 41

Hi,

do you plan to support ccz compressed pvr files?

Another question (I didn’t check the code to be sure), do you fully support pvr files like cocos2d-iphone does? (I mean by ‘fully support’, iOS optimized pixelFormats and direct PVR texture loading)

Thanks,
Chris

walzer
  • Posts: 1735
  • Location: Xiamen, China

#1 RE: 2011-07-25 06:13

Yeah, feature #536.
It has been implemented just one week ago, and will be published in the next version.
If you can’t wait for this, please checkout the lastest source from github. Any feedback is appreciated!

Less is More. Keep Focus.

dakiki
  • Posts: 41

#2 RE: 2011-07-25 07:47

Thanks, I will from now on, use the git repository instead of current “stable” release, it will be easier to communicate bugs (and to post patches).

dakiki
  • Posts: 41

#3 RE: 2011-07-25 09:09

Ok, pvr files are loading correctly using latest repository, but ccz is not supported (ZipUtils::ccInflateCCZFile not implemented).
I’ll take a look at that.

dakiki
  • Posts: 41

#4 RE: 2011-07-25 12:45

I’ve make a patch to support CCZ compressed files, but I’m having trouble with it on iOS, as well as another issue with current git revision (not compiling).

I’ll try to fix this, but if I cannot before going to bed, I’ll post my patch and let you include and complete it :D

dakiki
  • Posts: 41

#5 RE: 2011-07-25 14:23

Patch attached, I let you change the files if it doesn’t match the way you want it to be.

Things I did:

  • Created a CCCoreFoundation.h file to define types and functions from CoreFoundation
  • Created platform dependant CCCoreFoundation.cpp files (currently only win32 and iOS, since I can only test those right now), with needed fonction from CoreFoundation, used by ZipUtils::ccInflateCCZFile
  • Implemented missing win32 CCFileUtils::ccLoadFileIntoMemory function
  • Added CCCoreFoundation.cpp file to win32 vcproj file
  • Uncommented ZipUtils::ccInflateCCZFile function
  • Added a missing "return ~~1" in ZipUtils::ccInflateCCZFile function Things to do: ~~ Modify templates to include the new files I added
  • Add new platform files for airplay, android and woPhone
  • Test it on airplay, android and woPhone (Attached are: a modified HelloWorldScene.cpp and HelloWorldScene.h to load pvr.ccz file, as well as pvr.ccz and plist files)

patch-ccz.patch - git Patch file (12.2 kB)

pvr.ccz_win32_test.zip - files to test the patch (23.2 kB)

walzer
  • Posts: 1735
  • Location: Xiamen, China

#6 RE: 2011-07-25 22:42

Mark. After upgrade to Lion, the Parallels virtual machine cannot work correctly. I had to fix this before apply your patch. :(

Less is More. Keep Focus.

dakiki
  • Posts: 41

#7 RE: 2011-07-27 12:24

My patch should be updated to use the nice macro Jirka Fajfr did in his CCTexturePVR.cpp file.

In the win32 (and possibly other OS except for iOS that has native CF functions) “CCByteOrderGetCurrent” function, we should probably use the following define to detect the host endian:
#define CC_HOST_IS_BIG_ENDIAN (*(unsigned short *)“” < 0x100)

dakiki
  • Posts: 41

#8 RE: 2011-07-27 12:29

Oh and I forgot to mention that the “CCSwapInt32LittleToHost” function from CCTexturePVR.cpp file should be moved to the CCCoreFoundation.cpp files I created.

walzer
  • Posts: 1735
  • Location: Xiamen, China

#9 RE: 2011-07-27 20:12

Many thanks! Feature #638 created.
Currently I am on business trip to ShangHai ChinaJoy, I will merge it in next week when I am back.

Less is More. Keep Focus.

dakiki
  • Posts: 41

#10 RE: 2011-07-28 07:11

In my patch, I forgot to #include CCCoreFoundation.h in cocos2d.h
Please don’t forget it :)

walzer
  • Posts: 1735
  • Location: Xiamen, China

#11 RE: 2011-08-11 00:34

Sorry, Chris, I failed on apply your patch, no matter I use git am or git apply.
Can you please pull a request on github?

Less is More. Keep Focus.

walzer
  • Posts: 1735
  • Location: Xiamen, China

#12 RE: 2011-08-15 21:09

ohyeah, I finish it now. https://github.com/walzer/cocos2d-x/commit/069bbbf3308ab4ad2b0c0fac463c26bd80667930
CCSwapIntXxxxToHost is written to macros, and put into cocos2dx/include/ccMarcos.h, (I’m so lazy to add a new file, aha)
It works well on both iOS & Android, and I run instrument tool, without any mem leak detected.
Thanks Chris Calm’s contribution!

Less is More. Keep Focus.

dakiki
  • Posts: 41

#13 RE: 2011-08-16 02:49

Sorry, I was in away on vacation :)
Good to know it’s working fine!

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps