Skip to content

Commit 1983a2a

Browse files
committed
[IMPORTANT] Fixed heap corruption by adding int32_t to IFP_ANIM struct and fixed IFP_Animation struct.
1 parent 25e3a3e commit 1983a2a

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

Client/mods/deathmatch/logic/IFP/IFPLoader.h

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ struct IFP_ANIM
5252
int32_t Unk;
5353
int32_t Next;
5454
int32_t Previous;
55+
56+
// According to https://www.gtamodding.com/wiki/IFP, Unk2 should not exist, but for some reason, it's there
57+
// I don't know why. Let's just go with the flow and ignore it. The value "seems" to be always zero.
58+
int32_t Unk2;
5559
};
5660

5761
struct IFP_KFRM
@@ -128,13 +132,11 @@ struct IFPHeaderV2
128132
int32_t TotalAnimations;
129133
};
130134

131-
struct IFP : FileLoader
132-
{
133-
bool isVersion1;
134-
IFPHeaderV2 HeaderV2;
135-
std::vector <_CAnimBlendHierarchy> AnimationHierarchies;
136-
std::vector <_CAnimBlendSequence> AnimationSequences;
137-
unsigned char * KeyFramesArray;
135+
struct IFP_Animation
136+
{
137+
_CAnimBlendHierarchy Hierarchy;
138+
//std::vector <_CAnimBlendSequence> Sequences;
139+
char * pSequencesMemory;
138140
};
139141

140142
struct Animation
@@ -205,16 +207,6 @@ typedef void *(__cdecl* hCMemoryMgr_Malloc)
205207
);
206208

207209

208-
void LoadIFPFile(const char * FilePath);
209-
void ReadIFPVersion1();
210-
void ReadIFPVersion2( bool anp3);
211-
212-
void insertAnimDummySequence(bool anp3, _CAnimBlendHierarchy * pAnimHierarchy, size_t SequenceIndex);
213-
int32_t getBoneIDFromName(std::string const& BoneName);
214-
std::string getCorrectBoneNameFromName(std::string const& BoneName);
215-
std::string getCorrectBoneNameFromID(int32_t & BoneID);
216-
size_t getCorrectBoneIndexFromID(int32_t & BoneID);
217-
218210
void _CAnimBlendHierarchy_Constructor(_CAnimBlendHierarchy * pAnimHierarchy);
219211
void _CAnimBlendSequence_Constructor(_CAnimBlendSequence * pSequence);
220212

0 commit comments

Comments
 (0)