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

593 lines
18 KiB
JSON

// Unit deaths and kill attribution on the LocalMP host (native/wto-net/src/local_mp_kills.c):
// scoreboard counters and battle score for every MPlayer, the local player's kills as award facts.
// Without it: kills and deaths are not counted in LocalMP battles.
{
"module": "local_mp_kills",
"features": [
"K-Kill, assist and capture scoring",
"K-Scoreboard"
],
"requires": [
"local_mp_core",
"local_mp_awards",
"local_mp_scores"
],
"sites": {
// MPlayer::addScore.
// 2.61.0.37: 0x59f2d0
"mplayer_add_score": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 56 57 55 53 48 81 ec 88 00 00 00 0f 29 7c 24 70 0f 29 74 24 60 48 89 ce 44 89 c0 f3 0f 2a 84 81 fc 08 00 00 0f 28 f9 f3 0f 58 c1 f3 0f 2c c8 89 8c 86 fc 08 00 00"
}
}
]
},
// MPlayer battle score.
// 2.61.0.37: 0x59f30d (cvtsi2ss xmm0, dword ptr [rsi + 0x8f8]; addss xmm0, xmm1)
"mplayer_score": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "mplayer_add_score",
"pattern": "f3 0f 2a 86 ?? ?? ?? ?? f3 0f 58 c1",
"captures": {
"score": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer stats replication field and payload.
// 2.61.0.37: 0x59f5f8 (lea rcx, [rsi + 0xa10]; lea r8, [rsi + 0xa30]; mov rdx, rsi; ...)
"mplayer_stat_sync": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "mplayer_add_score",
"pattern": "48 8d 8e ?? ?? ?? ?? 4c 8d 86 ?? ?? ?? ?? 48 89 f2 e8 ?? ?? ?? ?? 0f 57 c0",
"captures": {
"dirty": {
"offset": 3,
"type": "u32"
},
"payload": {
"offset": 10,
"type": "u32"
}
}
}
}
]
},
// Replicated field setter that marks it dirty.
// 2.61.0.37: 0x31030a0
"net_mark_dirty": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "56 57 53 48 83 ec 40 81 7a 20 44 4e 45 54 0f 85 ?? ?? ?? ?? 48 89 ce 0f b7 41 02 a8 02 75 ?? f6 42 48 02 75 ?? a8 01 75 ?? 4c 89 c7 83 c8 01 66 89 46 02"
}
}
]
},
// onUnitDeadOnce; skips units flagged at +0x3058.
// 2.61.0.37: 0xe5b200
"on_unit_dead_once": {
"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 01 00 00 44 0f 29 84 24 80 01 00 00 0f 29 bc 24 70 01 00 00 0f 29 b4 24 60 01 00 00 80 b9 58 30 00 00 00 0f 85 ?? ?? ?? ?? 48 89 ce 48 8d 54 24 38 e8 ?? ?? ?? ?? 66 83 7c 24 38 ff",
"captures": {
"skip_kill": {
"offset": 46,
"type": "u32"
}
}
}
}
]
},
// Unit severe damage offender: index, user id, player id.
// 2.61.0.37: 0xe5b2c7 (movzx r8d, word ptr [rsi + 0x6b0]; cmp r8w, -1; je 0xe5b340; ...)
"unit_severe": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "on_unit_dead_once",
"pattern": "44 0f b7 86 ?? ?? ?? ?? 66 41 83 f8 ff 74 ?? 4c 8b 8e ?? ?? ?? ?? 49 83 f9 ff 0f 95 c1 44 0f b6 96 ?? ?? ?? ??",
"captures": {
"severe_idx": {
"offset": 4,
"type": "u32"
},
"severe_uid": {
"offset": 18,
"type": "u32"
},
"severe_pid": {
"offset": 33,
"type": "u32"
}
}
}
}
]
},
// IGroundModel death guards.
// 2.61.0.37: 0x427490 (cmp byte ptr [rsi + 0x2101], 0; jne 0x42846f; cmp byte ptr [rsi + 0x1c19], 0)
"ground_death_flags": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "iground_on_dead",
"pattern": "80 be ?? ?? ?? ?? 00 0f 85 ?? ?? ?? ?? 80 be ?? ?? ?? ?? 00",
"captures": {
"already_dead": {
"offset": 2,
"type": "u32"
},
"dead_silent": {
"offset": 15,
"type": "u32"
}
}
}
}
]
},
// IGroundModel crew bailed out.
// 2.61.0.37: 0x427a61 (cmp byte ptr [rsi + 0x3888], 0; jne 0x427d8c; mov rcx, qword ptr [rsp + 0x130])
"ground_bailout": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "iground_on_dead",
"pattern": "80 be ?? ?? ?? ?? 00 0f 85 ?? ?? ?? ?? 48 8b 8c 24 30 01 00 00",
"captures": {
"bailout_dead": {
"offset": 2,
"type": "u32"
}
}
}
}
]
},
// IGroundModel offender list and the embedded killer record.
// 2.61.0.37: 0x427aad (cmp word ptr [rsi + 0x8c], 5; jne 0x427bc0; mov ecx, dword ptr [rsi + 0x17d0]; ...)
"ground_offenders": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "iground_on_dead",
"pattern": "66 83 be ?? ?? ?? ?? 05 0f 85 ?? ?? ?? ?? 8b 8e ?? ?? ?? ?? 48 85 c9 0f 84 ?? ?? ?? ?? 48 8b 86 ?? ?? ?? ?? 48 69 c9 ?? ?? ?? ?? 48 8b 96 ?? ?? ?? ?? 48 83 fa ff 41 0f 95 c3 44 0f b7 86 ?? ?? ?? ?? 44 0f b6 8e ?? ?? ?? ??",
"captures": {
"unit_type": {
"offset": 3,
"type": "u32"
},
"offenders_count": {
"offset": 16,
"type": "u32"
},
"offenders": {
"offset": 32,
"type": "u32"
},
"offender_size": {
"offset": 39,
"type": "u32"
},
"killer_uid": {
"offset": 46,
"type": "u32"
},
"killer": {
"offset": 62,
"type": "u32"
},
"killer_pid": {
"offset": 70,
"type": "u32"
}
}
}
}
]
},
// IGroundModel::awardAssists; calls the unit chooseOffender virtual first.
// 2.61.0.37: 0x465540
"iground_award_assists": {
"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 01 00 00 44 0f 29 94 24 90 01 00 00 44 0f 29 8c 24 80 01 00 00 44 0f 29 84 24 70 01 00 00 0f 29 bc 24 60 01 00 00 0f 29 b4 24 50 01 00 00 48 89 ce 48 8b 01 48 8d 54 24 28 41 b0 01 ff 90 98 04 00 00",
"captures": {
"choose_offender": {
"offset": 78,
"type": "u32"
}
}
}
}
]
},
// Offender army, user id and player id.
// 2.61.0.37: 0x465832 (movzx eax, byte ptr [rsi + 0x1010]; cmp dword ptr [r14 + 0x1c], eax; je 0x465620; ...)
"offender_fields": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "iground_award_assists",
"pattern": "0f b6 86 ?? ?? ?? ?? 41 39 46 ?? 0f 84 ?? ?? ?? ?? 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 49 8b 56 ?? 48 83 fa ff 41 0f 95 c0 41 0f b6 46 ??",
"captures": {
"unit_army": {
"offset": 3,
"type": "u32"
},
"army": {
"offset": 10,
"type": "u8"
},
"uid": {
"offset": 33,
"type": "u8"
},
"pid": {
"offset": 46,
"type": "u8"
}
}
}
}
]
},
// MPlayer "kills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f0e4 (movsx r8d, word ptr [rsi + 0x9d8]; mov rcx, r14; lea rdx, [rip + 0x6614963])
"stat_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "kills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "groundKills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f0fb (movsx r8d, word ptr [rsi + 0x9de]; mov rcx, r14; lea rdx, [rip + 0x6614b0a])
"stat_ground_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "groundKills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "humanKills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f112 (movsx r8d, word ptr [rsi + 0x9e0]; mov rcx, r14; lea rdx, [rip + 0x66149da])
"stat_human_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "humanKills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "navalKills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f129 (movsx r8d, word ptr [rsi + 0x9e2]; mov rcx, r14; lea rdx, [rip + 0x6614a3b])
"stat_naval_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "navalKills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "teamKills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f140 (movsx r8d, word ptr [rsi + 0x9da]; mov rcx, r14; lea rdx, [rip + 0x6614a01])
"stat_team_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "teamKills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "aiKills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f157 (movsx r8d, word ptr [rsi + 0x9e4]; mov rcx, r14; lea rdx, [rip + 0x6614a84])
"stat_ai_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "aiKills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "aiGroundKills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f16e (movsx r8d, word ptr [rsi + 0x9e6]; mov rcx, r14; lea rdx, [rip + 0x6614ade])
"stat_ai_ground_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "aiGroundKills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "aiNavalKills" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f185 (movsx r8d, word ptr [rsi + 0x9e8]; mov rcx, r14; lea rdx, [rip + 0x6614a21])
"stat_ai_naval_kills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "aiNavalKills",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "assists" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f19c (movsx r8d, word ptr [rsi + 0x9ec]; mov rcx, r14; lea rdx, [rip + 0x65fb6b2])
"stat_assists": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "assists",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "deaths" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f1b3 (movsx r8d, word ptr [rsi + 0x9dc]; mov rcx, r14; lea rdx, [rip + 0x6618733])
"stat_deaths": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "deaths",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "captureZone" counter, read where the scoreboard row writes it.
// 2.61.0.37: 0x111f1ca (movsx r8d, word ptr [rsi + 0x9ee]; mov rcx, r14; lea rdx, [rip + 0x67096a5])
"stat_capture_zone": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "captureZone",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 11,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer scoreboard score: the larger of the short score and the battle score.
// 2.61.0.37: 0x111f1f7 (movsx r8d, word ptr [rsi + 0x2d8]; mov eax, dword ptr [rsi + 0x8f8]; cmp eax, r8d; ...)
"stat_score": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "score",
"pattern": "44 0f bf 86 ?? ?? ?? ?? 8b 86 ?? ?? ?? ?? 44 39 c0 44 0f 4f c0 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 24,
"captures": {
"fallback": {
"offset": 4,
"type": "u32"
},
"score": {
"offset": 10,
"type": "u32"
}
}
}
}
]
},
// MPlayer "awardDamage" counter.
// 2.61.0.37: 0x111f21b (mov r8d, dword ptr [rsi + 0xa00]; mov rcx, r14; lea rdx, [rip + 0x67392d6])
"stat_award_damage": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "awardDamage",
"pattern": "44 8b 86 ?? ?? ?? ?? 4c 89 f1 48 8d 15 ?? ?? ?? ??",
"lea_at": 10,
"captures": {
"field": {
"offset": 3,
"type": "u32"
}
}
}
}
]
},
// MPlayer "airSevereDamage" counter.
// 2.61.0.37: 0x129349c (movsx rax, word ptr [rdi + 0xa06]; mov qword ptr [rsp + 0x30], rax; mov byte ptr [rsp + 0x20], 0; ...)
"stat_air_severe": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "airSevereDamage",
"pattern": "48 0f bf 87 ?? ?? ?? ?? 48 89 44 24 30 c6 44 24 20 00 48 8d 15 ?? ?? ?? ??",
"lea_at": 18,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// MPlayer "shipSevereDamage" counter.
// 2.61.0.37: 0x12934c8 (movsx rax, word ptr [rdi + 0xa08]; mov qword ptr [rsp + 0x30], rax; mov byte ptr [rsp + 0x20], 0; ...)
"stat_ship_severe": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "string_ref",
"string": "shipSevereDamage",
"pattern": "48 0f bf 87 ?? ?? ?? ?? 48 89 44 24 30 c6 44 24 20 00 48 8d 15 ?? ?? ?? ??",
"lea_at": 18,
"captures": {
"field": {
"offset": 4,
"type": "u32"
}
}
}
}
]
}
}
}