From ad842e46655e339bb425b6f34f5f232dd8eff4f3 Mon Sep 17 00:00:00 2001 From: databomb Date: Tue, 8 Mar 2011 12:38:18 -0800 Subject: [PATCH 1/5] Fix mistaken unhooking of voice hooks (bug 4804, r+a=fyren) --- extensions/sdktools/voice.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/extensions/sdktools/voice.cpp b/extensions/sdktools/voice.cpp index 7b4cbdb7..ec060055 100644 --- a/extensions/sdktools/voice.cpp +++ b/extensions/sdktools/voice.cpp @@ -53,7 +53,6 @@ enum ListenOverride size_t g_VoiceFlags[65]; size_t g_VoiceHookCount = 0; -int g_ClientOverrides[65]; ListenOverride g_VoiceMap[65][65]; bool g_ClientMutes[65][65]; @@ -65,10 +64,10 @@ SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *); #endif -bool DecHookCount(int amount = 1); -bool DecHookCount(int amount) +bool DecHookCount() { - g_VoiceHookCount -= amount; + g_VoiceHookCount--; + if (g_VoiceHookCount == 0) { SH_REMOVE_HOOK_MEMFUNC(IVoiceServer, SetClientListening, voiceserver, &g_SdkTools, &SDKTools::OnSetClientListening, false); @@ -89,7 +88,6 @@ void IncHookCount() void SDKTools::VoiceInit() { memset(g_VoiceMap, 0, sizeof(g_VoiceMap)); - memset(g_ClientOverrides, 0, sizeof(g_ClientOverrides)); memset(g_ClientMutes, 0, sizeof(g_ClientMutes)); SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverClients, this, &SDKTools::OnClientCommand, true); @@ -193,6 +191,7 @@ void SDKTools::OnClientDisconnecting(int client) } g_ClientMutes[i][client] = false; + g_ClientMutes[client][i] = false; if (g_VoiceMap[i][client] != Listen_Default) { @@ -202,22 +201,19 @@ void SDKTools::OnClientDisconnecting(int client) break; } } - } - - /* Reset this client's mutes */ - memset(&g_ClientMutes[client], 0, sizeof(bool) * 65); - - /* Reset other clients who send to this client */ - if (g_ClientOverrides[client] > 0) - { - DecHookCount(g_ClientOverrides[client]); - g_ClientOverrides[client] = 0; - memset(&g_VoiceMap[client], false, sizeof(ListenOverride) * 65); + if (g_VoiceMap[client][i] != Listen_Default) + { + g_VoiceMap[client][i] = Listen_Default; + if (DecHookCount()) + { + break; + } + } } if (g_VoiceFlags[client]) { - g_VoiceFlags[client] = 0; + g_VoiceFlags[client] = SPEAK_NORMAL; DecHookCount(); } } @@ -294,13 +290,11 @@ static cell_t SetClientListening(IPluginContext *pContext, const cell_t *params) if (g_VoiceMap[r][s] == Listen_Default && params[3] != Listen_Default) { g_VoiceMap[r][s] = (ListenOverride) params[3]; - g_ClientOverrides[r]++; IncHookCount(); } else if (g_VoiceMap[r][s] != Listen_Default && params[3] == Listen_Default) { g_VoiceMap[r][s] = (ListenOverride) params[3]; - g_ClientOverrides[r]--; DecHookCount(); } else From dc550c25e53e8512b849ab8e36f2dae84597144e Mon Sep 17 00:00:00 2001 From: databomb Date: Tue, 8 Mar 2011 12:38:43 -0800 Subject: [PATCH 2/5] Fix precedence of voice mute flag versus specific client overrides (bug 4826, r+a=fyren) --- extensions/sdktools/voice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/sdktools/voice.cpp b/extensions/sdktools/voice.cpp index ec060055..423c1199 100644 --- a/extensions/sdktools/voice.cpp +++ b/extensions/sdktools/voice.cpp @@ -128,6 +128,11 @@ bool SDKTools::OnSetClientListening(int iReceiver, int iSender, bool bListen) RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false)); } + if (g_VoiceFlags[iSender] & SPEAK_MUTED) + { + RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false)); + } + if (g_VoiceMap[iReceiver][iSender] == Listen_No) { RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false)); @@ -137,11 +142,6 @@ bool SDKTools::OnSetClientListening(int iReceiver, int iSender, bool bListen) RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true)); } - if (g_VoiceFlags[iSender] & SPEAK_MUTED) - { - RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false)); - } - if ((g_VoiceFlags[iSender] & SPEAK_ALL) || (g_VoiceFlags[iReceiver] & SPEAK_LISTENALL)) { RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true)); From 55ec20b215abc0e78d5f568e935b56a9c25ac854 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 12 Mar 2011 20:30:06 -0800 Subject: [PATCH 3/5] New symstore. --- tools/buildbot/symstore.pl | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/tools/buildbot/symstore.pl b/tools/buildbot/symstore.pl index c16c3355..90f50906 100755 --- a/tools/buildbot/symstore.pl +++ b/tools/buildbot/symstore.pl @@ -10,13 +10,8 @@ require 'helpers.pm'; chdir('..'); chdir('..'); -our $SSH = 'ssh -i ../../smpvkey'; - open(PDBLOG, '../OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n"; -#Sync us up with the main symbol store -rsync('sourcemod@alliedmods.net:~/public_html/symbols/', '..\\..\\symstore'); - #Get version info my ($version); $version = Build::ProductVersion(Build::PathFormat('product.version')); @@ -41,14 +36,14 @@ while () $line = $_; $line =~ s/\.pdb/\*/; chomp $line; - Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s ..\\..\\symstore /t \"SourceMod\" /v \"$version\" /c \"$build_type\""); + Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s \"S:\\sourcemod" /t \"SourceMod\" /v \"$version\" /c \"$build_type\""); } close(PDBLOG); #Lowercase DLLs. Sigh. my (@files); -opendir(DIR, "..\\..\\symstore"); +opendir(DIR, "S:\\sourcemod"); @files = readdir(DIR); closedir(DIR); @@ -57,23 +52,14 @@ for ($i = 0; $i <= $#files; $i++) { $file = $files[$i]; next unless ($file =~ /\.dll$/); - next unless (-d "..\\..\\symstore\\$file"); - opendir(DIR, "..\\..\\symstore\\$file"); + next unless (-d "S:\\sourcemod\\$file"); + opendir(DIR, "S:\\sourcemod\\$file"); @subdirs = readdir(DIR); closedir(DIR); for ($j = 0; $j <= $#subdirs; $j++) { next unless ($subdirs[$j] =~ /[A-Z]/); - Build::Command("rename ..\\..\\symstore\\$file\\" . $subdirs[$j] . " " . lc($subdirs[$j])); + Build::Command("rename S:\\sourcemod\\$file\\" . $subdirs[$j] . " " . lc($subdirs[$j])); } } -#Now that we're done, rsync back. -rsync('../../symstore/', 'sourcemod@alliedmods.net:~/public_html/symbols'); - -sub rsync -{ - my ($from, $to) = (@_); - - Build::Command('rsync -av --delete -e="' . $SSH . '" ' . $from . ' ' . $to); -} From 01a826268b3ab1d0ef91ff35bb4c824de2e58fcd Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 12 Mar 2011 21:41:06 -0800 Subject: [PATCH 4/5] Fix build. --- core/PlayerManager.cpp | 5 +++++ core/PlayerManager.h | 1 + core/smn_lang.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index e4cd94c8..9aad0a66 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -1766,6 +1766,11 @@ unsigned int CPlayer::GetLanguageId() return m_LangId; } +void CPlayer::SetLanguageId(unsigned int id) +{ + m_LangId = id; +} + int CPlayer::GetUserId() { if (m_UserId == -1) diff --git a/core/PlayerManager.h b/core/PlayerManager.h index 452cf559..ce31287c 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -82,6 +82,7 @@ public: bool IsInKickQueue(); IPlayerInfo *GetPlayerInfo(); unsigned int GetLanguageId(); + void SetLanguageId(unsigned int id); int GetUserId(); bool RunAdminCacheChecks(); void NotifyPostAdminChecks(); diff --git a/core/smn_lang.cpp b/core/smn_lang.cpp index 29aa2038..9b4a60f9 100644 --- a/core/smn_lang.cpp +++ b/core/smn_lang.cpp @@ -113,7 +113,7 @@ static cell_t sm_SetClientLanguage(IPluginContext *pContext, const cell_t *param return pContext->ThrowNativeError("Invalid client index %d", params[1]); } - player->m_LangId = params[2]; + player->SetLanguageId(params[2]); return 1; } From 801815b7424f17fd6c4f1cd8668556a38fc4809d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 12 Mar 2011 22:38:38 -0800 Subject: [PATCH 5/5] Fix symstore. --- tools/buildbot/symstore.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/buildbot/symstore.pl b/tools/buildbot/symstore.pl index 90f50906..f7003d6d 100755 --- a/tools/buildbot/symstore.pl +++ b/tools/buildbot/symstore.pl @@ -36,7 +36,7 @@ while () $line = $_; $line =~ s/\.pdb/\*/; chomp $line; - Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s \"S:\\sourcemod" /t \"SourceMod\" /v \"$version\" /c \"$build_type\""); + Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s \"S:\\sourcemod\" /t \"SourceMod\" /v \"$version\" /c \"$build_type\""); } close(PDBLOG);