Files
WT-Offline/patches/exe/isolation/user-data-folder-name/patch.jsonc
T
N0VAN0M4LY b819912733 Let each patch carry variants written for different game builds
A game update used to fail a patch whenever any byte it compared moved, even
when only an address in the instruction changed. Patch definitions now say
what a change needs and read the rest from the code:

- patch.jsonc holds a list of variants, each written for one game build
  (written_for) with its own locate block and edit; locate.jsonc is merged
  into it. Exactly one variant must apply, otherwise the patch is left out.
  GUI script patches use the same variants rule.
- expect_original and the bytes to write use the signature syntax, so
  addresses that differ between builds can be wildcards.
- A locate block can capture values at the site (rel32 targets, immediates,
  displacements); a rel32 fixup fills a hole in the written bytes from a
  capture. allow-local-host-bot-spawns now jumps to the target of the
  conditional jump it replaces instead of a stored distance, which makes it
  apply to 2.61.0.43 as well.
- verified_on is gone from the definitions. patches/versions/<version>.jsonc
  records, per checked game build, which variant of every patch applies and
  where; scripts/record-game-version.ts writes it and the launcher reads the
  recorded versions from there.

The Python tools (check-patches, patch-exe, check-gui) read the same format;
check-patches assembles a variant whose assembly names captures at the site
it was located at.

Checked: root and launcher type checks; check-patches and check-gui on
2.61.0.37 and 2.61.0.43 (12 exe and 35 GUI patches each); check-patches and
check-gui report a deliberately broken patch with a non-zero exit;
build-game-copy from 2.61.0.43 into a temporary folder. The computed bytes of
allow-local-host-bot-spawns on 2.61.0.37 equal the bytes it stored before.
2026-11-29 11:47:08 +08:00

34 lines
1.2 KiB
JSON

// Rename the game from WarThunder to WTOffline, which moves every per-user data folder.
// Why the executable: the engine derives Documents/AppData folders from this constant name.
// Without it: the offline client reads and rewrites the retail client's settings.
{
"id": "isolation/user-data-folder-name",
"title": "把游戏名从 WarThunder 改成 WTOffline,让离线版的用户数据目录和正版分开",
"features": [
"A-Isolation from the official game"
],
"requires": [],
"variants": [
// "WarThunder" with the preceding string terminator and the following "War Thunder", 24 bytes,
// so the hit is the copy referenced by the game identity table.
// 2.61.0.37: unique hit at 0x777eb96, string at 0x777eb97.
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"section": ".rdata",
"pattern": "00 57 61 72 54 68 75 6e 64 65 72 00 57 61 72 20 54 68 75 6e 64 65 72 00"
},
"edit": {
"offset": 1,
"data": {
"encoding": "ascii",
"text": "WTOffline"
},
"bytes": "57 54 4f 66 66 6c 69 6e 65 00",
"expect_original": "57 61 72 54 68 75 6e 64 65 72"
}
}
]
}