Skip to content

Commit

Permalink
Simplify arig and aseq buffer base calculation
Browse files Browse the repository at this point in the history
Just use the size of the arig guid ref buffer to determine the base of the aseq guid ref buffer. This simplification reduces the chances of bugs like 5771b7c
  • Loading branch information
Mauler125 committed Dec 24, 2024
1 parent 5771b7c commit 98bed84
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/assets/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ static void Model_AllocateIntermediateDataChunk(CPakFileBuilder* const pak, PakP
if (hasGuidRefs)
{
asset.ExpandGuidBuf(animrigCount + sequenceCount);
uint64_t curIndex = 0;

if (animrigRefs)
{
Expand All @@ -132,13 +131,12 @@ static void Model_AllocateIntermediateDataChunk(CPakFileBuilder* const pak, PakP
const PakGuid_t guid = *reinterpret_cast<PakGuid_t*>(&intermediateChunk.data[offset]);

Pak_RegisterGuidRefAtOffset(guid, offset, intermediateChunk, asset);
curIndex++;
}
}

if (sequenceRefs)
{
const size_t base = alignedNameBufLen + (curIndex * sizeof(PakGuid_t));
const size_t base = alignedNameBufLen + animRigRefsBufLen;

memcpy(&intermediateChunk.data[base], sequenceRefs, sequenceRefsBufLen);
delete[] sequenceRefs;
Expand Down

0 comments on commit 98bed84

Please sign in to comment.