[raknet] Implement RakPeer::GetCompressionRatio()

This commit is contained in:
RD42 2024-04-14 21:19:44 +08:00
parent 3886884429
commit 0c4f681066
3 changed files with 32 additions and 5 deletions

View File

@ -8,6 +8,7 @@
RakPeer::RakPeer()
{
memset( frequencyTable, 0, sizeof( unsigned int ) * 256 );
rawBytesSent = compressedBytesSent = 0;
MTUSize = DEFAULT_MTU_SIZE;
trackFrequencyTable = false;
maximumIncomingConnections = 0;
@ -490,9 +491,19 @@ void RakPeer::vftable_DC()
// TODO: RakPeer::vftable_DC() (saco W: 1003ACA0) (server W: 451FE0 L: 806E250) (bot W: 405CD0 L: 80756CC)
}
void RakPeer::vftable_E0()
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Returns:
// The compression ratio. A low compression ratio is good. Compression is for outgoing data
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
float RakPeer::GetCompressionRatio( void ) const
{
// TODO: RakPeer::vftable_E0() (saco W: 10038B50) (server W: 450630 L: 806E330) (bot W: 404570 L: 80757FA)
if ( rawBytesSent > 0 )
{
return ( float ) compressedBytesSent / ( float ) rawBytesSent;
}
else
return 0.0f;
}
void RakPeer::vftable_E4()

View File

@ -163,7 +163,11 @@ public:
void vftable_D8();
void vftable_DC();
void vftable_E0();
/// Returns the compression ratio. A low compression ratio is good. Compression is for outgoing data
/// \return The compression ratio
float GetCompressionRatio( void ) const;
void vftable_E4();
void vftable_E8();
void vftable_EC();
@ -202,7 +206,15 @@ protected:
/// Compression stuff
unsigned int frequencyTable[ 256 ];
char _gap7D1[48];
char _gap7D1[8];
unsigned int rawBytesSent;
char _gap7DD[4];
unsigned int compressedBytesSent;
char _gap7E5[28];
RPCMap rpcMap; // Can't use StrPtrHash because runtime insertions will screw up the indices
int MTUSize;

View File

@ -159,7 +159,11 @@ public:
virtual void vftable_D8()=0;
virtual void vftable_DC()=0;
virtual void vftable_E0()=0;
/// Returns the compression ratio. A low compression ratio is good. Compression is for outgoing data
/// \return The compression ratio
virtual float GetCompressionRatio( void ) const=0;
virtual void vftable_E4()=0;
virtual void vftable_E8()=0;
virtual void vftable_EC()=0;