- Add app/games: GameProfile base, registry, ReaderHooks and renpy/naninovel/ tomie profiles. pipeline, preflight, detect and mods dispatch via the registry - Move tomie_* converter modules to app/games/tomie and split out reader hooks, import, mod validation and known defects - Tolerate the 31 authoring defects of the pinned Tomie build as report warnings (exact list, per-script counts); any new defect still blocks import - Frontend: runtime registry (runtimes.ts) with lazy Tomie launcher - Add profile/registry tests and docs/GAME_PROFILES.md; update IMPORT.md Full media export of the original Tomie build is not yet verified. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
29 lines
1.6 KiB
Python
29 lines
1.6 KiB
Python
"""Extra validation of edited Tomie mods (called from ``app.mods``)."""
|
|
from app.games.tomie.defects import split_known
|
|
from app.games.tomie.format import unpack_modules
|
|
from app.games.tomie.validation import validate_runtime
|
|
|
|
|
|
def validate_mod(game, scripts, manifest) -> None:
|
|
native = unpack_modules(scripts)
|
|
issues, _ = split_known(validate_runtime({"scripts": native}))
|
|
if issues:
|
|
raise ValueError(issues[0].message + " (" + issues[0].location + ")")
|
|
config = game.get("tomie")
|
|
if not isinstance(config, dict) or not isinstance(config.get("defaults"), dict) or not isinstance(config.get("function_data"), dict):
|
|
raise ValueError("Отсутствуют исходные настройки Tomie")
|
|
start = config.get("start", {})
|
|
script = native.get(start.get("script"))
|
|
if script is None or start.get("label", "") not in script["labels"]:
|
|
raise ValueError("Точка входа Tomie не найдена")
|
|
media = config.get("media")
|
|
if not isinstance(media, dict):
|
|
raise ValueError("Не найден индекс медиа Tomie")
|
|
for collection in ("backgrounds", "characters", "textures", "videos", "audio", "fonts"):
|
|
if not isinstance(media.get(collection), dict):
|
|
raise ValueError("Некорректный индекс медиа Tomie: " + collection)
|
|
for entry in media[collection].values():
|
|
path = entry.get("file") if isinstance(entry, dict) else entry
|
|
if not isinstance(path, str) or path not in manifest["files"]:
|
|
raise ValueError("Отсутствует медиа Tomie: " + str(path))
|