multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.41k stars 438 forks source link

Loading peds with complex bones crashes the client #1769

Open Timic3 opened 4 years ago

Timic3 commented 4 years ago

Describe the bug

When you try to load peds with complex bones (cutscene peds), the client crashes.

To reproduce

  1. Load the DFF
  2. Import/replace the DFF
  3. Crash

Here's an example resource: bone-crash.zip

Note that it crashes when DFF is replaced, TXD has nothing to do with the crash in this case.

Expected behaviour

Not crash.

Screenshots

None.

Version

1.5.8, commit ed2abb3.

Additional context

I tried adding more bones into https://github.com/multitheftauto/mtasa-blue/blob/b2b7ef9f6484962dd981c9ea341e7f03e5b41934/Client/sdk/game/CPed.h#L46 but that didn't help (cutscene peds have more bones, some IDs above 5000). I got exception Exception thrown at 0x004D2C3A in gta_sa.exe: 0xC0000005: Access violation reading location 0x3DF63CBD.

Bones I added ```cpp enum eBone { BONE_ROOT = 0, BONE_PELVIS1, BONE_PELVIS, BONE_SPINE1, BONE_UPPERTORSO, BONE_NECK, BONE_HEAD2, BONE_HEAD1, BONE_HEAD, BONE_RIGHTUPPERTORSO = 21, BONE_RIGHTSHOULDER, BONE_RIGHTELBOW, BONE_RIGHTWRIST, BONE_RIGHTHAND, BONE_RIGHTTHUMB, BONE_RIGHTTHUMB1 = 28, BONE_RIGHTTHUMB2 = 29, BONE_LLIP11 = 30, BONE_LEFTUPPERTORSO = 31, BONE_LEFTSHOULDER, BONE_LEFTELBOW, BONE_LEFTWRIST, BONE_LEFTHAND, BONE_LEFTTHUMB, BONE_LEFTTHUMB1 = 38, BONE_LEFTTHUMB2 = 39, BONE_JAW22 = 40, BONE_LEFTHIP = 41, BONE_LEFTKNEE, BONE_LEFTANKLE, BONE_LEFTFOOT, BONE_RIGHTHIP = 51, BONE_RIGHTKNEE, BONE_RIGHTANKLE, BONE_RIGHTFOOT, BONE_BELLY = 201, BONE_RIGHTBREAST = 301, BONE_LEFTBREAST = 302, BONE_RBROW1 = 5001, BONE_RBROW2 = 5002, BONE_LBROW2 = 5003, BONE_LBROW1 = 5004, BONE_RLID = 5005, BONE_LLID = 5006, BONE_RTLIP3 = 5007, BONE_LTLIP3 = 5008, BONE_RTLIP1 = 5009, BONE_RTLIP2 = 5010, BONE_LTLIP1 = 5011, BONE_LTLIP2 = 5012, BONE_RCORNER = 5013, BONE_LCORNER = 5014, BONE_JAW1 = 5015, BONE_JAW2 = 5016, BONE_LLIP1 = 5017, BONE_REYE = 5018, BONE_LEYE = 5019, BONE_RCHEEK = 5020, BONE_LCHEEK = 5021 }; ```
MegadreamsBE commented 4 years ago

In my case using cutscene peds such as csstew and cstenpenny I don't get the crash upon loading them in but when I try to rotate their bones using the new bone functions.