Skip to content

Optimize resource loading and fix PAL3A script execution - #92

Merged
0x7c13 merged 5 commits into
mainfrom
feat/pal3a-script-runtime
Nov 13, 2026
Merged

0x7c13 merged 5 commits into
mainfrom
feat/pal3a-script-runtime

Conversation

@0x7c13

@0x7c13 0x7c13 commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

改动内容

外传部分指令的参数定义有误,可能把后续入队、算命结果等指令当作参数读掉;局部变量共享和成组等待串行计时也会改变剧情流程。本 PR 修正指令解码与脚本运行逻辑,并完善资源加载、静态场景绘制和 Core 协议测试。

  • 外传指令:修正参数签名,加入算命选择与结果写入、天空盒序列帧特效、按武器播放攻击动作、对话禁止转身、镜头方向约束、静默队伍变更、等级进度和战斗准备标志的处理。
  • 脚本解释器与状态恢复:局部变量按实例隔离,成组等待并行计时;外传仅在直接执行 16 号指令时等待子脚本。重置时取消旧交互与旧读档等待,避免有限次动作恢复成无限循环,并在解除镜头约束后恢复朝向。支持的状态使用 v2 存档保存。
  • 贴图与场景绘制:分离资源解码和 Unity 贴图上传,校验 DDS 布局,支持原生 BC 压缩上传及 RGBA 软件回退;压紧 POL 实际使用的顶点,并对附近、同材质的静态不透明几何合批,保留水面与动态几何的独立处理。
  • Core 与回归测试:覆盖指令协议、二进制读取、资源布局、脚本运行和角色进度;修正 CVD 时间基准、读取边界与短读、CPK/NAV 校验。统一自有代码的版权头,保留改名指令的 Unity GUID。
  • CI:10 个工作流仅由 PR 触发,同一 PR 的新提交取消旧构建,避免 push 和 PR 重复跑两套矩阵;升级 checkout 至 v7.0.1、cache 至 v6.1.0、unity-builder 至 v6.0.0,并固定其 CLI 为 v0.1.73。已核对上游参数映射与许可证环境变量的兼容性,整合 Dependabot action-deps: bump actions/cache from 5.0.5 to 6.1.0 #86、action-deps: bump actions/checkout from 6.0.3 to 7.0.1 #87、action-deps: bump game-ci/unity-builder from 5 to 6 #88。

验证结果

检查 仙剑三 PAL3 问情篇 PAL3A
Unity EditMode 测试 274/274 通过 291/291 通过
最近一轮实际运行检查 18/18 通过 22/22 通过
  • 外传全部 34 个 SCE 文件、1,960 个脚本块、77,889 条指令的起始偏移和 ID,与从 EXE 提取的参数表解码结果逐条一致;解析错误和非法跳转均为 0。实际脚本涉及 133 种指令 ID。

  • 实际运行检查覆盖对话动作恢复、巡逻暂停配对、124 间接启动独立物件脚本、场景脚本计时,以及 198 在固定视角和自由旋转状态下恢复朝向。此前的专项检查还覆盖算命结果写入、存档状态及天空特效的深度遮挡。

  • 资源与渲染改动已在 macOS Metal 下验证 Game、ResourceViewer、原版和 Toon 画风,并通过两作的 macOS Player 构建。

  • 版权头与改名指令的 .meta GUID 检查通过;提交的项目配置为 PAL3。

  • CI 配置通过 actionlint v1.7.12 检查;升级后两作在 Windows 32/64 位、macOS、Linux、iOS、Android 上的 12/12 个构建任务全部通过。新提交仅产生 10 个 pull_request 工作流,没有 push 重复构建。

当前限制

  • 战斗仍是原型:能力/变身标志和初始化已接入,完整战斗玩法尚未实现;216 的累计接口仍没有实际战斗伤害来源。
  • 196 的部分属性字段/模型映射,以及 167 的天空盒面方向,仍需运行原版对照确认。
  • 开发阶段有意使用 v2 存档,不兼容 v1 存档。
  • 手机、Windows 实机运行及物理显存峰值仍待验证。

Separate file decoding from Unity upload through format-neutral texture data
and explicit world, sprite and skybox policies. Validate DDS layouts, preserve
alpha coverage and use native BC uploads with software RGBA fallback.

Compact referenced POL vertices and batch nearby static opaque groups sharing
materials. Keep water and dynamic geometry separate, with source ranges retained
only in the Editor. Add DDS layout and POL index regression tests.

Validation: PAL3 and PAL3A each passed 24 Editor tests, eight combined Game and
ResourceViewer style regressions, 936 paired skybox comparisons, and both macOS
Player builds on Metal. Editor provenance and Core tests are excluded from Players.
Cover SCE command contracts, binary readers, resource layouts and full local CPK decompression for PAL3 and PAL3A. Fix CVD time rebasing, binary read bounds and short reads, and CPK/NAV validation.

Standardize first-party copyright headers, preserve correct creation years, and update console source generation. Validate both variants in Unity and verify all live CPK entries.
Correct PAL3A parameter signatures and add handlers for fortune selection,
skybox sequences, actor facing and attacks, team and progression state,
camera constraints, and battle preparation flags.

Give script instances separate locals, advance grouped waits concurrently,
and pause PAL3A parents only for their directly decoded child calls. Cancel
stale interactions and save replay on reset, preserve finite action semantics,
and restore camera orientation after releasing horizontal constraints.

Persist supported state in v2 saves and add protocol, runtime, and progression
regressions. Full combat gameplay remains outside this change.

Validation: PAL3 274/274 and PAL3A 291/291 EditMode tests; 18 PAL3 and 22 PAL3A
runtime checks. All 77,889 PAL3A instruction boundaries match EXE signatures.
@0x7c13
0x7c13 merged commit d1b2c05 into main Nov 13, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant