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

212 lines
6.2 KiB
JSON

// Player state on the LocalMP host (native/wto-net/src/local_mp_players.c): team from the hangar
// country, GUI states, crew slots used, spare vehicles.
// Without it: the player cannot pick a vehicle or spawn in a LocalMP battle.
{
"module": "local_mp_players",
"features": [
"K-Spawn score and respawns"
],
"requires": [
"local_mp_core"
],
"sites": {
// MPlayer::initFromMatching.
// 2.61.0.37: 0x59e660
"mplayer_init_matching": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 56 56 57 55 53 48 81 ec e0 00 00 00 48 89 d7 48 89 ce 48 89 91 90 0c 00 00 48 8d 8c 24 88 00 00 00 0f 57 c0 0f 11 84 24 b8 00 00 00 0f 11 84 24 a8 00 00 00 0f 11 84 24 98 00 00 00"
}
}
]
},
// is_crew_slot_was_ready_at_host.
// 2.61.0.37: 0x17a31d0
"is_slot_ready_at_host": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 56 56 57 55 53 48 81 ec a0 00 00 00 0f 29 b4 24 90 00 00 00 44 89 c3 48 89 d6 48 83 3d"
}
}
]
},
// MPlayer GUI state byte.
// 2.61.0.37: 0x155f6f1 (movzx r15d, byte ptr [rdi + 0x640]; movsxd r12, esi; lea rax, [rip + 0x5d757fd])
"mplayer_gui_state": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "set_player_gui_state",
"pattern": "44 0f b6 bf ?? ?? ?? ?? 4c 63 e6 48 8d 05 ?? ?? ?? ??",
"captures": {
"gui_state": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer::clearBeforeLobby.
// 2.61.0.37: 0x599680 (push r15; push r14; push r13; ...)
"mplayer_clear_before_lobby": {
"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 98 00 00 00 0f 29 b4 24 80 00 00 00 48 89 ce 83 b9 0c 0c 00 00 00"
}
}
]
},
// MPlayer used spare vehicles mask, reset after the broken slots mask.
// 2.61.0.37: 0x59a102 (cmp dword ptr [rsi + 0x520], 0; je 0x59a129; lea rcx, [rsi + 0x500])
"mplayer_used_spares": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "mplayer_clear_before_lobby",
"pattern": "83 be ?? ?? ?? ?? 00 74 ?? 48 8d 8e 00 05 00 00",
"captures": {
"used_spares": {
"offset": 2,
"type": "u32"
}
}
}
}
]
},
// Scoreboard row writer (refers to "airSevereDamage").
// 2.61.0.37: 0x12929f0
"scoreboard_rows": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "airSevereDamage",
"target": "function"
}
}
]
},
// The controlled unit eid, falling back to the player's own unit eid.
// 2.61.0.37: 0x1292bfb (mov edx, dword ptr [rdi + 0x880]; lea r8, [rdi + 0x854]; test edx, edx; ...)
"mplayer_unit_eid": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "scoreboard_rows",
"pattern": "8b 97 ?? ?? ?? ?? 4c 8d 87 54 08 00 00 85 d2 4c 0f 45 c1 48 8d 8f 48 08 00 00 0f 44 97 ?? ?? ?? ??",
"captures": {
"controlled_eid": {
"offset": 2,
"type": "u32"
},
"unit_eid": {
"offset": 29,
"type": "u32"
}
}
}
}
]
},
// MissionSettings allies country.
// 2.61.0.37: 0x1277500 (mov rcx, qword ptr [rcx + 0xd0]; jmp 0x127751f; xor r10d, r10d)
"mission_allies_country": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "get_player_country",
"pattern": "48 8b 89 ?? ?? ?? ?? eb ?? 45 31 d2",
"captures": {
"allies_country": {
"offset": 3,
"type": "u32"
}
}
}
}
]
},
// MissionSettings axis country.
// 2.61.0.37: 0x1277518 (mov rcx, qword ptr [rcx + 0xc8]; test rcx, rcx; lea r10, [rip + 0x67c23d8])
"mission_axis_country": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "get_player_country",
"pattern": "48 8b 89 ?? ?? ?? ?? 48 85 c9 4c 8d 15 ?? ?? ?? ??",
"captures": {
"axis_country": {
"offset": 3,
"type": "u32"
}
}
}
}
]
},
// MissionSettings arcade country mode.
// 2.61.0.37: 0x127748a (cmp byte ptr [rcx + 0x1d0], 1; jne 0x12774ee; movzx ecx, byte ptr [r10 + 0x250])
"mission_arcade_country": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "get_player_country",
"pattern": "80 b9 ?? ?? ?? ?? 01 75 ?? 41 0f b6 8a 50 02 00 00",
"captures": {
"arcade_country": {
"offset": 2,
"type": "u32"
}
}
}
}
]
},
// MissionSettings customBots.
// 2.61.0.37: 0x126ef8d (lea rdi, [rsi + 0x718]; mov rcx, rdi; call 0x3093970)
"mission_custom_bots": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "mission_settings_load",
"pattern": "48 8d be ?? ?? ?? ?? 48 89 f9 e8 ?? ?? ?? ??",
"captures": {
"custom_bots": {
"offset": 3,
"type": "u32"
}
}
}
}
]
}
}
}