Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import binascii
- #
- # Hexdump from ETS2 .tobj files. This data is the same for all .tobj files,
- # so I didn't bother to reverse engineer it further.
- #
- # file_mid is placed after the string length byte
- #
- file_start = "010ab170000000000000000000000000000000000100000002000303030000000000000000010000"
- file_mid = "00000000000000"
- # Request directory from user, this is the only changing data in the format
- file_location = str(input("Enter Base subdirectory\n(e.g. /material/editor/Europe.dds)\n\t"))
- file_name = input("Enter output filename excluding .tobj (e.g. Europe)\t")
- #file_location = "/material/editor/Europe.dds"
- length = hex(len(file_location))[2:]
- f = open(file_name+".tobj", 'wb')
- f.write(binascii.unhexlify(file_start))
- f.write(binascii.unhexlify(length))
- f.write(binascii.unhexlify(file_mid))
- f.close()
- f = open(file_name+".tobj", 'a')
- f.write(file_location)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement