mirror of https://github.com/AxioDL/metaforce.git
ANIM serialization fix
This commit is contained in:
parent
48c285be11
commit
055de86170
|
@ -268,9 +268,9 @@ void WordBitmap::write(athena::io::IStreamWriter& writer) const
|
|||
for (atUint32 word : m_words)
|
||||
writer.writeUint32Big(word);
|
||||
}
|
||||
size_t WordBitmap::binarySize(size_t __isz) const
|
||||
void WordBitmap::binarySize(size_t& __isz) const
|
||||
{
|
||||
return __isz + m_words.size() * 4;
|
||||
__isz += m_words.size() * 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ public:
|
|||
void read(athena::io::IStreamReader& reader, size_t bitCount);
|
||||
void write(athena::io::IStreamWriter& writer) const;
|
||||
void reserve(size_t bitCount) { m_words.reserve((bitCount + 31) / 32); }
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void binarySize(size_t& __isz) const;
|
||||
size_t getBitCount() const {return m_bitCount;}
|
||||
bool getBit(size_t idx) const
|
||||
{
|
||||
|
|
|
@ -459,7 +459,6 @@ void ANIM::ANIM2::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
head.binarySize(scratchSize);
|
||||
keyBmp.binarySize(scratchSize);
|
||||
scratchSize += bsSize;
|
||||
head.scratchSize = scratchSize;
|
||||
if (m_version == 3)
|
||||
{
|
||||
for (const std::pair<atUint32, bool>& bone : bones)
|
||||
|
@ -468,7 +467,7 @@ void ANIM::ANIM2::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
desc.keyCount1 = keyframeCount;
|
||||
if (bone.second)
|
||||
desc.keyCount2 = keyframeCount;
|
||||
head.scratchSize = desc.binarySize(head.scratchSize);
|
||||
desc.binarySize(scratchSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -479,9 +478,10 @@ void ANIM::ANIM2::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
|
|||
desc.keyCount1 = keyframeCount;
|
||||
if (bone.second)
|
||||
desc.keyCount2 = keyframeCount;
|
||||
head.scratchSize = desc.binarySize(head.scratchSize);
|
||||
desc.binarySize(scratchSize);
|
||||
}
|
||||
}
|
||||
head.scratchSize = scratchSize;
|
||||
|
||||
head.write(writer);
|
||||
keyBmp.write(writer);
|
||||
|
|
|
@ -133,12 +133,11 @@ struct ANIM : BigDNA
|
|||
writer.writeUByte(qTZ);
|
||||
}
|
||||
}
|
||||
size_t binarySize(size_t __isz) const
|
||||
void binarySize(size_t& __isz) const
|
||||
{
|
||||
__isz += 17;
|
||||
if (keyCount2)
|
||||
__isz += 9;
|
||||
return __isz;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -185,12 +184,11 @@ struct ANIM : BigDNA
|
|||
writer.writeUint32Big(QinitTZ);
|
||||
}
|
||||
}
|
||||
size_t binarySize(size_t __isz) const
|
||||
void binarySize(size_t& __isz) const
|
||||
{
|
||||
__isz += 24;
|
||||
if (keyCount2)
|
||||
__isz += 12;
|
||||
return __isz;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -88,6 +88,7 @@ std::unique_ptr<u32[]> CFBStreamedCompression::GetRotationsAndOffsets(u32 words,
|
|||
u32 bsWords = ComputeBitstreamWords(chans);
|
||||
|
||||
u32* bsPtr = reinterpret_cast<u32*>(bs);
|
||||
size_t wordsz = bsPtr - ret.get();
|
||||
for (u32 w=0 ; w<bsWords ; ++w)
|
||||
bsPtr[w] = in.readUint32Big();
|
||||
|
||||
|
|
Loading…
Reference in New Issue