1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-27 14:22:17 +00:00
Atmosphere/fusee_cpp/program/lz4_compress.py

24 lines
602 B
Python
Raw Normal View History

2021-08-21 19:10:13 +01:00
#!/usr/bin/env python
import sys, lz4
from struct import unpack as up
def lz4_compress(data):
try:
import lz4.block as block
except ImportError:
block = lz4.LZ4_compress
return block.compress(data, 'high_compression', store_size=False)
def main(argc, argv):
if argc != 3:
print('Usage: %s in out' % argv[0])
return 1
with open(argv[1], 'rb') as f:
data = f.read()
with open(argv[2], 'wb') as f:
2021-08-21 23:49:36 +01:00
f.write(lz4_compress(data[:0x2B000 + 0x11000]))
2021-08-21 19:10:13 +01:00
return 0
if __name__ == '__main__':
sys.exit(main(len(sys.argv), sys.argv))