[saco] Implement CSvrNetStats

This commit is contained in:
RD42 2024-03-27 23:27:18 +08:00
parent 531911be69
commit 408b637e3c
6 changed files with 54 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#define __RAK_CLIENT_INTERFACE_H
#include "NetworkTypes.h"
#include "RakNetStatistics.h"
class RakClientInterface
{

View File

@ -38,6 +38,7 @@ CUnkClass3 *pUnkClass3=NULL;
CUnkClass4 *pUnkClass4=NULL;
CUnkClass5 *pUnkClass5=NULL;
CUnkClass6 *pUnkClass6=NULL;
CSvrNetStats *pSvrNetStats=NULL;
bool bShowDebugLabels = false;
@ -348,6 +349,7 @@ void DoInitStuff()
pUnkClass4 = new CUnkClass4(pD3DDevice);
pUnkClass5 = new CUnkClass5(pD3DDevice);
pUnkClass6 = new CUnkClass6(pD3DDevice);
pSvrNetStats = new CSvrNetStats(pD3DDevice);
}

View File

@ -58,6 +58,7 @@ typedef struct _GAME_SETTINGS {
#include "cmdwindow.h"
#include "deathwindow.h"
#include "spawnscreen.h"
#include "svrnetstats.h"
#include "audiostream.h"
#include "archive/ArchiveFS.h"

View File

@ -706,6 +706,12 @@
<File
RelativePath=".\subclass.cpp">
</File>
<File
RelativePath=".\svrnetstats.cpp">
</File>
<File
RelativePath=".\svrnetstats.h">
</File>
</Files>
<Globals>
</Globals>

24
saco/svrnetstats.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "main.h"
#include <stdio.h>
char szSvrDispBuf[16384];
char szSvrStatBuf[16384];
char szSvrDrawLine[1024];
RakNetStatisticsStruct RakServerStats;
CSvrNetStats::CSvrNetStats(IDirect3DDevice9 *pD3DDevice)
{
m_dwLastUpdateTick = GetTickCount();
m_dwLastTotalBytesRecv = 0;
m_dwLastTotalBytesSent = 0;
m_dwBPSDownload = 0;
m_dwBPSUpload = 0;
m_pD3DDevice = pD3DDevice;
memset(&RakServerStats,0,sizeof(RakNetStatisticsStruct));
}
void CSvrNetStats::Draw()
{
return;
}

20
saco/svrnetstats.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
class CSvrNetStats
{
private:
DWORD m_dwLastTotalBytesSent;
DWORD m_dwLastTotalBytesRecv;
DWORD m_dwLastUpdateTick;
DWORD m_dwBPSUpload;
DWORD m_dwBPSDownload;
IDirect3DDevice9 *m_pD3DDevice;
public:
CSvrNetStats(IDirect3DDevice9 *pD3DDevice);
~CSvrNetStats() {};
void Draw();
};