1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-18 08:22:04 +00:00

exo: integrate multiple PRs' split_program changes

This commit is contained in:
Michael Scire 2020-07-07 20:28:31 -07:00
parent 0cac10a2f0
commit aa2d1e15ab

View file

@ -3,7 +3,11 @@ import sys, lz4
from struct import unpack as up
def lz4_compress(data):
return lz4.block.compress(data, 'high_compression', store_size=False)
try:
import lz4.block as block
except ImportError:
block = lz4.LZ4_compress
return block.compress(data, 'high_compression', store_size=False)
def split_binary(data):
A, B, START, BOOT_CODE_START, BOOT_CODE_END, PROGRAM_START, C, D = up('<QQQQQQQQ', data[:0x40])
@ -19,7 +23,7 @@ def split_binary(data):
def main(argc, argv):
if argc != 3:
print 'Usage: %s in outdir' % argv[0]
print('Usage: %s in outdir' % argv[0])
return 1
with open(argv[1], 'rb') as f:
data = f.read()
@ -30,4 +34,4 @@ def main(argc, argv):
return 0
if __name__ == '__main__':
sys.exit(main(len(sys.argv), sys.argv))
sys.exit(main(len(sys.argv), sys.argv))