From 6c038f5fb6d17374269f01466c8f6266cac38605 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sun, 14 Apr 2024 18:44:00 +0800 Subject: [PATCH] [raknet] Implement `RakPeer::GetInternalID()` --- raknet/RakPeer.cpp | 15 +++++++++++++-- raknet/RakPeer.h | 14 +++++++++++++- raknet/RakPeerInterface.h | 7 ++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/raknet/RakPeer.cpp b/raknet/RakPeer.cpp index c934fef..9576aab 100644 --- a/raknet/RakPeer.cpp +++ b/raknet/RakPeer.cpp @@ -7,6 +7,12 @@ RakPeer::RakPeer() { + maximumIncomingConnections = 0; + maximumNumberOfPeers = 0; + endThreads = true; + myPlayerId = UNASSIGNED_PLAYER_ID; + incomingPasswordLength=0; + // TODO: RakPeer ctor saco .text:1003DE50 server W .text:00455140 L .text:08072970 bot W .text:00408DF0 L .text:08071AB0 } @@ -319,9 +325,14 @@ void RakPeer::vftable_98() // TODO: RakPeer::vftable_98() (saco W: 10038730) (server W: 450230 L: 8070B60) (bot W: 404170 L: 8074FA8) } -void RakPeer::vftable_9C() +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +// Description: +// Return the unique PlayerID that represents you on the the network +// Note that unlike in previous versions, this is a struct and is not sequential +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +PlayerID RakPeer::GetInternalID( void ) const { - // TODO: RakPeer::vftable_9C() (saco W: 10038780) (server W: 450280 L: 806DBC0) (bot W: 4041C0 L: 8074FD2) + return myPlayerId; } void RakPeer::vftable_A0() diff --git a/raknet/RakPeer.h b/raknet/RakPeer.h index d93c265..f5d2b2e 100644 --- a/raknet/RakPeer.h +++ b/raknet/RakPeer.h @@ -113,7 +113,12 @@ public: void vftable_90(); void vftable_94(); void vftable_98(); - void vftable_9C(); + + //--------------------------------------------------------------------------------------------Network Functions - Functions dealing with the network in general-------------------------------------------------------------------------------------------- + /// Return the unique address identifier that represents you on the the network and is based on your local IP / port. + /// \return the identifier of your system internally, which may not be how other systems see if you if you are behind a NAT or proxy + PlayerID GetInternalID( void ) const; + void vftable_A0(); void vftable_A4(); void vftable_A8(); @@ -149,11 +154,18 @@ protected: ///Set this to true to terminate the Peer thread execution volatile bool endThreads; + char _gap6[2]; + ///Store the maximum number of peers allowed to connect unsigned short maximumNumberOfPeers; ///Store the maximum incoming connection allowed unsigned short maximumIncomingConnections; + RakNet::BitStream field_B; + RakNet::BitStream field_11C; + + ///Local Player ID + PlayerID myPlayerId; char incomingPassword[256]; unsigned char incomingPasswordLength; diff --git a/raknet/RakPeerInterface.h b/raknet/RakPeerInterface.h index 82242e1..76062b5 100644 --- a/raknet/RakPeerInterface.h +++ b/raknet/RakPeerInterface.h @@ -110,7 +110,12 @@ public: virtual void vftable_90()=0; virtual void vftable_94()=0; virtual void vftable_98()=0; - virtual void vftable_9C()=0; + + //--------------------------------------------------------------------------------------------Network Functions - Functions dealing with the network in general-------------------------------------------------------------------------------------------- + /// Return the unique address identifier that represents you on the the network and is based on your local IP / port. + /// \return the identifier of your system internally, which may not be how other systems see if you if you are behind a NAT or proxy + virtual PlayerID GetInternalID( void ) const=0; + virtual void vftable_A0()=0; virtual void vftable_A4()=0; virtual void vftable_A8()=0;