Created
November 13, 2019 01:40
-
-
Save Tilka/d479e3adbb67663e74c847fe969e4093 to your computer and use it in GitHub Desktop.
Python script to extract all HVQM2 videos from *.z64 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import struct | |
import sys | |
rom = open(sys.argv[1], 'rb').read() | |
pos = 0 | |
while True: | |
i = rom.find(b'HVQM2 1.0', pos) | |
if i == -1: | |
break | |
size = struct.unpack('>I', rom[i+16:i+20])[0] | |
video = rom[i:i+size] | |
name = 'video_%u.hvqm' % i | |
print(name) | |
open(name, 'wb+').write(video) | |
pos = i + size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment