[SOLVED] Texture swap gone horribly wrong

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Creepio
Posts: 3
Joined: Wed May 26, 2021 6:07 am
Projects :: Robot Pirate Island
Games I'm Playing :: Impossible Creatures
xbox live or psn: No gamertag set

[SOLVED] Texture swap gone horribly wrong

Post by Creepio »

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.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Texture swap gone horribly wrong

Post by AQT »

Can you provide screenshot of the .msh in the hex editor where the name change was done? Did you add any extra bytes?
User avatar
Creepio
Posts: 3
Joined: Wed May 26, 2021 6:07 am
Projects :: Robot Pirate Island
Games I'm Playing :: Impossible Creatures
xbox live or psn: No gamertag set

Re: Texture swap gone horribly wrong

Post by Creepio »

AQT wrote:
Thu May 27, 2021 12:54 pm
Can you provide screenshot of the .msh in the hex editor where the name change was done? Did you add any extra bytes?

Here it is: https://imgur.com/a/r4dM7Ks
It appears that the modified file is one byte lesser.
Last edited by Creepio on Thu May 27, 2021 6:00 pm, edited 1 time in total.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Texture swap gone horribly wrong

Post by AQT »

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.
User avatar
Creepio
Posts: 3
Joined: Wed May 26, 2021 6:07 am
Projects :: Robot Pirate Island
Games I'm Playing :: Impossible Creatures
xbox live or psn: No gamertag set

Re: Texture swap gone horribly wrong

Post by Creepio »

AQT wrote:
Wed Jun 02, 2021 12:03 am
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.
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.
Sporadia
Corporal
Corporal
Posts: 151
Joined: Thu Jan 24, 2019 11:02 pm
Projects :: No Mod project currently
Games I'm Playing :: None
xbox live or psn: No gamertag set

Re: Texture swap gone horribly wrong

Post by Sporadia »

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.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Texture swap gone horribly wrong

Post by AQT »

Creepio wrote:
Wed Jun 02, 2021 12:10 am
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.
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.

Image
User avatar
Creepio
Posts: 3
Joined: Wed May 26, 2021 6:07 am
Projects :: Robot Pirate Island
Games I'm Playing :: Impossible Creatures
xbox live or psn: No gamertag set

Re: Texture swap gone horribly wrong

Post by Creepio »

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.
Post Reply