multitheftauto/mtasa-blue

Custom CJ Clothes textures are extremely finicky

Opened this issue · 1 comments

Describe the bug

Adding new clothes is a pain right now. I have been encountering multiple issues that make this more complicated than they should. Mostly it's the fault of the texture file, which might end up crashing with offset 0x003ECABB (like in #4412) or it will crash without any warning.

Some examples of the current issues:

  • If the texture inside the TXD File is not RASTER_888 it might crash.
  • If the size is not 1:1 for torso and 1:2 legs it might not display or it might display combined with CJ's clothing, sometimes it might even crash without a crash window or dump. It seems to be random. For some reason this doesn't happen with any extras, the head or the feet, but it does happen mostly with legs and the torso. You can use the same texture files and models and they will work just fine
  • Also in some instances the game might crash if you change your lua script, particularly if you delete the part of the code in which you add the new clothes. No crash nor dump... and yes it is pretty strange, probably the memory is not being cleaned properly. Before the crash the game freezes and the mouse is basically unresponsive.

Just to make it extremely clear, the issues are mostly with the torso and legs, the shoes, head and extras seem to handle textures fine as long as they are ARGB, no matter the size.

Steps to reproduce

  • Use a TXD file that has textures compressed to DXT1 for your new allocated clothes.
  • Use a TXD file that has textures in ARGB but in RASTER_8888, they might not work.
  • Try to allocate new legs with a texture that has a size 256x256 or any 1:1, it will probably crash (if you get CJ's textures using engineGetModelTextures you will see that the texture is all stretched and zoomed in)
  • Use a texture thats 128x256 for the torso and you will see this:
Image Sometimes you might crash.

Version

No response

Additional context

I think I read that using TXD Workshop is better for changing these textures, which I haven't confirmed. I have been using Magic TXD for years now, and I have no issues with any models except the clothes sometimes.

Relevant log output

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.

I’ve also noticed the torso and legs being the most problematic when adding custom clothes.
For me, converting all textures to RASTER_888 and keeping them 1:1 (like 512x512) solved most crashes.
Maybe we should have better error handling or auto-conversion for TXD textures in future updates so it doesn’t crash silently.