Files
WT-Offline/patches/native/local_mp_air_events.jsonc
T
N0VAN0M4LYandAlem Bek e8122d7c6b fix(battle): restore LocalMP Ground Arcade air events
Copy allowedKillStreaks and set useKillStreaks for Ground Arcade in battle-mission-settings.ts, and add a dedicated dynamic native module (local_mp_air_events) that preserves MissionSettings.useKillStreaks across prepare_local_mission, credits local player AI kills toward native killstreak counters, delivers UnitRespawn (0xf030) to the LocalMP host via shared unit_on_event, and recovers invalid surface poses from gameplay.blk spawnPos parameters for the match rank.

Based on PR #3 by Rivfflot, who diagnosed the LocalMP Ground Arcade air-event gaps and verified the fix in-game; refactored here onto patches/native dynamic resolution for cross-version and MSVC build compatibility.

Checked: root and launcher typecheck, MSVC native/wto-net/build.ps1, native resolution across 2.61.0.37 and 2.61.0.58 (12/12 modules), 2.61.0.58 check-patches (14/14), and temporary 2.61.0.58 copy build all passed. Pending in-game acceptance on the refactored module.

Co-authored-by: Alem Bek <[email protected]>
2026-12-03 00:14:32 +08:00

324 lines
10 KiB
JSON

