Guest User

convert_disktext.py - Decrypts DISKTEXT.TXT (Circuit's Edge)

a guest
Feb 27th, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. from disktext_lookup import lookup
  2.  
  3. f = open("../game/DISKTEXT.TXT", "rb")
  4. lines = f.read()
  5. f.close()
  6.  
  7. #remove the carriage return (\r) at the beginning of the file
  8. lines = lines[1:]
  9.  
  10. #split by line delimiter (carriage return, null, carriage return)
  11. lines = lines.split("\x00")
  12.  
  13. print "%d lines" % len(lines)
  14.  
  15. texts = []
  16. for line in lines:
  17.     text = []
  18.     for byte in line:
  19.         text.append(lookup.get(ord(byte), byte))
  20.  
  21.     texts.append("".join(text))
  22.  
  23. f = open("disktext_unpacked.txt", "wb") #disktext_unpacked.txt
  24. f.write("\x00".join(texts))
  25. f.close()
Advertisement
Add Comment
Please, Sign In to add comment