Hex-editing a texture-chunk

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
CdtFox
2nd Lieutenant
2nd Lieutenant
Posts: 379
Joined: Wed Feb 17, 2016 8:51 am
Projects :: BUC and Designated Days
Games I'm Playing :: SWBF2+EAW+Subnautica
xbox live or psn: No gamertag set
Location: France
Contact:

Hex-editing a texture-chunk

Post by CdtFox »

After reading this documentation/topic (http://www.gametoast.com/viewtopic.php? ... t&start=20) I've seen that the .mshedit tool works only for models chuncks and not the chunck's textures.

Then how can i add the chunck including the texture's name? I mean there is certainly a way to add this specific chunk thought classic/normal hex-editing, but how can i recognize a texture chunk? its start with TX0D or HBATRB? Also i don't know where its end: after the .tga? Or MATD? Scene_Material940 maybe?
Hidden/Spoiler:
Image
Once i'll have the texture chunk, where can i paste it? Maybe where there is a lot of "0"?
Hidden/Spoiler:
Image
Thx for the help guys :)
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Hex-editing a texture-chunk

Post by AQT »

The "texture chunk" is the MATD chunk. A MATD chunk starts at M and ends right before the next MATD chunk. (Unless it is the last MATD chunk, it ends right before the first MODL chunk.)

MATD chunks are children of MATL. In the fifth place after MATL, there is a value. This value is the number of MATD chunks in hexidecimal. For example, if there are three MATD chunks, then this value would be 03. But if there are 10 MATD chunks, then this value would be 0A.

Each MATD chunk has an index value that lets MODL chunks know which texture/material to use. The first MATD chunk is 00, the second is 01, the third is 02, and so on and so forth. Again, these are in hexidecimal.

I'm going to keep this next part simple for now: MODL chunks have a MATI. In the fifth place after MATI, there is a value. This value refers to the index value of a MATD chunk. For example, if you want a MODL chunk to use the second MATD chunk, then you would change the fifth place value after MATI to 01.

When you hex edit in or remove a MODL chunk, you resize HEDR and MSH2. However, when you hex edit in or remove a MATD chunk, you resize HEDR and MSH2 as well as MATL. Don't forget to increase/decrease the fifth place value after MATL to account for additions or removals of MATD chunks.

If you need any pictures, I'll try to get to them on the weekend. Feel free to ask any clarifying questions in the meantime. Hope this helps.
CdtFox
2nd Lieutenant
2nd Lieutenant
Posts: 379
Joined: Wed Feb 17, 2016 8:51 am
Projects :: BUC and Designated Days
Games I'm Playing :: SWBF2+EAW+Subnautica
xbox live or psn: No gamertag set
Location: France
Contact:

Re: Hex-editing a texture-chunk

Post by CdtFox »

The "texture chunk" is the MATD chunk. A MATD chunk starts at M and ends right before the next MATD chunk. (Unless it is the last MATD chunk, it ends right before the first MODL chunk.)
Ok i understand that...1 point
MATD chunks are children of MATL. In the fifth place after MATL, there is a value. This value is the number of MATD chunks in hexidecimal. For example, if there are three MATD chunks, then this value would be 03. But if there are 10 MATD chunks, then this value would be 0A.
Hum...when i search for MATL it can't find anything, but well I counted all the MATD chuncks and the interisting one is the sixth, then i guess it's value is 06.
I'm going to keep this next part simple for now: MODL chunks have a MATI. In the fifth place after MATI, there is a value. This value refers to the index value of a MATD chunk. For example, if you want a MODL chunk to use the second MATD chunk, then you would change the fifth place value after MATI to 01.
:? I would need a picture if possible...didn"t understand this part.
When you hex edit in or remove a MODL chunk, you resize HEDR and MSH2. However, when you hex edit in or remove a MATD chunk, you resize HEDR and MSH2 as well as MATL. Don't forget to increase/decrease the fifth place value after MATL to account for additions or removals of MATD chunks.
oh well, let's hope i won't fail...I'm not good at these sort of things :runaway:

Thanks for the help AQt :thumbs:

EDIT:

I've made some other hex-edit, and well the skirt i just hex edited is textured with the clone's texture (still with mshtool):
Hidden/Spoiler:
Image
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Hex-editing a texture-chunk

Post by AQT »

No problem! A couple images with explanations are coming right up.

I will be using the stock imp_inf_shocktrooper.msh as an example. In the following screenshot, the MATL and all of the MATD chunks have been highlighted in red:
Hidden/Spoiler:
Image
The start of the MATL is in green, and the start of each MATD chunk is in blue. Notice the green box around the fifth place after MATL. Again, this value is the number of MATD chunks in hexadecimal. Since there are three MATD chunks, this value is 03.

So the three MATD chunks are the following:

First MATD chunk:
  • Index number = 00
  • NAME = Scene_Material0
  • Texture = N/A
Second MATD chunk:
  • Index number = 01
  • NAME = Material110
  • Texture = Imp_inf_trooper.tga
Third MATD chunk:
  • Index number = 02
  • NAME = Material120
  • Texture = Imp_inf_trooper_pack.tga
In the following screenshot, the beginning section of the MODL chunk with NAME imp_inf_shocktrooper_gear is highlighted in red. (These are the backpack, pauldron, and pouches found on the Shocktrooper model.):
Hidden/Spoiler:
Image
The start of the MODL is in green, and *its MATI is in blue. Notice the blue box around the fifth place after MATI. This value refers to a MATD chunk's index number. Since this value is 02, this MODL chunk uses the third MATD chunk, which uses the texture Imp_inf_trooper_pack.tga.

Hopefully this clears up any confusion you may have. :)



*The MATI really belongs to SEGM, which is a child of MODL.
Post Reply