fakequeries: fixed hooking problems on certain providers

linkage: added support for fake steam ids for bots controlled via yb_enable_fake_steamids)

note that fake steam ids just used for give ability server owners to run statistics modules with tracking by steam ids ant not nicknames.
This commit is contained in:
jeefo 2024-01-19 18:29:20 +03:00
commit 1dc1043f7d
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
5 changed files with 42 additions and 1 deletions

View file

@ -68,6 +68,11 @@ void ServerQueryHook::init () {
return;
}
// do not detour twice
if (m_sendToDetour.detoured () || m_sendToDetourSys.detoured ()) {
return;
}
// do not enable on not dedicated server
if (!game.isDedicated ()) {
return;
@ -83,12 +88,17 @@ void ServerQueryHook::init () {
sendToAddress = address;
}
}
m_sendToDetourSys.initialize ("ws2_32.dll", "sendto", sendto);
}
m_sendToDetour.initialize ("ws2_32.dll", "sendto", sendToAddress);
// enable only on modern games
if (!game.is (GameFlags::Legacy) && (plat.nix || plat.win) && !plat.isNonX86 () && !m_sendToDetour.detoured ()) {
m_sendToDetour.install (reinterpret_cast <void *> (BotSupport::sendTo), true);
if (!m_sendToDetourSys.detoured ()) {
m_sendToDetourSys.install (reinterpret_cast <void *> (BotSupport::sendTo), true);
}
}
}