add support for double precision and 64bit serialization (and compatibility between all versions)

fix some issue in serialization of nested array data
add some tesing files
This commit is contained in:
erwin.coumans
2010-01-25 19:42:51 +00:00
parent 5d8e6dc3f3
commit e7ff71d99b
48 changed files with 1207 additions and 294 deletions

View File

@@ -20,11 +20,13 @@ subject to the following restrictions:
// 32 && 64 bit versions
//#ifdef _WIN64
extern unsigned char sBulletDNAstr64[];
extern int sBulletDNAlen64;
//#else
extern unsigned char sBulletDNAstr[];
extern int sBulletDNAlen;
//not yetto. extern unsigned char DNAstr64[];
//not yetto. extern int DNAlen64;
//#endif //_WIN64
using namespace bParse;
@@ -33,7 +35,13 @@ btBulletFile::btBulletFile()
:bFile("", "BULLET ")
{
mMemoryDNA = new bDNA();
mMemoryDNA->init((char*)sBulletDNAstr,sBulletDNAlen);
//#ifdef _WIN64
if (VOID_IS_8)
mMemoryDNA->init((char*)sBulletDNAstr64,sBulletDNAlen64);
else
//#else
mMemoryDNA->init((char*)sBulletDNAstr,sBulletDNAlen);
//#endif
}
@@ -128,6 +136,9 @@ void btBulletFile::parseData()
// {
// m_glob = (bStructHandle*) id;
// }
} else
{
printf("unknown chunk\n");
}
// next please!
@@ -158,17 +169,25 @@ void btBulletFile::writeDNA(FILE* fp)
if (VOID_IS_8)
{
//dataChunk.len = DNAlen64;
//dataChunk.oldPtr = DNAstr64;
//fwrite(&dataChunk,sizeof(bChunkInd),1,fp);
//fwrite(DNAstr64, DNAlen64,1,fp);
//#ifdef _WIN64
dataChunk.len = sBulletDNAlen64;
dataChunk.oldPtr = sBulletDNAstr64;
fwrite(&dataChunk,sizeof(bChunkInd),1,fp);
fwrite(sBulletDNAstr64, sBulletDNAlen64,1,fp);
//#else
// btAssert(0);
//#endif
}
else
{
//#ifndef _WIN64
dataChunk.len = sBulletDNAlen;
dataChunk.oldPtr = sBulletDNAstr;
fwrite(&dataChunk,sizeof(bChunkInd),1,fp);
fwrite(sBulletDNAstr, sBulletDNAlen,1,fp);
//#else
// btAssert(0);
//#endif
}
}
@@ -177,12 +196,19 @@ void btBulletFile::parse(bool verboseDumpAllTypes)
{
if (VOID_IS_8)
{
exit(0);
//parseInternal(verboseDumpAllTypes,(char*)DNAstr64,DNAlen64);
//#ifdef _WIN64
parseInternal(verboseDumpAllTypes,(char*)sBulletDNAstr64,sBulletDNAlen64);
//#else
// btAssert(0);
//#endif
}
else
{
//#ifndef _WIN64
parseInternal(verboseDumpAllTypes,(char*)sBulletDNAstr,sBulletDNAlen);
//#else
// btAssert(0);
//#endif
}
}