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

196 lines
5.6 KiB
JSON

// In-battle award events (native/wto-net/src/local_mp_awards.c): the stock InBattleReward HUD event
// and the facts sent to the local server for awards.
// Without it: no reward banners and no battle awards in LocalMP battles.
{
"module": "local_mp_awards",
"features": [
"L-Battle awards"
],
"requires": [
"local_mp_core"
],
"sites": {
// GameSaveData::addScoreMessage.
// 2.61.0.37: 0x189a8e0
"add_score_message": {
"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 38 01 00 00 45 89 c5 41 8d 45 fd"
}
}
]
},
// DataBlock::DataBlock.
// 2.61.0.37: 0x189b99c (call 0x3093000; cmp dword ptr [rsp + 0x68], 0; mov ebx, dword ptr [rsp + 0x104])
"score_msg_blk_ctor": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "add_score_message",
"pattern": "e8 ?? ?? ?? ?? 83 7c 24 68 00 8b 9c 24 04 01 00 00",
"captures": {
"call": {
"offset": 1,
"type": "rel32"
}
}
}
}
]
},
// DataBlock set string.
// 2.61.0.37: 0x189ba34 (call 0x3094950; mov dword ptr [rsp + 0x78], ebp; cmp dword ptr [rsp + 0xa4], -1)
"score_msg_blk_set_str": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "add_score_message",
"pattern": "e8 ?? ?? ?? ?? 89 6c 24 78 83 bc 24 a4 00 00 00 ff",
"captures": {
"call": {
"offset": 1,
"type": "rel32"
}
}
}
}
]
},
// DataBlock make owned.
// 2.61.0.37: 0x189ba4f (call 0x30998c0; lea rdx, [rip + 0x5fc2664]; lea rcx, [rsp + 0x90]; ...)
"score_msg_blk_to_owned": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "add_score_message",
"pattern": "e8 ?? ?? ?? ?? 48 8d 15 ?? ?? ?? ?? 48 8d 8c 24 90 00 00 00 4c 8d 44 24 78 e8 ?? ?? ?? ?? 44 89 74 24 78",
"captures": {
"call": {
"offset": 1,
"type": "rel32"
}
}
}
}
]
},
// DataBlock set int.
// 2.61.0.37: 0x189ba68 (call 0x3095130; mov dword ptr [rsp + 0x78], r14d; cmp dword ptr [rsp + 0xa4], -1)
"score_msg_blk_set_int": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "add_score_message",
"pattern": "e8 ?? ?? ?? ?? 44 89 74 24 78 83 bc 24 a4 00 00 00 ff",
"captures": {
"call": {
"offset": 1,
"type": "rel32"
}
}
}
}
]
},
// The HUD script event queue in GameSaveData and its queue function.
// 2.61.0.37: 0x189be3b (add rcx, 0xae8; lea rdx, [rip + 0x5fcb75d]; lea r8, [rsp + 0x90]; ...)
"score_msg_hud_queue": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "add_score_message",
"pattern": "48 81 c1 ?? ?? ?? ?? 48 8d 15 ?? ?? ?? ?? 4c 8d 84 24 90 00 00 00 e8 ?? ?? ?? ??",
"captures": {
"queue": {
"offset": 3,
"type": "u32"
},
"call": {
"offset": 23,
"type": "rel32"
}
}
}
}
]
},
// DataBlock::~DataBlock.
// 2.61.0.37: 0x189be90 (call 0x3093a60; cmp ebp, 0xe; setne al; ...)
"score_msg_blk_dtor": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "add_score_message",
"pattern": "e8 ?? ?? ?? ?? 83 fd 0e 0f 95 c0 0f b6 4c 24 52",
"captures": {
"call": {
"offset": 1,
"type": "rel32"
}
}
}
}
]
},
// Unit info expClass string.
// 2.61.0.37: 0x189bb19 (mov rax, qword ptr [r15 + 0x1020]; mov rax, qword ptr [rax + 0x38]; test rax, rax)
"score_msg_exp_class": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "add_score_message",
"pattern": "49 8b 87 ?? ?? ?? ?? 48 8b 40 ?? 48 85 c0",
"captures": {
"unit_info": {
"offset": 3,
"type": "u32"
},
"exp_class": {
"offset": 10,
"type": "u8"
}
}
}
}
]
},
// The global GameSaveData.
// 2.61.0.37: 0x427e19 (mov rcx, qword ptr [rip + 0x77ccb38]; test rcx, rcx; je 0x427f77; ...)
"game_save_data": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "iground_on_dead",
"pattern": "48 8b 0d ?? ?? ?? ?? 48 85 c9 0f 84 ?? ?? ?? ?? 48 8b 05 ?? ?? ?? ??",
"captures": {
"game_save_data": {
"offset": 3,
"type": "rel32"
}
}
}
}
]
}
}
}