Fatal Error: "Out of range write" in bitStream.cc
by Nabarro · in Torque Game Engine · 12/19/2007 (8:58 pm) · 2 replies
Hello, everybody,
I came accross one fatal error when doing BitStream writing operation. I taced back and found the cause:
1> In bitStream.cc, Line 16: static U8 gPacketBuffer[MaxPacketDataSize];
So, the maximum stream size is MaxPacketDataSize(1500) bytes, that's 12000 bits.
2> But for my player data, because it has more than 100+ animations, it exceeds the maximum value. So, it will assert fatal error when doing packUpdate().
Do you have such problem, and how to solve it?
Thanks,
I came accross one fatal error when doing BitStream writing operation. I taced back and found the cause:
1> In bitStream.cc, Line 16: static U8 gPacketBuffer[MaxPacketDataSize];
So, the maximum stream size is MaxPacketDataSize(1500) bytes, that's 12000 bits.
2> But for my player data, because it has more than 100+ animations, it exceeds the maximum value. So, it will assert fatal error when doing packUpdate().
Do you have such problem, and how to solve it?
Thanks,
Associate David Montgomery-Blake
David MontgomeryBlake
Here is some of the information on the TGE changes. I do not know about the specifics as I did what the pack said...and it worked. Since you have so many animations, you will probably need to perform some more in-depth problem solving.
(from the Ragdoll pack documentation, edited by me):
And then...
And finally...
void TSShapeConstructor::packData(BitStream* stream) { Parent::packData(stream); stream->writeString(mShape); S32 count = 0; for (S32 b=0; b<MaxSequences; b++) if (mSequence[b]) count++; stream->writeInt(count,NumSequenceBits); for (S32 i=0; i<MaxSequences; i++) if (mSequence[i]) { if (TS_IS_RELATIVE_SEQUENCES) { const char *subtext = dStrrchr(mSequence[i],'/'); stream->writeString(subtext); } else { stream->writeString(mSequence[i]); } } } void TSShapeConstructor::unpackData(BitStream* stream) { char shapePath[90],pathedSeq[90]; Parent::unpackData(stream); mShape = stream->readSTString(); if (TS_IS_RELATIVE_SEQUENCES) { dsize_t strLen = (int)dStrlen(mShape); const char *subtext = dStrrchr(mShape,'/'); dsize_t endLen = (int)dStrlen(subtext); dsize_t pathLen = (strLen - endLen) ; dStrncpy(shapePath,mShape,pathLen); shapePath[pathLen] = '[[60c1da72daaa7]]'; } S32 i = 0, count = stream->readInt(NumSequenceBits); for (; i<count; i++) { mSequence[i] = stream->readSTString(); if (TS_IS_RELATIVE_SEQUENCES) { dSprintf(pathedSeq,90,"%s%s",shapePath,mSequence[i]); mSequence[i] = StringTable->insert(pathedSeq); } } while (i<MaxSequences) mSequence[i++] = NULL; }