lsteamclient: Support reference parameters

This commit is contained in:
Andrew Eikum 2021-11-12 13:13:03 -06:00 committed by Arkadiusz Hiler
parent 67316452df
commit 58860a6cc6
9 changed files with 50 additions and 42 deletions

View file

@ -48,7 +48,7 @@ void *cppISteamClient_SteamClient020_GetISteamGameServer(void *linux_side, HStea
void cppISteamClient_SteamClient020_SetLocalIPBinding(void *linux_side, const SteamIPAddress_t * unIP, uint16 usPort) void cppISteamClient_SteamClient020_SetLocalIPBinding(void *linux_side, const SteamIPAddress_t * unIP, uint16 usPort)
{ {
((ISteamClient*)linux_side)->SetLocalIPBinding((const SteamIPAddress_t *)unIP, (uint16)usPort); ((ISteamClient*)linux_side)->SetLocalIPBinding(*unIP, (uint16)usPort);
} }
void *cppISteamClient_SteamClient020_GetISteamFriends(void *linux_side, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion) void *cppISteamClient_SteamClient020_GetISteamFriends(void *linux_side, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion)

View file

@ -14,27 +14,27 @@ extern "C" {
#include "cppISteamNetworkingMessages_SteamNetworkingMessages002.h" #include "cppISteamNetworkingMessages_SteamNetworkingMessages002.h"
EResult cppISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser(void *linux_side, const SteamNetworkingIdentity * identityRemote, const void * pubData, uint32 cubData, int nSendFlags, int nRemoteChannel) EResult cppISteamNetworkingMessages_SteamNetworkingMessages002_SendMessageToUser(void *linux_side, const SteamNetworkingIdentity * identityRemote, const void * pubData, uint32 cubData, int nSendFlags, int nRemoteChannel)
{ {
return ((ISteamNetworkingMessages*)linux_side)->SendMessageToUser((const SteamNetworkingIdentity *)identityRemote, (const void *)pubData, (uint32)cubData, (int)nSendFlags, (int)nRemoteChannel); return ((ISteamNetworkingMessages*)linux_side)->SendMessageToUser(*identityRemote, (const void *)pubData, (uint32)cubData, (int)nSendFlags, (int)nRemoteChannel);
} }
bool cppISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote) bool cppISteamNetworkingMessages_SteamNetworkingMessages002_AcceptSessionWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote)
{ {
return ((ISteamNetworkingMessages*)linux_side)->AcceptSessionWithUser((const SteamNetworkingIdentity *)identityRemote); return ((ISteamNetworkingMessages*)linux_side)->AcceptSessionWithUser(*identityRemote);
} }
bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote) bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseSessionWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote)
{ {
return ((ISteamNetworkingMessages*)linux_side)->CloseSessionWithUser((const SteamNetworkingIdentity *)identityRemote); return ((ISteamNetworkingMessages*)linux_side)->CloseSessionWithUser(*identityRemote);
} }
bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote, int nLocalChannel) bool cppISteamNetworkingMessages_SteamNetworkingMessages002_CloseChannelWithUser(void *linux_side, const SteamNetworkingIdentity * identityRemote, int nLocalChannel)
{ {
return ((ISteamNetworkingMessages*)linux_side)->CloseChannelWithUser((const SteamNetworkingIdentity *)identityRemote, (int)nLocalChannel); return ((ISteamNetworkingMessages*)linux_side)->CloseChannelWithUser(*identityRemote, (int)nLocalChannel);
} }
ESteamNetworkingConnectionState cppISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo(void *linux_side, const SteamNetworkingIdentity * identityRemote, SteamNetConnectionInfo_t * pConnectionInfo, SteamNetworkingQuickConnectionStatus * pQuickStatus) ESteamNetworkingConnectionState cppISteamNetworkingMessages_SteamNetworkingMessages002_GetSessionConnectionInfo(void *linux_side, const SteamNetworkingIdentity * identityRemote, SteamNetConnectionInfo_t * pConnectionInfo, SteamNetworkingQuickConnectionStatus * pQuickStatus)
{ {
return ((ISteamNetworkingMessages*)linux_side)->GetSessionConnectionInfo((const SteamNetworkingIdentity *)identityRemote, (SteamNetConnectionInfo_t *)pConnectionInfo, (SteamNetworkingQuickConnectionStatus *)pQuickStatus); return ((ISteamNetworkingMessages*)linux_side)->GetSessionConnectionInfo(*identityRemote, (SteamNetConnectionInfo_t *)pConnectionInfo, (SteamNetworkingQuickConnectionStatus *)pQuickStatus);
} }
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -14,12 +14,12 @@ extern "C" {
#include "cppISteamNetworkingSockets_SteamNetworkingSockets009.h" #include "cppISteamNetworkingSockets_SteamNetworkingSockets009.h"
HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets009_CreateListenSocketIP(void *linux_side, const SteamNetworkingIPAddr * localAddress, int nOptions, const SteamNetworkingConfigValue_t * pOptions) HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets009_CreateListenSocketIP(void *linux_side, const SteamNetworkingIPAddr * localAddress, int nOptions, const SteamNetworkingConfigValue_t * pOptions)
{ {
return ((ISteamNetworkingSockets*)linux_side)->CreateListenSocketIP((const SteamNetworkingIPAddr *)localAddress, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions); return ((ISteamNetworkingSockets*)linux_side)->CreateListenSocketIP(*localAddress, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions);
} }
HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets009_ConnectByIPAddress(void *linux_side, const SteamNetworkingIPAddr * address, int nOptions, const SteamNetworkingConfigValue_t * pOptions) HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets009_ConnectByIPAddress(void *linux_side, const SteamNetworkingIPAddr * address, int nOptions, const SteamNetworkingConfigValue_t * pOptions)
{ {
return ((ISteamNetworkingSockets*)linux_side)->ConnectByIPAddress((const SteamNetworkingIPAddr *)address, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions); return ((ISteamNetworkingSockets*)linux_side)->ConnectByIPAddress(*address, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions);
} }
HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets009_CreateListenSocketP2P(void *linux_side, int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions) HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets009_CreateListenSocketP2P(void *linux_side, int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions)
@ -29,7 +29,7 @@ HSteamListenSocket cppISteamNetworkingSockets_SteamNetworkingSockets009_CreateLi
HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets009_ConnectP2P(void *linux_side, const SteamNetworkingIdentity * identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions) HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets009_ConnectP2P(void *linux_side, const SteamNetworkingIdentity * identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions)
{ {
return ((ISteamNetworkingSockets*)linux_side)->ConnectP2P((const SteamNetworkingIdentity *)identityRemote, (int)nRemoteVirtualPort, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions); return ((ISteamNetworkingSockets*)linux_side)->ConnectP2P(*identityRemote, (int)nRemoteVirtualPort, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions);
} }
EResult cppISteamNetworkingSockets_SteamNetworkingSockets009_AcceptConnection(void *linux_side, HSteamNetConnection hConn) EResult cppISteamNetworkingSockets_SteamNetworkingSockets009_AcceptConnection(void *linux_side, HSteamNetConnection hConn)
@ -139,12 +139,12 @@ bool cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceivedRelayAuthTicke
int cppISteamNetworkingSockets_SteamNetworkingSockets009_FindRelayAuthTicketForServer(void *linux_side, const SteamNetworkingIdentity * identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket * pOutParsedTicket) int cppISteamNetworkingSockets_SteamNetworkingSockets009_FindRelayAuthTicketForServer(void *linux_side, const SteamNetworkingIdentity * identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket * pOutParsedTicket)
{ {
return ((ISteamNetworkingSockets*)linux_side)->FindRelayAuthTicketForServer((const SteamNetworkingIdentity *)identityGameServer, (int)nRemoteVirtualPort, (SteamDatagramRelayAuthTicket *)pOutParsedTicket); return ((ISteamNetworkingSockets*)linux_side)->FindRelayAuthTicketForServer(*identityGameServer, (int)nRemoteVirtualPort, (SteamDatagramRelayAuthTicket *)pOutParsedTicket);
} }
HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets009_ConnectToHostedDedicatedServer(void *linux_side, const SteamNetworkingIdentity * identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions) HSteamNetConnection cppISteamNetworkingSockets_SteamNetworkingSockets009_ConnectToHostedDedicatedServer(void *linux_side, const SteamNetworkingIdentity * identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions)
{ {
return ((ISteamNetworkingSockets*)linux_side)->ConnectToHostedDedicatedServer((const SteamNetworkingIdentity *)identityTarget, (int)nRemoteVirtualPort, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions); return ((ISteamNetworkingSockets*)linux_side)->ConnectToHostedDedicatedServer(*identityTarget, (int)nRemoteVirtualPort, (int)nOptions, (const SteamNetworkingConfigValue_t *)pOptions);
} }
uint16 cppISteamNetworkingSockets_SteamNetworkingSockets009_GetHostedDedicatedServerPort(void *linux_side) uint16 cppISteamNetworkingSockets_SteamNetworkingSockets009_GetHostedDedicatedServerPort(void *linux_side)
@ -184,12 +184,12 @@ bool cppISteamNetworkingSockets_SteamNetworkingSockets009_ReceivedP2PCustomSigna
bool cppISteamNetworkingSockets_SteamNetworkingSockets009_GetCertificateRequest(void *linux_side, int * pcbBlob, void * pBlob, SteamNetworkingErrMsg * errMsg) bool cppISteamNetworkingSockets_SteamNetworkingSockets009_GetCertificateRequest(void *linux_side, int * pcbBlob, void * pBlob, SteamNetworkingErrMsg * errMsg)
{ {
return ((ISteamNetworkingSockets*)linux_side)->GetCertificateRequest((int *)pcbBlob, (void *)pBlob, (SteamNetworkingErrMsg *)errMsg); return ((ISteamNetworkingSockets*)linux_side)->GetCertificateRequest((int *)pcbBlob, (void *)pBlob, *errMsg);
} }
bool cppISteamNetworkingSockets_SteamNetworkingSockets009_SetCertificate(void *linux_side, const void * pCertificate, int cbCertificate, SteamNetworkingErrMsg * errMsg) bool cppISteamNetworkingSockets_SteamNetworkingSockets009_SetCertificate(void *linux_side, const void * pCertificate, int cbCertificate, SteamNetworkingErrMsg * errMsg)
{ {
return ((ISteamNetworkingSockets*)linux_side)->SetCertificate((const void *)pCertificate, (int)cbCertificate, (SteamNetworkingErrMsg *)errMsg); return ((ISteamNetworkingSockets*)linux_side)->SetCertificate((const void *)pCertificate, (int)cbCertificate, *errMsg);
} }
void cppISteamNetworkingSockets_SteamNetworkingSockets009_RunCallbacks(void *linux_side) void cppISteamNetworkingSockets_SteamNetworkingSockets009_RunCallbacks(void *linux_side)

View file

@ -19,27 +19,27 @@ ESteamNetworkingAvailability cppISteamNetworkingUtils_SteamNetworkingUtils003_Ge
float cppISteamNetworkingUtils_SteamNetworkingUtils003_GetLocalPingLocation(void *linux_side, SteamNetworkPingLocation_t * result) float cppISteamNetworkingUtils_SteamNetworkingUtils003_GetLocalPingLocation(void *linux_side, SteamNetworkPingLocation_t * result)
{ {
return ((ISteamNetworkingUtils*)linux_side)->GetLocalPingLocation((SteamNetworkPingLocation_t *)result); return ((ISteamNetworkingUtils*)linux_side)->GetLocalPingLocation(*result);
} }
int cppISteamNetworkingUtils_SteamNetworkingUtils003_EstimatePingTimeBetweenTwoLocations(void *linux_side, const SteamNetworkPingLocation_t * location1, const SteamNetworkPingLocation_t * location2) int cppISteamNetworkingUtils_SteamNetworkingUtils003_EstimatePingTimeBetweenTwoLocations(void *linux_side, const SteamNetworkPingLocation_t * location1, const SteamNetworkPingLocation_t * location2)
{ {
return ((ISteamNetworkingUtils*)linux_side)->EstimatePingTimeBetweenTwoLocations((const SteamNetworkPingLocation_t *)location1, (const SteamNetworkPingLocation_t *)location2); return ((ISteamNetworkingUtils*)linux_side)->EstimatePingTimeBetweenTwoLocations(*location1, *location2);
} }
int cppISteamNetworkingUtils_SteamNetworkingUtils003_EstimatePingTimeFromLocalHost(void *linux_side, const SteamNetworkPingLocation_t * remoteLocation) int cppISteamNetworkingUtils_SteamNetworkingUtils003_EstimatePingTimeFromLocalHost(void *linux_side, const SteamNetworkPingLocation_t * remoteLocation)
{ {
return ((ISteamNetworkingUtils*)linux_side)->EstimatePingTimeFromLocalHost((const SteamNetworkPingLocation_t *)remoteLocation); return ((ISteamNetworkingUtils*)linux_side)->EstimatePingTimeFromLocalHost(*remoteLocation);
} }
void cppISteamNetworkingUtils_SteamNetworkingUtils003_ConvertPingLocationToString(void *linux_side, const SteamNetworkPingLocation_t * location, char * pszBuf, int cchBufSize) void cppISteamNetworkingUtils_SteamNetworkingUtils003_ConvertPingLocationToString(void *linux_side, const SteamNetworkPingLocation_t * location, char * pszBuf, int cchBufSize)
{ {
((ISteamNetworkingUtils*)linux_side)->ConvertPingLocationToString((const SteamNetworkPingLocation_t *)location, (char *)pszBuf, (int)cchBufSize); ((ISteamNetworkingUtils*)linux_side)->ConvertPingLocationToString(*location, (char *)pszBuf, (int)cchBufSize);
} }
bool cppISteamNetworkingUtils_SteamNetworkingUtils003_ParsePingLocationString(void *linux_side, const char * pszString, SteamNetworkPingLocation_t * result) bool cppISteamNetworkingUtils_SteamNetworkingUtils003_ParsePingLocationString(void *linux_side, const char * pszString, SteamNetworkPingLocation_t * result)
{ {
return ((ISteamNetworkingUtils*)linux_side)->ParsePingLocationString((const char *)pszString, (SteamNetworkPingLocation_t *)result); return ((ISteamNetworkingUtils*)linux_side)->ParsePingLocationString((const char *)pszString, *result);
} }
bool cppISteamNetworkingUtils_SteamNetworkingUtils003_CheckPingDataUpToDate(void *linux_side, float flMaxAgeSeconds) bool cppISteamNetworkingUtils_SteamNetworkingUtils003_CheckPingDataUpToDate(void *linux_side, float flMaxAgeSeconds)
@ -95,7 +95,7 @@ ESteamNetworkingConfigValue cppISteamNetworkingUtils_SteamNetworkingUtils003_Get
void cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIPAddr_ToString(void *linux_side, const SteamNetworkingIPAddr * addr, char * buf, size_t cbBuf, bool bWithPort) void cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIPAddr_ToString(void *linux_side, const SteamNetworkingIPAddr * addr, char * buf, size_t cbBuf, bool bWithPort)
{ {
((ISteamNetworkingUtils*)linux_side)->SteamNetworkingIPAddr_ToString((const SteamNetworkingIPAddr *)addr, (char *)buf, (size_t)cbBuf, (bool)bWithPort); ((ISteamNetworkingUtils*)linux_side)->SteamNetworkingIPAddr_ToString(*addr, (char *)buf, (size_t)cbBuf, (bool)bWithPort);
} }
bool cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIPAddr_ParseString(void *linux_side, SteamNetworkingIPAddr * pAddr, const char * pszStr) bool cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIPAddr_ParseString(void *linux_side, SteamNetworkingIPAddr * pAddr, const char * pszStr)
@ -105,7 +105,7 @@ bool cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIPAddr_Pars
void cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIdentity_ToString(void *linux_side, const SteamNetworkingIdentity * identity, char * buf, size_t cbBuf) void cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIdentity_ToString(void *linux_side, const SteamNetworkingIdentity * identity, char * buf, size_t cbBuf)
{ {
((ISteamNetworkingUtils*)linux_side)->SteamNetworkingIdentity_ToString((const SteamNetworkingIdentity *)identity, (char *)buf, (size_t)cbBuf); ((ISteamNetworkingUtils*)linux_side)->SteamNetworkingIdentity_ToString(*identity, (char *)buf, (size_t)cbBuf);
} }
bool cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIdentity_ParseString(void *linux_side, SteamNetworkingIdentity * pIdentity, const char * pszStr) bool cppISteamNetworkingUtils_SteamNetworkingUtils003_SteamNetworkingIdentity_ParseString(void *linux_side, SteamNetworkingIdentity * pIdentity, const char * pszStr)

View file

@ -701,6 +701,9 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
parambytes = 4 #_this parambytes = 4 #_this
for param in list(method.get_children()): for param in list(method.get_children()):
if param.kind == clang.cindex.CursorKind.PARM_DECL: if param.kind == clang.cindex.CursorKind.PARM_DECL:
if param.type.kind == clang.cindex.TypeKind.LVALUEREFERENCE:
parambytes += 4
else:
parambytes += int(math.ceil(param.type.get_size()/4.0) * 4) parambytes += int(math.ceil(param.type.get_size()/4.0) * 4)
if cppname in manually_handled_methods and \ if cppname in manually_handled_methods and \
used_name in manually_handled_methods[cppname]: used_name in manually_handled_methods[cppname]:
@ -752,6 +755,8 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
elif param.spelling in manual_param_converters: elif param.spelling in manual_param_converters:
manual_convert.append(param) manual_convert.append(param)
win_name = win_name.replace('&', '*')
if param.spelling == "": if param.spelling == "":
cfile.write(f", {win_name} _{unnamed}") cfile.write(f", {win_name} _{unnamed}")
cpp.write(f", {win_name} _{unnamed}") cpp.write(f", {win_name} _{unnamed}")
@ -857,6 +862,9 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
cpp.write(f"lin_{param.spelling}") cpp.write(f"lin_{param.spelling}")
else: else:
cpp.write(f"&lin_{param.spelling}") cpp.write(f"&lin_{param.spelling}")
elif param.type.kind == clang.cindex.TypeKind.LVALUEREFERENCE:
cfile.write(f", {param.spelling}")
cpp.write(f"*{param.spelling}")
else: else:
cfile.write(f", {param.spelling}") cfile.write(f", {param.spelling}")
cpp.write(f"({param.type.spelling}){param.spelling}") cpp.write(f"({param.type.spelling}){param.spelling}")

View file

@ -56,7 +56,7 @@ public:
// set the local IP and Port to bind to // set the local IP and Port to bind to
// this must be set before CreateLocalUser() // this must be set before CreateLocalUser()
virtual void SetLocalIPBinding( const SteamIPAddress_t *unIP, uint16 usPort ) = 0; virtual void SetLocalIPBinding( const SteamIPAddress_t &unIP, uint16 usPort ) = 0;
// returns the ISteamFriends interface // returns the ISteamFriends interface
virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;

View file

@ -77,7 +77,7 @@ public:
/// GetSessionConnectionInfo to get the details.) In order to acknowledge the broken session /// GetSessionConnectionInfo to get the details.) In order to acknowledge the broken session
/// and start a new one, you must call CloseSessionWithUser /// and start a new one, you must call CloseSessionWithUser
/// - See ISteamNetworkingSockets::SendMessageToConnection for more possible return values /// - See ISteamNetworkingSockets::SendMessageToConnection for more possible return values
virtual EResult SendMessageToUser( const SteamNetworkingIdentity *identityRemote, const void *pubData, uint32 cubData, int nSendFlags, int nRemoteChannel ) = 0; virtual EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const void *pubData, uint32 cubData, int nSendFlags, int nRemoteChannel ) = 0;
/// Reads the next message that has been sent from another user via SendMessageToUser() on the given channel. /// Reads the next message that has been sent from another user via SendMessageToUser() on the given channel.
/// Returns number of messages returned into your list. (0 if no message are available on that channel.) /// Returns number of messages returned into your list. (0 if no message are available on that channel.)
@ -95,20 +95,20 @@ public:
/// existing active session, this function will return true, even if it is not pending. /// existing active session, this function will return true, even if it is not pending.
/// ///
/// Calling SendMessageToUser() will implicitly accepts any pending session request to that user. /// Calling SendMessageToUser() will implicitly accepts any pending session request to that user.
virtual bool AcceptSessionWithUser( const SteamNetworkingIdentity *identityRemote ) = 0; virtual bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0;
/// Call this when you're done talking to a user to immediately free up resources under-the-hood. /// Call this when you're done talking to a user to immediately free up resources under-the-hood.
/// If the remote user tries to send data to you again, another SteamNetworkingMessagesSessionRequest_t /// If the remote user tries to send data to you again, another SteamNetworkingMessagesSessionRequest_t
/// callback will be posted. /// callback will be posted.
/// ///
/// Note that sessions that go unused for a few minutes are automatically timed out. /// Note that sessions that go unused for a few minutes are automatically timed out.
virtual bool CloseSessionWithUser( const SteamNetworkingIdentity *identityRemote ) = 0; virtual bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0;
/// Call this when you're done talking to a user on a specific channel. Once all /// Call this when you're done talking to a user on a specific channel. Once all
/// open channels to a user have been closed, the open session to the user will be /// open channels to a user have been closed, the open session to the user will be
/// closed, and any new data from this user will trigger a /// closed, and any new data from this user will trigger a
/// SteamSteamNetworkingMessagesSessionRequest_t callback /// SteamSteamNetworkingMessagesSessionRequest_t callback
virtual bool CloseChannelWithUser( const SteamNetworkingIdentity *identityRemote, int nLocalChannel ) = 0; virtual bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nLocalChannel ) = 0;
/// Returns information about the latest state of a connection, if any, with the given peer. /// Returns information about the latest state of a connection, if any, with the given peer.
/// Primarily intended for debugging purposes, but can also be used to get more detailed /// Primarily intended for debugging purposes, but can also be used to get more detailed
@ -119,7 +119,7 @@ public:
/// you do not need the corresponding details. Note that sessions time out after a while, /// you do not need the corresponding details. Note that sessions time out after a while,
/// so if a connection fails, or SendMessageToUser returns k_EResultNoConnection, you cannot wait /// so if a connection fails, or SendMessageToUser returns k_EResultNoConnection, you cannot wait
/// indefinitely to obtain the reason for failure. /// indefinitely to obtain the reason for failure.
virtual ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity *identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetworkingQuickConnectionStatus *pQuickStatus ) = 0; virtual ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity &identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetworkingQuickConnectionStatus *pQuickStatus ) = 0;
}; };
#define STEAMNETWORKINGMESSAGES_INTERFACE_VERSION "SteamNetworkingMessages002" #define STEAMNETWORKINGMESSAGES_INTERFACE_VERSION "SteamNetworkingMessages002"

