[Voice] Clear muted list when dc

This commit is contained in:
Diavolo 2022-08-14 13:33:28 +02:00
parent f3d5afb83b
commit 8b224f6130
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
2 changed files with 9 additions and 4 deletions

View File

@ -242,6 +242,11 @@ namespace Components
} }
} }
void Voice::CL_ClearMutedList()
{
std::memset(s_playerMute, 0, sizeof(s_playerMute));
}
bool Voice::CL_IsPlayerMuted_Hk([[maybe_unused]] Game::SessionData* session, [[maybe_unused]] const int localClientNum, const int muteClientIndex) bool Voice::CL_IsPlayerMuted_Hk([[maybe_unused]] Game::SessionData* session, [[maybe_unused]] const int localClientNum, const int muteClientIndex)
{ {
AssertIn(muteClientIndex, Game::MAX_CLIENTS); AssertIn(muteClientIndex, Game::MAX_CLIENTS);
@ -312,12 +317,9 @@ namespace Components
} }
void Voice::UI_Mute_player(int clientNum, const int localClientNum) void Voice::UI_Mute_player(int clientNum, const int localClientNum)
{
if (Game::cgArray->clientNum != Game::sharedUiInfo->playerClientNums[clientNum])
{ {
CL_TogglePlayerMute(localClientNum, Game::sharedUiInfo->playerClientNums[clientNum]); CL_TogglePlayerMute(localClientNum, Game::sharedUiInfo->playerClientNums[clientNum]);
} }
}
__declspec(naked) void Voice::UI_Mute_Player_Stub() __declspec(naked) void Voice::UI_Mute_Player_Stub()
{ {
@ -342,6 +344,8 @@ namespace Components
std::memset(voicePacketCount, 0, sizeof(voicePacketCount)); std::memset(voicePacketCount, 0, sizeof(voicePacketCount));
std::memset(s_playerMute, 0, sizeof(s_playerMute)); std::memset(s_playerMute, 0, sizeof(s_playerMute));
Events::OnSteamDisconnect(CL_ClearMutedList);
// Write voice packets to the server instead of other clients // Write voice packets to the server instead of other clients
Utils::Hook(0x487935, CL_WriteVoicePacket_Hk, HOOK_CALL).install()->quick(); Utils::Hook(0x487935, CL_WriteVoicePacket_Hk, HOOK_CALL).install()->quick();
Utils::Hook(0x5AD945, CL_WriteVoicePacket_Hk, HOOK_CALL).install()->quick(); Utils::Hook(0x5AD945, CL_WriteVoicePacket_Hk, HOOK_CALL).install()->quick();

View File

@ -31,6 +31,7 @@ namespace Components
static void SV_PreGameUserVoice(Game::client_t* cl, Game::msg_t* msg); static void SV_PreGameUserVoice(Game::client_t* cl, Game::msg_t* msg);
static void SV_VoicePacket(Game::netadr_t from, Game::msg_t* msg); static void SV_VoicePacket(Game::netadr_t from, Game::msg_t* msg);
static void CL_ClearMutedList();
static bool CL_IsPlayerMuted_Hk(Game::SessionData* session, int localClientNum, int muteClientIndex); static bool CL_IsPlayerMuted_Hk(Game::SessionData* session, int localClientNum, int muteClientIndex);
static void CL_MutePlayer_Hk(Game::SessionData* session, int muteClientIndex); static void CL_MutePlayer_Hk(Game::SessionData* session, int muteClientIndex);
static void Voice_UnmuteMember_Hk(Game::SessionData* session, int clientNum); static void Voice_UnmuteMember_Hk(Game::SessionData* session, int clientNum);