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. BREAKING CHANGE: Each patch needs a variants list. Move executable locators into patch.jsonc and regenerate game version records with record-game-version.ts.
36 lines
1.3 KiB
JSON
36 lines
1.3 KiB
JSON
// Import wto_ws.dll instead of WS2_32.dll; it forwards every export and redirects lookups and connections.
|
|
// Why the executable: many Gaijin addresses, ports and schemes are constants with no configuration entry.
|
|
// Without it: hard-coded https endpoints try the real internet and purchases/redeem codes never reach the local server.
|
|
{
|
|
"id": "online/network-hook-library",
|
|
"title": "让游戏加载离线版的网络钩子库 wto_ws.dll(代替直接加载 WS2_32.dll),把所有联网都接到本地服务器",
|
|
"features": [
|
|
"A-No Gaijin connections",
|
|
"A-Isolation from the official game",
|
|
"G-Store",
|
|
"G-Redeem codes"
|
|
],
|
|
"requires": [],
|
|
"variants": [
|
|
// The import name "WS2_32.dll" with its terminating zero, 11 bytes.
|
|
// 2.61.0.37: unique hit at 0x7a4b090 (referenced by the import descriptor Name field).
|
|
{
|
|
"written_for": "2.61.0.37",
|
|
"locate": {
|
|
"method": "signature",
|
|
"section": ".rdata",
|
|
"pattern": "57 53 32 5f 33 32 2e 64 6c 6c 00"
|
|
},
|
|
"edit": {
|
|
"offset": 0,
|
|
"data": {
|
|
"encoding": "ascii",
|
|
"text": "wto_ws.dll"
|
|
},
|
|
"bytes": "77 74 6f 5f 77 73 2e 64 6c 6c 00",
|
|
"expect_original": "57 53 32 5f 33 32 2e 64 6c 6c 00"
|
|
}
|
|
}
|
|
]
|
|
}
|