View file

@ -59,7 +59,7 @@ public:
/// ///
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t /// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
/// will be posted. The connection will be in the connecting state. /// will be posted. The connection will be in the connecting state.
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr *localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
/// Creates a connection and begins talking to a "server" over UDP at the /// Creates a connection and begins talking to a "server" over UDP at the
/// given IPv4 or IPv6 address. The remote host must be listening with a /// given IPv4 or IPv6 address. The remote host must be listening with a
@ -83,7 +83,7 @@ public:
/// If you need to set any initial config options, pass them here. See /// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to /// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation. /// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr *address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P. /// Like CreateListenSocketIP, but clients will connect using ConnectP2P.
/// ///
@ -121,7 +121,7 @@ public:
/// To use your own signaling service, see: /// To use your own signaling service, see:
/// - ConnectP2PCustomSignaling /// - ConnectP2PCustomSignaling
/// - k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling /// - k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity *identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
/// Accept an incoming connection that has been received on a listen socket. /// Accept an incoming connection that has been received on a listen socket.
/// ///
@ -486,7 +486,7 @@ public:
/// ///
/// Typically this is useful just to confirm that you have a ticket, before you /// Typically this is useful just to confirm that you have a ticket, before you
/// call ConnectToHostedDedicatedServer to connect to the server. /// call ConnectToHostedDedicatedServer to connect to the server.
virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity *identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0; virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
/// Client call to connect to a server hosted in a Valve data center, on the specified virtual /// Client call to connect to a server hosted in a Valve data center, on the specified virtual
/// port. You must have placed a ticket for this server into the cache, or else this connect /// port. You must have placed a ticket for this server into the cache, or else this connect
@ -504,7 +504,7 @@ public:
/// If you need to set any initial config options, pass them here. See /// If you need to set any initial config options, pass them here. See
/// SteamNetworkingConfigValue_t for more about why this is preferable to /// SteamNetworkingConfigValue_t for more about why this is preferable to
/// setting the options "immediately" after creation. /// setting the options "immediately" after creation.
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity *identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
// //
// Servers hosted in data centers known to the Valve relay network // Servers hosted in data centers known to the Valve relay network
@ -683,11 +683,11 @@ public:
/// size. (512 bytes is a conservative estimate.) /// size. (512 bytes is a conservative estimate.)
/// ///
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert. /// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg *errMsg ) = 0; virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
/// Set the certificate. The certificate blob should be the output of /// Set the certificate. The certificate blob should be the output of
/// SteamDatagram_CreateCert. /// SteamDatagram_CreateCert.
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg *errMsg ) = 0; virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
/// Invoke all callback functions queued for this interface. /// Invoke all callback functions queued for this interface.
/// See k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, etc /// See k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, etc

