Files
WT-Offline/patches/native/local_mp_damage_notifications.jsonc
T
N0VAN0M4LY 69d95df88e fix(hud): correct LocalMP damage feedback
Use the stock effective-hit flag to award normal hits and show ineffective hits without rewards. Route enemy parts feedback by the actual attacker or recipient and the active spectator state.

Verified both TypeScript projects, the native DLL build, and patch and Quirrel checks on 2.61.0.37, 2.61.0.58, and 2.61.0.60. Built fresh 2.61.0.58 and 2.61.0.60 copies. In-game verification is pending.
2026-12-04 02:35:47 +08:00

281 lines
11 KiB
JSON

// Bind self damage, avionics failure and hit-parts feedback to the player on a LocalMP host.
// The stock damage producers skip hero/attacker checks on dedicated-server paths because a
// dedicated server has no HUD; on a LocalMP host both run in the same process.
// The HUD receives only the type, text index and ID, or the victim's damaged parts list.
{
"module": "local_mp_damage_notifications",
"features": [
"K-Player damage notices"
],
"requires": [
"local_mp_core",
"local_mp_players",
"local_mp_kills"
],
"sites": {
// Damage handler prologue reads the impact's tagged unit reference.
// 2.61.0.37: 0x398780; 2.61.0.43: 0x398700.
"barrel_damage": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "41 56 56 57 53 48 83 ec 58 48 8b 72 ?? 89 f0 83 e0 01 0b 05 ?? ?? ?? ?? 3b 42 ?? 0f 85",
"captures": {
"unit": { "offset": 12, "type": "u8" }
}
}
}
]
},
// The barrel handler sends HUD_MSG_EVENT with hud_gun_barrel_exploded.
"barrel_damage_notice": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "barrel_damage",
"pattern": "b9 09 00 00 00 ba e2 01 00 00 45 31 c0 45 31 c9 e8 ?? ?? ?? ??",
"captures": {
"id": { "offset": 6, "type": "u32" },
"deliver": { "offset": 17, "type": "rel32" }
}
}
}
]
},
// Fire update prologue through the argument saves and the weapon owner's unit load.
// 2.61.0.37: 0x13e03a0; 2.61.0.43: 0x13e4a40.
"breech_fire_update": {
"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 bc 24 e0 01 00 00 44 0f 29 b4 24 d0 01 00 00 44 0f 29 ac 24 c0 01 00 00 44 0f 29 a4 24 b0 01 00 00 44 0f 29 9c 24 a0 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 4c 89 8c 24 18 01 00 00 4c 89 84 24 d8 00 00 00 48 89 94 24 10 01 00 00 48 89 ce f3 44 0f 10 94 24 80 02 00 00 48 8b 49 ??",
"captures": {
"unit": { "offset": 147, "type": "u8" }
}
}
}
]
},
// The fire update sends HUD_MSG_EVENT with hud_gun_breech_malfunction_misfire.
"breech_damage_notice": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "breech_fire_update",
"pattern": "b9 09 00 00 00 ba e4 01 00 00 45 31 c0 45 31 c9 e8 ?? ?? ?? ??",
"captures": {
"id": { "offset": 6, "type": "u32" },
"deliver": { "offset": 17, "type": "rel32" }
}
}
}
]
},
// Resolve the currently controlled unit, preferring the active override over the original unit.
// 2.61.0.37: 0x598bc0; 2.61.0.43: 0x5994c0.
"mplayer_controlled_unit": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "48 83 ec 38 48 8d 81 78 08 00 00 48 8d 91 84 08 00 00 44 8b 81 80 08 00 00 4c 8d 89 54 08 00 00 45 85 c0 4c 0f 45 ca 48 8d 91 48 08 00 00"
}
}
]
},
// HUD_MSG_DAMAGE delivery: resolves the text index to localized text, then pushes
// {type, text, id} into the local HUD event queue.
// 2.61.0.37: 0x19b1030; 2.61.0.43: 0x19b6ba0.
"hud_damage_deliver": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "56 57 53 48 83 ec 50 48 83 3d ?? ?? ?? ?? 00 0f 84 ?? ?? ?? ?? 44 89 c6 89 cf b0 01"
}
}
]
},
// Unit avionics/electronics failure dispatcher (13-entry switch for guidance, sensors, radar,
// RWR, TWS, optics, targeting pod, laser designator, NVG, indicators). Reads its owning Unit*
// from [comp + unit]; most cases emit HUD_MSG_DAMAGE without checking the unit's hero flag.
// 2.61.0.37: 0xfca8b0; 2.61.0.43: 0xfce8e0.
"avionics_damage": {
"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 0f 29 74 24 40 48 89 ce 83 fa 0c 0f 87 ?? ?? ?? ?? 89 d0 48 8d 0d ?? ?? ?? ?? 48 63 04 81 48 01 c8 ff e0 48 8b 46 ??",
"captures": {
"unit": { "offset": 54, "type": "u8" }
}
}
}
]
},
// Camera optic-view exit invoked by avionics_damage cases 2, 7 and 8 without checking hero.
// 2.61.0.37: 0xfcab0b -> 0x15cd9c0; 2.61.0.43: 0xfceb3b -> 0x15d2760.
"avionics_exit_optic": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "avionics_damage",
"pattern": "48 81 c1 ?? ?? ?? ?? 89 d3 ba 01 00 00 00 41 b0 01 e8 ?? ?? ?? ??",
"captures": {
"call": { "offset": 18, "type": "rel32" }
}
}
}
]
},
// Hit event attacker Unit* offset loaded before comparing against g_hero in Unit::onEvent
// (unit_on_event is resolved in local_mp_core).
// 2.61.0.37: 0x104495d (offender=0xd0); 2.61.0.43: 0x1048d7d (offender=0xd0).
"hit_event_offender": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "unit_on_event",
"pattern": "48 8b bf ?? ?? ?? ?? 48 8b 35 ?? ?? ?? ?? 48 85 f6 74 ?? 48 8b 8e ?? ?? ?? ??",
"captures": {
"offender": { "offset": 3, "type": "u32" }
}
}
}
]
},
// Watched hero cell used when spectating in Unit::onEvent.
// 2.61.0.37: 0x10449ab -> 0x7bad420; 2.61.0.43: 0x1048dcb -> 0x7bb9780.
"hit_watched_hero": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "unit_on_event",
"pattern": "40 84 ed 74 ?? 48 8b 15 ?? ?? ?? ?? 48 8b 0d ?? ?? ?? ?? 48 39 d7 75 ??",
"captures": {
"watched_hero": { "offset": 8, "type": "rel32" }
}
}
}
]
},
// guiSpectator.onSpectatorMode implementation writes the active respawn spectator byte.
// 2.61.0.37: 0x1a46070 -> 0x7bb9e16; 2.61.0.58: 0x1a4e830 -> 0x7bcb2a6.
"respawn_spectator": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "89 ca 84 c9 74 ?? 48 8b 05 ?? ?? ?? ?? c6 80 ?? ?? ?? ?? 01 88 15 ?? ?? ?? ?? 48 8b 0d ?? ?? ?? ?? 48 85 c9 74 ??",
"captures": {
"active": { "offset": 22, "type": "rel32" }
}
}
}
]
},
// Unconditional enemy parts-list, hit-camera important events and naval hit-state calls
// reached after the hit-camera attacker check in Unit::onEvent.
// 2.61.0.37: 0x1045fc3 -> 0x18977c0, 0x1897cc0, 0x1896a40;
// 2.61.0.43: 0x104a3d9 -> 0x189d140, 0x189d640, 0x189c3c0.
"hit_parts_feedback": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "within",
"in": "unit_on_event",
"pattern": "48 8b 0d ?? ?? ?? ?? 4c 8d b4 24 00 01 00 00 4c 89 ea 4d 89 f0 e8 ?? ?? ?? ?? 48 8b 0d ?? ?? ?? ?? 4c 89 ea 4d 89 f0 e8 ?? ?? ?? ?? 66 41 83 bd 8c 00 00 00 05 75 ?? 48 8b 0d ?? ?? ?? ?? 4c 8d 84 24 00 01 00 00 4c 89 ea e8 ?? ?? ?? ??",
"captures": {
"enqueue_enemy_parts": { "offset": 22, "type": "rel32" },
"hit_cam_important": { "offset": 40, "type": "rel32" },
"naval_hit_state": { "offset": 74, "type": "rel32" }
}
}
}
]
},
// AcesApp local MPI proxy dispatch(proxy, msg, recipient_pid): forwards every local message to
// AcesApp::onEvent without checking recipient_pid, so enemy-part-damage MPI messages addressed
// to AI bots reach the local HUD kill feed on a LocalMP host.
// 2.61.0.37: 0xc9d930; 2.61.0.58: 0xca1770.
"local_mpi_dispatch": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "56 48 83 ec 20 48 89 d6 48 8b 02 48 89 d1 ff 50 40 84 c0 74 ?? 48 8b 4e 08 48 8b 01 48 8b 40 10 48 89 f2 48 83 c4 20 5e 48 ff e0"
}
}
]
},
// Offset of the uint16 MPI message ID inside mpi::Message, read by mpi::send_to's error branch.
// 2.61.0.37: 0x3091846 (id_offset=0x20); 2.61.0.58: 0x30a0726 (id_offset=0x20).
"mpi_msg_id": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "0f b7 46 ?? 48 8d 0d ?? ?? ?? ?? 48 89 4c 24 28 c7 44 24 20 01 00 00 00 48 89 74 24 38 c7 44 24 30 06 00 00 00 48 89 44 24 48 c7 44 24 40 03 00 00 00",
"captures": {
"id_offset": { "offset": 3, "type": "u8" }
}
}
}
]
},
// Aircraft enemy-part-damage MPI constructor (HUD_MSG_ENEMY_DAMAGE/CRITICAL/FATAL).
// 2.61.0.37: 0xe19abb (msg_id=0xf104); 2.61.0.58: 0xe1dbfb (msg_id=0xf104).
"enemy_part_damage_mpi": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "4c 89 7c 24 40 c7 44 24 48 ff ff ff ff 48 89 4c 24 50 66 c7 44 24 58 ?? ?? 48 c7 44 24 60 00 00 00 00 c7 44 24 68 00 00 00 00",
"captures": {
"msg_id": { "offset": 23, "type": "u16" }
}
}
}
]
},
// Aircraft minor enemy-part-hit MPI constructor (HUD_MSG_ENEMY_DAMAGE).
// 2.61.0.37: 0xe6971f (msg_id=0xf118); 2.61.0.58: 0xe6d6ef (msg_id=0xf118).
"enemy_part_hit_mpi": {
"variants": [
{
"written_for": "2.61.0.37",
"locate": {
"method": "signature",
"pattern": "48 89 7c 24 30 c7 44 24 38 ff ff ff ff 48 89 54 24 40 66 c7 44 24 48 ?? ?? 48 c7 44 24 50 00 00 00 00 c7 44 24 58 00 00 00 00",
"captures": {
"msg_id": { "offset": 23, "type": "u16" }
}
}
}
]
}
}
}