docs(dev-docs): rewrite bilingual developer handbook with real code and byte walkthroughs

Expand dev-docs with a plain-language glossary, accurate single-port server flow, real apps/server directory map and cln_set_researchable trace, un-elided 57-byte EXE patch anatomy, 6-file Native C wiring guide, real Good vs. Bad code comparisons, AI constraint prompt, and traffic-log debugging steps at 1:1 zh-CN/en parity.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 11:25:53 +08:00
1 parent e2ac4fa744
commit e79866b96e
5 files changed
+2013 -183

No files matched your search

+254 -48
View File
@@ -1,81 +1,122 @@
# Contributing
# 环境搭建、流量调试与提交指南 / Contributing Guide
<a id="zh-cn"></a>
简体中文 · [English](#english) · [返回 Dev Docs](README.md#zh-cn)
## 提交前自查
这篇指南带你从零搭好本地开发环境、用内置的自动解码流量日志快速定位机库与对局问题,并在发起 Pull Request 前跑通对应的真实工程检查。
- 改动只解决一个目标。实现、配置、补丁说明和相关开发文档一致。提交标题用英文 `type(scope): description`,scope 用小写模块名,仓库级改动用 `repo`。破坏兼容时用 `type(scope)!: description`,并在 `BREAKING CHANGE:` 脚注说明影响和处理方式。正文交代原因、依据和验证结果,代码注释也用英文。联署留给实际协作的开发者。
- 游戏行为的判断有目标版本和一手出处。新动作写清客户端怎样发请求、怎样读取应答。客户端改动登记到对应补丁或构建模块,并说明为何需要。涉及新数值时,按[三类数值规则](development-rules.md#数值和数据来源)检查来源、配置和校验。
- 检查模块职责、依赖方向和重复逻辑。涉及账号、余额和档案时,检查错误输入、写盘顺序,以及多个账号之间的数据隔离。选择奖品或其他数据项时,按明确规则排序和筛选。
- 若借助 AI 助手编写代码,提交前请人工逐行对照 [常见实现陷阱与工程红线](development-rules.md#常见实现陷阱与工程红线含-ai-辅助开发对照):确认没有硬编码偏移/地址、没有写死原版数据或魔法数字、没有越层修改或夹带无关改动,并且每一条写进 PR 的检查命令都在本机真实运行过。
- 只做类型、补丁、构建和可运行检查。功能验收由人使用隔离副本在游戏里做。注明实际执行过的命令、对应版本和结果。还要实机核对时写出入口、操作和预期现象。商城或交易所改动覆盖内置浏览器打开、相关操作和关窗后的档案刷新。
- 提交前看一遍差异,确认来源、路径、记录和玩家数据可以分享。用 [PR 模板](templates/pull-request.md) 提供复核所需的信息。
---
<a id="english"></a>
## 1. 开发环境准备
[简体中文](#zh-cn) · English · [Dev Docs](README.md#english)
你需要一台 **Windows x64** 电脑,并安装以下基础工具:
## Review before submitting
1. **Node.js 24+**:仓库内的 CLI 脚本与 `apps/server` 直接以 Node 24 原生类型剥离模式运行 `.ts` 源码(Node 20/22 旧版本会因 `.ts` 扩展名或模块解析报错)。
2. **Visual Studio 2022 或 Build Tools(勾选「使用 C++ 的桌面开发」x64 工具链与 CMake)**:用于通过 `cl.exe` 编译 `native/wto-net/`(生成 `wto_ws.dll`),以及一次性编译 Quirrel 字节码检查器 `sq.exe`。
3. **Python 3.12+**:用于运行补丁校验器 `wtotools`、静态逆向工具 `tools/re/cli.py` 与客户端 `.clog` 日志解密命令。
4. **一份玩家本人合法持有的官方原版客户端(严格保持只读)**,以及在 Steam 游戏库目录之外单独准备的**离线副本目录**与**本地服务器数据目录**。
- Keep one purpose per change. Update the affected implementation, configuration, patch notes, and developer docs together. Use English `type(scope): description` commit subjects with a lowercase module scope or `repo` for repository-wide changes. For a breaking change, use `type(scope)!: description` and a `BREAKING CHANGE:` footer that explains the impact and what to do. Explain the reason, evidence, and verification in the commit body. Use English comments and reserve co-author credits for developers who actually collaborated.
- Cite the target build and primary evidence for game behavior. For new actions, explain how the client sends the request and consumes the reply. Register client edits in their patch or build module and explain why they are needed. For new values, check the source, tuning, and validation using the [three kinds of values](development-rules.md#data-and-tuning).
- Check module responsibilities, dependency direction, and reuse. For accounts, currency, and saves, check bad inputs, when updates reach disk, and separation between accounts. Use explicit ordering and selection rules for prize pools and other lists.
- When using AI tools to draft code, review the diff line by line against [common implementation pitfalls](development-rules.md#common-implementation-pitfalls-especially-with-ai-assisted-prs): confirm there are no hardcoded addresses/offsets, no copied stock numbers or magic constants, no layer violations or unrelated edits, and that every check reported in the PR was actually executed.
- Limit automated checks to type, patch, build, and startup checks. Functional acceptance is performed by a person in an isolated game copy. Report the commands actually run, the client builds, and the results. For pending in-game checks, give the entry point, action, and expected result. Store and marketplace changes cover opening the embedded browser, the affected action, and the profile refresh on close.
- Review the diff for shareable sources, paths, records, and player data. Use the [PR template](templates/pull-request.md) to provide enough detail for review.
首次克隆仓库后,在仓库根目录依次执行:
```powershell
# 1. 安装工作区依赖
npm install
# 2. 编译进程内网络重定向与 LocalMP 桥接库 -> build\native\wto_ws.dll
powershell -NoProfile -File .\native\wto-net\build.ps1
# 3. 下载桌面启动器所需的 Electron 二进制运行时
node node_modules/electron/install.js
# 4. 初始化 Python 虚拟环境并安装本地补丁/逆向工具包 wtotools
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ./tools
```
如果你想脱离桌面启动器,直接从命令行快速构建一份离线副本并以前台模式启动本地服务器查看实时输出(注意:**`--game` 在构建时传只读原版目录、启动服务器时传离线副本目录,两条命令的 `--data` 与 `--port` 必须完全一致**):
```powershell
node scripts/build-game-copy.ts --game "<原版目录>" --out "<离线副本目录>" --data "<独立数据目录>" --port 27015
node apps/server/src/cli.ts --game "<离线副本目录>" --data "<独立数据目录>" --port 27015
```
---
<a id="debugging-zh"></a>
## 2. 怎么调试与查日志(排查 Bug 最快的路径)
排查机库动作报错、购买失败、匹配卡住或对局计分异常时,**千万不要靠盲猜客户端发了什么包**。WTOffline 在四处关键节点都留有可直接阅读的诊断日志:
### 2.1 本地服务器流量日志:`<数据目录>/logs/<启动时间戳>/`(第一站!)
每次启动 `apps/server`,`TrafficLog`(`apps/server/src/traffic-log/traffic-log.ts`)都会在 `<数据目录>/logs/` 下新建一个带 ISO 时间戳的会话文件夹,里面包含两部分:
1. **`requests.jsonl`(全量请求索引流)**
每行是一条 JSON 记录,按全局递增序号 `id` 记录每一次 HTTP 交互(`kind: "http"`)、每一条匹配服双向消息(`kind: "matching"`)、被拒绝的 WebSocket 升级请求(`kind: "websocket"`)以及连接开关事件:
- **一秒定位未实现接口**:直接在 `requests.jsonl` 中搜索 `"unhandled":true`(或看终端输出末尾带 `[UNHANDLED]` 标记的行),就能立刻抓出客户端刚发了哪个尚未挂载处理器的 `char` 动作、`yuplay2` 路径或 `matching` 消息!
- 每条记录中的 `files` 字段直接指明该次请求与响应对应的负载文件名。
2. **`bodies/` 子目录(自动解码的可读明文负载!)**
每个序号 `id`(补零至 6 位,如 `000042`)按需生成以下文件:
- `000042.req.bin` / `000042.resp.bin`:原始线上传输字节(登录表单中的密码字段会自动脱敏);
- **`000042.req.txt` / `000042.resp.txt`**:**自动解包并格式化好的可读明文 BLK 文本**(无论是带 `0x69` / zlib / zstd 标记的 `char` 二进制 BLK,还是 `cln_bulk_set_gblk` 上传的 `PBBD` 多段批处理流,都会自动转成缩进清晰的文本 BLK!)或 UTF-8 JSON 文本——你无需手写任何解包脚本,直接用编辑器打开 `.txt` 就能看清每一个字段与类型;
- **`000042.matching-in.json` / `000042.matching-out.json`**:解密并解压后的匹配长连接双向 RPC 消息(`in` 为客户端发来,`out` 为本地服务器下发)。
### 2.2 其余三类配套诊断日志
- **进程内钩子与 `LocalMP` 日志:`<离线副本目录>/win64/wto_ws.log`**
由 `wto_ws.dll` 每次启动游戏时重写。记录本地服务器端口号、每一次域名拦截与 Socket 连接重定向结果、`wto_ws.cfg` 与当前 `aces.exe` 的 PE 头校验结果,以及 **11 个 `local_mp_*` 模块中哪些成功安装、哪些因缺少 `wto_ws.cfg` 键值被优雅跳过**(并打印缺失的具体键名)。排查局内不刷 AI、选车无响应、记分牌为 0 或连杀飞机异常时先看这里。
- **游戏引擎客户端日志:`<离线副本目录>/.game_logs/*.clog`**
Dagor 引擎原生日志,记录 Quirrel 脚本编译/运行期报错、进机库卡死在「正在加载…」的具体栈信息、任务脚本报错与资源缺失。由于 `.clog` 是二进制异或加密格式,直接用 `tools/re/cli.py` 解密成纯文本再查阅:
```powershell
.\.venv\Scripts\python.exe tools\re\cli.py decrypt-clog "<离线副本目录>\.game_logs\<最新文件>.clog" --out "<临时目录>\game.clog.txt"
```
- **桌面启动器日志:`launcher.log`**
在启动器界面打开「设置 → 诊断 → 打开日志目录」即可查看,记录副本构建、补丁包校验、子进程启停与更新器状态。
---
<a id="checks"></a>
## 检查命令 / Check commands
## 3. 提交前必跑的工程检查命令(按改动范围对照执行)
在仓库根目录执行适用于本次改动的命令。尖括号内的占位内容换成自己的实际值。所有游戏输入文件用只读原版来源,构建输出用单独目录。
WTOffline **不要求也不提倡编写庞大的模拟(Mock)单元测试套件**,而是要求你按实际触碰的代码目录,跑通下面对应的**真实编译器、补丁字节核对与 Quirrel 字节码检查**;最终交互体验则在独立隔离副本中进游戏实机验收。
Run the applicable commands from the repository root. Replace placeholders in angle brackets with your own values. Use read-only stock inputs and a separate build output directory.
| 改动 / Change | 检查 / Check |
| 你修改了哪里 | 提交前必须跑通的检查 |
| --- | --- |
| 共用库或本地服务器 / Shared packages or local server | 根目录类型检查,必要时用独立数据目录确认服务器能启动<br>Root type check and server startup with separate data when applicable |
| 启动器 / Launcher | 启动器的类型检查和构建<br>Launcher type check and build |
| exe 补丁 / Exe patch | `check-patches` 核对定位、原字节和源码<br>Verify matches, original bytes, and the patch source with `check-patches` |
| 修改 `patch.jsonc` 或 GUI 片段 / Edits to `patch.jsonc` or GUI fragments | 完整 `check-gui` 检查所有 GUI 补丁的命中、词法作用域和字节码编译<br>Run the full `check-gui` location, lexical scope, and bytecode checks |
| Native 或构建流程 / Native or copy build | Native 改动先编译 DLL,再用临时输出目录构建,核对定位和可用性<br>Build the DLL for native changes, then check locations and availability with a temporary copy build |
| 版本适配 / New client build | 生成版本核对记录,完成适用的补丁和构建检查,再走实机验收<br>Generate a version record, run the applicable checks, then perform in-game acceptance |
| 共享库 `packages/*`、本地服务器 `apps/server` 或 `scripts/*` | 根目录 `npm run typecheck`;若动了服务端启动逻辑或 `tuning/*.jsonc`,用临时数据目录启动一次 `apps/server/src/cli.ts` 确认数据集提取与配置校验零报错 |
| 桌面启动器 `apps/launcher` | 启动器 `typecheck` + `electron-vite build`;若增改了界面多语言词条,确认 `en.json` 与 `zh-CN.json` 键名完全对齐 |
| `patches/exe/`(任何 `patch.jsonc`) | `wtotools check-patches`(验证特征码唯一命中、`expect_original` 匹配,且 `asm`/`data` 编译结果与 `bytes` 逐字节一致) |
| `patches/gui/`(任何 `patch.jsonc` 或 `.nut` 片段) | **完整** `wtotools check-gui`(调用 `sq.exe` 执行 `compilestring` 词法作用域与字节码编译检查) + 临时副本构建确认 `gui-patch-definition.ts` Schema 无未知键报错 |
| `native/wto-net/` 或 `patches/native/` | MSVC `native\wto-net\build.ps1`(`/W4` **零警告**)+ 临时目录 `scripts/build-game-copy.ts` 确认所有原生站点全部解析就绪 |
| 适配客户端新版本(`patches/versions/`) | `scripts/record-game-version.ts` + 上述全部适用检查 + **在隔离副本中实机登录进机库并完成 `LocalMP` 对局验收后**,方可提交 `patches/versions/<版本号>.jsonc` |
常用检查命令汇总(均在仓库根目录执行,将尖括号替换为你的本地路径):
```powershell
# TypeScript / launcher
# 1. TypeScript 类型与语法剥离约束检查(校验 .ts 后缀、import type、erasableSyntaxOnly 等)
npm run typecheck
npm run typecheck --workspace "@wto/launcher"
npm run build --workspace "@wto/launcher"
# Patch tool setup
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ./tools
# 2. EXE 与 GUI 补丁核对(输入源必须是只读原版客户端目录!)
.\.venv\Scripts\python.exe -m wtotools.cli check-patches --exe "<原版目录>\win64\aces.exe"
.\.venv\Scripts\python.exe -m wtotools.cli check-gui --gui "<原版目录>\gui.vromfs.bin" --sq "build\quirrel-cli\bin\Release\sq.exe"
# Patch verification
.\.venv\Scripts\python.exe -m wtotools.cli check-patches --exe "<stock-client-dir>\win64\aces.exe"
.\.venv\Scripts\python.exe -m wtotools.cli check-gui --gui "<stock-client-dir>\gui.vromfs.bin" --sq "build\quirrel-cli\bin\Release\sq.exe"
# Native build and copy build check
# 3. Native DLL 编译(MSVC /W4 零警告)与完整离线副本试构建
powershell -NoProfile -File .\native\wto-net\build.ps1
node scripts/build-game-copy.ts --game "<stock-client-dir>" --out "<temporary-output-dir>" --data "<separate-data-dir>" --port <port>
node scripts/build-game-copy.ts --game "<原版目录>" --out "<临时副本目录>" --data "<临时数据目录>" --port 27015
# Version adaptation
node scripts/record-game-version.ts --game "<stock-client-dir>"
# 4. 客户端版本适配记录核对
node scripts/record-game-version.ts --game "<原版目录>"
```
实际启动时,离线副本需要包含完整游戏文件,本地服务器与副本构建使用同一端口和数据目录。版本记录命令会写入 `patches/versions/`,按[补丁指南](patches.md#核对版本与提交)核对后再提交。[服务器启动命令](../README.md#构建副本并启动服务器)
For an actual launch, use a full offline copy and match the server's port and data directory to the copy build. The record generator writes to `patches/versions/`. Follow the [patch guide](patches.md#check-versions-and-submit) before committing a record. [Server startup command](../README.md#build-the-copy-and-start-the-server)
<a id="quirrel"></a>
## 构建 Quirrel 编译器 / Build the Quirrel compiler
### 一次性编译 Quirrel 字节码检查器 `sq.exe`(注意 `--sq` 路径参数!)
GUI 检查使用 `sq.exe` 调用 `compilestring`,检查词法作用域和字节码编译。成功时会报告所有改动脚本都编译通过。以下步骤使用 Visual Studio 2022 的 x64 C++ 工具和 CMake 3.31。将实际编译器路径传给 `check-gui --sq`。[Quirrel 源码版本](https://github.com/GaijinEntertainment/quirrel/tree/19f17df9b6ee43c91ef5c635fd45970ec76c5dbe)
The GUI checker uses `sq.exe` and `compilestring` to check lexical scope and compile bytecode. A passing run reports successful compilation for all changed scripts. These steps use the Visual Studio 2022 x64 C++ tools and CMake 3.31. Pass the path to your compiler to `check-gui --sq`. [Quirrel source revision](https://github.com/GaijinEntertainment/quirrel/tree/19f17df9b6ee43c91ef5c635fd45970ec76c5dbe)
`check-gui` 需要调用与《战争雷霆》客户端同代的官方 Quirrel 编译器(固定在 [Quirrel 仓库提交 `19f17df9b6ee43c91ef5c635fd45970ec76c5dbe`](https://github.com/GaijinEntertainment/quirrel/tree/19f17df9b6ee43c91ef5c635fd45970ec76c5dbe))。使用 Visual Studio 2022 C++ 工具链与 CMake 编译一次即可长期复用:
```powershell
git clone https://github.com/GaijinEntertainment/quirrel.git build/quirrel-source
@@ -83,3 +124,168 @@ git -C build/quirrel-source checkout --detach 19f17df9b6ee43c91ef5c635fd45970ec7
cmake -S build/quirrel-source -B build/quirrel-cli -G "Visual Studio 17 2022" -A x64
cmake --build build/quirrel-cli --config Release --target sq
```
> **关于 `--sq` 参数的重要说明**:`wtotools check-gui` 在不传 `--sq` 时的默认查找路径是 `build/quirrel-check/sq.exe`(见 `tools/src/wtotools/cli/gui_commands.py`),而上面这条 Visual Studio CMake 多配置构建命令会把可执行文件生成在 **`build\quirrel-cli\bin\Release\sq.exe`**。因此运行 `check-gui` 时请像上方命令一样显式传入 `--sq "build\quirrel-cli\bin\Release\sq.exe"`(或者手动把生成的 `sq.exe` 复制一份到 `build\quirrel-check\sq.exe`)。
---
## 4. 提交消息规范与 PR 自查清单
- **一笔 PR 只聚焦一个清晰目标**:不要在修某个结算 Bug 的 PR 里顺手重排无关目录或大面积格式化其他文件。
- **全英文约定式提交(Conventional Commits)与英文注释**:
- 提交标题格式:`type(scope): concise summary`(例如 `fix(battle): credit Ground Arcade air event kills from AI victims`、`feat(launcher): show missing optional patch features`;仓库级工程或文档改动用 `repo` 或 `docs`);
- 若包含破坏性变更,在 `scope` 后加 `!` 并在正文末尾附上 `BREAKING CHANGE:` 说明;
- 代码注释、补丁顶部三行说明、补丁 `title` 与 Git 提交消息正文统一使用英文;
- `Co-authored-by` 尾注仅用于署名实际参与协作的人类开发者,不要填写 AI 模型或编程工具。
- **发起 PR 前最后 5 项自检**:
1. 对照 [开发规范第 4 节](development-rules.md#good-vs-bad-zh):零硬编码 RVA/结构体偏移/`_ReturnAddress()`、零手抄游戏静态数值、零越层 I/O;
2. 核对语法与 Schema 细节:TS 相对导入全部带 `.ts` 后缀且遵守 `erasableSyntaxOnly`;补丁 JSONC 无多余未知键(特别是 `patches/gui/**/patch.jsonc` 未误写 `requires`);带尾随立即数的 `rel32` 捕获已显式填写 `"end"`;
3. 涉及货币、研发、库存或存档改动时,确认所有修改均通过 `PlayerProfiles` / `SaveStore` **先完成原子写盘再向客户端返回响应**,且多账号目录严格隔离;
4. 通读一遍 `git diff`,确认没有带入任何本机个人路径、原版游戏文件、解包产物、测试存档或未脱敏日志;
5. 完整填写 [PR 模板](templates/pull-request.md),如实列出实际运行过的命令与输出结论,并把「已在隔离副本实机验收的界面步骤」与「尚待维护者实机验收的步骤」明确区分开。
---
<a id="english"></a>
[简体中文](#zh-cn) · English · [Back to Dev Docs](README.md#english)
This guide walks you through setting up a Windows x64 development environment, diagnosing bugs rapidly with auto-decoded local traffic logs, and running the required verification checks before opening a Pull Request.
---
## 1. Environment Setup
You need a **Windows x64** machine with:
1. **Node.js 24+**: Repository CLI scripts and `apps/server` execute `.ts` files directly via Node 24's native type-stripping (older Node 20/22 releases will fail on `.ts` import specifiers).
2. **Visual Studio 2022 or Build Tools (with "Desktop development with C++" x64 tools & CMake)**: Used by `native/wto-net/build.ps1` (`cl.exe`) to build `wto_ws.dll` and once to compile the Quirrel bytecode checker `sq.exe`.
3. **Python 3.12+**: Used for the patch verifier (`wtotools`), static disassembler (`tools/re/cli.py`), and `.clog` log decryptor.
4. **Your own legitimate stock War Thunder installation (kept strictly read-only)**, plus a separate **offline copy folder** and **server data folder** located outside any Steam library directory.
After cloning the repository, bootstrap everything from the repo root:
```powershell
# 1. Install npm workspace dependencies
npm install
# 2. Compile the Winsock redirector & LocalMP host bridge -> build\native\wto_ws.dll
powershell -NoProfile -File .\native\wto-net\build.ps1
# 3. Download the Electron runtime binary for the desktop launcher
node node_modules/electron/install.js
# 4. Create the Python virtual environment and install `wtotools` in editable mode
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ./tools
```
To build an offline game copy and run the local server directly from the terminal without the desktop launcher (note: pass the **read-only stock folder** to `build-game-copy.ts --game`, pass the **offline copy folder** to `cli.ts --game`, and keep `--data` and `--port` identical across both commands):
```powershell
node scripts/build-game-copy.ts --game "<stock-dir>" --out "<copy-dir>" --data "<data-dir>" --port 27015
node apps/server/src/cli.ts --game "<copy-dir>" --data "<data-dir>" --port 27015
```
---
<a id="debugging-en"></a>
## 2. Traffic Log Debugging & Diagnostic Logs
Never guess what payload the game client sent or why a hangar action failed—WTOffline records human-readable diagnostics across four log locations:
### 2.1 Local Server Traffic Logs: `<data-dir>/logs/<ISO-timestamp>/` (Check Here First!)
Every time `apps/server` starts, `TrafficLog` (`apps/server/src/traffic-log/traffic-log.ts`) creates a timestamped session folder under `<data-dir>/logs/` containing:
1. **`requests.jsonl` (Indexed Exchange Log)**
One JSON line per HTTP request/response (`kind: "http"`), matching message (`kind: "matching"`), refused WebSocket upgrade (`kind: "websocket"`), or TCP connection open/close, numbered sequentially by `id`:
- **Spot missing endpoints instantly**: Search `requests.jsonl` for `"unhandled":true` (or look for `[UNHANDLED]` in the server console) to immediately see any unimplemented `char` action, `yuplay2` endpoint, or `matching` RPC!
- Each entry's `files` object points directly to its corresponding payload files inside `bodies/`.
2. **`bodies/` Subdirectory (Auto-Decoded Readable BLK & JSON Payloads!)**
Numbered by zero-padded sequence ID (e.g., `000042.*`):
- `000042.req.bin` / `000042.resp.bin`: Raw wire bytes (with sign-in passwords automatically redacted);
- **`000042.req.txt` / `000042.resp.txt`**: **Automatically unpacked and formatted readable BLK text** (covering `0x69`/zlib/zstd-framed `char` binary BLK payloads as well as multi-chunk `PBBD` streams on `cln_bulk_set_gblk`!) or UTF-8 JSON/form text—open any `.txt` file directly in your editor to inspect exact block trees and parameter types without manual decoding;
- **`000042.matching-in.json` / `000042.matching-out.json`**: Decrypted, LZ4-decompressed inbound (`in`) and outbound (`out`) `matching` binary RPC messages.
### 2.2 The Other Three Diagnostic Logs
- **Native Hook & `LocalMP` Log: `<copy-dir>/win64/wto_ws.log`**
Rewritten on every client launch by `wto_ws.dll`. Logs the active local port, every locally answered hostname and redirected/refused socket, whether `wto_ws.cfg` matched the running `aces.exe` PE `TimeDateStamp` / `SizeOfImage`, and **which of the 11 `local_mp_*` modules installed vs. were skipped** (naming the exact missing `wto_ws.cfg` key when skipped), plus live battle referee events.
- **Dagor Client Log: `<copy-dir>/.game_logs/*.clog`**
Records Quirrel script compilation/runtime errors, exact call stacks behind `"Loading..."` login hangs, mission errors, and missing assets. Because `.clog` files are XOR-encrypted binary logs, decrypt them to plain text with `tools/re/cli.py`:
```powershell
.\.venv\Scripts\python.exe tools\re\cli.py decrypt-clog "<copy-dir>\.game_logs\<latest>.clog" --out "<temp-dir>\game.clog.txt"
```
- **Desktop Launcher Log: `launcher.log`**
Accessible from Launcher **Settings -> Diagnostics -> Open log folder**, covering copy builds, patch-pack checks, server process lifecycle, and updater activity.
---
<a id="checks-en"></a>
## 3. Required Checks Before Submitting
WTOffline **does not require or encourage large mock unit test suites**. Instead, run the real compiler, binary-patch, and Quirrel bytecode verifiers matching the files you touched, followed by live acceptance in an isolated game copy:
| What you changed | Required checks before opening a PR |
| --- | --- |
| `packages/*`, `apps/server`, or `scripts/*` | Root `npm run typecheck`; if you touched server startup or `tuning/*.jsonc`, boot `apps/server/src/cli.ts` against a temporary data folder to confirm clean dataset extraction and tuning validation |
| `apps/launcher` | Launcher `typecheck` + `electron-vite build`; if you edited UI strings, verify `en.json` and `zh-CN.json` locale key parity |
| `patches/exe/` (any `patch.jsonc`) | `wtotools check-patches` (verifies unique signature hits, `expect_original` bytes, and exact byte-for-byte agreement between `asm`/`data` and `bytes`) |
| `patches/gui/` (any `patch.jsonc` or `.nut` fragment) | **Full** `wtotools check-gui` using `sq.exe` `compilestring` (required) + a temporary copy build to confirm zero unknown schema keys in `gui-patch-definition.ts` |
| `native/wto-net/` or `patches/native/` | MSVC `native\wto-net\build.ps1` (`/W4`, **zero warnings**) + temporary `scripts/build-game-copy.ts` run confirming every native module resolves cleanly |
| Adapting a new client build (`patches/versions/`) | `scripts/record-game-version.ts` + all applicable checks above + **live in-game verification in an isolated copy (hangar login + `LocalMP` battle)** before committing `patches/versions/<version>.jsonc` |
Complete command reference (run from the repository root, substituting bracketed paths):
```powershell
# 1. TypeScript typecheck & Node 24 erasable-syntax checks (.ts extensions, import type, etc.)
npm run typecheck
npm run typecheck --workspace "@wto/launcher"
npm run build --workspace "@wto/launcher"
# 2. EXE & GUI patch verification (always point at your READ-ONLY stock folder!)
.\.venv\Scripts\python.exe -m wtotools.cli check-patches --exe "<stock-dir>\win64\aces.exe"
.\.venv\Scripts\python.exe -m wtotools.cli check-gui --gui "<stock-dir>\gui.vromfs.bin" --sq "build\quirrel-cli\bin\Release\sq.exe"
# 3. Native DLL build (MSVC /W4 zero warnings) & temporary offline copy build
powershell -NoProfile -File .\native\wto-net\build.ps1
node scripts/build-game-copy.ts --game "<stock-dir>" --out "<temp-copy-dir>" --data "<temp-data-dir>" --port 27015
# 4. Client build compatibility record
node scripts/record-game-version.ts --game "<stock-dir>"
```
<a id="quirrel-en"></a>
### One-Time Build of the Quirrel Bytecode Compiler `sq.exe` (Note the `--sq` Flag!)
`check-gui` requires the official Quirrel compiler pinned to the revision matching War Thunder's client VM ([Quirrel commit `19f17df9b6ee43c91ef5c635fd45970ec76c5dbe`](https://github.com/GaijinEntertainment/quirrel/tree/19f17df9b6ee43c91ef5c635fd45970ec76c5dbe)). Build it once with Visual Studio 2022 C++ tools and CMake:
```powershell
git clone https://github.com/GaijinEntertainment/quirrel.git build/quirrel-source
git -C build/quirrel-source checkout --detach 19f17df9b6ee43c91ef5c635fd45970ec76c5dbe
cmake -S build/quirrel-source -B build/quirrel-cli -G "Visual Studio 17 2022" -A x64
cmake --build build/quirrel-cli --config Release --target sq
```
> **Important note on `--sq`**: `wtotools check-gui` defaults `--sq` to `build/quirrel-check/sq.exe` (`tools/src/wtotools/cli/gui_commands.py`), whereas the multi-config Visual Studio CMake build above outputs **`build\quirrel-cli\bin\Release\sq.exe`**. Always pass `--sq "build\quirrel-cli\bin\Release\sq.exe"` explicitly as shown in the command block above (or copy `sq.exe` to `build\quirrel-check\sq.exe`).
---
## 4. Commit Conventions & Pre-PR Checklist
- **One focused goal per PR**: Avoid mixing unrelated refactors or repo-wide formatting into a bugfix or feature PR.
- **English Conventional Commits & English code comments**:
- Format commit titles as `type(scope): concise summary` (e.g., `fix(battle): credit Ground Arcade air event kills from AI victims`, `feat(launcher): show missing optional patch features`; use `repo` or `docs` for repository-level or documentation changes);
- Mark breaking changes with `!` after the scope and a `BREAKING CHANGE:` footer;
- Write all code comments, 3-line patch header comments, patch `title` fields, and commit bodies in English;
- Reserve `Co-authored-by` trailers strictly for human collaborators—never list AI models or coding tools.
- **Final 5-point self-check before opening a PR**:
1. Check against [Development Rules — Section 4](development-rules.md#good-vs-bad-en): zero hardcoded RVAs, struct offsets, or `_ReturnAddress()` checks; zero hardcoded stock game numbers; zero cross-layer I/O;
2. Verify syntax & schema discipline: explicit `.ts` extensions on relative imports, `import type` for types, no `enum`/`namespace`/parameter properties; strict patch JSONC keys (no `requires` in `patches/gui/**/patch.jsonc`, explicit `"end"` on `rel32` captures with trailing immediates);
3. For currency, research, inventory, or profile mutations, verify changes persist atomically via `PlayerProfiles` / `SaveStore` **before** replying to the client, with strict per-account isolation;
4. Review `git diff` to ensure zero personal machine paths, copyrighted game files, extracted stock scripts, personal saves, or unredacted logs slipped in;
5. Fill out the [PR template](templates/pull-request.md) completely, recording exact commands run and clearly separating observed in-game checks from pending in-game acceptance steps.