View file

@ -106,7 +106,7 @@ public:
/// ///
/// This always return the most up-to-date information we have available /// This always return the most up-to-date information we have available
/// right now, even if we are in the middle of re-calculating ping times. /// right now, even if we are in the middle of re-calculating ping times.
virtual float GetLocalPingLocation( SteamNetworkPingLocation_t *result ) = 0; virtual float GetLocalPingLocation( SteamNetworkPingLocation_t &result ) = 0;
/// Estimate the round-trip latency between two arbitrary locations, in /// Estimate the round-trip latency between two arbitrary locations, in
/// milliseconds. This is a conservative estimate, based on routing through /// milliseconds. This is a conservative estimate, based on routing through
@ -130,7 +130,7 @@ public:
/// ///
/// Do you need to be able to do this from a backend/matchmaking server? /// Do you need to be able to do this from a backend/matchmaking server?
/// You are looking for the "game coordinator" library. /// You are looking for the "game coordinator" library.
virtual int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t *location1, const SteamNetworkPingLocation_t *location2 ) = 0; virtual int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 ) = 0;
/// Same as EstimatePingTime, but assumes that one location is the local host. /// Same as EstimatePingTime, but assumes that one location is the local host.
/// This is a bit faster, especially if you need to calculate a bunch of /// This is a bit faster, especially if you need to calculate a bunch of
@ -140,17 +140,17 @@ public:
/// GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because /// GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because
/// this function uses a slightly more complete set of information about what /// this function uses a slightly more complete set of information about what
/// route would be taken. /// route would be taken.
virtual int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t *remoteLocation ) = 0; virtual int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation ) = 0;
/// Convert a ping location into a text format suitable for sending over the wire. /// Convert a ping location into a text format suitable for sending over the wire.
/// The format is a compact and human readable. However, it is subject to change /// The format is a compact and human readable. However, it is subject to change
/// so please do not parse it yourself. Your buffer must be at least /// so please do not parse it yourself. Your buffer must be at least
/// k_cchMaxSteamNetworkingPingLocationString bytes. /// k_cchMaxSteamNetworkingPingLocationString bytes.
virtual void ConvertPingLocationToString( const SteamNetworkPingLocation_t *location, char *pszBuf, int cchBufSize ) = 0; virtual void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize ) = 0;
/// Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand /// Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand
/// the string. /// the string.
virtual bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t *result ) = 0; virtual bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result ) = 0;
/// Check if the ping data of sufficient recency is available, and if /// Check if the ping data of sufficient recency is available, and if
/// it's too old, start refreshing it. /// it's too old, start refreshing it.
@ -282,7 +282,7 @@ public:
/// (This is just a convenience shortcut; see below for the implementation and /// (This is just a convenience shortcut; see below for the implementation and
/// a little insight into how SteamNetworkingConfigValue_t is used when /// a little insight into how SteamNetworkingConfigValue_t is used when
/// setting config options during listen socket and connection creation.) /// setting config options during listen socket and connection creation.)
bool SetConfigValueStruct( const SteamNetworkingConfigValue_t *opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj ); bool SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj );
/// Get a configuration value. /// Get a configuration value.
/// - eValue: which value to fetch /// - eValue: which value to fetch
@ -308,9 +308,9 @@ public:
// String conversions. You'll usually access these using the respective // String conversions. You'll usually access these using the respective
// inline methods. // inline methods.
virtual void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr *addr, char *buf, size_t cbBuf, bool bWithPort ) = 0; virtual void SteamNetworkingIPAddr_ToString( const SteamNetworkingIPAddr &addr, char *buf, size_t cbBuf, bool bWithPort ) = 0;
virtual bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ) = 0; virtual bool SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr *pAddr, const char *pszStr ) = 0;
virtual void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity *identity, char *buf, size_t cbBuf ) = 0; virtual void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf ) = 0;
virtual bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr ) = 0; virtual bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr ) = 0;
protected: protected: