diff --git a/src/core/settings.hpp b/src/core/settings.hpp index a9334ff3..1dbfb138 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -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 diff --git a/src/hooks/matchmaking/start_matchmaking_find_sessions.cpp b/src/hooks/matchmaking/start_matchmaking_find_sessions.cpp index 25285d76..21d5e499 100644 --- a/src/hooks/matchmaking/start_matchmaking_find_sessions.cpp +++ b/src/hooks/matchmaking/start_matchmaking_find_sessions.cpp @@ -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 @@ -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)++; diff --git a/src/views/network/view_session_browser.cpp b/src/views/network/view_session_browser.cpp index 2121e545..5d00ca20 100644 --- a/src/views/network/view_session_browser.cpp +++ b/src/views/network/view_session_browser.cpp @@ -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(); }