[SOLVED] Texture swap gone horribly wrong
Moderator: Moderators
- Creepio
- Posts: 3
- Joined: Wed May 26, 2021 6:07 am
- Projects :: Robot Pirate Island
- xbox live or psn: No gamertag set
[SOLVED] Texture swap gone horribly wrong
I tried to hex edit the MSH of the Rhen Var statue to use the texture "yav_prop_boulder" instead of "Rhn_bldg_brick_01", but after doing this, selecting the prop crashes Zeroeditor. Does anyone know why this is happening?
Last edited by Creepio on Wed Jun 02, 2021 5:44 pm, edited 1 time in total.
-
- Gametoast Staff
- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: Texture swap gone horribly wrong
Can you provide screenshot of the .msh in the hex editor where the name change was done? Did you add any extra bytes?
- Creepio
- Posts: 3
- Joined: Wed May 26, 2021 6:07 am
- Projects :: Robot Pirate Island
- xbox live or psn: No gamertag set
Re: Texture swap gone horribly wrong
Last edited by Creepio on Thu May 27, 2021 6:00 pm, edited 1 time in total.
-
- Gametoast Staff
- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: Texture swap gone horribly wrong
So you shouldn't be deleting bytes like that. If the name is shorter, replace unused characters with 00 on the hexadecimal side of the editor.
- Creepio
- Posts: 3
- Joined: Wed May 26, 2021 6:07 am
- Projects :: Robot Pirate Island
- xbox live or psn: No gamertag set
Re: Texture swap gone horribly wrong
Am I correct in assuming that I should also shave off bytes if the name is longer?
EDIT: It doesn't crash anymore, but the new texture isn't showing up in the editor or ingame.
Last edited by Creepio on Wed Jun 02, 2021 12:56 am, edited 1 time in total.
-
- Corporal
- Posts: 151
- Joined: Thu Jan 24, 2019 11:02 pm
- Projects :: No Mod project currently
- xbox live or psn: No gamertag set
Re: Texture swap gone horribly wrong
Assuming that you changed the texture under a MATD chunk, then you've made the MATD one byte smaller. Every chunk has a longint at the beginning which states how long that chunk is, so you need to edit that number whenever you resize them. The MATD is inside of the MATL, MATL is inside of MSH2 and every chunk is inside of HEDR so all 4 of those chunks are now one byte smaller, and that's probably the cause of the crash.
Because you're lucky enough to be using a new texture with a shorter file name, you can just insert an extra 00 at the end and it should be problem solved. You could also have just done this with a text editor and added an extra space at the end to keep the file name the same length as it was before. But if you ever need to insert extra bytes (eg if your new texture has a longer file name than the old one) then the proper fix is to adjust the MATD, MATL, MSH2 and HEDR sizes.
Edit: Actually the chunk you'd be changing is the TX0D, inside a MATD, inside the MATL... So the longint at the start of TX0D would also need changing.
Because you're lucky enough to be using a new texture with a shorter file name, you can just insert an extra 00 at the end and it should be problem solved. You could also have just done this with a text editor and added an extra space at the end to keep the file name the same length as it was before. But if you ever need to insert extra bytes (eg if your new texture has a longer file name than the old one) then the proper fix is to adjust the MATD, MATL, MSH2 and HEDR sizes.
Edit: Actually the chunk you'd be changing is the TX0D, inside a MATD, inside the MATL... So the longint at the start of TX0D would also need changing.
-
- Gametoast Staff
- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: Texture swap gone horribly wrong
You're not supposed to delete any bytes at all just to keep things simple. If the name needed to be longer, it would make more sense to add more bytes to accommodate the extra characters, right? But that's not the case here. You actually replaced a texture name with a shorter one, so again, you should be replacing the unused characters/bytes with 00, not delete them. What exactly did you do to end up in the situation you are in now? Is the start of the original texture name also the the start of the new texture name? It should be if it isn't already.

- Creepio
- Posts: 3
- Joined: Wed May 26, 2021 6:07 am
- Projects :: Robot Pirate Island
- xbox live or psn: No gamertag set
Re: Texture swap gone horribly wrong
The second one is what I did. At the time I thought it should match the end of the string and not the beginning. It looks like that squares it.