Filtering blocked modders in session browser (#3257)

This commit is contained in:
CringeArab 2024-06-24 21:24:53 +03:00 committed by GitHub
parent 1b25bdc866
commit b02e428cf9
3 changed files with 22 additions and 1 deletions

View File

@ -1041,8 +1041,9 @@ namespace big
int sort_direction = 0;
bool replace_game_matchmaking = false;
bool exclude_modder_sessions = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(session_browser, region_filter_enabled, region_filter, language_filter_enabled, language_filter, player_count_filter_enabled, player_count_filter_minimum, player_count_filter_maximum, sort_method, sort_direction, replace_game_matchmaking, pool_filter_enabled, pool_filter)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(session_browser, region_filter_enabled, region_filter, language_filter_enabled, language_filter, player_count_filter_enabled, player_count_filter_minimum, player_count_filter_maximum, sort_method, sort_direction, replace_game_matchmaking, pool_filter_enabled, pool_filter, exclude_modder_sessions)
} session_browser{};
struct session_protection

View File

@ -2,6 +2,7 @@
#include "function_types.hpp"
#include "hooking/hooking.hpp"
#include "services/matchmaking/matchmaking_service.hpp"
#include "services/player_database/player_database_service.hpp"
#include <network/Network.hpp>
@ -28,6 +29,13 @@ namespace big
{
if (g_matchmaking_service->get_found_sessions()[i].is_valid)
{
auto host_rid =
g_matchmaking_service->get_found_sessions()[i].info.m_net_player_data.m_gamer_handle.m_rockstar_id;
auto player = g_player_database_service->get_player_by_rockstar_id(host_rid);
if (g.session_browser.exclude_modder_sessions && player && player->block_join)
continue;
results[*num_sessions_found] = g_matchmaking_service->get_found_sessions()[i].info;
(*num_sessions_found)++;

View File

@ -4,6 +4,7 @@
#include "pointers.hpp"
#include "script.hpp"
#include "services/matchmaking/matchmaking_service.hpp"
#include "services/player_database/player_database_service.hpp"
#include "util/session.hpp"
#include "views/view.hpp"
@ -33,6 +34,12 @@ namespace big
if (!session.is_valid)
continue;
auto host_rid = session.info.m_net_player_data.m_gamer_handle.m_rockstar_id;
auto player = g_player_database_service->get_player_by_rockstar_id(host_rid);
if (g.session_browser.exclude_modder_sessions && player && player->block_join)
continue;
if (components::selectable(std::to_string(session.info.m_session_token), i == selected_session_idx))
{
selected_session_idx = i;
@ -158,6 +165,11 @@ namespace big
ImGui::Combo("###pooltype", &g.session_browser.pool_filter, pool_filter_options.c_str());
}
ImGui::Checkbox("EXCLUDE_MODDER_SESSIONS"_T.data(), &g.session_browser.exclude_modder_sessions);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("EXCLUDE_MODDER_SESSIONS_DESC"_T.data());
ImGui::TreePop();
}