From 98bed842b20623a197c370852dfd6e897a132f45 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 24 Dec 2024 01:47:37 +0100 Subject: [PATCH] Simplify arig and aseq buffer base calculation 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 5771b7ce3a39305f4426b4121f969633b84d4c5c --- src/assets/model.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/assets/model.cpp b/src/assets/model.cpp index cfd8fb7..b17b57b 100644 --- a/src/assets/model.cpp +++ b/src/assets/model.cpp @@ -114,7 +114,6 @@ static void Model_AllocateIntermediateDataChunk(CPakFileBuilder* const pak, PakP if (hasGuidRefs) { asset.ExpandGuidBuf(animrigCount + sequenceCount); - uint64_t curIndex = 0; if (animrigRefs) { @@ -132,13 +131,12 @@ static void Model_AllocateIntermediateDataChunk(CPakFileBuilder* const pak, PakP const PakGuid_t guid = *reinterpret_cast(&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;