From 408b637e3cdaefb94693490141d3e6f015642eaa Mon Sep 17 00:00:00 2001
From: RD42 <42702181+dashr9230@users.noreply.github.com>
Date: Wed, 27 Mar 2024 23:27:18 +0800
Subject: [PATCH] [saco] Implement CSvrNetStats
---
raknet/RakClientInterface.h | 1 +
saco/main.cpp | 2 ++
saco/main.h | 1 +
saco/saco.vcproj | 6 ++++++
saco/svrnetstats.cpp | 24 ++++++++++++++++++++++++
saco/svrnetstats.h | 20 ++++++++++++++++++++
6 files changed, 54 insertions(+)
create mode 100644 saco/svrnetstats.cpp
create mode 100644 saco/svrnetstats.h
diff --git a/raknet/RakClientInterface.h b/raknet/RakClientInterface.h
index 36f61b3..14dbfd0 100644
--- a/raknet/RakClientInterface.h
+++ b/raknet/RakClientInterface.h
@@ -4,6 +4,7 @@
#define __RAK_CLIENT_INTERFACE_H
#include "NetworkTypes.h"
+#include "RakNetStatistics.h"
class RakClientInterface
{
diff --git a/saco/main.cpp b/saco/main.cpp
index b0f87bc..4161246 100644
--- a/saco/main.cpp
+++ b/saco/main.cpp
@@ -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);
}
diff --git a/saco/main.h b/saco/main.h
index 3b25568..cd1a7ce 100644
--- a/saco/main.h
+++ b/saco/main.h
@@ -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"
diff --git a/saco/saco.vcproj b/saco/saco.vcproj
index 3cfbf11..d595aac 100644
--- a/saco/saco.vcproj
+++ b/saco/saco.vcproj
@@ -706,6 +706,12 @@
+
+
+
+
diff --git a/saco/svrnetstats.cpp b/saco/svrnetstats.cpp
new file mode 100644
index 0000000..34fd2d0
--- /dev/null
+++ b/saco/svrnetstats.cpp
@@ -0,0 +1,24 @@
+
+#include "main.h"
+#include
+
+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;
+}
diff --git a/saco/svrnetstats.h b/saco/svrnetstats.h
new file mode 100644
index 0000000..e4182ec
--- /dev/null
+++ b/saco/svrnetstats.h
@@ -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();
+};