Cocos2DXNA / cocos2d-xna

XNA Port of Cocos2d-X
www.cocos2dxna.com
227 stars 123 forks source link

PlistDocument does not support double precision real values in binary format #416

Closed doubleday closed 10 years ago

doubleday commented 10 years ago

Tried to open a new pull request for this but failed miserably because i already have one for the same file.

Whatever here's my commit: https://github.com/wooga/cocos2d-xna/commit/b8c7e34f1e690cdb3e6825f22070a550b4de339c

Problem is that PlistDocument tries to parse floats even when real values are encoded as 8 byte double precision values.

For the reference implementation check: http://opensource.apple.com/source/CF/CF-550/CFBinaryPList.c and search for kCFBinaryPlistMarkerReal.

I am actually not sure where the need for RegulateNullBytes in the C# code is coming from so I just can assume it makes sense. The C++ code from apple does not seem to produce something that would make this necessary. But maybe some third party libs ...

totallyeviljake commented 10 years ago

merged from your PR.

doubleday commented 10 years ago

BTW: I just saw that the code is derived from https://github.com/animetrics/PlistCS.

They actually always parse double precision.

Also: I came across this because I tried using a plist from particle designer which initially failed. After the patch it worked

doubleday commented 10 years ago

A cool :-) thanks