08-01-2022, 11:14 PM
This should help with step 11. Create a PS1 file containing the following script. This searches the MTB file for references to textures files, then copies those files into a folder for you. In my test I did Bob from the Incredibles. It found 6 textures in less than a second. Should remove any annoyance in finding your textures. When you run that script from a PowerShell window you will be asked for 3 paths.
This is a quick and dirty brute force script, it could be cleaned up/made more efficient but the MTB files are so small its not really worth the time to do that.
- The path of the MTB file extracted back in step 4.
example: C:\temp\characters\spd_spiderman\spd_spiderman.mtb
- The extracted and renamed texture archive root directory created in Step 8-10 (I recommend using the method patrickmollohan suggested for renaming the files to DDS.)
example: C:\temp\textures
- The path of you are saving extracted files for this character, or where you want to put copies of the texture files used by this character.
example: C:\temp\characters\spd_spiderman\extracted
This is a quick and dirty brute force script, it could be cleaned up/made more efficient but the MTB files are so small its not really worth the time to do that.
Code:
$MTB = read-host "MTB File Path"
$TArchive = read-host "Texture Archive Root Directory Path"
$SavePath = read-host "Location To Save Texture Files"
$filename = ""
$OFFSET = 0
$CYCLE = 1
$GTZ = 0
$DDS = @()
If (!$MTB) {
Write-Host "ERROR - MTB FILE NOT FOUND!"
}ELSE{
$spd = get-content $MTB -encoding byte
while ($CYCLE -lt 9) {
foreach ($byte in $spd) {
if ($OFFSET -lt 7) {
$OFFSET++
}ELSE{
$GTZ++
$Hex = ‘{0:x}‘ -f $byte
if ($HEX.length -lt 2) {$HEX = "0"+$HEX}
$filename = $filename + $Hex
if ($GTZ -ge 8) {
$filename = $filename + ".dds"
$SPC = $filename.Substring(0,2)
$Tpath = $TArchive+"\"+$SPC+"\textures\"+$filename
if (Test-Path -path $Tpath) {
$DDS += $Tpath
$filename
}
$GTZ = 0
$filename = ""
}
}
}
$OFFSET = $CYCLE
$GTZ=0
$CYCLE++
}
$OUTPUT = $DDS | select -Unique
Foreach ($File in $OUTPUT) {Copy-Item $File -Destination $SavePath -Force}
}