void MMatchServer::OnNameEsp(const MUID& uidSender) { MMatchObject* pObj = GetObject(uidSender); if (pObj && IsAdminGrade(pObj)) { LogCommand("esp", pObj->GetCharInfo()->m_szName, ""); } }
bool ChatHandler::HandleAccountPasswordCommand(char* args) { PSendSysMessage("Due to security reasons you can only change your password through the forum. Please visit http://gamingconsortium.org/ for more information."); SetSentErrorMessage(true); // OK, but avoid normal report for hide passwords, but log use command for anyone LogCommand(".account password *** *** ***"); SetSentErrorMessage(true); return false; }
void MMatchServer::OnFollow(const MUID& uidSender, const char* pName) { MMatchObject* pObj = GetObject(uidSender); if (pObj && IsAdminGrade(pObj)) { OnStageFollow(uidSender, pName); LogCommand("follow", pObj->GetCharInfo()->m_szName, ""); } }
//--------------------------------------------------------------------------------- // Purpose: Process the ma_restrict command //--------------------------------------------------------------------------------- PLUGIN_RESULT ManiWeaponMgr::ProcessMaRestrict ( player_t *player_ptr, const char *command_name, const int help_id, const int command_type ) { if ((!gpManiGameType->IsGameType(MANI_GAME_CSS)) && (!gpManiGameType->IsGameType(MANI_GAME_CSGO))) return PLUGIN_CONTINUE; if (player_ptr) { // Check if player is admin if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_RESTRICT_WEAPON, war_mode)) return PLUGIN_BAD_ADMIN; } if (gpCmd->Cmd_Argc() < 2) return gpManiHelp->ShowHelp(player_ptr, command_name, help_id, command_type); int limit = 0; if (gpCmd->Cmd_Argc() == 3) { // Validate negative limit = atoi(gpCmd->Cmd_Argv(2)); if (limit < 0) { return gpManiHelp->ShowHelp(player_ptr, command_name, help_id, command_type); } if (!this->SetWeaponRestriction(gpCmd->Cmd_Argv(1), true, limit)) { OutputHelpText(ORANGE_CHAT, player_ptr, "%s", Translate(player_ptr, 3044, "%s", gpCmd->Cmd_Argv(1))); return PLUGIN_STOP; } } else { if (!this->SetWeaponRestriction(gpCmd->Cmd_Argv(1), true)) { OutputHelpText(ORANGE_CHAT, player_ptr, "%s", Translate(player_ptr, 3044, "%s", gpCmd->Cmd_Argv(1))); return PLUGIN_STOP; } } LogCommand (player_ptr, "restrict [%s]\n", gpCmd->Cmd_Argv(1)); if (gpCmd->Cmd_Argc() == 2) { SayToAll(GREEN_CHAT, true, "%s", Translate(player_ptr, 3045, "%s", gpCmd->Cmd_Argv(1))); } else { SayToAll(GREEN_CHAT, true, "%s", Translate(player_ptr, 3040, "%s%i", gpCmd->Cmd_Argv(1), limit)); } return PLUGIN_STOP; }
//--------------------------------------------------------------------------------- // Purpose: Process the ma_map command //--------------------------------------------------------------------------------- PLUGIN_RESULT ProcessMaSetNextMap(player_t *player_ptr, const char *command_name, const int help_id, const int command_type) { if (player_ptr) { // Check if player is admin if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_CHANGEMAP, war_mode)) return PLUGIN_BAD_ADMIN; } if (gpCmd->Cmd_Argc() < 2) return gpManiHelp->ShowHelp(player_ptr, command_name, help_id, command_type); const char *map_name = gpCmd->Cmd_Argv(1); for( int i = 0; i < map_list_size; i++ ) { // String must be valid map !! if (FStrEq(map_list[i].map_name, map_name)) { Q_strcpy(forced_nextmap,map_name); Q_strcpy(next_map, map_name); mani_nextmap.SetValue(next_map); LogCommand (player_ptr, "%s %s\n", command_name, map_name); override_changelevel = MANI_MAX_CHANGELEVEL_TRIES; override_setnextmap = true; SetChangeLevelReason("Admin set nextmap"); // Make sure end of map vote doesn't try and override it gpManiVote->SysSetMapDecided(true); gpManiAutoMap->SetMapOverride(false); AdminSayToAll(ORANGE_CHAT, player_ptr, mani_adminmap_anonymous.GetInt(), "set nextmap to %s", map_name); return PLUGIN_STOP; } } LogCommand(player_ptr, "User attempted to set mapname [%s] as the nextmap\n", map_name); OutputHelpText(ORANGE_CHAT, player_ptr, "Map [%s] is not in maplist.txt file", map_name); return PLUGIN_STOP; }
void MMatchServer::OnChatBan(const MUID& uidSender, const char* pName, const char* pReason) { MMatchObject* pObj = GetObject(uidSender); if (pObj && IsAdminGrade(pObj)) { MMatchObject* pTarget = GetPlayerByName(pName); if (pTarget) { m_MatchDBMgr.EventJjangUpdate(pTarget->GetAccountInfo()->m_nAID, false, MMUG_CHAT_LIMITED); Disconnect(pTarget->GetUID()); } LogCommand("cban", pObj->GetCharInfo()->m_szName, pReason); } }
void MMatchServer::OnStop(const MUID& uidSender, const char* pName) { MMatchObject* pObj = GetObject(uidSender); if (pObj && IsAdminGrade(pObj)) { MMatchObject* pTarget = GetPlayerByName(pName); if (pTarget) { MCommand* pCmd = CreateCommand(MC_ADMIN_STOP, MUID(0,0)); pCmd->AddParameter(new MCmdParamStr(pName)); RouteToListener(pTarget, pCmd); } LogCommand("stop", pObj->GetCharInfo()->m_szName, ""); } }
//--------------------------------------------------------------------------------- // Purpose: Process the ma_knives //--------------------------------------------------------------------------------- PLUGIN_RESULT ManiWeaponMgr::ProcessMaKnives(player_t *player_ptr, const char *command_name, const int help_id, const int command_type) { if ((!gpManiGameType->IsGameType(MANI_GAME_CSS)) && (!gpManiGameType->IsGameType(MANI_GAME_CSGO))) return PLUGIN_CONTINUE; if (player_ptr) { // Check if player is admin if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_RESTRICT_WEAPON, war_mode)) return PLUGIN_BAD_ADMIN; } this->RestrictAll(); LogCommand (player_ptr, "Only knives can be used next round !!!\n"); SayToAll(GREEN_CHAT, true, "%s", Translate(NULL, 3050)); return PLUGIN_STOP; }
//--------------------------------------------------------------------------------- // Purpose: Process the ma_unrestrictall command //--------------------------------------------------------------------------------- PLUGIN_RESULT ManiWeaponMgr::ProcessMaUnRestrictAll(player_t *player_ptr, const char *command_name, const int help_id, const int command_type) { if ((!gpManiGameType->IsGameType(MANI_GAME_CSS)) && (!gpManiGameType->IsGameType(MANI_GAME_CSGO))) return PLUGIN_CONTINUE; if (player_ptr) { // Check if player is admin if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_RESTRICT_WEAPON, war_mode)) return PLUGIN_BAD_ADMIN; } // UnRestrict all the weapons this->UnRestrictAll(); LogCommand (player_ptr, "unrestricted all weapons\n"); SayToAll(GREEN_CHAT, true, "%s", Translate(NULL, 3048)); return PLUGIN_STOP; }
//--------------------------------------------------------------------------------- // Purpose: Process the ma_nosnipers //--------------------------------------------------------------------------------- PLUGIN_RESULT ManiWeaponMgr::ProcessMaNoSnipers(player_t *player_ptr, const char *command_name, const int help_id, const int command_type) { if ((!gpManiGameType->IsGameType(MANI_GAME_CSS)) && (!gpManiGameType->IsGameType(MANI_GAME_CSGO))) return PLUGIN_CONTINUE; if (player_ptr) { // Check if player is admin if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_RESTRICT_WEAPON, war_mode)) return PLUGIN_BAD_ADMIN; } this->UnRestrictAll(); this->SetWeaponRestriction("awp", true); this->SetWeaponRestriction("g3sg1", true); this->SetWeaponRestriction("sg550", true); this->SetWeaponRestriction("scout", true); LogCommand (player_ptr, "No sniper weapons next round !!!\n"); SayToAll(GREEN_CHAT, true, "%s", Translate(NULL, 3053)); return PLUGIN_STOP; }
bool CCommandControl::ClientCommand(player_t *player_ptr) { if ( !mani_command_flood_time.GetBool() ) return true; int time_to_check = mani_command_flood_time.GetInt(); int player_index = player_ptr->index - 1; if ( player_index < 0 || player_index >= max_players ) return false; player_command_times[player_index].times.push_back(gpGlobals->curtime); CommandsIssuedOverTime ( player_index, time_to_check ); if ( (int) (player_command_times[player_index].times.size() - 1) >= mani_command_flood_total.GetInt() ) { //add one to the players violation count player_command_times[player_index].violation_count += 1; if( mani_command_flood_punish.GetInt() == 1 ) { //kick punishment if ( player_command_times[player_index].violation_count >= mani_command_flood_violation_count.GetInt() ) gpManiPlayerKick->KickPlayer ( player_ptr->index, "Kicked due to command spam" ); //kick the player immediately } else if ( mani_command_flood_punish.GetInt() == 2 ) { //ban punishment if ( player_command_times[player_index].violation_count >= mani_command_flood_violation_count.GetInt() ) { //ban the player LogCommand (NULL,"Ban (Command Spam) [%s] [%s]\n", player_ptr->name, player_ptr->steam_id); gpManiHandleBans->AddBan(player_ptr, player_ptr->steam_id, "MAP", mani_command_flood_punish_ban_time.GetInt(), "Banned (Command spam)", "Banned (Command spam)"); gpManiHandleBans->WriteBans(); } } return false; } return true; }
//--------------------------------------------------------------------------------- // Purpose: Player Spawned //--------------------------------------------------------------------------------- void ManiAntiRejoin::PlayerSpawn(player_t *player_ptr) { if (war_mode) return; if (IsLAN()) return; if ((!gpManiGameType->IsGameType(MANI_GAME_CSS)) && (!gpManiGameType->IsGameType(MANI_GAME_CSGO))) return; if (gpManiWarmupTimer->InWarmupRound()) return; if (!gpManiGameType->IsValidActiveTeam(player_ptr->team)) return; if (mani_anti_rejoin.GetInt() == 0) return; if (player_ptr->is_bot) return; if(rejoin_list.find(player_ptr->steam_id) == rejoin_list.end()) { return; } if (rejoin_list[player_ptr->steam_id] == gpManiTeam->GetTeamScore(2) + gpManiTeam->GetTeamScore(3)) { SlayPlayer(player_ptr, true, true, true); SayToAll(GREEN_CHAT, true, "%s", Translate(NULL, 3060, "%s", player_ptr->name)); LogCommand (NULL, "slayed user for rejoining the same round [%s] [%s]\n", player_ptr->name, player_ptr->steam_id); } }
void MMatchServer::OnHwBan(const MUID& uidSender, const char* pName, const char* pReason) { MMatchObject* pObj = GetObject(uidSender); if (pObj && IsAdminGrade(pObj)) { char message[512]; char razon[500]; if (strstr(pName, "%") || strstr(pReason, "%")) return; if(strlen(pReason) > 500) strcpy_s(razon, 500, pReason); else strcpy(razon, pReason); MMatchObject* pTarget = GetPlayerByName(pName); if(pTarget) { m_MatchDBMgr.spBanPC(pTarget->GetAccountInfo()->m_nAID, razon); Disconnect(pTarget->GetUID()); sprintf(message, "%s - %s", pTarget->GetAccountName(), pReason); LogCommand("banpc", pObj->GetCharInfo()->m_szName, message); } } }
//--------------------------------------------------------------------------------- // Purpose: Level Loaded //--------------------------------------------------------------------------------- void ManiAutoMap::LevelInit(void) { this->ResetTimeout(mani_automap_timer.GetInt()); ignore_this_map = false; if (set_next_map) { int map_choice = this->ChooseMap(); Q_strcpy(forced_nextmap, automap_list[map_choice].map_name); Q_strcpy(next_map, automap_list[map_choice].map_name); mani_nextmap.SetValue(automap_list[map_choice].map_name); override_changelevel = MANI_MAX_CHANGELEVEL_TRIES; override_setnextmap = true; // Make sure end of map vote doesn't try and override it gpManiVote->SysSetMapDecided(true); set_next_map = false; ignore_this_map = true; SetChangeLevelReason("Automap set nextmap"); LogCommand (NULL, "Autochange set nextmap %s while server idle\n", automap_list[map_choice].map_name); } }
//--------------------------------------------------------------------------------- // Purpose: Process the ma_observe command //--------------------------------------------------------------------------------- PLUGIN_RESULT ManiObserverTrack::ProcessMaObserve ( player_t *player_ptr, const char *command_name, const int help_id, const int command_type ) { if (war_mode) return PLUGIN_CONTINUE; if (gpManiGameType->GetVFuncIndex(MANI_VFUNC_SET_OBSERVER_TARGET) == -1) return PLUGIN_CONTINUE; if (!gpManiGameType->IsSpectatorAllowed()) return PLUGIN_CONTINUE; if (player_ptr) { // Check if player is admin if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_BASIC_ADMIN, war_mode)) return PLUGIN_BAD_ADMIN; } if (gpCmd->Cmd_Argc() < 2) return gpManiHelp->ShowHelp(player_ptr, command_name, help_id, command_type); const char *target_string = gpCmd->Cmd_Argv(1); // Whoever issued the commmand is authorised to do it. if (!FindTargetPlayers(player_ptr, target_string, NULL)) { OutputHelpText(ORANGE_CHAT, player_ptr, "%s", Translate(player_ptr, M_NO_TARGET, "%s", target_string)); return PLUGIN_STOP; } // Found a player to observe for (int i = 0; i < target_player_list_size; i++) { if (target_player_list[i].player_info->IsFakeClient()) { continue; } observer_id[player_ptr->index - 1] = target_player_list[i].index; strcpy(observer_steam[player_ptr->index - 1], ""); if (mani_sb_observe_mode.GetInt() == 1) { helpers->ClientCommand(player_ptr->entity, "sb_status"); } LogCommand (player_ptr, "observing user [%s] [%s]\n", target_player_list[i].name, target_player_list[i].steam_id); OutputHelpText(GREEN_CHAT, player_ptr, "%s", Translate(player_ptr, 3118, "%s%s", target_player_list[i].name, target_player_list[i].steam_id)); if (!gpManiGameType->IsValidActiveTeam(target_player_list[i].team)) { break; } if (!target_player_list[i].is_dead && (player_ptr->is_dead || gpManiGameType->GetSpectatorIndex() == player_ptr->team)) { CBaseEntity *pTarget = EdictToCBE(target_player_list[i].entity); CBasePlayer *pBase = (CBasePlayer *) EdictToCBE(player_ptr->entity); CBasePlayer_SetObserverTarget(pBase, pTarget); OutputHelpText(GREEN_CHAT, player_ptr, "%s", Translate(player_ptr, 3116, "%s%s", target_player_list[i].name, target_player_list[i].steam_id)); } break; } return PLUGIN_STOP; }
bool CMUSHclientDoc::ProcessOneAliasSequence (const CString strCurrentLine, const bool bCountThem, bool & bOmitFromLog, bool & bEchoAlias, CAliasList & AliasList, OneShotItemMap & mapOneShotItems) { for (int iAlias = 0; iAlias < GetAliasArray ().GetSize (); iAlias++) { CAlias * alias_item = GetAliasArray () [iAlias]; // ignore non-enabled aliases if (!alias_item->bEnabled) continue; m_iAliasesEvaluatedCount++; BOOL bMatched; // empty wildcards now for (int i = 0; i < MAX_WILDCARDS; i++) alias_item->wildcards [i] = ""; CString strTarget = strCurrentLine; try { bMatched = regexec (alias_item->regexp, strTarget); } catch(CException* e) { e->ReportError (); e->Delete (); bMatched = false; } if (!bMatched) // no match, try next one continue; m_iAliasesMatchedCount++; m_iAliasesMatchedThisSessionCount++; if (alias_item->bOneShot) mapOneShotItems.push_back ( OneShotItem (m_CurrentPlugin, (const char *) alias_item->strInternalName)); // if alias wants it, omit entire typed line from command history if (alias_item->bOmitFromCommandHistory) m_bOmitFromCommandHistory = true; alias_item->wildcards.clear (); for (int iWildcard = 0; iWildcard < MAX_WILDCARDS; iWildcard++) alias_item->wildcards.push_back ( FixWildcard (alias_item->regexp->GetWildcard (iWildcard), false, alias_item->iSendTo, m_strLanguage) ); // echo the alias they typed, unless command echo off, or previously displayed // (if wanted - v3.38) if (bEchoAlias && // not already done alias_item->bEchoAlias) // alias wants to be echoed { DisplayMsg (strCurrentLine + ENDLINE, strCurrentLine.GetLength () + strlen (ENDLINE), USER_INPUT | (LoggingInput () ? LOG_LINE : 0)); bEchoAlias = false; // don't echo the same line twice // and log the command the actually typed if (LoggingInput ()) LogCommand (strCurrentLine); } if (bCountThem) alias_item->nMatched++; // count alias matches bOmitFromLog = alias_item->bOmitFromLog; alias_item->tWhenMatched = CTime::GetCurrentTime(); // when it matched if (alias_item->strLabel.IsEmpty ()) Trace ("Matched alias \"%s\"", (LPCTSTR) alias_item->name); else Trace ("Matched alias %s", (LPCTSTR) alias_item->strLabel); // if we have to do parameter substitution on the alias, do it now CString strSendText; // copy contents to strSendText area, replacing %1, %2 etc. with appropriate contents try { strSendText = FixSendText (::FixupEscapeSequences (alias_item->contents), alias_item->iSendTo, // where it is going alias_item->regexp, // regexp GetLanguage (), // eg. vbscript false, // lower-case wildcards alias_item->bExpandVariables, // expand variables true, // expand wildcards false, // convert regexps false, // is it regexp or normal? true); // throw exceptions } catch (CException* e) { e->ReportError(); e->Delete(); return true; } AliasList.AddTail (alias_item); // add to list of aliases CString strExtraOutput; // let them know if they are foolishly trying to send to a closed connection // - only applies to commands that actually send to the world if (!strSendText.IsEmpty ()) switch (alias_item->iSendTo) { case eSendToWorld: case eSendToCommandQueue: case eSendToSpeedwalk: case eSendImmediate: if (CheckConnected ()) return true; break; } alias_item->bExecutingScript = true; // cannot be deleted now SendTo (alias_item->iSendTo, strSendText, alias_item->bOmitFromOutput, alias_item->bOmitFromLog, TFormat ("Alias: %s", (LPCTSTR) alias_item->strLabel), alias_item->strVariable, strExtraOutput); alias_item->bExecutingScript = false; // can be deleted now // display any stuff sent to output window if (!strExtraOutput.IsEmpty ()) DisplayMsg (strExtraOutput, strExtraOutput.GetLength (), COMMENT); // only re-match if they want multiple matches if (!alias_item->bKeepEvaluating) break; } // end of looping, checking each alias return FALSE; } // end of CMUSHclientDoc::ProcessOneAliasSequence
bool ChatHandler::HandleAccountPasswordCommand(char* args) { // allow use from RA, but not from console (not have associated account id) if (!GetAccountId()) { SendSysMessage(LANG_RA_ONLY_COMMAND); SetSentErrorMessage(true); return false; } // allow or quoted string with possible spaces or literal without spaces char* old_pass = ExtractQuotedOrLiteralArg(&args); char* new_pass = ExtractQuotedOrLiteralArg(&args); char* new_pass_c = ExtractQuotedOrLiteralArg(&args); if (!old_pass || !new_pass || !new_pass_c) { return false; } std::string password_old = old_pass; std::string password_new = new_pass; std::string password_new_c = new_pass_c; if (password_new != password_new_c) { SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); SetSentErrorMessage(true); return false; } if (!sAccountMgr.CheckPassword(GetAccountId(), password_old)) { SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); SetSentErrorMessage(true); return false; } AccountOpResult result = sAccountMgr.ChangePassword(GetAccountId(), password_new); switch (result) { case AOR_OK: SendSysMessage(LANG_COMMAND_PASSWORD); break; case AOR_PASS_TOO_LONG: SendSysMessage(LANG_PASSWORD_TOO_LONG); SetSentErrorMessage(true); return false; case AOR_NAME_NOT_EXIST: // not possible case, don't want get account name for output default: SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); SetSentErrorMessage(true); return false; } // OK, but avoid normal report for hide passwords, but log use command for anyone LogCommand(".account password *** *** ***"); SetSentErrorMessage(true); return false; }
//--------------------------------------------------------------------------------- // Purpose: Process the ma_play command //--------------------------------------------------------------------------------- PLUGIN_RESULT ProcessMaPlaySound(player_t *player_ptr, const char *command_name, const int help_id, const int command_type) { bool unlimited_play = false; if (player_ptr) { // Check if player is admin if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_BASIC_ADMIN)) { if (mani_sounds_per_round.GetInt() == 0) { OutputHelpText(ORANGE_CHAT, player_ptr, "Mani Admin Plugin: You are not authorised to use admin commands"); return PLUGIN_STOP; } } else { // Definately admin but can they play sounds ? if (!gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_PLAYSOUND) || war_mode) { if (mani_sounds_per_round.GetInt() == 0) { OutputHelpText(ORANGE_CHAT, player_ptr, "Mani Admin Plugin: You are not authorised to play sounds"); return PLUGIN_STOP; } } else { // Is admin and allowed to play to their hearts content unlimited_play = true; } } } else { unlimited_play = true; } if (gpCmd->Cmd_Argc() < 2) return (gpManiHelp->ShowHelp(player_ptr, command_name, help_id, command_type)); if (player_ptr && !unlimited_play) { // Check to see if player has reached their limit if (sounds_played[player_ptr->index - 1] < mani_sounds_per_round.GetInt()) { sounds_played[player_ptr->index - 1] ++; } else { SayToPlayer(ORANGE_CHAT, player_ptr, "You can't play any more sounds this round"); return PLUGIN_STOP; } } int sound_index; char play_sound[512]; // See if we can find a match by index or partial match on name sound_index = atoi(gpCmd->Cmd_Argv(1)); if (sound_index < 1 || sound_index > sound_list_size) { bool found_match = false; for (int i = 0; i < sound_list_size; i ++) { if (NULL != Q_stristr(sound_list[i].alias, gpCmd->Cmd_Argv(1))) { sound_index = i; found_match = true; break; } } if (!found_match) { OutputHelpText(ORANGE_CHAT, player_ptr, "Did not find sound requested"); if ( !unlimited_play ) sounds_played[player_ptr->index - 1] --; // don't penalize them for the sound not existing! return PLUGIN_STOP; } } else { sound_index --; } for (int i = 1; i <= max_players; i++ ) { player_t target_player; target_player.index = i; if (!FindPlayerByIndex(&target_player)) continue; if (target_player.is_bot) continue; player_settings_t *player_settings; player_settings = FindPlayerSettings(&target_player); if (!player_settings) continue; // This player doesn't want to hear sounds if (player_settings->server_sounds == 0) continue; if (!unlimited_play && mani_sounds_filter_if_dead.GetInt() == 1) { // Is player who triggered it dead if (player_ptr->is_dead) { if (!target_player.is_dead) { // Don't play to alive players continue; } } } if ( mani_play_sound_type.GetBool() ) snprintf(play_sound, sizeof(play_sound), "play \"%s\"\n",sound_list[sound_index].sound_name); else snprintf(play_sound, sizeof(play_sound), "playgamesound \"%s\"\n",sound_list[sound_index].sound_name); engine->ClientCommand(target_player.entity, play_sound); //UTIL_EmitSoundSingle(&target_player, sound_list[sound_index].sound_name); } if(!unlimited_play) { // Not admin so output message if (mani_sounds_filter_if_dead.GetInt() == 1) { if (player_ptr->is_dead) { SayToDead(ORANGE_CHAT, "Player %s played sound %s", player_ptr->name, sound_list[sound_index].alias); } else { SayToAll(ORANGE_CHAT, false, "Player %s played sound %s", player_ptr->name, sound_list[sound_index].alias); } } else { SayToAll(ORANGE_CHAT, false, "Player %s played sound %s", player_ptr->name, sound_list[sound_index].alias); } DirectLogCommand("[MANI_ADMIN_PLUGIN] Player [%s] Steam ID [%s] played sound [%s]\n", player_ptr->name, player_ptr->steam_id, sound_list[sound_index].alias); } else { LogCommand(player_ptr, "played sound %s\n", sound_list[sound_index].alias); } return PLUGIN_STOP; }
//--------------------------------------------------------------------------------- // Purpose: Do timed afk if needed //--------------------------------------------------------------------------------- void ManiAFK::GameFrame(void) { if (war_mode) return; if (mani_afk_kicker.GetInt() == 0) return; if (mani_afk_kicker_alive_timer.GetInt() == 0 && mani_afk_kicker_spectator_timer.GetInt() == 0) return; if (gpManiGameType->GetVFuncIndex(MANI_VFUNC_USER_CMDS) == -1) return; if (g_RealTime < next_check) return; next_check = g_RealTime + 1; int max_timeout; if (mani_afk_kicker_alive_timer.GetInt() == 0) { max_timeout = mani_afk_kicker_spectator_timer.GetInt(); } else if (mani_afk_kicker_spectator_timer.GetInt() == 0) { max_timeout = mani_afk_kicker_alive_timer.GetInt(); } else { if (mani_afk_kicker_alive_timer.GetInt() > mani_afk_kicker_spectator_timer.GetInt()) { max_timeout = mani_afk_kicker_spectator_timer.GetInt(); } else { max_timeout = mani_afk_kicker_alive_timer.GetInt(); } } // Process our list for (int i = 0; i < max_players; i++) { if (!afk_list[i].check_player) continue; // Faster way of discriminating hopefully without getting player data // We are in game frame dont forget :) if (afk_list[i].last_active + max_timeout > g_RealTime) continue; player_t player; player.index = i + 1; if (!FindPlayerByIndex(&player)) { this->ResetPlayer(i, false); continue; } if (player.is_bot) continue; if (gpManiGameType->IsValidActiveTeam(player.team) && mani_afk_kicker_alive_timer.GetInt() != 0) { // Player on active team (considered alive) if (afk_list[i].last_active + mani_afk_kicker_alive_timer.GetInt() <= g_RealTime) { if (gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_AFK)) { this->ResetPlayer(i, true); if (mani_afk_kicker_immunity_to_spec_only.GetInt() == 1) { // Shift player to spectator player.player_info->ChangeTeam(gpManiGameType->GetSpectatorIndex()); //engine->ClientCommand(player.entity, "cmd jointeam %i", gpManiGameType->GetSpectatorIndex()); SayToPlayer(GREEN_CHAT, &player, "You were moved to the Spectator team for being AFK"); LogCommand(NULL, "AFK-Kicker moved player [%s] [%s] to Spectator\n", player.name, player.steam_id); continue; } continue; } // Exceeded timeout this->ResetPlayer(i, true); if (mani_afk_kicker_mode.GetInt() == 0) { // Shift player to spectator player.player_info->ChangeTeam(gpManiGameType->GetSpectatorIndex()); //engine->ClientCommand(player.entity, "cmd jointeam %i", gpManiGameType->GetSpectatorIndex()); SayToPlayer(GREEN_CHAT, &player, "You were moved to the Spectator team for being AFK"); LogCommand(NULL, "AFK-Kicker moved player [%s] [%s] to Spectator\n", player.name, player.steam_id); } else { // Need to kick player SayToPlayer(GREEN_CHAT, &player, "You have been kicked for being AFK"); UTIL_KickPlayer(&player, "Auto-kicked for being AFK", "You were automatically kicked for being AFK", "Auto-AFK kicked"); } } } else if (player.team == gpManiGameType->GetSpectatorIndex() && mani_afk_kicker_spectator_timer.GetInt() != 0) { // Player is spectator // Player on active team (considered alive) if (afk_list[i].last_active + mani_afk_kicker_spectator_timer.GetInt() <= g_RealTime) { if (gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_AFK)) { this->ResetPlayer(i, true); continue; } // Exceeded round count this->ResetPlayer(i, false); // Need to kick player SayToPlayer(GREEN_CHAT, &player, "You have been kicked for being AFK"); UTIL_KickPlayer(&player, "Auto-kicked for being AFK", "You were automatically kicked for being AFK", "Auto-AFK kicked"); } } else if (player.team == 0 && gpManiGameType->IsTeamPlayAllowed() && mani_afk_kicker_spectator_timer.GetInt() != 0 && afk_list[i].last_active + mani_afk_kicker_spectator_timer.GetInt() <= g_RealTime) { if (gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_AFK)) { this->ResetPlayer(i, true); continue; } // Exceeded round count this->ResetPlayer(i, false); // Need to kick player SayToPlayer(GREEN_CHAT, &player, "You have been kicked for being AFK"); UTIL_KickPlayer(&player, "Auto-kicked for being AFK", "You were automatically kicked for being AFK", "Auto-AFK kicked"); } } }
VOID ReleaseSlottedCommand( _In_ PAHCI_CHANNEL_EXTENSION ChannelExtension, _In_ UCHAR SlotNumber, _In_ BOOLEAN AtDIRQL ) /*++ Performs Completion Data marshaling back into the SRB It assumes: SRB STATUS has already been filled out ATA status from the AHCI registers is valid for this command SlotNumber points to a fully filled out Slot entry Called by: AhciHwStartIo AhciNonQueuedErrorRecovery AhciCompleteIssuedSRBs It performs: (overview) 1 Initialize 2 Marshal completion data 3 Complete the Command (details) 1.1 Keep track of the completion for our debugging records 2.1 Handle Request Sense marshaling 2.2.1 Handle everything else's marshaling 2.2.2 If this was marked as needing return data, fill in the return Task File 3.1 Make the slot available again 3.2 Perform the Slot's last request, if there was one 3.3.1 IO is completing, that IO may have paused the queue so unpause the queue 3.3.2 Complete the command Affected Variables/Registers: SRB --*/ { PSLOT_CONTENT slotContent; PAHCI_SRB_EXTENSION srbExtension; PSTORAGE_REQUEST_BLOCK srbToRelease; BOOLEAN isSenseSrb; BOOLEAN retrySrb = FALSE; slotContent = &ChannelExtension->Slot[SlotNumber]; if (slotContent->Srb == NULL) { return; } srbExtension = GetSrbExtension(slotContent->Srb); isSenseSrb = IsRequestSenseSrb(srbExtension->AtaFunction); if (LogExecuteFullDetail(ChannelExtension->AdapterExtension->LogFlags)) { RecordExecutionHistory(ChannelExtension, 0x10000053);//ReleaseSlottedCommand } //2/2 Log command completion part for our debugging records if (LogCommand(ChannelExtension->AdapterExtension->LogFlags)) { PCOMMAND_HISTORY cmdHistory; slotContent->CommandHistoryIndex %= 64; // should not be 64 or bigger. do it anyway to make sure we are safe cmdHistory = &ChannelExtension->CommandHistory[slotContent->CommandHistoryIndex]; StorPortCopyMemory((PVOID)&cmdHistory->CompletionFIS, (PVOID)&ChannelExtension->ReceivedFIS->D2hRegisterFis, sizeof(AHCI_D2H_REGISTER_FIS)); cmdHistory->CompletionPx[0] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->CLB.AsUlong); cmdHistory->CompletionPx[1] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->CLBU); cmdHistory->CompletionPx[2] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->FB.AsUlong); cmdHistory->CompletionPx[3] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->FBU); cmdHistory->CompletionPx[4] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->IS.AsUlong); cmdHistory->CompletionPx[5] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->IE.AsUlong); cmdHistory->CompletionPx[6] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->CMD.AsUlong); cmdHistory->CompletionPx[7] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->DW7_Reserved); cmdHistory->CompletionPx[8] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->TFD.AsUlong); cmdHistory->CompletionPx[9] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->SIG.AsUlong); cmdHistory->CompletionPx[10] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->SSTS.AsUlong); cmdHistory->CompletionPx[11] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->SCTL.AsUlong); cmdHistory->CompletionPx[12] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->SERR.AsUlong); cmdHistory->CompletionPx[13] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->SACT); cmdHistory->CompletionPx[14] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->CI); cmdHistory->CompletionPx[15] = StorPortReadRegisterUlong(ChannelExtension->AdapterExtension, &ChannelExtension->Px->SNTF.AsUlong); cmdHistory->SrbStatus = slotContent->Srb->SrbStatus; } //2. Then complete the command if (isSenseSrb) { //2.1 Handle Request Sense marshaling srbToRelease = (PSTORAGE_REQUEST_BLOCK)SrbGetOriginalRequest(slotContent->Srb); //that original SRB must have SRB_STATUS_AUTOSENSE_VALID set appropriately if (slotContent->Srb->SrbStatus == SRB_STATUS_SUCCESS) { srbToRelease->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID; SrbSetScsiStatus(srbToRelease, SCSISTAT_CHECK_CONDITION); } else { srbToRelease->SrbStatus &= ~SRB_STATUS_AUTOSENSE_VALID; } //finish use of Sense.Srb srbExtension->AtaFunction = 0; } else { //2.2.1 Handle everything else's marshaling srbToRelease = slotContent->Srb; if ((srbExtension->Flags & ATA_FLAGS_SENSEDATA_SET) == 0) { //Record error and status srbExtension->AtaStatus = ChannelExtension->TaskFileData.STS.AsUchar; srbExtension->AtaError = ChannelExtension->TaskFileData.ERR; //2.2.2 If this was marked as needing return data, fill in the return Task File. if( IsReturnResults(srbExtension->Flags) ) { SetReturnRegisterValues(ChannelExtension, srbToRelease, NULL); } // interpret ATA error to be SCSI error and fill SenseBuffer // also log IO Record if (IsAtaCommand(srbExtension->AtaFunction) || IsAtaCfisPayload(srbExtension->AtaFunction)) { // IO Record for ATA device is logged in AtaMapError() AtaMapError(ChannelExtension, srbToRelease, slotContent->StateFlags.FUA); } else { if (SRB_STATUS(srbToRelease->SrbStatus) == SRB_STATUS_SUCCESS) { ChannelExtension->DeviceExtension[0].IoRecord.SuccessCount++; } else { ChannelExtension->DeviceExtension[0].IoRecord.OtherErrorCount++; } } } } //3.1 Make the slot available again slotContent->CmdHeader = NULL; slotContent->CommandHistoryIndex = 0; slotContent->Srb = NULL; slotContent->StateFlags.FUA = FALSE; //Clear the CommandsToComplete bit ChannelExtension->SlotManager.CommandsToComplete &= ~(1 << SlotNumber); ChannelExtension->SlotManager.HighPriorityAttribute &= ~(1 << SlotNumber); //3.3.1 IO is completing, that IO may have paused the queue so unpause the queue // During NCQ Error Recovery process, this flag will be reset in the error recovery completion process, either through reset or through slot release again. if (ChannelExtension->StateFlags.NcqErrorRecoveryInProcess == 0) { ChannelExtension->StateFlags.QueuePaused = FALSE; } //3.3.2 Complete the command if ( (srbToRelease->SrbStatus != SRB_STATUS_SUCCESS) && !isSenseSrb && (srbExtension->RetryCount == 0) ) { if ( (ChannelExtension->StateFlags.HybridInfoEnabledOnHiberFile == 1) && IsNCQWriteCommand(srbExtension) ) { // NCQ WRITE with Hybrid Information failed, retry once without Hybrid Information. ChannelExtension->StateFlags.HybridInfoEnabledOnHiberFile = 0; retrySrb = TRUE; } else if (srbToRelease->SrbStatus == SRB_STATUS_PARITY_ERROR) { // if a command encounters CRC error, retry once retrySrb = TRUE; } } if (retrySrb) { srbToRelease->SrbStatus = SRB_STATUS_PENDING; srbExtension->RetryCount++; AhciProcessIo(ChannelExtension, srbToRelease, AtDIRQL); } else { // otherwise, complete it. AhciCompleteRequest(ChannelExtension, srbToRelease, AtDIRQL); } }
//----------------------------------------------------------------------------- // Purpose: handles a request //----------------------------------------------------------------------------- void CServerRemoteAccess::WriteDataRequest( CRConServer *pNetworkListener, ra_listener_id listener, const void *buffer, int bufferSize) { m_iBytesReceived += bufferSize; // ConMsg("RemoteAccess: bytes received: %d\n", m_iBytesReceived); if ( bufferSize < 2*sizeof(int) ) // check that the buffer contains at least the id and type { return; } CUtlBuffer cmd(buffer, bufferSize, CUtlBuffer::READ_ONLY); bool invalidRequest = false; while ( invalidRequest == false && (int)cmd.TellGet() < (int)(cmd.Size() - 2 * sizeof(int) ) ) // while there is commands to read { // parse out the buffer int requestID = cmd.GetInt(); pNetworkListener->SetRequestID( listener, requestID ); // tell the rcon server the ID so it can reflect it when the console redirect flushes int requestType = cmd.GetInt(); switch (requestType) { case SERVERDATA_REQUESTVALUE: { if ( IsAuthenticated(listener) ) { char variable[256]; if ( !GetStringHelper( cmd, variable, sizeof(variable) ) ) { invalidRequest = true; break; } RequestValue( listener, requestID, variable); if ( !GetStringHelper( cmd, variable, sizeof(variable) ) ) { invalidRequest = true; break; } } else { char variable[256]; if ( !GetStringHelper( cmd, variable, sizeof(variable) ) ) { invalidRequest = true; break; } if ( !GetStringHelper( cmd, variable, sizeof(variable) ) ) { invalidRequest = true; break; } } } break; case SERVERDATA_SETVALUE: { if ( IsAuthenticated(listener) ) { char variable[256]; char value[256]; if ( !GetStringHelper( cmd, variable, sizeof(variable) ) ) { invalidRequest = true; break; } if ( !GetStringHelper( cmd, value, sizeof(value) ) ) { invalidRequest = true; break; } SetValue(variable, value); } else { char command[512]; if ( !GetStringHelper( cmd, command, sizeof(command) ) ) { invalidRequest = true; break; } if ( !GetStringHelper( cmd, command, sizeof(command) ) ) { invalidRequest = true; break; } } } break; case SERVERDATA_EXECCOMMAND: { if ( IsAuthenticated(listener) ) { char command[512]; if ( !GetStringHelper( cmd, command, sizeof(command) ) ) { invalidRequest = true; break; } ExecCommand(command); if ( listener != m_AdminUIID ) { LogCommand( listener, va( "command \"%s\"", command) ); } if ( !GetStringHelper( cmd, command, sizeof(command) ) ) { invalidRequest = true; break; } } else { char command[512]; if ( !GetStringHelper( cmd, command, sizeof(command) ) ) { invalidRequest = true; break; } if ( !GetStringHelper( cmd, command, sizeof(command) ) ) { invalidRequest = true; break; } LogCommand( listener, "Bad Password" ); } } break; case SERVERDATA_AUTH: { char password[512]; if ( !GetStringHelper( cmd, password, sizeof(password) ) ) { invalidRequest = true; break; } CheckPassword( pNetworkListener, listener, requestID, password ); if ( !GetStringHelper( cmd, password, sizeof(password) ) ) { invalidRequest = true; break; } if ( m_ListenerIDs[ listener ].authenticated ) { // if the second string has a non-zero value, it is a userid. int userID = atoi( password ); const ConCommandBase *var = g_pCVar->GetCommands(); while ( var ) { if ( var->IsCommand() ) { if ( Q_stricmp( var->GetName(), "mp_disable_autokick" ) == 0 ) { Cbuf_AddText( va( "mp_disable_autokick %d\n", userID ) ); Cbuf_Execute(); break; } } var = var->GetNext(); } } } break; case SERVERDATA_TAKE_SCREENSHOT: #ifndef SWDS m_nScreenshotListener = listener; CL_TakeJpeg( ); #endif break; case SERVERDATA_SEND_CONSOLE_LOG: { #ifndef SWDS const char *pLogFile = GetConsoleLogFilename(); CUtlBuffer buf( 1024, 0, CUtlBuffer::TEXT_BUFFER ); if ( g_pFullFileSystem->ReadFile( pLogFile, "GAME", buf ) ) { HZIP hZip = CreateZipZ( 0, 1024 * 1024, ZIP_MEMORY ); void *pMem; unsigned long nLen; ZipAdd( hZip, "console.log", buf.Base(), buf.TellMaxPut(), ZIP_MEMORY ); ZipGetMemory( hZip, &pMem, &nLen ); SendResponseToClient( listener, SERVERDATA_CONSOLE_LOG_RESPONSE, pMem, nLen ); CloseZip( hZip ); } else { LogCommand( listener, "Failed to read console log!\n" ); RespondString( listener, requestID, "Failed to read console log!\n" ); } #endif } break; #ifdef VPROF_ENABLED case SERVERDATA_VPROF: { char password[25]; if ( !GetStringHelper( cmd, password, sizeof(password) ) ) { invalidRequest = true; break; } if ( !GetStringHelper( cmd, password, sizeof(password) ) ) { invalidRequest = true; break; } if ( IsAuthenticated(listener) ) { RegisterVProfDataListener( listener ); LogCommand( listener, "Remote VProf started!\n" ); RespondString( listener, requestID, "Remote VProf started!\n" ); } } break; case SERVERDATA_REMOVE_VPROF: { char password[25]; if ( !GetStringHelper( cmd, password, sizeof(password) ) ) { invalidRequest = true; break; } if ( !GetStringHelper( cmd, password, sizeof(password) ) ) { invalidRequest = true; break; } if ( IsAuthenticated(listener) ) { RemoveVProfDataListener( listener ); LogCommand( listener, "Remote VProf finished!\n" ); RespondString( listener, requestID, "Remote VProf finished!\n" ); } } break; #endif default: Assert(!("Unknown requestType in CServerRemoteAccess::WriteDataRequest()")); cmd.Purge(); invalidRequest = true; break; }; } }
//--------------------------------------------------------------------------------- // Purpose: Do kicks on round end //--------------------------------------------------------------------------------- void ManiAFK::RoundEnd(void) { if (war_mode) return; if (mani_afk_kicker.GetInt() == 0) return; if (mani_afk_kicker_alive_rounds.GetInt() == 0 && mani_afk_kicker_spectator_rounds.GetInt() == 0) return; if (gpManiGameType->GetVFuncIndex(MANI_VFUNC_USER_CMDS) == -1) return; if (gpManiWarmupTimer->InWarmupRound()) return; for (int i = 0; i < max_players; i++) { if (!afk_list[i].check_player) continue; player_t player; player.index = i + 1; if (!FindPlayerByIndex(&player)) { this->ResetPlayer(i, false); continue; } if (player.is_bot) continue; if (afk_list[i].idle) { afk_list[i].round_count++; if (gpManiGameType->IsValidActiveTeam(player.team) && mani_afk_kicker_alive_rounds.GetInt() != 0) { // Player on active team (considered alive) if (afk_list[i].round_count > mani_afk_kicker_alive_rounds.GetInt()) { if (gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_AFK)) { this->ResetPlayer(i, true); if (mani_afk_kicker_immunity_to_spec_only.GetInt() == 1) { // Shift player to spectator player.player_info->ChangeTeam(gpManiGameType->GetSpectatorIndex()); //engine->ClientCommand(player.entity, "cmd jointeam %i", gpManiGameType->GetSpectatorIndex()); SayToPlayer(GREEN_CHAT, &player, "You were moved to the Spectator team for being AFK"); LogCommand(NULL, "AFK-Kicker moved player [%s] [%s] to Spectator\n", player.name, player.steam_id); continue; } continue; } // Exceeded round count this->ResetPlayer(i, true); if (mani_afk_kicker_mode.GetInt() == 0) { // Shift player to spectator player.player_info->ChangeTeam(gpManiGameType->GetSpectatorIndex()); //engine->ClientCommand(player.entity, "cmd jointeam %i", gpManiGameType->GetSpectatorIndex()); SayToPlayer(GREEN_CHAT, &player, "You were moved to the Spectator team for being AFK"); LogCommand(NULL, "AFK-Kicker moved player [%s] [%s] to Spectator\n", player.name, player.steam_id); } else { // Need to kick player SayToPlayer(GREEN_CHAT, &player, "You have been kicked for being AFK"); UTIL_KickPlayer(&player, "Auto-kicked for being AFK", "You were automatically kicked for being AFK", "Auto-AFK kicked"); } } } else if (player.team == gpManiGameType->GetSpectatorIndex() && mani_afk_kicker_spectator_rounds.GetInt() != 0) { // Player is spectator // Player on active team (considered alive) if (afk_list[i].round_count > mani_afk_kicker_spectator_rounds.GetInt()) { if (gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_AFK)) { this->ResetPlayer(i, true); continue; } // Exceeded round count this->ResetPlayer(i, false); // Need to kick player SayToPlayer(GREEN_CHAT, &player, "You have been kicked for being AFK"); UTIL_KickPlayer(&player, "Auto-kicked for being AFK", "You were automatically kicked for being AFK", "Auto-AFK kicked"); } } else if (player.team == 0 && gpManiGameType->IsTeamPlayAllowed() && mani_afk_kicker_spectator_rounds.GetInt() != 0 && afk_list[i].round_count > mani_afk_kicker_spectator_rounds.GetInt()) { if (gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_AFK)) { this->ResetPlayer(i, true); continue; } // Exceeded round count this->ResetPlayer(i, false); // Need to kick player SayToPlayer(GREEN_CHAT, &player, "You have been kicked for being AFK"); UTIL_KickPlayer(&player, "Auto-kicked for being AFK", "You were automatically kicked for being AFK", "Auto-AFK kicked"); } } } for (int i = 0; i < max_players; i++) { if (!afk_list[i].check_player) continue; afk_list[i].idle = true; } }
void COverlayRenderer::ProcessOverlay(const BD_OVERLAY* pOv) { if (!pOv) { CloseOverlay(BD_OVERLAY_IG); CloseOverlay(BD_OVERLAY_PG); return; } else if (pOv->plane > BD_OVERLAY_IG) return; LogCommand(pOv); switch (pOv->cmd) { case BD_OVERLAY_INIT: ASSERT(m_overlayType[pOv->plane] == NONE); OpenOverlay(pOv); m_overlayType[pOv->plane] = NORMAL_OVERLAY; return; case BD_OVERLAY_CLOSE: ASSERT(m_overlayType[pOv->plane] == NORMAL_OVERLAY); CloseOverlay(pOv->plane); FreeOverlayQueue(pOv->plane); m_overlayType[pOv->plane] = NONE; return; } OSDTexture* plane = m_pPlanesBackbuffer[pOv->plane]; // Workaround for some BDs that wont issue BD_OVERLAY_INIT after BD_OVERLAY_CLOSE if (!plane) { OpenOverlay(pOv); plane = m_pPlanesBackbuffer[pOv->plane]; if (!plane) return; } switch (pOv->cmd) { case BD_OVERLAY_DRAW: DrawBitmap(plane, pOv); break; case BD_OVERLAY_WIPE: ClearArea(plane, pOv); break; case BD_OVERLAY_CLEAR: ClearOverlay(pOv->plane); break; case BD_OVERLAY_HIDE: // TODO break; case BD_OVERLAY_FLUSH: { CopyToFrontBuffer(pOv->plane); OSDTexture* plane = m_pPlanes[pOv->plane]; m_pLib->HandleOSDUpdate(*plane); break; } default: break; } }
VOID ReleaseSlottedCommand( _In_ PAHCI_CHANNEL_EXTENSION ChannelExtension, _In_ UCHAR SlotNumber, _In_ BOOLEAN AtDIRQL ) /*++ Performs Completion Data marshalling back into the SRB It assumes: SRB STATUS has already been filled out ATA status from the AHCI registers is valid for this command SlotNumber points to a fully filled out Slot entry Called by: AhciHwStartIo AhciNonQueuedErrorRecovery AhciCompleteIssuedSRBs It performs: (overview) 1 Intialize 2 Marshal completion data 3 Complete the Command (details) 1.1 Keep track of the completion for our debugging records 2.1 Handle Request Sense marshalling 2.2.1 Handle everything else's marshalling 2.2.2 If this was marked as needing return data, fill in the return Task File 3.1 Make the slot available again 3.2 Perform the Slot's last request, if there was one 3.3.1 IO is completing, that IO may have paused the queue so unpause the queue 3.3.2 Complete the command Affected Variables/Registers: SRB --*/ { PSLOT_CONTENT slotContent; PAHCI_SRB_EXTENSION srbExtension; PSTORAGE_REQUEST_BLOCK srbToRelease; PATA_TASK_FILE returnTaskFile; BOOLEAN isSenseSrb; BOOLEAN retrySrb = FALSE; slotContent = &ChannelExtension->Slot[SlotNumber]; if (slotContent->Srb == NULL) { return; } srbExtension = GetSrbExtension(slotContent->Srb); isSenseSrb = IsRequestSenseSrb(srbExtension->AtaFunction); if (LogExecuteFullDetail(ChannelExtension->AdapterExtension->LogFlags)) { RecordExecutionHistory(ChannelExtension, 0x10000053);//ReleaseSlottedCommand } //2/2 Log command completion part for our debugging records if (LogCommand(ChannelExtension->AdapterExtension->LogFlags)) { PCOMMAND_HISTORY cmdHistory; slotContent->CommandHistoryIndex %= 64; // should not be 64 or bigger. do it anyway to make sure we are safe cmdHistory = &ChannelExtension->CommandHistory[slotContent->CommandHistoryIndex]; StorPortCopyMemory((PVOID)&cmdHistory->CompletionFIS, (PVOID)&ChannelExtension->ReceivedFIS->D2hRegisterFis, sizeof(AHCI_D2H_REGISTER_FIS)); StorPortCopyMemory((PVOID)&cmdHistory->CompletionPx, (PVOID)ChannelExtension->Px, 0x40); cmdHistory->SrbStatus = slotContent->Srb->SrbStatus; } //2. Then complete the command if (isSenseSrb) { //2.1 Handle Request Sense marshalling srbToRelease = (PSTORAGE_REQUEST_BLOCK)SrbGetOriginalRequest(slotContent->Srb); //that original SRB must have SRB_STATUS_AUTOSENSE_VALID set appropriately if (slotContent->Srb->SrbStatus == SRB_STATUS_SUCCESS) { srbToRelease->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID; SrbSetScsiStatus(srbToRelease, SCSISTAT_CHECK_CONDITION); } else { srbToRelease->SrbStatus &= ~SRB_STATUS_AUTOSENSE_VALID; } //finish use of Sense.Srb srbExtension->AtaFunction = 0; } else { //2.2.1 Handle everything else's marshalling srbToRelease = slotContent->Srb; //Record error and status srbExtension->AtaStatus = ChannelExtension->TaskFileData.STS.AsUchar; srbExtension->AtaError = ChannelExtension->TaskFileData.ERR; //2.2.2 If this was marked as needing return data, fill in the return Task File. if( IsReturnResults(srbExtension->Flags) ) { PCDB cdb = SrbGetCdb(srbToRelease); if ((cdb != NULL) && (cdb->CDB10.OperationCode == SCSIOP_ATA_PASSTHROUGH16)) { // for ATA PASS THROUGH 16 command, return Descriptor Format Sense Data, including ATA Status Return info. if (srbExtension->ResultBufferLength >= sizeof(DESCRIPTOR_SENSE_DATA)) { PDESCRIPTOR_SENSE_DATA descriptorSenseData = (PDESCRIPTOR_SENSE_DATA)srbExtension->ResultBuffer; PSCSI_SENSE_DESCRIPTOR_ATA_STATUS_RETURN ataStatus = (PSCSI_SENSE_DESCRIPTOR_ATA_STATUS_RETURN)((PUCHAR)descriptorSenseData + FIELD_OFFSET(DESCRIPTOR_SENSE_DATA, DescriptorBuffer)); AhciZeroMemory((PCHAR)srbExtension->ResultBuffer, srbExtension->ResultBufferLength); // fill sense data header, leave SenseKey, ASC, ASCQ as zero. descriptorSenseData->ErrorCode = SCSI_SENSE_ERRORCODE_DESCRIPTOR_CURRENT; descriptorSenseData->AdditionalSenseLength = sizeof(SCSI_SENSE_DESCRIPTOR_ATA_STATUS_RETURN); // fill ATA Status Return Info. ataStatus->Header.DescriptorType = SCSI_SENSE_DESCRIPTOR_TYPE_ATA_STATUS_RETURN; ataStatus->Header.AdditionalLength = 0x0C; ataStatus->Extend = Is48BitCommand(srbExtension->Flags) ? 1 : 0; ataStatus->Error = ChannelExtension->ReceivedFIS->D2hRegisterFis.Error; ataStatus->SectorCount7_0 = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorCount; ataStatus->LbaLow7_0 = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorNumber; ataStatus->LbaMid7_0 = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylLow; ataStatus->LbaHigh7_0 = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylHigh; ataStatus->Device = ChannelExtension->ReceivedFIS->D2hRegisterFis.Dev_Head; ataStatus->Status = ChannelExtension->ReceivedFIS->D2hRegisterFis.Status; if (Is48BitCommand(srbExtension->Flags)) { ataStatus->SectorCount15_8 = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorCount_Exp; ataStatus->LbaLow15_8 = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorNum_Exp; ataStatus->LbaMid15_8 = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylLow_Exp; ataStatus->LbaHigh15_8 = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylHigh_Exp; } } else { NT_ASSERT(FALSE); } } else { returnTaskFile = (PATA_TASK_FILE)srbExtension->ResultBuffer; returnTaskFile->Current.bCommandReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.Status; returnTaskFile->Current.bFeaturesReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.Error; returnTaskFile->Current.bCylHighReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylHigh; returnTaskFile->Current.bCylLowReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylLow; returnTaskFile->Current.bDriveHeadReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.Dev_Head; returnTaskFile->Current.bSectorCountReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorCount; returnTaskFile->Current.bSectorNumberReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorNumber; //if 48bit, get all of it if(Is48BitCommand(srbExtension->Flags) && (srbExtension->ResultBufferLength >= sizeof(ATA_TASK_FILE))) { returnTaskFile->Previous.bCommandReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.Status; returnTaskFile->Previous.bFeaturesReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.Error; returnTaskFile->Previous.bCylHighReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylHigh_Exp; returnTaskFile->Previous.bCylLowReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.CylLow_Exp; returnTaskFile->Previous.bDriveHeadReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.Dev_Head; returnTaskFile->Previous.bSectorCountReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorCount_Exp; returnTaskFile->Previous.bSectorNumberReg = ChannelExtension->ReceivedFIS->D2hRegisterFis.SectorNum_Exp; } } // set flag SRB_STATUS_AUTOSENSE_VALID so that Storport will copy it back to original Sense Buffer srbToRelease->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID; } // interpret ATA error to be SCSI error and fill SenseBuffer // also log IO Record if (IsAtaCommand(srbExtension->AtaFunction) || IsAtaCfisPayload(srbExtension->AtaFunction)) { // IO Record for ATA device is logged in AtaMapError() AtaMapError(ChannelExtension, srbToRelease, slotContent->StateFlags.FUA); } else { if (SRB_STATUS(srbToRelease->SrbStatus) == SRB_STATUS_SUCCESS) { ChannelExtension->DeviceExtension[0].IoRecord.SuccessCount++; } else { ChannelExtension->DeviceExtension[0].IoRecord.OtherErrorCount++; } } } //3.1 Make the slot available again slotContent->CmdHeader = NULL; slotContent->CommandHistoryIndex = 0; slotContent->Srb = NULL; slotContent->StateFlags.FUA = FALSE; //Clear the CommandsToComplete bit ChannelExtension->SlotManager.CommandsToComplete &= ~(1 << SlotNumber); ChannelExtension->SlotManager.HighPriorityAttribute &= ~(1 << SlotNumber); //3.3.1 IO is completing, that IO may have paused the queue so unpause the queue ChannelExtension->StateFlags.QueuePaused = FALSE; //3.3.2 Complete the command if ( (srbToRelease->SrbStatus != SRB_STATUS_SUCCESS) && !isSenseSrb && (srbExtension->RetryCount == 0) ) { if ( (ChannelExtension->StateFlags.HybridInfoEnabledOnHiberFile == 1) && IsNCQWriteCommand(srbExtension) ) { // NCQ WRITE with Hybrid Information failed, retry once without Hybrid Information. ChannelExtension->StateFlags.HybridInfoEnabledOnHiberFile = 0; retrySrb = TRUE; } else if (srbToRelease->SrbStatus == SRB_STATUS_PARITY_ERROR) { // if a command encounters CRC error, retry once retrySrb = TRUE; } } if (retrySrb) { srbToRelease->SrbStatus = SRB_STATUS_PENDING; srbExtension->RetryCount++; AhciProcessIo(ChannelExtension, srbToRelease, AtDIRQL); } else { // otherwise, complete it. AhciCompleteRequest(ChannelExtension, srbToRelease, AtDIRQL); } }
//--------------------------------------------------------------------------------- // Purpose: Process Game Frame //--------------------------------------------------------------------------------- void ManiAutoMap::GameFrame(void) { if (war_mode || mani_automap.GetInt() == 0 || ignore_this_map || automap_list_size == 0) return; if (g_RealTime < trigger_time) return; trigger_time += 15; int players = 0; bool include_bots = mani_automap_include_bots.GetBool(); int threshold = mani_automap_player_threshold.GetInt(); // Count players for (int i = 1; i <= max_players; i++) { // Faster than FindPlayerByIndex() #if defined ( GAME_CSGO ) edict_t *pEntity = PEntityOfEntIndex(i); #else edict_t *pEntity = engine->PEntityOfEntIndex(i); #endif if(pEntity && !pEntity->IsFree() ) { IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo( pEntity ); if (playerinfo && playerinfo->IsConnected()) { if (playerinfo->IsHLTV()) continue; if (!include_bots && strcmp(playerinfo->GetNetworkIDString(), "BOT") == 0) continue; players ++; if (players > threshold) { // Broken threshold so just ignore, but reset the timeout this->ResetTimeout(mani_automap_timer.GetInt()); return; } } } } // Need to change map if (mani_automap_set_nextmap.GetInt() != 0) { set_next_map = true; } else { set_next_map = false; } int map_choice = this->ChooseMap(); override_changelevel = 0; override_setnextmap = false; ignore_this_map = true; LogCommand (NULL, "Autochange to map %s while server idle\n", automap_list[map_choice].map_name); SetChangeLevelReason("Automap changed map"); char changelevel_command[128]; snprintf(changelevel_command, sizeof(changelevel_command), "changelevel %s\n", automap_list[map_choice].map_name); engine->ServerCommand(changelevel_command); }