Version 3.2.2: in-memory replacements fill their slots exactly (padded ones played as silence)

This commit is contained in:
2026-10-11 00:10:44 +02:00
parent cac52e7597
commit b6b96307ca
16 changed files with 223 additions and 52 deletions

View File

@@ -9,6 +9,7 @@ from ackit import banks
from ackit.bnk import fnv1
from ackit.catalog import build_lines
from ackit.game import Game
from ackit.wem import fill
from ackit.workspace import ORIGINAL, MODIFIED, Workspace
import synth
@@ -138,8 +139,9 @@ def test_whole_recording_in_a_bank_is_written_with_its_line(tmp_path):
assert l.kind == banks.PREFETCH_HEAD and l.size == len(a["INT"]) and l.file == "Lines.upk"
pkg = os.path.join(ws.game.cooked, "Lines.upk")
before = hashlib.sha1(open(pkg, "rb").read()).hexdigest()
new = synth.wem(0.3, 900)
new = synth.fitting_wem(ws, s, 0.3, 900)
ws.apply([(s, new, {})])
assert banks.open_file(pkg).read(l.offset, l.size) == new + bytes(l.size - len(new))
assert banks.open_file(pkg).read(l.offset, l.size) == fill(new, l.size) # filled exactly, not padded
assert ws.current_bytes(s) == new
ws.revert([s])
assert hashlib.sha1(open(pkg, "rb").read()).hexdigest() == before