mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Add AD:RP to servers in "LS-RP Mode"
This commit is contained in:
parent
a06fc527f5
commit
a0b1f9690a
1 changed files with 15 additions and 12 deletions
|
@ -73,22 +73,25 @@ namespace ModCompat
|
||||||
return aware;
|
return aware;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct IPv4
|
||||||
|
{
|
||||||
|
uint8_t ip[4];
|
||||||
|
uint16_t port;
|
||||||
|
|
||||||
|
friend bool operator == ( const IPv4& left, const IPv4& right )
|
||||||
|
{
|
||||||
|
return std::make_tuple( left.ip[0], left.ip[1], left.ip[2], left.ip[3], left.port ) == std::make_tuple( right.ip[0], right.ip[1], right.ip[2], right.ip[3], right.port );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool LSRPMode = false;
|
bool LSRPMode = false;
|
||||||
void DetectPlayingOnLSRP()
|
void DetectPlayingOnLSRP()
|
||||||
{
|
{
|
||||||
struct IPv4
|
constexpr IPv4 serversWithLSRPMode[] = {
|
||||||
{
|
{ 149, 56, 123, 148, 7777 }, // LS-RP
|
||||||
uint8_t ip[4];
|
{ 198, 27, 95, 178, 7777 }, // AD:RP
|
||||||
uint16_t port;
|
|
||||||
|
|
||||||
bool operator== ( const IPv4& right )
|
|
||||||
{
|
|
||||||
return std::make_tuple( this->ip[0], this->ip[1], this->ip[2], this->ip[3], this->port ) == std::make_tuple( right.ip[0], right.ip[1], right.ip[2], right.ip[3], right.port );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr IPv4 LSRP = { 149, 56, 123, 148, 7777 };
|
|
||||||
|
|
||||||
IPv4 myIP = {};
|
IPv4 myIP = {};
|
||||||
|
|
||||||
// Obtain IP and check if it's LS-RP
|
// Obtain IP and check if it's LS-RP
|
||||||
|
@ -124,7 +127,7 @@ namespace ModCompat
|
||||||
LocalFree( cmdLine );
|
LocalFree( cmdLine );
|
||||||
}
|
}
|
||||||
|
|
||||||
LSRPMode = myIP == LSRP;
|
LSRPMode = std::find( std::begin(serversWithLSRPMode), std::end(serversWithLSRPMode), myIP ) != std::end(serversWithLSRPMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
|
|
Loading…
Reference in a new issue