Hack for legacy server list ping
This commit is contained in:
parent
dacb7396be
commit
06a192a4b0
|
@ -16,7 +16,7 @@ namespace Feather
|
|||
{
|
||||
public:
|
||||
PacketReader(const uint8_t *const dataPtr)
|
||||
: m_data(dataPtr), m_offset(0), m_length(ReadVarInt())
|
||||
: m_data(dataPtr), m_offset(0), m_length(ReadLength())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,20 @@ namespace Feather
|
|||
// Fast way to read a byte
|
||||
inline uint8_t ReadByte() { return m_data[m_offset++]; }
|
||||
|
||||
inline int32_t ReadLength()
|
||||
{
|
||||
int32_t length = ReadVarInt();
|
||||
|
||||
// HACK: handle Legacy Server List Ping
|
||||
if (length == 0xFE) {
|
||||
if (PeekByte() == 0x01) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
template <typename T = int32_t>
|
||||
inline T ReadVarInt()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue