Repository navigation
v1.3.2 — 适配配方按内容定位 / Content-driven recipes
v1.3.2 · 适配配方按内容定位,上游变动不再只能等更新
这次修的是什么
有玩家在「官方还原 / 重编当前版本」时遇到:
cfg.c: 上游与扩展修改了同一段代码(第 124-124 行与第 123-126 行重叠),需更新适配配方;未覆盖任何游戏文件。
根因不在游戏版本(1.2.1 是官方支持版本之一),而在配方身份和上游版本脱钩:
- 1.2.x / 1.3.0 的完整包曾附带
recipe-0.3.13.zip,之后的更新包只有 8 个文件,既不包含也不清理它; - 1.3.1 的选择逻辑是
VERSION < 0.4.0 且存在该文件就直接用,不看 commit、不看源码; - 玩家装的是 0.3.4 / 0.3.1 时代的上游,旧配方就是照着 0.3.13 写的基线;
- 旧配方改 base 第 124 行,而那两版上游正好在 123–126 行改了自己的东西 —— 两处替换共享同一 base 行,冲突。
用 1.3.1 包内的 core.py + recipe-0.3.13.zip + v0.3.4 源码,可以逐字复现同一行报错(v0.3.1 相同,v0.2.8 报 123-127)。
改了什么
- 配方按内容选择。
select_recipe分三档:verified(basis 与 commit 都一致)、basis(同版本)、rebased(用更旧的配方按上下文重定位)。版本号或 commit 变化不再单独判为不兼容。 - 编辑按上下文重定位。
rebase_edits对每处扩展修改定位唯一落点;carved()保留上游自己改动的格式与缩进;lost_edits兜底,扩展改动若会静默丢失则直接判失败。上游真的改写了被补丁的那几行、或匹配到多处、或两处编辑撞同一区间,都会带文件名和行号报出并停止。 - 预检前移。
recipe_plan在下载编译器、探测 CPU、写任何游戏文件之前,把全部待改文件在内存里合并校验完;不兼容时目标目录根本不会创建。 - 配方可单独更新。「三种更新各自独立」把管理器、上游程序、适配配方分成三个入口;新配方从本仓库发行版下载并校验 SHA-256 后落到
cache/recipes,不必为一份配方升级整个管理器。离线时自动回退本机配方,不阻塞安装。 - 上游不受支持时给出可点的下一步。报错对话框直接提供「升级上游到最新正式版再重编」;选择不升级则游戏维持现有可用状态,管理器不擅自升级或降级。
- 重复修复不再毁掉回退点。内容完全一致时不再新建备份、不再改写回退记录。
- 备份范围扩大。存档备份同时收纳 MOD 目录、三套手柄样式图标与扩展设置,超过体积上限的模组单独计数提示,不静默截断。
验证
- 86 项自动化测试全部通过。
- 六套预编译组合(v2/v3 × PS5/图形/整合)逐组合还原验证:
totk.exeSHA-256 一致,组件标识TOTK_EXTENSIONS_V1:{1,2,3}与档位一致。 - 真实 1.3.1 安装目录升级到 1.3.2,故意保留残留
recipe-0.3.13.zip:升级成功,残留配方未被误用。 - 上游 0.3.4 桩:安装前拦截,写入 0 个文件,提示「更新上游并重编」。
- 上游同系列小改(改版本号、插入新键、整段重缩进)自动适配,扩展编辑与上游格式同时保留。
- 上游改写被补丁行:正确拒绝。
- 断网:只用本机配方继续工作。
- 重复安装 → 回滚:回退点保持,
totk.exe恢复官方字节。 - PS5 提示、DualSense、DLSS/FSR、帧生成、MOD 相关用例均无回归。
附件
| 文件 | 大小 | SHA-256 |
|---|---|---|
totk-patch-manager-v1.3.2-windows-x64-update.zip |
126,916 B | 8faaf86beb631429d5332a1783a1d788a3dd98f810019c5c599ffec774d886b8 |
recipe-0.4.0.zip |
895,254 B | 40bfb89db1389152c5d181baf6a5823437d9973d74f53688db262f74bd2605d4 |
recipe-catalog.json |
206 B | d944293794c3bf97cedbb7406d9657e3b18129a233bcbcebd670f4ca084afdd3 |
SHA256SUMS.txt |
— | — |
更新包只含管理器自身文件,沿用原安装的 Python 环境与本地组件。本 Release 不含游戏资源、预编译成品或整合包,请遵守上游与第三方授权边界。
升级方式
- v1.2.9 及以上:打开「设置 → 关于与管理器更新」,检查稳定版更新,按提示下载、校验、安装并重启。
- 手动更新:下载 update ZIP,用
SHA256SUMS.txt校验后覆盖原安装目录中的对应文件。 - 更新管理器后,用「安装管理 → 修复」把已有组件刷到 1.3.2 的合并结果。
- 若上游版本低于本机所有配方,按提示点「一键升级上游并安装」,或在「高级安装」里自行升级上游后重编。
English
What broke
Rebuilding against a 0.3.x upstream failed with cfg.c: upstream and extension modified the same region (lines 124-124 and 123-126 overlap). A recipe-0.3.13.zip left behind by an older full package was applied to any upstream below 0.4.0 without looking at the commit or the source, and that recipe was authored against the 0.3.13 baseline. The game resource version was never the cause.
What changed
- Recipes are chosen by content.
select_recipereports verified (basis and commit), basis (same version) or rebased (an older recipe relocated onto the tree). A version string or commit change alone no longer means incompatible. - Edits are relocated by context.
rebase_editsfinds a unique home for each extension edit,carved()keeps the upstream formatting of untouched lines, andlost_editsfails the merge when an edit would silently disappear. A genuinely rewritten line, an ambiguous match or two edits on one region is reported with file and line. - Preflight moved forward.
recipe_planmerges every patched file in memory before the compiler is downloaded or any game file is written. - Recipes update independently. Manager, upstream program and patch recipes are three separate entry points; new recipes come from this repository's release, verified by SHA-256, and land in
cache/recipes. Offline runs keep using the local set. - Actionable recovery. An unadaptable upstream offers the one-click upgrade instead of only a technical error, and refusing it leaves the game as it was.
- Repeat repair keeps the rollback point, and personal backups now also carry mods, icon styles and extension settings with an explicit size limit.
Verification
86 automated tests pass; all six prebuilt combinations reproduce byte-identical totk.exe with matching component markers; a real 1.3.1 install with a deliberately retained stale recipe upgrades to 1.3.2 and ignores it; a 0.3.4 upstream is stopped before any file is written; same-series upstream changes (version bump, new keys, re-indentation) adapt automatically while a rewritten patched line is refused; offline, repeat-install and rollback paths all hold. PS5 prompts, DualSense, DLSS/FSR, frame generation and the Mod Center show no regression.