mirror of
https://github.com/elliotnunn/tbxi.git
synced 2024-12-21 00:29:33 +00:00
Re-compress ROM images properly
This commit is contained in:
parent
78c14e7c97
commit
a1e5442bf5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user