From 4999c7f5a386f576f1cbbdf25a87e2eedf4b5e04 Mon Sep 17 00:00:00 2001 From: N0VAN0M4LY <224130499+N0VAN0M4LY@users.noreply.github.com> Date: Wed, 2 Dec 2026 23:16:49 +0800 Subject: [PATCH] fix(native): assign local player squad ID for yellow squad target mark Pressing ID_SQUAD_TARGET_DESIGNATION ("Set target for squad") checks MPlayer+0xab0 (squadId) and returns early when it is zero (2.61.0.58 0x1600a4f). The LocalMP host already retains the 0xf10f relay and 0xf142 HUD indicator path (0xcb045c -> 0xcb1646 -> 0xcafffb -> 0x19a65e0), which also requires a non-zero squadId from matchingInfo+0x0. Set matchingInfo+0x0 (squadId) to 1 for the local player when zero in hook_mplayer_init_from_matching so MPlayer::initFromMatching (0x59e660 on 2.61.0.37, 0x59f370 on 2.61.0.58) copies it into MPlayer+0xab0 and restores the yellow squad target marker without extra hooks or exe patches. Verified with native wto_ws.dll build; pending in-game verification. --- native/wto-net/src/local_mp_offsets.h | 4 ++++ native/wto-net/src/local_mp_players.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/native/wto-net/src/local_mp_offsets.h b/native/wto-net/src/local_mp_offsets.h index acf0562..6676616 100644 --- a/native/wto-net/src/local_mp_offsets.h +++ b/native/wto-net/src/local_mp_offsets.h @@ -55,6 +55,10 @@ #define LMP_REQ_OFF_RESP_BASE_ID 0x00b8u #define LMP_REQ_OFF_SPARE_TYPE 0x00c0u +/* First field of the matching info passed to MPlayer::initFromMatching (0x59ead4 on 2.61.0.37, + * 0x59f7e4 on 2.61.0.58), copied into MPlayer+0xab0 and read by the 0xf10f squad target relay. */ +#define LMP_MATCH_INFO_OFF_SQUAD_ID 0x0000u + /* Multiplayer */ #define LMP_MP_MGR_OFF_IS_HOST (g_lmp.mp_is_host) #define LMP_MP_MGR_OFF_IS_LOCAL_MP (g_lmp.mp_is_local_mp) diff --git a/native/wto-net/src/local_mp_players.c b/native/wto-net/src/local_mp_players.c index 0d16a68..8005f93 100644 --- a/native/wto-net/src/local_mp_players.c +++ b/native/wto-net/src/local_mp_players.c @@ -108,9 +108,12 @@ static void __fastcall hook_mplayer_init_from_matching(uint8_t *mplayer, uint8_t int32_t desired_team = resolve_configured_player_team(); if (desired_team == 1 || desired_team == 2) *(int32_t *)(info + LMP_MATCH_INFO_OFF_TEAM) = desired_team; + if (*(int32_t *)(info + LMP_MATCH_INFO_OFF_SQUAD_ID) == 0) + *(int32_t *)(info + LMP_MATCH_INFO_OFF_SQUAD_ID) = 1; local_mp_events_reset(); - log_line("local_mp: initialized local player team=%d", - (int)(*(int32_t *)(info + LMP_MATCH_INFO_OFF_TEAM))); + log_line("local_mp: initialized local player team=%d squad=%d", + (int)(*(int32_t *)(info + LMP_MATCH_INFO_OFF_TEAM)), + (int)(*(int32_t *)(info + LMP_MATCH_INFO_OFF_SQUAD_ID))); } orig_mplayer_init_matching(mplayer, info, uid); }