initialize some uninitialized things#37
Open
briaguya0 wants to merge 4 commits into
Open
Conversation
totalVtxCount had no default value, so limbs that don't go through ParseRawData (non-SkinType_Animated limbs) would export uninitialized data as skinVtxCnt into the OTR file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dlist is only set in ParseRawData, which is only called for SkinType_Animated limbs. For all other limb types it is uninitialized. OTRExporter unconditionally checks segmentStruct.dlist != SEGMENTED_NULL and passes it through GETSEGOFFSET into GetDeclaration. If the garbage value's offset happened to match a key in the declarations map, it would write that declaration's path as skinDList2 into the OTR file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SkinAnimatedLimbData::totalVtxCount to 0SkinAnimatedLimbData::totalVtxCount to 0 and dlist to SEGMENTED_NULL
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SkinAnimatedLimbData::totalVtxCount to 0 and dlist to SEGMENTED_NULLThese fields are only assigned in ParseRawData when isSubStruct is false (multi-bg entries). For single-bg rooms (isSubStruct=true), they are left uninitialized but still written by the OTRExporter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Initialize
SkinAnimatedLimbData::totalVtxCountto0anddlisttoSEGMENTED_NULLtotalVtxCountanddlisthad no default values, so limbs that don't go throughParseRawData(non-SkinType_Animatedlimbs) would export uninitialized data into the OTR file.the only flow where we get intentional data for these is
ZAPDTR/ZAPD/ZLimb.cpp
Line 114 in 74a8e9d
in
ZAPDTR/ZAPD/ZLimb.cpp
Lines 105 to 117 in 74a8e9d
the rest of
ZAPDTR/ZAPD/ZLimb.cpp
Line 61 in 74a8e9d
leaves them uninitialized.
totalVtxCountis written unconditionally and read back asskinVtxCnt.this means we read garbage in
OTRExporter_SkeletonLimb::Savedlist(also inOTRExporter_SkeletonLimb::Save) is checked againstSEGMENTED_NULLand passed throughGETSEGOFFSETintoGetDeclaration.If the garbage value's offset happened to match a key in the declarations map, it would write that declaration's path as
skinDList2into the OTR file.Others
they weren't getting initialized so they had garbage
Initialize
SetMesh::datato0Initialize
RoomShapeImageMultiBgEntry::unk_00andidto0