Skip to content

Commit

Permalink
1.51
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed May 9, 2021
1 parent 2cfccd5 commit da1a0d6
Show file tree
Hide file tree
Showing 48 changed files with 785 additions and 360 deletions.
2 changes: 1 addition & 1 deletion .ci/azure.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Azure Pipeline YAML file

name: 1.50$(Rev:.r)
name: 1.51$(Rev:.r)

trigger:
branches:
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include(ExternalProject)

set(SWSDK_VERSION "1.50")
set(SWSDK_VERSION "1.51")
set(SWSDK_RELEASE "x86")
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set(SWSDK_RELEASE "x64")
Expand Down
19 changes: 19 additions & 0 deletions steamworks_sdk/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ Welcome to the Steamworks SDK. For documentation please see our partner
website at: http://partner.steamgames.com


----------------------------------------------------------------
v1.51 8th January 2021
----------------------------------------------------------------
ISteamUGC
* Added GetQueryUGCNumTags(), GetQueryUGCTag(), and GetQueryUGCTagDisplayName() for access to an item's tags and the display names (e.g. localized versions) of those tags
* A previous SDK update added (but failed to call out) AddRequiredTagGroup() which allows for matching at least one tag from the group (logical "or")

ISteamInput & ISteamController
* Added PS5 Action Origins

ISteamFriends
* Added ActivateGameOverlayInviteDialogConnectString - Activates the game overlay to open an invite dialog that will send the provided Rich Presence connect string to selected friends

Steamworks Example
* Updated to use latest SteamNetworkingSockets API

Content Builder
* Updated upload example to use a single script file to upload a simple depot

----------------------------------------------------------------
v1.50 29th August 2020
----------------------------------------------------------------
Expand Down
22 changes: 0 additions & 22 deletions steamworks_sdk/SteamworksExample/Messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ enum EMessage

// Client messages
k_EMsgClientBegin = 500,
k_EMsgClientInitiateConnection = k_EMsgClientBegin+1,
k_EMsgClientBeginAuthentication = k_EMsgClientBegin+2,
k_EMsgClientSendLocalUpdate = k_EMsgClientBegin+3,
k_EMsgClientLeavingServer = k_EMsgClientBegin+4,

// P2P authentication messages
k_EMsgP2PBegin = 600,
Expand Down Expand Up @@ -126,16 +124,6 @@ struct MsgServerExiting_t
const DWORD m_dwMessageType;
};

// Msg from client to server when trying to connect
struct MsgClientInitiateConnection_t
{
MsgClientInitiateConnection_t() : m_dwMessageType( LittleDWord( k_EMsgClientInitiateConnection ) ) {}
DWORD GetMessageType() { return LittleDWord( m_dwMessageType ); }

private:
const DWORD m_dwMessageType;
};

// Msg from client to server when initiating authentication
struct MsgClientBeginAuthentication_t
{
Expand Down Expand Up @@ -175,16 +163,6 @@ struct MsgClientSendLocalUpdate_t
ClientSpaceWarUpdateData_t m_ClientUpdateData;
};

// Msg from the client telling the server it is about to leave
struct MsgClientLeavingServer_t
{
MsgClientLeavingServer_t() : m_dwMessageType( LittleDWord( k_EMsgClientLeavingServer ) ) {}
DWORD GetMessageType() { return LittleDWord( m_dwMessageType ); }

private:
const DWORD m_dwMessageType;
};

// Message sent from one peer to another, so peers authenticate directly with each other.
// (In this example, the server is responsible for relaying the messages, but peers
// are directly authenticating each other.)
Expand Down
3 changes: 0 additions & 3 deletions steamworks_sdk/SteamworksExample/SpaceWar.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
// Current game server version
#define SPACEWAR_SERVER_VERSION "1.0.0.0"

// UDP port for the spacewar server to do authentication on (ie, talk to Steam on)
#define SPACEWAR_AUTHENTICATION_PORT 8766

// UDP port for the spacewar server to listen on
#define SPACEWAR_SERVER_PORT 27015

Expand Down
20 changes: 8 additions & 12 deletions steamworks_sdk/SteamworksExample/SpaceWarClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ void CSpaceWarClient::DisconnectFromServer()
SteamUser()->AdvertiseGame( k_steamIDNil, 0, 0 );
#endif

