Files
WT-Offline/patches/native/local_mp_nuke.jsonc
T
N0VAN0M4LY dde852e2b1 feat(patcher): resolve native LocalMP values from patch definitions
The LocalMP modules of wto_ws.dll scanned for 42 functions at start-up and
used about a hundred structure offsets compiled in as constants, so a game
update could move a field without anything noticing. Their needs are now
definitions under patches/native/<module>.jsonc, resolved by the patcher when
it builds the game copy, the same way exe patches are located:

- Locate methods: "string_ref" finds code by the string it loads (optionally
  with a pattern around the lea, to read the field a scoreboard row stores
  under that name), and "within" searches a short pattern inside the function
  of a site located before it (function ranges from the exception directory).
- Each module lists its sites (functions, globals, call targets and the
  instructions whose captures give structure offsets), its features and the
  modules it requires. A module whose sites are not all found is reported
  like an unavailable patch, with the modules depending on it.
- The resolved values go into wto_ws.cfg as native.<site>[.<capture>] lines,
  with the executable's PE time stamp and image size so the library can
  refuse values resolved for another build.
- Version records include the native module variants and values.
- Patch-set folders: the patcher, the scripts and the launcher take the root
  of a patch set (exe, gui, native, versions) instead of separate folders.
- New feature tags K-Chat and radio and K-Nuclear bomb in both language packs.

The library still scans by itself; reading these values is the next change.

Checked: root and launcher type checks; all 10 modules resolve on 2.61.0.37,
where the 239 values equal what the drafting tool read with a disassembler, and
on 2.61.0.43, where every structure offset is unchanged except the GameSaveData
HUD event queue (0xae8 -> 0xb18); build-game-copy from 2.61.0.37 into a
temporary folder writes the values into wto_ws.cfg.
2026-11-29 12:15:30 +08:00

167 lines
5.2 KiB
JSON

// Nuclear strike ends the battle on the LocalMP host (native/wto-net/src/local_mp_nuke.c).
// Without it: a nuclear explosion does not win a LocalMP battle.
{
"module": "local_mp_nuke",
"features": [
"K-Nuclear bomb"
],
"requires": [
"local_mp_core",
"local_mp_awards"
],
"sites": {
// Bomb / shell launch.
// 2.61.0.37: 0x1431c10
"shell_launch": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 54 56 57 55 53 48 81 ec 30 02 00 00 44 0f 29 bc 24 20 02 00 00"
}
}
]
},
// The launch record (+0x18 of the launch) gets the instant-win flag.
// 2.61.0.37: 0x14332fd (mov rax, qword ptr [rsi + 0x18]; test rax, rax; jne 0x143330d; ...)
"shell_instant_win": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "shell_launch",
"pattern": "48 8b 46 ?? 48 85 c0 75 ?? 48 8b 06 48 89 46 18 c6 40 ?? 01",
"captures": {
"record": {
"offset": 3,
"type": "u8"
},
"instant_win": {
"offset": 18,
"type": "u8"
}
}
}
}
]
},
// Projectile explosion.
// 2.61.0.37: 0xbe7c00
"shell_explode": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 81 ec a8 02 00 00 44 0f 29 bc 24 90 02 00 00 44 0f 29 b4 24 80 02 00 00 44 0f 29 ac 24 70 02 00 00 44 0f 29 a4 24 60 02 00 00 44 0f 29 9c 24 50 02 00 00 44 0f 29 94 24 40 02 00 00 44 0f 29 8c 24 30 02 00 00 44 0f 29 84 24 20 02 00 00 0f 29 bc 24 10 02 00 00 0f 29 b4 24 00 02 00 00 41 89 d3"
}
}
]
},
// cta_logic_action (domination logic).
// 2.61.0.37: 0x11bc400
"cta_logic_action": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 81 ec a8 02 00 00 44 0f 29 bc 24 90 02 00 00 44 0f 29 b4 24 80 02 00 00 44 0f 29 ac 24 70 02 00 00 44 0f 29 a4 24 60 02 00 00 44 0f 29 9c 24 50 02 00 00 44 0f 29 94 24 40 02 00 00 44 0f 29 8c 24 30 02 00 00 44 0f 29 84 24 20 02 00 00 0f 29 bc 24 10 02 00 00 0f 29 b4 24 00 02 00 00 48 89 cf"
}
}
]
},
// Mission variables array of the logic context.
// 2.61.0.37: 0x11bc4f6 (lea rax, [rdi + 0x40]; mov r14d, dword ptr [rdi + 0x50]; test r14, r14; ...)
"mission_vars_data": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "cta_logic_action",
"pattern": "48 8d 47 ?? 44 8b 77 50 4d 85 f6 48 89 44 24 38",
"captures": {
"data": {
"offset": 3,
"type": "u8"
}
}
}
}
]
},
// Mission variables count; the walk keeps a pointer 8 bytes into each entry.
// 2.61.0.37: 0x11bd150 (mov ebx, dword ptr [rdi + 0x50]; test rbx, rbx; je 0x11bd250; ...)
"mission_vars_walk": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "mpTi0",
"pattern": "8b 5f ?? 48 85 db 0f 84 ?? ?? ?? ?? 48 8b 44 24 38 48 8b 30 4c 8d 7e ?? 4c 8d 35 ?? ?? ?? ??",
"lea_at": 24,
"captures": {
"count": {
"offset": 2,
"type": "u8"
},
"entry_bias": {
"offset": 23,
"type": "u8"
}
}
}
}
]
},
// Entry name and size.
// 2.61.0.37: 0x11bd180 (mov rcx, qword ptr [r15 - 8]; mov rdx, r14; call 0x6bdf490; ...)
"mission_vars_step": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "cta_logic_action",
"pattern": "49 8b 4f ?? 4c 89 f2 e8 ?? ?? ?? ?? 85 c0 74 ?? 49 83 c7 ?? 49 ff cc 75 ?? 45 31 ff c7 05 ?? ?? ?? ?? 00 00 00 00 49 8d 4f 08",
"captures": {
"name": {
"offset": 3,
"type": "i8"
},
"stride": {
"offset": 19,
"type": "u8"
}
}
}
}
]
},
// Entry value.
// 2.61.0.37: 0x11bd1a6 (lea rcx, [r15 + 8]; test r15, r15; lea rax, [rip + 0x69f6e0c]; ...)
"mission_vars_value": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "cta_logic_action",
"pattern": "49 8d 4f ?? 4d 85 ff 48 8d 05 ?? ?? ?? ?? 48 0f 44 c8 48 89 cd",
"captures": {
"value": {
"offset": 3,
"type": "u8"
}
}
}
}
]
}
}
}