Version 3.2.1: whole bank copies of voice lines, unique names, docs figures checked by tools/check_docs.py
This commit is contained in:
@@ -18,7 +18,8 @@ import random
|
||||
|
||||
from .. import banks, classify, subtitles
|
||||
from ..catalog import (Catalog, apply_lines, available_archives, bank_names, bank_sounds, build_lines, character_of,
|
||||
is_shipped, line_names, load_archive, load_banks, load_characters, read_csv, scan_archive)
|
||||
is_shipped, line_names, load_archive, load_banks, load_characters, mark_heads, read_csv,
|
||||
scan_archive, sfx_names, whole_recordings)
|
||||
from ..inject import read_target
|
||||
from ..paths import catalog_dir
|
||||
from ..wad import Wad
|
||||
@@ -133,14 +134,17 @@ def check_banks(rep, game, rows, locations, characters, quick=False, sample=40,
|
||||
col.resolve({n for n in sc.names | known if n.lower().startswith("speech_")})
|
||||
check_subtitles(rep, game, col, set(files), quick)
|
||||
lines = None
|
||||
if not quick:
|
||||
sc.names.update(col.dialogues) # as the build does: subtitle objects name speech events too
|
||||
lines = build_lines(game, sc)
|
||||
index = collections.defaultdict(set)
|
||||
for m, ls in locations.items():
|
||||
for l in ls:
|
||||
if l.file in set(files):
|
||||
index[(l.media, l.kind)].add((l.file, l.offset, l.size, l.sound if l.kind == banks.PREFETCH_HEAD else ""))
|
||||
if not quick:
|
||||
sc.names.update(col.dialogues) # as the build does: subtitle objects name speech events too
|
||||
lines = build_lines(game, sc)
|
||||
mark_heads(sc, whole_recordings(sc, lines)) # WAD recordings also stored whole in banks
|
||||
else: # a sample cannot derive them: the index says which they are
|
||||
mark_heads(sc, {m for m, k in index if k == banks.PREFETCH_HEAD} - sc.prefetch)
|
||||
found = collections.defaultdict(set)
|
||||
for l in sc.locations:
|
||||
head = l.kind == banks.PREFETCH_HEAD
|
||||
@@ -152,7 +156,7 @@ def check_banks(rep, game, rows, locations, characters, quick=False, sample=40,
|
||||
rep.add(banks.ARCHIVE, "copies", "%08X" % k[0], "%s: index %d, game %d"
|
||||
% ("head" if k[1] == banks.PREFETCH_HEAD else "copies", len(index.get(k, ())), len(found.get(k, ()))))
|
||||
cat = {s.target: s for s in rows}
|
||||
fresh_list = bank_sounds(sc, characters)
|
||||
fresh_list = bank_sounds(sc, characters, sfx_names(game))
|
||||
if lines is not None:
|
||||
lines.names = line_names(game, sc, lines, {s.key: s.name for s in fresh_list})
|
||||
apply_lines(fresh_list, lines, lines.names)
|
||||
@@ -253,11 +257,11 @@ def check_lines(rep, game, sc, lines, locations):
|
||||
rep.add("LINES", "links", k, "media %08X is not a source in any %s bank" % (m, L))
|
||||
rep.facts.append("WAD recordings named as a source by a Sound object of their own language's bank: %d of %d"
|
||||
% (named, total))
|
||||
rep.facts.append("voice languages %s: %d recordings (WAD %s + localized in-memory), %d lines, %d of them "
|
||||
"with exactly one recording in every language"
|
||||
% ("/".join(lines.langs), st["recordings"],
|
||||
"/".join(str(st["wad_wems"].get(L, 0)) for L in lines.langs), st["lines"],
|
||||
st["lines_in_every_language"]))
|
||||
rep.facts.append("voice languages %s: %d recordings (WAD WEMs %s, %d of them second places of a recording "
|
||||
"stored twice, + localized in-memory), %d lines, %d of them with exactly one recording in every "
|
||||
"language" % ("/".join(lines.langs), st["recordings"],
|
||||
"/".join(str(st["wad_wems"].get(L, 0)) for L in lines.langs), len(st["copies"]),
|
||||
st["lines"], st["lines_in_every_language"]))
|
||||
# catalog rows vs the game's lines
|
||||
rows = {}
|
||||
for L in lines.langs + [banks.ARCHIVE]:
|
||||
@@ -305,7 +309,8 @@ def check_lines(rep, game, sc, lines, locations):
|
||||
rep.add("LINES", "copies", k, "differs from %s (same media ID)" % primary)
|
||||
rep.facts.append("recordings stored twice in a WAD (same media ID, written together): %d, byte-identical: %d"
|
||||
% (len(lines.copy_of), same_copies))
|
||||
rep.facts.append("prefetch heads: %d of %d stored copies are byte-identical to the start of their WAD recording"
|
||||
rep.facts.append("prefetch heads and whole bank copies: %d of %d are byte-identical to the start of their WAD "
|
||||
"recording"
|
||||
% (same, len(heads)))
|
||||
# independent evidence: the recordings of a line have similar lengths in every language
|
||||
ratios = []
|
||||
|
||||
Reference in New Issue
Block a user