Re-compress ROM images properly

This commit is contained in:
Elliot Nunn 2019-05-25 10:05:06 +08:00
parent 78c14e7c97
commit a1e5442bf5

View File

@ -2,6 +2,11 @@ from os import path
import re
import zlib
try:
from .fast_lzss import compress
except ImportError:
from .slow_lzss import compress
from . import dispatcher
@ -47,7 +52,7 @@ def build(src):
constants[base + '-offset'] = len(booter)
for attempt in ['MacROM', 'Parcels']:
try:
booter.extend(dispatcher.build_path(path.join(src, attempt)))
data = dispatcher.build_path(path.join(src, attempt))
except:
pass
else:
@ -55,6 +60,9 @@ def build(src):
else:
raise FileNotFoundError
if not data.startswith(b'prcl'): data = compress(data)
booter.extend(data)
constants[base + '-size'] = len(booter) - constants[base + '-offset']
constants['info-size'] = len(booter)