Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import binascii
  2.  
  3. #
  4. # Hexdump from ETS2 .tobj files. This data is the same for all .tobj files,
  5. # so I didn't bother to reverse engineer it further.
  6. #
  7. # file_mid is placed after the string length byte
  8. #
  9.  
  10. file_start = "010ab170000000000000000000000000000000000100000002000303030000000000000000010000"
  11. file_mid = "00000000000000"
  12.  
  13. # Request directory from user, this is the only changing data in the format
  14. file_location = str(input("Enter Base subdirectory\n(e.g. /material/editor/Europe.dds)\n\t"))
  15. file_name = input("Enter output filename excluding .tobj (e.g. Europe)\t")
  16. #file_location = "/material/editor/Europe.dds"
  17.  
  18. length = hex(len(file_location))[2:]
  19.  
  20. f = open(file_name+".tobj", 'wb')
  21. f.write(binascii.unhexlify(file_start))
  22. f.write(binascii.unhexlify(length))
  23. f.write(binascii.unhexlify(file_mid))
  24. f.close()
  25.  
  26. f = open(file_name+".tobj", 'a')
  27. f.write(file_location)
  28. f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement