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); }