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.
This commit is contained in:
N0VAN0M4LY committed 2026-12-02 23:16:49 +08:00
1 parent d0e4797fe7
commit 4999c7f5a3
2 files changed
+9 -2

No files matched your search

+4
View File
@@ -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)
+5 -2
View File
@@ -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);
}