1. Some DDS textures cannot be opened with GIMP (usually 'Unexpected EOF')
Code: Select all
find . -name '*.dds' > full-list
split -dl200 full-list list
gimp &
cat list0 | while read f; do gimp "$f"; done; # etc
NOTE: gimp-dds needs to be installed
2. Some DDS textures have wrong format
ScuL wrote:have DDS 8-8-8 32-bit format which is probably why it could crash the game
ScuL wrote:the textures are saved in DDS DXT5 (Nvidia spec). However some files may be in DDS but not necessarily DXT5 (8-bit for instance).
Notice the absence of 'DXT5' in the output of
file:
Code: Select all
$ file bad.dds
bad.dds: Microsoft DirectDraw Surface (DDS), 128 x 128,
$ file good.dds
good.dds: Microsoft DirectDraw Surface (DDS), 1024 x 512, DXT5
Find non-DXT5:
Code: Select all
find . -name '*.dds' | while read f; do file "$f" | grep -q DXT5 || file "$f" | sed -r 's|(.+): Microsoft DirectDraw Surface \(DDS\), [0-9]+ x [0-9]+, (.*)|\2\t\1|'; done;
NOTE: some files are recognized as 'x86 boot sector' for some reason.
NOTE2: original SCS content actually includes ATI2, DXT1, DXT3, uncompressed and unrecognized files.
Convert DDS files:
Code: Select all
nvcompress [-options,..] in.dds out.dds
-rgb no compression
-bc1 DXT1 (no alpha!)
-bc1a DXT1 (binary alpha)
-bc2 DXT3
-bc3 DXT5
-bc5 ATI2 (alpha unsupported?)
3. Incorrect TOBJ files
ScuL wrote:As far as I know the correct TOBJ format for ETS2 works as following:
Header:
01 0A B1 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 03 03 03 00 02 02 00 00 00 00 00 01 00 00 2A 00 00 00 00 00 00 00
where 2A equals the length of the path to the file following;
in this case:
/model/sign/traffic/traffic_signs_se_2.dds
is 42 characters long which equals 2A in hex.
So the total file then becomes:
01 0A B1 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 03 03 03 00 02 02 00 00 00 00 00 01 00 00 2A 00 00 00 00 00 00 00 2F 6D 6F 64 65 6C 2F 73 69 67 6E 2F 74 72 61 66 66 69 63 2F 74 72 61 66 66 69 63 5F 73 69 67 6E 73 5F 73 65 5F 32 2E 64 64 73
The older TOBJ format can have a different header:
01 0A B1 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 03 03 03 00 02 02 00 00 00 00 00 88 39 00 28 00 00 00 00 00 00 00
(here 28 is the length)
The main difference here are the bits with 88 39. So basically if you can identify TOBJ files that have faulty headers you could track them down.
I found that varying bytes are (from 0): 20, 22, 24, 26-28, 30-33, 37-38.
Export all headers:
Code: Select all
find . -name '*.tobj' | while read f; do echo "$(hexdump -ve '/1 "%02x "' -n 40 "$f")" >> headers.txt; done;
so far only bytes 37-38 are the culprits so might as well use '-s 37 -n 2'
might also add $f at the end of echo to print the path on each line
Look for specific bytes:
Code: Select all
find . -name '*.tobj' | while read f; do grep -UaPl "\xc4\x42" "$f"; done;
note the lowercase 'c' in '\xc4'
Replace bytes:
Code: Select all
sed -i -e 's|\xC4\x42|\x01\x00|' "$file"
'-i' changes the file, skipping it would print the output to STDOUT instead