TmpMenu/src/hooks/matchmaking/start_matchmaking_find_sessions.cpp
maybegreat48 74ecf22ecf Menu revamp (#3274)
* Complete player and network UI redesign, meant to show all features instead of stuffing them into tiny boxes
* Added option to delete player vehicles
* Better clone player (now clones head blend too)
* Better host token spoofing, with an option to enter your own
* Better host token spoofing detection
* Better desync kick prot detections
* A script blocker for the entire session (per-player options will be added later)
* Added option to spoof data/DLC hashes
* Logging framework that allows developers to easily debug false positives
* Major protection improvements
2024-06-27 10:32:17 +02:00

58 lines
1.9 KiB
C++

#include "fiber_pool.hpp"
#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>
namespace big
{
bool hooks::start_matchmaking_find_sessions(int profile_index, int available_slots, NetworkGameFilterMatchmakingComponent* filter, unsigned int max_sessions, rage::rlSessionInfo* results, int* num_sessions_found, rage::rlTaskStatus* status)
{
int discriminator = filter->m_param_values[0];// this is guaranteed to work
if (g.session_browser.replace_game_matchmaking && filter->m_filter_type == 1)
{
status->status = 1;
g_fiber_pool->queue_job([max_sessions, results, num_sessions_found, status, discriminator] {
bool result = false;
result = g_matchmaking_service->matchmake(discriminator, !g.session.join_in_sctv_slots);
if (result)
{
for (int i = 0; i < g_matchmaking_service->get_num_found_sessions(); i++)
{
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)++;
if (max_sessions <= *num_sessions_found)
break;
}
}
status->status = 3;
}
else
{
status->status = 2;
}
});
return true;
}
else
{
return g_hooking->get_original<hooks::start_matchmaking_find_sessions>()(profile_index, available_slots, filter, max_sessions, results, num_sessions_found, status);
}
}
}