This is awesome, thanks!
I’ve managed to get it working in my game. However, I did have some trouble with the way the reader handles strings that are in the dictionary.
This was all using the win32 version of cocos2d.
Here’s the line that gets the file type:
const char * fileType = (((CCString**) )) -> toStdString).c_str;
This calls the function CCString::toStdString, which is defined like this:
This function returns a std::string which is a copy of the value of m_sString. Thus, this copy is made when the function is called on the CCString containing the fileType, and then the char** is accessed with c_str. However, when I first ran the reader, the value of fileType after the line was executed was an empty string (“”).
It seemed that what was happening was that the std::string returned by toStdString() was being destroyed immediately after this line was executed. This also destroyed the attached char* string. Why the value of fileType was “” rather than some random bit of memory I don’t know. Perhaps it’s my compiler settings.
Perhaps all of this is my compiler settings! But anyway, I got it working by changing the toStdString function to this:
This seems like it might be dangerous if the value returned anywhere in the engine is modified. But at least for my game it all seems fine.
Anyway, I hope that makes sense. Thanks again for the port! Now if only someone would port cocosbuilder itself so I don’t have to run it on a VMWare box