Advertisement
GenesisFan64

YinYangYoComicDreadExtract

May 20th, 2021
1,290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. # code.grv extractor for YinYangYo Comic Book of Dread
  2.  
  3. input_file = open("code.grv","rb")
  4. head_pos = 0x19
  5.  
  6. wrk = True
  7. while wrk:
  8.   input_file.seek(head_pos)
  9.   a = (ord(input_file.read(1))&0xFF) << 24
  10.   b = (ord(input_file.read(1))&0xFF) << 16
  11.   c = (ord(input_file.read(1))&0xFF) << 8
  12.   d = ord(input_file.read(1))&0xFF
  13.   FILE_POS = a|b|c|d
  14.   a = (ord(input_file.read(1))&0xFF) << 24
  15.   b = (ord(input_file.read(1))&0xFF) << 16
  16.   c = (ord(input_file.read(1))&0xFF) << 8
  17.   d = ord(input_file.read(1))&0xFF
  18.   FILE_SIZE = a|b|c|d
  19.   head_pos += 8
  20.  
  21.   a = []
  22.   b = True
  23.   while b:
  24.     c = (ord(input_file.read(1))&0xFF)
  25.     if c == 0:
  26.       b = False
  27.       head_pos += 5
  28.     else:
  29.       a.append(c)
  30.       head_pos += 1
  31.   a = bytes(a)
  32.  
  33.  
  34.   output_file = open("output/"+a.decode("ascii"),"wb")
  35.   input_file.seek(FILE_POS)
  36.   a = input_file.read(FILE_SIZE)
  37.   output_file.write(a)
  38.   output_file.close()
  39.  
  40.   print(hex(head_pos))
  41.   #wrk = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement