Files
WT-Offline/patches/native/local_mp_actions.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

87 lines
2.4 KiB
JSON

// LocalMP construction and chat host (native/wto-net/src/local_mp_actions.c): both teams' countries
// and the AI vehicle pool, and an MPChat host that delivers the player's messages.
// Without it: each side has a single country, and chat messages are not delivered.
{
"module": "local_mp_actions",
"features": [
"K-AI opponents and teammates",
"K-Chat and radio"
],
"requires": [
"local_mp_core"
],
"sites": {
// Multiplayer::initMPChat.
// 2.61.0.37: 0x5bd6a0
"mp_init_chat": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 54 56 57 53 48 83 ec 48 48 89 d7 48 89 ce 48 8b 05 ?? ?? ?? ?? 48 85 c0 74 ?? c6 00 01 48 8b 9e 00 02 00 00"
}
}
]
},
// Multiplayer MPChat pointer.
// 2.61.0.37: 0x5bd732 (mov rbx, qword ptr [rsi + 0x1f0]; test rbx, rbx; je 0x5bd7e0)
"mp_chat": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "mp_init_chat",
"pattern": "48 8b 9e ?? ?? ?? ?? 48 85 db 0f 84 ?? ?? ?? ??",
"captures": {
"mp_chat": {
"offset": 3,
"type": "u32"
}
}
}
}
]
},
// BotSystem setup (refers to "botDeviationLimits").
// 2.61.0.37: 0x11af3f0
"bot_system_setup": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "botDeviationLimits",
"target": "function"
}
}
]
},
// Multiplayer country vectors of both teams.
// 2.61.0.37: 0x11afd9f (mov rbx, qword ptr [r10 + 0x150]; mov r14, qword ptr [r10 + 0x170])
"mp_team_countries": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "bot_system_setup",
"pattern": "49 8b 9a ?? ?? ?? ?? 4d 8b b2 ?? ?? ?? ??",
"captures": {
"team1_countries": {
"offset": 3,
"type": "u32"
},
"team2_countries": {
"offset": 10,
"type": "u32"
}
}
}
}
]
}
}
}