MsgClientLeavingServer_t msg;
BSendServerData( &msg, sizeof(msg) );

// tell steam china duration control system that we are no longer in a match
SteamUser()->BSetDurationControlOnlineState( k_EDurationControlOnlineState_Offline );

Expand Down Expand Up @@ -315,7 +312,7 @@ void CSpaceWarClient::OnReceiveServerInfo( CSteamID steamIDGameServer, bool bVAC
if ( msg.GetTokenLen() < 1 )
OutputDebugString( "Warning: Looks like GetAuthSessionTicket didn't give us a good ticket\n" );

BSendServerData( &msg, sizeof(msg) );
BSendServerData( &msg, sizeof(msg), k_nSteamNetworkingSend_Reliable );
}


Expand Down Expand Up @@ -554,9 +551,9 @@ void CSpaceWarClient::SetConnectionFailureText( const char *pchErrorText )
//-----------------------------------------------------------------------------
// Purpose: Send data to the current server
//-----------------------------------------------------------------------------
bool CSpaceWarClient::BSendServerData( const void *pData, uint32 nSizeOfData )
bool CSpaceWarClient::BSendServerData( const void *pData, uint32 nSizeOfData, int nSendFlags )
{
EResult res = SteamNetworkingSockets()->SendMessageToConnection( m_hConnServer, pData, nSizeOfData, k_nSteamNetworkingSend_UnreliableNoDelay, nullptr );
EResult res = SteamNetworkingSockets()->SendMessageToConnection( m_hConnServer, pData, nSizeOfData, nSendFlags, nullptr );
switch (res)
{
case k_EResultOK:
Expand Down Expand Up @@ -636,10 +633,6 @@ void CSpaceWarClient::InitiateServerConnection( CSteamID steamIDGameServer )
// Update when we last retried the connection, as well as the last packet received time so we won't timeout too soon,
// and so we will retry at appropriate intervals if packets drop
m_ulLastNetworkDataReceivedTime = m_ulLastConnectionAttemptRetryTime = m_pGameEngine->GetGameTickCount();

// send the packet to the server
MsgClientInitiateConnection_t msg;
BSendServerData( &msg, sizeof( msg ) );
}


Expand Down Expand Up @@ -1760,9 +1753,12 @@ void CSpaceWarClient::RunFrame()
MsgClientSendLocalUpdate_t msg;
msg.SetShipPosition( m_uPlayerShipIndex );

// If this fails, it probably just means its not time to send an update yet
// Send update as unreliable message. This means that if network packets drop,
// the networking system will not attempt retransmission, and our message may not arrive.
// That's OK, because we would rather just send a new, update message, instead of
// retransmitting the old one.
if ( m_rgpShips[ m_uPlayerShipIndex ]->BGetClientUpdateData( msg.AccessUpdateData() ) )
BSendServerData( &msg, sizeof( msg ) );
BSendServerData( &msg, sizeof( msg ), k_nSteamNetworkingSend_Unreliable );
}

if ( m_pP2PAuthedGame )
Expand Down
2 changes: 1 addition & 1 deletion steamworks_sdk/SteamworksExample/SpaceWarClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class CSpaceWarClient
void InitiateServerConnection( uint32 unServerAddress, const int32 nPort );

// Send data to a client at the given ship index
bool BSendServerData( const void *pData, uint32 nSizeOfData );
bool BSendServerData( const void *pData, uint32 nSizeOfData, int nSendFlags );

// Menu callback handler (handles a bunch of menus that just change state with no extra data)
void OnMenuSelection( EClientGameState eState ) { SetGameState( eState ); }
Expand Down
118 changes: 43 additions & 75 deletions steamworks_sdk/SteamworksExample/SpaceWarServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CSpaceWarServer::CSpaceWarServer( IGameEngine *pGameEngine )

// !FIXME! We need a way to pass the dedicated server flag here!

