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

430 lines
13 KiB
JSON

// Vehicle selection on the LocalMP host (native/wto-net/src/local_mp_loadout.c): the client build has
// no receiver for SemChangeAircraftRequest, so the host builds the ChangeUnitReflection itself.
// Request fields with no reader in the client (respawn base, spare type) and the fuel member are
// kept in the module; see the module header.
// Without it: pressing "To battle!" in a LocalMP battle does nothing.
{
"module": "local_mp_loadout",
"features": [
"K-Spawn score and respawns"
],
"requires": [
"local_mp_core",
"local_mp_players"
],
"sites": {
// SemChangeAircraftRequest::send.
// 2.61.0.37: 0xccba20
"sem_change_aircraft_send": {
"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 f8 01 00 00 44 0f 29 84 24 e0 01 00 00 0f 29 bc 24 d0 01 00 00 0f 29 b4 24 c0 01 00 00 4c 89 cf 4c 89 c3 49 89 d7 48 89 ce 8b 05 ?? ?? ?? ?? 65 48 8b 0c 25 58 00 00 00"
}
}
]
},
// ChangeUnitReflection constructor.
// 2.61.0.37: 0xcccdc0
"refl_ctor": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "56 48 83 ec 50 0f 29 74 24 40 48 89 ce 66 c7 41 08 ff ff c7 41 0c ff ff ff ff 0f 57 f6 0f 11 71 10 c7 41 20 44 4e 45 54 0f 11 71 28 0f 11 71 38"
}
}
]
},
// DataBlock destructor.
// 2.61.0.37: 0x3093a60
"datablock_dtor": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 54 56 57 53 48 83 ec 38 0f 29 74 24 20 48 8b 41 18"
}
}
]
},
// BulletSetVec::assign.
// 2.61.0.37: 0x4f1410
"bullet_vec_assign": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 83 ec 58 4c 89 c5 49 89 d7 48 89 ce 4c 89 c3 48 29 d3 4c 8b 01 48 8b 41 10 4c 29 c0 48 39 c3 0f 86 ?? ?? ?? ?? 48 89 d9"
}
}
]
},
// GameSaveData::getDecalsBlk.
// 2.61.0.37: 0x2df9a0
"get_decals_blk": {
"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 88 00 00 00 44 0f 29 44 24 70 0f 29 7c 24 60 0f 29 74 24 50 4d 89 cf"
}
}
]
},
// GameSaveData::getAttachablesBlk.
// 2.61.0.37: 0x2e08f0
"get_attachables_blk": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 83 ec 38 48 89 d7 4d 85 c0"
}
}
]
},
// str_hash_fnv1.
// 2.61.0.37: 0x21b670
"str_hash_fnv1": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 56 56 57 53 49 89 d0 49 ba db 28 b4 a0 d1 7e 03 e7 48 83 fa 10 77 76"
}
}
]
},
// OAHashNameMap::addNameId.
// 2.61.0.37: 0xed4b0
"namemap_add_name_id": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 83 ec 38 44 89 cf 48 89 ce 80 79 4b 00"
}
}
]
},
// UnitCrewSkills::initFromSave.
// 2.61.0.37: 0x1032130
"crew_skills_init": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 56 56 57 55 53 48 81 ec 90 00 00 00 0f 29 b4 24 80 00 00 00 0f 28 f3"
}
}
]
},
// ChangeUnitReflection members the destructor frees: bullet sets, modification name maps, blocks.
// 2.61.0.37: 0x548f45 (mov rdi, qword ptr [rsi + 0x190]; mov rbx, qword ptr [rsi + 0x198]; cmp rdi, rbx; ...)
"refl_objects": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "refl_dtor",
"pattern": "48 8b be ?? ?? ?? ?? 48 8b 9e 98 01 00 00 48 39 df 0f 85 ?? ?? ?? ?? 48 85 ff 74 ?? 48 89 f9 e8 ?? ?? ?? ?? 48 8d 8e ?? ?? ?? ?? e8 ?? ?? ?? ?? 48 8d 8e ?? ?? ?? ?? e8 ?? ?? ?? ?? 48 8d 8e ?? ?? ?? ?? e8 ?? ?? ?? ?? 48 8d 8e ?? ?? ?? ?? e8 ?? ?? ?? ?? 48 8d 4e ??",
"captures": {
"bullets": {
"offset": 3,
"type": "u32"
},
"disabled_mods": {
"offset": 39,
"type": "u32"
},
"enabled_mods": {
"offset": 51,
"type": "u32"
},
"custom_preset": {
"offset": 63,
"type": "u32"
},
"attachables": {
"offset": 75,
"type": "u32"
},
"decals": {
"offset": 87,
"type": "u8"
}
}
}
}
]
},
// ChangeUnitReflection name strings the destructor frees.
// 2.61.0.37: 0x548fa2 (mov rdx, qword ptr [rsi + 0x68]; test rdx, rdx; je 0x548fb8; ...)
"refl_names": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "refl_dtor",
"pattern": "48 8b 56 ?? 48 85 d2 74 ?? 48 8b 0d ?? ?? ?? ?? 48 8b 01 ff 50 40 48 8b 56 ?? 48 85 d2 74 ?? 48 8b 0d ?? ?? ?? ?? 48 8b 01 ff 50 40 48 8b 56 ?? 48 85 d2 74 ?? 48 8b 0d ?? ?? ?? ?? 48 8b 01 ff 50 40 48 8b 56 ??",
"captures": {
"custom_skin": {
"offset": 3,
"type": "u8"
},
"skin": {
"offset": 25,
"type": "u8"
},
"weapon": {
"offset": 47,
"type": "u8"
},
"unit": {
"offset": 69,
"type": "u8"
}
}
}
}
]
},
// ChangeUnitReflection flags.
// 2.61.0.37: 0xff139a (mov eax, dword ptr [rdx + 0xd0]; test al, 0x20; jne 0xff13ad; ...)
"refl_flags": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "unit_change_aircraft",
"pattern": "8b 82 ?? ?? ?? ?? a8 20 75 ?? 83 c8 10",
"captures": {
"flags": {
"offset": 2,
"type": "u32"
}
}
}
}
]
},
// ChangeUnitReflection gun convergence.
// 2.61.0.37: 0xff13ce (movss xmm0, dword ptr [rdx + 0xdc]; movss dword ptr [rsp + 0x40], xmm0; movss xmm1, dword ptr [rsi + 0xb20])
"refl_targeting": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "unit_change_aircraft",
"pattern": "f3 0f 10 82 ?? ?? ?? ?? f3 0f 11 44 24 40 f3 0f 10 8e 20 0b 00 00",
"captures": {
"gun_convergence": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// ChangeUnitReflection vertical targeting.
// 2.61.0.37: 0xff140e (movzx eax, byte ptr [rdx + 0xe0]; mov byte ptr [rsp + 0x40], al; cmp byte ptr [rsi + 0xb48], al)
"refl_vertical_targeting": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "unit_change_aircraft",
"pattern": "0f b6 82 ?? ?? ?? ?? 88 44 24 40 38 86 48 0b 00 00",
"captures": {
"vertical_targeting": {
"offset": 3,
"type": "u32"
}
}
}
}
]
},
// ChangeUnitReflection bomb activation time.
// 2.61.0.37: 0xff1443 (movss xmm0, dword ptr [rdx + 0xe4]; movss dword ptr [rsp + 0x40], xmm0; movss xmm1, dword ptr [rsi + 0xb70])
"refl_bomb_fuse": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "unit_change_aircraft",
"pattern": "f3 0f 10 82 ?? ?? ?? ?? f3 0f 11 44 24 40 f3 0f 10 8e 70 0b 00 00",
"captures": {
"bomb_fuse": {
"offset": 4,
"type": "u32"
}
}
}
}
]
},
// Local MPlayer spawn point, delay and position read before respawning.
// 2.61.0.37: 0xc6c48a (mov edi, dword ptr [rax + 0xbd8]; mov esi, dword ptr [rax + 0xbf4]; movss xmm6, dword ptr [rax + 0xbfc]; ...)
"respawn_spawn": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "do_respawn_player",
"pattern": "8b b8 ?? ?? ?? ?? 8b b0 ?? ?? ?? ?? f3 0f 10 b0 ?? ?? ?? ?? f3 0f 10 b8 ?? ?? ?? ?? f3 44 0f 10 80 ?? ?? ?? ??",
"captures": {
"resp_base_id": {
"offset": 2,
"type": "u32"
},
"spawn_delay_a": {
"offset": 8,
"type": "u32"
},
"spawn_pos_x": {
"offset": 16,
"type": "u32"
},
"spawn_pos_y": {
"offset": 24,
"type": "u32"
},
"spawn_pos_z": {
"offset": 33,
"type": "u32"
}
}
}
}
]
},
// Unit::onEvent reading the owner MPlayer spawn state (base, both delays, position).
// 2.61.0.37: 0x1044ff1 (mov rax, qword ptr [r13 + 0xf98]; mov ebp, dword ptr [rax + 0xbd8]; mov r15d, dword ptr [rax + 0xbf4]; ...)
"unit_spawn_state": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "49 8b 85 ?? ?? ?? ?? 8b a8 ?? ?? ?? ?? 44 8b b8 ?? ?? ?? ?? 44 89 bc 24 80 00 00 00 8b b8 ?? ?? ?? ??",
"captures": {
"unit_mplayer": {
"offset": 3,
"type": "u32"
},
"resp_base_id": {
"offset": 9,
"type": "u32"
},
"spawn_delay_a": {
"offset": 16,
"type": "u32"
},
"spawn_delay_b": {
"offset": 30,
"type": "u32"
}
}
}
}
]
},
// Change request crew slot, as an offset in the economic state.
// 2.61.0.37: 0xebc657 (mov r8d, dword ptr [rsi + 0xf65c]; mov dword ptr [rsi + 0x2c4], r8d)
"change_req_slot": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "aircraft_change_result",
"pattern": "44 8b 86 ?? ?? ?? ?? 44 89 86 c4 02 00 00",
"captures": {
"slot_id": {
"offset": 3,
"type": "u32"
}
}
}
}
]
},
// GameEconomicState member cleanup, which frees the change request.
// 2.61.0.37: 0x2dd300 (push r14; push rsi; push rdi; ...)
"econ_clear": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 56 56 57 53 48 83 ec 28 48 89 ce 48 8d 05 ?? ?? ?? ?? 48 89 01 48 8d 05 ?? ?? ?? ?? 48 89 81 c8 02 00 00"
}
}
]
},
// Change request bullet set vector, as offsets in the economic state.
// 2.61.0.37: 0x2dd45f (mov rdi, qword ptr [rsi + 0xf608]; mov rbx, qword ptr [rsi + 0xf610]; cmp rdi, rbx; ...)
"change_req_bullets": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "econ_clear",
"pattern": "48 8b be ?? ?? ?? ?? 48 8b 9e ?? ?? ?? ?? 48 39 df 0f 85 ?? ?? ?? ?? 48 85 ff 74 ?? 48 89 f9 e8 ?? ?? ?? ?? 48 8d 8e e0 f5 00 00",
"captures": {
"bullets_begin": {
"offset": 3,
"type": "u32"
},
"bullets_end": {
"offset": 10,
"type": "u32"
}
}
}
}
]
},
// A Unit method that starts by reading the unit crew skills.
// 2.61.0.37: 0x485850 (push r15; push r14; push r12; ...)
"unit_crew_skills": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 54 56 57 53 48 81 ec b8 00 00 00 44 0f 29 b4 24 a0 00 00 00 44 0f 29 ac 24 90 00 00 00 44 0f 29 a4 24 80 00 00 00 44 0f 29 5c 24 70 44 0f 29 54 24 60 44 0f 29 4c 24 50 44 0f 29 44 24 40 0f 29 7c 24 30 0f 29 74 24 20 48 89 ce 48 8b b9 ?? ?? ?? ??",
"captures": {
"crew_skills": {
"offset": 83,
"type": "u32"
}
}
}
}
]
}
}
}