// Ground Arcade air events (fighter/attacker/bomber killstreaks) on a LocalMP host
// (native/wto-net/src/local_mp_air_events.c).
// Why the local server cannot do this alone: LocalMP initialization clears MissionSettings.useKillStreaks,
// local AI kill attribution does not advance native killstreak counters, and BombingKillStreakEvent
// broadcasts UnitRespawn via mpi::sendto without delivering it to the LocalMP host.
// Without it: Ground Arcade air-event action bar slots stay unavailable or spawn without UnitRespawn.
{
"module": "local_mp_air_events",
"features": [
"K-Additional vehicles"
],
"requires": [
"local_mp_core",
"local_mp_kills"
],
"sites": {
// MissionSettings gameModeName offset, captured where mission_settings_load reads "gameModeName".
// 2.61.0.58: 0x126c4c8 (mode_name = 0x48).
"mission_mode_name": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "string_ref",
"string": "gameModeName",
"pattern": "48 8d 15 ?? ?? ?? ?? 4c 8d 44 24 50 4c 89 e9 e8 ?? ?? ?? ?? 48 8b 56 ??",
"lea_at": 0,
"captures": {
"mode_name": {
"offset": 23,
"type": "u8"
}
}
}
}
]
},
// LocalMP mission preparation helper: clears MissionSettings.useKillStreaks at its tail.
// 2.61.0.58: 0x12bf540.
"prepare_local_mission": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "signature",
"pattern": "48 83 ec 48 48 8b 05 ?? ?? ?? ?? 80 b8 80 04 00 00 01 0f 85 ?? ?? ?? ?? 0f 1f 84 00 00 00 00 00 b9 10 00 00 00 e8 ?? ?? ?? ??"
}
}
]
},
// Tail store in prepare_local_mission that clears MissionSettings.useKillStreaks to 0.
// 2.61.0.58: 0x12bf5d6 (use_kill_streaks = 0x7bc66b7).
"prepare_local_mission_clear": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "within",
"in": "prepare_local_mission",
"pattern": "c6 05 ?? ?? ?? ?? 00 48 83 c4 48 c3",
"captures": {
"use_kill_streaks": {
"offset": 2,
"type": "rel32",
"end": 7
}
}
}
}
]
},
// kill_streak_fighter_revert_es_event_handler: accesses gameplay killstreak rules, the killstreak
// NameMap, and calls MPlayer::addKillStreakPoints.
// 2.61.0.58: 0x33c9d0.
"kill_streak_revert": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "string_ref",
"string": "kill_streak_fighter_revert_es_event_handler",
"target": "function"
}
}
]
},
// Gameplay global, killstreak rules vector (data/count), rule tag id offset, and tag NameMap.
// 2.61.0.58: 0x33ca72 (gameplay = 0x7bbe730, rule_count = 0x3818, rules = 0x3808, rule_tag = 0x3c, name_map = 0x7bbe670).
"kill_streak_rules": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "within",
"in": "kill_streak_revert",
"pattern": "48 8b 0d ?? ?? ?? ?? 48 63 81 ?? ?? ?? ?? 41 39 c5 73 ?? 48 8b 81 ?? ?? ?? ?? 42 8b 4c 30 ?? 3b 0d ?? ?? ?? ?? 73 ?? 48 8b 15 ?? ?? ?? ??",
"captures": {
"gameplay": {
"offset": 3,
"type": "rel32"
},
"rule_count": {
"offset": 10,
"type": "u32"
},
"rules": {
"offset": 22,
"type": "u32"
},
"rule_tag": {
"offset": 30,
"type": "u8"
},
"name_map": {
"offset": 42,
"type": "rel32"
}
}
}
}
]
},
// MPlayer::addKillStreakPoints(player, ruleIndex, points, relatedRule).
// 2.61.0.58: 0x59e8a0 (called at 0x33cc47).
"add_kill_streak_points": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 54 56 57 55 53 48 83 ec 20 48 89 ce 48 8b 05 ?? ?? ?? ?? 0f b6 ca 39 88 ?? ?? ?? ?? 0f 86 ?? ?? ?? ?? 48 8b 98 ?? ?? ?? ?? 89 c8 4c 8d 34 c0 41 c1 e6 04"
}
}
]
},
// MPlayer killstreak progress dag::Vector offset (data at +0x00, count at +0x10).
// 2.61.0.58: 0x59e98e (progress = 0x788).
"mplayer_streak_progress": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "within",
"in": "add_kill_streak_points",
"pattern": "4c 8b 96 ?? ?? ?? ?? 89 d2 48 c1 e2 04 41 0f b6 04 12",
"captures": {
"progress": {
"offset": 3,
"type": "u32"
}
}
}
}
]
},
// Gameplay killstreak parser: airAiKillsMult and groundAiKillsMult offsets in a rule entry (stride 0x90).
// 2.61.0.58: 0xeb097d (air_ai_mult = 0x28, ground_ai_mult = 0x2c).
"kill_streak_ai_mults": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "string_ref",
"string": "airAiKillsMult",
"pattern": "48 8d 15 ?? ?? ?? ?? 49 89 f8 e8 ?? ?? ?? ?? 89 46 ?? c7 44 24 30 01 00 00 00 4c 89 e1 48 8d 15 ?? ?? ?? ?? 49 89 f8 e8 ?? ?? ?? ?? 89 46 ??",
"lea_at": 0,
"captures": {
"air_ai_mult": {
"offset": 17,
"type": "u8"
},
"ground_ai_mult": {
"offset": 46,
"type": "u8"
}
}
}
}
]
},
// BombingKillStreakEvent::initiateEvent: computes the initiator spawn position from gameplay.blk spawnPos.
// 2.61.0.58: 0x1283c10.
"air_event_initiate": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "string_ref",
"string": "%s: reject - event (%d) unavailable active %d, timeToStart %f",
"target": "function"
}
}
]
},
// Battle-area center helper, room max rank global, and rule spawnPos table offsets in initiateEvent.
// 2.61.0.58: 0x1283e05 (battle_center = 0x1284140, spawn_pos_count = 0x60, max_rank = 0x7bc666c, spawn_pos = 0x50, stride = 0x64).
"air_event_spawn_table": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "within",
"in": "air_event_initiate",
"pattern": "48 8d 4c 24 4c e8 ?? ?? ?? ?? 45 8b 47 ?? f3 44 0f 10 0d ?? ?? ?? ?? 45 0f 28 d1 45 0f 28 c1 4d 85 c0 4c 89 e0 0f 84 ?? ?? ?? ?? 8b 15 ?? ?? ?? ?? 49 8b 4f ?? 4d 6b c8 ??",
"captures": {
"battle_center": {
"offset": 6,
"type": "rel32"
},
"spawn_pos_count": {
"offset": 13,
"type": "u8"
},
"max_rank": {
"offset": 45,
"type": "rel32"
},
"spawn_pos": {
"offset": 52,
"type": "u8"
},
"spawn_pos_stride": {
"offset": 56,
"type": "u8"
}
}
}
}
]
},
// App terrain pointer offset and terrain height query call in initiateEvent.
// 2.61.0.58: 0x1283f95 (app_terrain = 0x3d8, terrain_height = 0xf9bcd0).
"air_event_terrain": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "within",
"in": "air_event_initiate",
"pattern": "48 8b 05 ?? ?? ?? ?? 48 8b 88 ?? ?? ?? ?? 0f 57 c0 0f 11 44 24 20 e8 ?? ?? ?? ??",
"captures": {
"app_terrain": {
"offset": 10,
"type": "u32"
},
"terrain_height": {
"offset": 23,
"type": "rel32"
}
}
}
}
]
},
// BombingKillStreakEvent::switchPlayerUnit: switches the player to/from the event aircraft and calls sendUnitRespawn.
// 2.61.0.58: 0x1287020.
"air_event_switch_unit": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "signature",
"pattern": "41 57 41 56 41 54 56 57 55 53 48 81 ec f0 00 00 00 44 89 c5 48 89 d6 48 89 cf 48 8b 1a 44 8b 83 ?? ?? ?? ?? 8b 05 ?? ?? ?? ?? 48 8b 93 ?? ?? ?? ??"
}
}
]
},
// Matrix-to-quaternion orientation helper called by switchPlayerUnit when building the respawn pose.
// 2.61.0.58: 0x1287309 (get_orientation = 0x280710).
"air_event_orientation": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "within",
"in": "air_event_switch_unit",
"pattern": "48 8d 8c 24 88 00 00 00 48 8d 54 24 40 e8 ?? ?? ?? ??",
"captures": {
"call": {
"offset": 14,
"type": "rel32"
}
}
}
}
]
},
// Unit::sendUnitRespawn: packs UnitRespawn (0xf030) and broadcasts it via mpi::sendto.
// 2.61.0.58: 0xff13a0.
"send_unit_respawn": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "string_ref",
"string": "sending unit respawn uid:%i name:%s ptr:%p at (%f, %f, %f)",
"target": "function"
}
}
]
},
// mpi::sendto broadcast call at the end of Unit::sendUnitRespawn.
// 2.61.0.58: 0xff17a1 (mpi_sendto = 0x30a0650).
"send_unit_respawn_broadcast": {
"variants": [
{
"written_for": "2.61.0.58",
"locate": {
"method": "within",
"in": "send_unit_respawn",
"pattern": "48 8d 74 24 30 48 89 f1 e8 ?? ?? ?? ?? 48 89 f1 b2 ff e8 ?? ?? ?? ??",
"captures": {
"mpi_sendto": {
"offset": 19,
"type": "rel32"
}
}
}
}
]
}
}
}