From e35e932c37fba01d5671c5065f044cd1e54fb67e Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Wed, 14 Feb 2024 23:03:16 +0800 Subject: [PATCH] [raknet] Change `RakPeer::vftable_24()` to `RakPeer::Disconnect(...)` --- raknet/RakPeer.cpp | 6 +++++- raknet/RakPeer.h | 8 ++++++-- raknet/RakPeerInterface.h | 8 ++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/raknet/RakPeer.cpp b/raknet/RakPeer.cpp index aa1c415..defb5bc 100644 --- a/raknet/RakPeer.cpp +++ b/raknet/RakPeer.cpp @@ -101,7 +101,11 @@ void RakPeer::vftable_20() // TODO: RakPeer::vftable_20() (saco W: 10040550) (server W: 457B00 L: 806D230) (bot W: 40B2C0 L: 807306A) } -void RakPeer::vftable_24() +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +// Description: +// Stops the network threads and close all connections. Multiple calls are ok. +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +void RakPeer::Disconnect( unsigned int blockDuration, unsigned char orderingChannel ) { // TODO: RakPeer::vftable_24() (saco W: 10040620) (server W: 457BD0 L: 806FB70) (bot W: 40B390 L: 80730D2) } diff --git a/raknet/RakPeer.h b/raknet/RakPeer.h index 6fbe574..25dd6b4 100644 --- a/raknet/RakPeer.h +++ b/raknet/RakPeer.h @@ -19,8 +19,6 @@ public: void vftable_8(); void vftable_C(); void vftable_20(); - void vftable_24(); - void vftable_28(); /// Sets how many incoming connections are allowed. If this is less than the number of players currently connected, /// no more players will be allowed to connect. If this is greater than the maximum number of peers allowed, @@ -43,6 +41,12 @@ public: /// \param[in,out] passwordDataLength Maximum size of the array passwordData. Modified to hold the number of bytes actually written void GetIncomingPassword( char* passwordData, int *passwordDataLength ); + /// \brief Stops the network threads and closes all connections. + /// \param[in] blockDuration How long you should wait for all remaining messages to go out, including ID_DISCONNECTION_NOTIFICATION. If 0, it doesn't wait at all. + /// \param[in] orderingChannel If blockDuration > 0, ID_DISCONNECTION_NOTIFICATION will be sent on this channel + /// If you set it to 0 then the disconnection notification won't be sent + void Disconnect( unsigned int blockDuration, unsigned char orderingChannel=0 ); + /// Returns if the network thread is running /// \return true if the network thread is running, false otherwise bool IsActive( void ) const; diff --git a/raknet/RakPeerInterface.h b/raknet/RakPeerInterface.h index 563d5f2..c3421e9 100644 --- a/raknet/RakPeerInterface.h +++ b/raknet/RakPeerInterface.h @@ -15,8 +15,6 @@ public: virtual void vftable_8()=0; virtual void vftable_C()=0; virtual void vftable_20()=0; - virtual void vftable_24()=0; - virtual void vftable_28()=0; /// Sets how many incoming connections are allowed. If this is less than the number of players currently connected, /// no more players will be allowed to connect. If this is greater than the maximum number of peers allowed, @@ -39,6 +37,12 @@ public: /// \param[in,out] passwordDataLength Maximum size of the array passwordData. Modified to hold the number of bytes actually written virtual void GetIncomingPassword( char* passwordData, int *passwordDataLength )=0; + /// \brief Stops the network threads and closes all connections. + /// \param[in] blockDuration How long you should wait for all remaining messages to go out, including ID_DISCONNECTION_NOTIFICATION. If 0, it doesn't wait at all. + /// \param[in] orderingChannel If blockDuration > 0, ID_DISCONNECTION_NOTIFICATION will be sent on this channel + /// If you set it to 0 then the disconnection notification won't be sent + virtual void Disconnect( unsigned int blockDuration, unsigned char orderingChannel=0 )=0; + /// Returns if the network thread is running /// \return true if the network thread is running, false otherwise virtual bool IsActive( void ) const=0;