mirror of
https://github.com/elliotnunn/tbxi.git
synced 2024-12-21 15:29:26 +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 re
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
|
try:
|
||||||
|
from .fast_lzss import compress
|
||||||
|
except ImportError:
|
||||||
|
from .slow_lzss import compress
|
||||||
|
|
||||||
from . import dispatcher
|
from . import dispatcher
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +52,7 @@ def build(src):
|
|||||||
constants[base + '-offset'] = len(booter)
|
constants[base + '-offset'] = len(booter)
|
||||||
for attempt in ['MacROM', 'Parcels']:
|
for attempt in ['MacROM', 'Parcels']:
|
||||||
try:
|
try:
|
||||||
booter.extend(dispatcher.build_path(path.join(src, attempt)))
|
data = dispatcher.build_path(path.join(src, attempt))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -55,6 +60,9 @@ def build(src):
|
|||||||
else:
|
else:
|
||||||
raise FileNotFoundError
|
raise FileNotFoundError
|
||||||
|
|
||||||
|
if not data.startswith(b'prcl'): data = compress(data)
|
||||||
|
booter.extend(data)
|
||||||
|
|
||||||
constants[base + '-size'] = len(booter) - constants[base + '-offset']
|
constants[base + '-size'] = len(booter) - constants[base + '-offset']
|
||||||
|
|
||||||
constants['info-size'] = len(booter)
|
constants['info-size'] = len(booter)
|
||||||
|
Loading…
Reference in New Issue
Block a user