45 lines
908 B
Python
Executable File
45 lines
908 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
sys.path.append('src/assets/sequences')
|
|
from sequences import sequences
|
|
|
|
def zip(filename):
|
|
return subprocess.check_output(['tools/rarezip', filename])
|
|
|
|
zips = []
|
|
|
|
fd = open('build/%s/assets/sequences.bin' % os.environ['ROMID'], 'wb')
|
|
fd.write(len(sequences).to_bytes(2, 'big'))
|
|
fd.seek(4)
|
|
|
|
offset = 4 + len(sequences) * 8
|
|
|
|
for name in sequences:
|
|
filename = 'src/assets/sequences/' + name;
|
|
fd2 = open(filename, 'rb')
|
|
data = fd2.read()
|
|
fd2.close()
|
|
|
|
zipped = zip(filename)
|
|
ziplen = len(zipped)
|
|
|
|
if ziplen % 2 == 1:
|
|
zipped += (0x0a).to_bytes(1, 'big')
|
|
ziplen += 1
|
|
|
|
fd.write(offset.to_bytes(4, 'big'))
|
|
fd.write(len(data).to_bytes(2, 'big'))
|
|
fd.write(len(zipped).to_bytes(2, 'big'))
|
|
|
|
zips.append(zipped)
|
|
offset += len(zipped)
|
|
|
|
for zipdata in zips:
|
|
fd.write(zipdata)
|
|
|
|
fd.close()
|