[raknet] Change RakPeer::vftable_20() to RakPeer::Connect(...)

This commit is contained in:
RD42 2024-02-14 23:05:11 +08:00
parent e35e932c37
commit cbe46e1d3d
3 changed files with 46 additions and 3 deletions

View File

@ -96,9 +96,28 @@ void RakPeer::GetIncomingPassword( char* passwordData, int *passwordDataLength
memcpy(passwordData, incomingPassword, *passwordDataLength); memcpy(passwordData, incomingPassword, *passwordDataLength);
} }
void RakPeer::vftable_20() // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Description:
// Call this to connect to the specified host (ip or domain name) and server port.
// Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer.
// This is a non-blocking connection. You know the connection is successful when IsConnected() returns true
// or receive gets a packet with the type identifier ID_CONNECTION_ACCEPTED. If the connection is not
// successful, such as rejected connection or no response then neither of these things will happen.
// Requires that you first call Initialize
//
// Parameters:
// host: Either a dotted IP address or a domain name
// remotePort: Which port to connect to on the remote machine.
// passwordData: A data block that must match the data block on the server. This can be just a password, or can be a stream of data
// passwordDataLength: The length in bytes of passwordData
//
// Returns:
// True on successful initiation. False on incorrect parameters, internal error, or too many existing peers
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
bool RakPeer::Connect( const char* host, unsigned short remotePort, char* passwordData, int passwordDataLength )
{ {
// TODO: RakPeer::vftable_20() (saco W: 10040550) (server W: 457B00 L: 806D230) (bot W: 40B2C0 L: 807306A) // TODO: RakPeer::vftable_20() (saco W: 10040550) (server W: 457B00 L: 806D230) (bot W: 40B2C0 L: 807306A)
return false;
} }
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -18,7 +18,6 @@ public:
void vftable_4(); void vftable_4();
void vftable_8(); void vftable_8();
void vftable_C(); void vftable_C();
void vftable_20();
/// Sets how many incoming connections are allowed. If this is less than the number of players currently connected, /// 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, /// no more players will be allowed to connect. If this is greater than the maximum number of peers allowed,
@ -41,6 +40,19 @@ public:
/// \param[in,out] passwordDataLength Maximum size of the array passwordData. Modified to hold the number of bytes actually written /// \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 ); void GetIncomingPassword( char* passwordData, int *passwordDataLength );
/// \brief Connect to the specified host (ip or domain name) and server port.
/// Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client.
/// Calling both acts as a true peer. This is a non-blocking connection.
/// You know the connection is successful when IsConnected() returns true or Receive() gets a message with the type identifier ID_CONNECTION_ACCEPTED.
/// If the connection is not successful, such as a rejected connection or no response then neither of these things will happen.
/// \pre Requires that you first call Initialize
/// \param[in] host Either a dotted IP address or a domain name
/// \param[in] remotePort Which port to connect to on the remote machine.
/// \param[in] passwordData A data block that must match the data block on the server passed to SetIncomingPassword. This can be a string or can be a stream of data. Use 0 for no password.
/// \param[in] passwordDataLength The length in bytes of passwordData
/// \return True on successful initiation. False on incorrect parameters, internal error, or too many existing peers. Returning true does not mean you connected!
bool Connect( const char* host, unsigned short remotePort, char* passwordData, int passwordDataLength );
/// \brief Stops the network threads and closes all connections. /// \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] 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 /// \param[in] orderingChannel If blockDuration > 0, ID_DISCONNECTION_NOTIFICATION will be sent on this channel

View File

@ -14,7 +14,6 @@ public:
virtual void vftable_4()=0; virtual void vftable_4()=0;
virtual void vftable_8()=0; virtual void vftable_8()=0;
virtual void vftable_C()=0; virtual void vftable_C()=0;
virtual void vftable_20()=0;
/// Sets how many incoming connections are allowed. If this is less than the number of players currently connected, /// 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, /// no more players will be allowed to connect. If this is greater than the maximum number of peers allowed,
@ -37,6 +36,19 @@ public:
/// \param[in,out] passwordDataLength Maximum size of the array passwordData. Modified to hold the number of bytes actually written /// \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; virtual void GetIncomingPassword( char* passwordData, int *passwordDataLength )=0;
/// \brief Connect to the specified host (ip or domain name) and server port.
/// Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client.
/// Calling both acts as a true peer. This is a non-blocking connection.
/// You know the connection is successful when IsConnected() returns true or Receive() gets a message with the type identifier ID_CONNECTION_ACCEPTED.
/// If the connection is not successful, such as a rejected connection or no response then neither of these things will happen.
/// \pre Requires that you first call Initialize
/// \param[in] host Either a dotted IP address or a domain name
/// \param[in] remotePort Which port to connect to on the remote machine.
/// \param[in] passwordData A data block that must match the data block on the server passed to SetIncomingPassword. This can be a string or can be a stream of data. Use 0 for no password.
/// \param[in] passwordDataLength The length in bytes of passwordData
/// \return True on successful initiation. False on incorrect parameters, internal error, or too many existing peers. Returning true does not mean you connected!
virtual bool Connect( const char* host, unsigned short remotePort, char* passwordData, int passwordDataLength )=0;
/// \brief Stops the network threads and closes all connections. /// \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] 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 /// \param[in] orderingChannel If blockDuration > 0, ID_DISCONNECTION_NOTIFICATION will be sent on this channel