if ( !SteamGameServer_Init( unIP, SPACEWAR_AUTHENTICATION_PORT, SPACEWAR_SERVER_PORT, usMasterServerUpdaterPort, eMode, SPACEWAR_SERVER_VERSION ) )
if ( !SteamGameServer_Init( unIP, SPACEWAR_SERVER_PORT, usMasterServerUpdaterPort, eMode, SPACEWAR_SERVER_VERSION ) )
{
OutputDebugString( "SteamGameServer_Init call failed\n" );
}
Expand Down Expand Up @@ -158,47 +158,65 @@ CSpaceWarServer::~CSpaceWarServer()
void CSpaceWarServer::OnNetConnectionStatusChanged(SteamNetConnectionStatusChangedCallback_t* pCallback)
{
/// Connection handle
HSteamNetConnection m_hConn = pCallback->m_hConn;
HSteamNetConnection hConn = pCallback->m_hConn;

/// Full connection info
SteamNetConnectionInfo_t m_info = pCallback->m_info;
SteamNetConnectionInfo_t info = pCallback->m_info;

/// Previous state. (Current state is in m_info.m_eState)
ESteamNetworkingConnectionState m_eOldState = pCallback->m_eOldState;
ESteamNetworkingConnectionState eOldState = pCallback->m_eOldState;

// Parse information to know what was changed

// Check if a client has connected
if (m_info.m_hListenSocket &&
m_eOldState == k_ESteamNetworkingConnectionState_None &&
m_info.m_eState == k_ESteamNetworkingConnectionState_Connecting)
if (info.m_hListenSocket &&
eOldState == k_ESteamNetworkingConnectionState_None &&
info.m_eState == k_ESteamNetworkingConnectionState_Connecting)
{
// Handle connecting a client
// We always accept connectiosn from clients, without even checking for room on the server,
// since we reserve that for the authentication phase of the connection which comes next.
// In production code you probably ned to remember the connection and not let it hang
// around indefinitely
EResult res = SteamGameServerNetworkingSockets()->AcceptConnection(m_hConn);
// Connection from a new client
// Search for an available slot
for (uint32 i = 0; i < MAX_PLAYERS_PER_SERVER; ++i)
{
if (!m_rgClientData[i].m_bActive && !m_rgPendingClientData[i].m_hConn)
{
m_rgPendingClientData[i].m_hConn = m_hConn;

// Found one. "Accept" the connection.
EResult res = SteamGameServerNetworkingSockets()->AcceptConnection( hConn );
if ( res != k_EResultOK )
{
char msg[ 256 ];
sprintf( msg, "AcceptConnection returned %d", res );
OutputDebugString( msg );
SteamGameServerNetworkingSockets()->CloseConnection( hConn, k_ESteamNetConnectionEnd_AppException_Generic, "Failed to accept connection", false );
return;
}

m_rgPendingClientData[i].m_hConn = hConn;

// add the user to the poll group
SteamGameServerNetworkingSockets()->SetConnectionPollGroup(m_hConn, m_hNetPollGroup);
break;
SteamGameServerNetworkingSockets()->SetConnectionPollGroup(hConn, m_hNetPollGroup);

// Send them the server info as a reliable message
MsgServerSendInfo_t msg;
msg.SetSteamIDServer(SteamGameServer()->GetSteamID().ConvertToUint64());
#ifdef USE_GS_AUTH_API
// You can only make use of VAC when using the Steam authentication system
msg.SetSecure(SteamGameServer()->BSecure());
#endif
msg.SetServerName(m_sServerName.c_str());
SteamGameServerNetworkingSockets()->SendMessageToConnection( hConn, &msg, sizeof(MsgServerSendInfo_t), k_nSteamNetworkingSend_Reliable, nullptr );

return;
}
}
if ( res != k_EResultOK )
{
char msg[ 256 ];
sprintf( msg, "AcceptConnection returned %d", res );
OutputDebugString("Connection failed: Invalid Param");
}

// No empty slots. Server full!
OutputDebugString("Rejecting connection; server full");
SteamGameServerNetworkingSockets()->CloseConnection( hConn, k_ESteamNetConnectionEnd_AppException_Generic, "Server full!", false );
}
// Check if a client has disconnected
else if ((m_eOldState == k_ESteamNetworkingConnectionState_Connecting || m_eOldState == k_ESteamNetworkingConnectionState_Connected) &&
m_info.m_eState == k_ESteamNetworkingConnectionState_ClosedByPeer)
else if ((eOldState == k_ESteamNetworkingConnectionState_Connecting || eOldState == k_ESteamNetworkingConnectionState_Connected) &&
info.m_eState == k_ESteamNetworkingConnectionState_ClosedByPeer)
{
// Handle disconnecting a client
for (uint32 i = 0; i < MAX_PLAYERS_PER_SERVER; ++i)
Expand All @@ -207,7 +225,7 @@ void CSpaceWarServer::OnNetConnectionStatusChanged(SteamNetConnectionStatusChang
if (!m_rgClientData[i].m_bActive)
continue;

if (m_rgClientData[i].m_SteamIDUser == m_info.m_identityRemote.GetSteamID())//pCallback->m_steamIDRemote)
if (m_rgClientData[i].m_SteamIDUser == info.m_identityRemote.GetSteamID())//pCallback->m_steamIDRemote)
{
OutputDebugString("Disconnected dropped user\n");
RemovePlayerFromServer(i, EDisconnectReason::k_EDRClientDisconnect);
Expand Down Expand Up @@ -554,21 +572,6 @@ void CSpaceWarServer::ReceiveNetworkData()

switch (eMsg)
{
case k_EMsgClientInitiateConnection:
{
// We always let clients do this without even checking for room on the server since we reserve that for
// the authentication phase of the connection which comes next
MsgServerSendInfo_t msg;
msg.SetSteamIDServer(SteamGameServer()->GetSteamID().ConvertToUint64());
#ifdef USE_GS_AUTH_API
// You can only make use of VAC when using the Steam authentication system
msg.SetSecure(SteamGameServer()->BSecure());
#endif
msg.SetServerName(m_sServerName.c_str());
int64 messageOut;
SteamGameServerNetworkingSockets()->SendMessageToConnection(connection, &msg, sizeof(MsgServerSendInfo_t), k_nSteamNetworkingSend_Reliable, &messageOut);
}
break;
case k_EMsgClientBeginAuthentication:
{
if (message->GetSize() != sizeof(MsgClientBeginAuthentication_t))
Expand Down Expand Up @@ -612,41 +615,6 @@ void CSpaceWarServer::ReceiveNetworkData()
OutputDebugString("Got a client data update, but couldn't find a matching client\n");
}
break;
case k_EMsgClientLeavingServer:
{
if (message->GetSize() != sizeof(MsgClientLeavingServer_t))
{
OutputDebugString("Bad leaving server msg\n");
message->Release();
message = nullptr;
continue;
}
// Find the connection that should exist for this users address
bool bFound = false;
for (uint32 i = 0; i < MAX_PLAYERS_PER_SERVER; ++i)
{
if (m_rgClientData[i].m_SteamIDUser == steamIDRemote)
{
bFound = true;
RemovePlayerFromServer(i, EDisconnectReason::k_EDRClientDisconnect);
break;
}

// Also check for pending connections that may match
if (m_rgPendingClientData[i].m_SteamIDUser == steamIDRemote)
{
#ifdef USE_GS_AUTH_API
// Tell the GS the user is leaving the server
SteamGameServer()->SendUserDisconnect(m_rgPendingClientData[i].m_SteamIDUser);
#endif
// Clear our data on the user
memset(&m_rgPendingClientData[i], 0, sizeof(ClientConnectionData_t));
break;
}
}
if (!bFound)
OutputDebugString("Got a client leaving server msg, but couldn't find a matching client\n");
}

case k_EMsgVoiceChatData:
{
Expand Down
4 changes: 2 additions & 2 deletions steamworks_sdk/public/steam/isteamapplist.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamAppList *, SteamAppList, STEAMAPPLIS
//---------------------------------------------------------------------------------
// Purpose: Sent when a new app is installed
//---------------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 );
STEAM_CALLBACK_BEGIN( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
STEAM_CALLBACK_END(1)


//---------------------------------------------------------------------------------
// Purpose: Sent when an app is uninstalled
//---------------------------------------------------------------------------------
STEAM_CALLBACK_BEGIN( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 );
STEAM_CALLBACK_BEGIN( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
STEAM_CALLBACK_END(1)

Expand Down
Loading

0 comments on commit da1a0d6

Please sign in to comment.