mirror of
https://github.com/rlabrecque/SteamworksSDK.git
synced 2026-10-10 09:33:04 +08:00
v1.02
This commit is contained in:
+87
-2
@@ -1,4 +1,4 @@
|
||||
This is the Steamworks SDK v1.0
|
||||
This is the Steamworks SDK v1.02
|
||||
|
||||
================================================================
|
||||
|
||||
@@ -8,11 +8,96 @@ Copyright
|
||||
|
||||
|
||||
Welcome to the Steamworks SDK. For documentation please see our partner
|
||||
website at: http://partner.steamgames.com.
|
||||
website at: http://partner.steamgames.com
|
||||
|
||||
|
||||
Revision History:
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
v1.02 09/04/08
|
||||
----------------------------------------------------------------
|
||||
|
||||
The following interfaces have been updated:
|
||||
|
||||
ISteamUser
|
||||
|
||||
// Starts voice recording. Once started, use GetCompressedVoice() to get the data
|
||||
virtual void StartVoiceRecording( ) = 0;
|
||||
|
||||
// Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for
|
||||
// a little bit after this function is called. GetCompressedVoice() should continue to be called until it returns
|
||||
// k_eVoiceResultNotRecording
|
||||
virtual void StopVoiceRecording( ) = 0;
|
||||
|
||||
// Gets the latest voice data. It should be called as often as possible once recording has started.
|
||||
// nBytesWritten is set to the number of bytes written to pDestBuffer.
|
||||
virtual EVoiceResult GetCompressedVoice( void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten ) = 0;
|
||||
|
||||
// Decompresses a chunk of data produced by GetCompressedVoice(). nBytesWritten is set to the
|
||||
// number of bytes written to pDestBuffer. The output format of the data is 16-bit signed at
|
||||
// 11025 samples per second.
|
||||
virtual EVoiceResult DecompressVoice( void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten ) = 0;
|
||||
|
||||
virtual int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) = 0;
|
||||
|
||||
This has been extended to be usable for games that don't use the other parts of Steamworks matchmaking. This allows any multiplayer game to easily notify the Steam client of the IP:Port of the game server the user is connected to, so that their friends can join them via the Steam friends list. Empty values are taken for auth blob.
|
||||
|
||||
virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0;
|
||||
|
||||
This function returns a hint as a good place to store per- user per-game data.
|
||||
|
||||
|
||||
|
||||
ISteamMatchmaking
|
||||
|
||||
Added a set of server-side lobby filters, as well as voice chat, lobby member limits, and a way of quickly accessing the list of lobbies a users friends are in.
|
||||
|
||||
// filters for lobbies
|
||||
// this needs to be called before RequestLobbyList() to take effect
|
||||
// these are cleared on each call to RequestLobbyList()
|
||||
virtual void AddRequestLobbyListFilter( const char *pchKeyToMatch, const char *pchValueToMatch ) = 0;
|
||||
// numerical comparison - 0 is equal, -1 is the lobby value is less than nValueToMatch, 1 is the lobby value is greater than nValueToMatch
|
||||
virtual void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, int nComparisonType /* 0 is equal, -1 is less than, 1 is greater than */ ) = 0;
|
||||
// sets RequestLobbyList() to only returns lobbies which aren't yet full - needs SetLobbyMemberLimit() called on the lobby to set an initial limit
|
||||
virtual void AddRequestLobbyListSlotsAvailableFilter() = 0;
|
||||
|
||||
// returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist
|
||||
virtual bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, CSteamID *psteamIDGameServer ) = 0;
|
||||
|
||||
// set the limit on the # of users who can join the lobby
|
||||
virtual bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers ) = 0;
|
||||
// returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined
|
||||
virtual int GetLobbyMemberLimit( CSteamID steamIDLobby ) = 0;
|
||||
|
||||
// asks the Steam servers for a list of lobbies that friends are in
|
||||
// returns results by posting one RequestFriendsLobbiesResponse_t callback per friend/lobby pair
|
||||
// if no friends are in lobbies, RequestFriendsLobbiesResponse_t will be posted but with 0 results
|
||||
// filters don't apply to lobbies (currently)
|
||||
virtual bool RequestFriendsLobbies() = 0;
|
||||
|
||||
|
||||
ISteamUtils
|
||||
// Sets the position where the overlay instance for the currently calling game should show notifications.
|
||||
// This position is per-game and if this function is called from outside of a game context it will do nothing.
|
||||
virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0;
|
||||
|
||||
|
||||
ISteamFriends
|
||||
virtual int GetFriendAvatar( CSteamID steamIDFriend, int eAvatarSize ) = 0;
|
||||
|
||||
This function now takes an eAvatarSize parameter, which can be k_EAvatarSize32x32 or k_EAvatarSize64x64 (previously it always just returned a handle to the 32x32 image)
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
v1.01 08/08/08
|
||||
----------------------------------------------------------------
|
||||
|
||||
The Steamworks SDK has been updated to simplfy game server authentication and better expose application state
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
v1.0:
|
||||
----------------------------------------------------------------
|
||||
|
||||
- Initial Steamworks SDK release
|
||||
@@ -121,6 +121,7 @@ void CLobby::RunFrame()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handles a user in the lobby changing their name or details
|
||||
// ( note: joining and leaving is handled below by CLobby::OnLobbyChatUpdate() )
|
||||
//-----------------------------------------------------------------------------
|
||||
void CLobby::OnPersonaStateChange( PersonaStateChange_t *pCallback )
|
||||
{
|
||||
|
||||
@@ -71,11 +71,17 @@ int APIENTRY RealMain(HINSTANCE hInstance,
|
||||
// set our debug handler
|
||||
SteamClient()->SetWarningMessageHook( &SteamAPIDebugTextHook );
|
||||
|
||||
// Tell Steam where it's overlay should show notification dialogs, this can be top right, top left,
|
||||
// bottom right, bottom left. The default position is the bottom left if you don't call this.
|
||||
// Generally you should use the default and not call this as users will be most comfortable with
|
||||
// the default position. The API is provided in case the bottom right creates a serious conflict
|
||||
// with important UI in your game.
|
||||
SteamUtils()->SetOverlayNotificationPosition( k_EPositionTopRight );
|
||||
|
||||
// Look for the +connect ipaddress:port parameter in the command line,
|
||||
// Steam will pass this when a user has used the Steam Server browser to find
|
||||
// a server for our game and is trying to join it.
|
||||
const char* pchConnectParam = "+connect";
|
||||
const char *pchConnectParam = "+connect";
|
||||
char *pchCmdLine = ::GetCommandLine();
|
||||
char *pchConnect = strstr( pchCmdLine, pchConnectParam );
|
||||
char *pchServerAddress = NULL;
|
||||
@@ -85,6 +91,16 @@ int APIENTRY RealMain(HINSTANCE hInstance,
|
||||
pchServerAddress = pchCmdLine + ( pchConnect - pchCmdLine ) + strlen( pchConnectParam ) + 1;
|
||||
}
|
||||
|
||||
// look for +connect_lobby lobbyid paramter on the command line
|
||||
// Steam will pass this in if a user taken up an invite to a lobby
|
||||
const char *pchConnectLobbyParam = "+connect_lobby";
|
||||
char *pchConnectLobby = strstr( pchCmdLine, pchConnectParam );
|
||||
char *pchLobbyID = NULL;
|
||||
if ( pchConnectLobby && strlen( pchCmdLine ) > (pchConnectLobby - pchCmdLine) + strlen( pchConnectLobbyParam ) + 1 )
|
||||
{
|
||||
// Address should be right after the +connect, +1 on the end to skip the space
|
||||
pchLobbyID = pchCmdLine + ( pchConnectLobby - pchCmdLine ) + strlen( pchConnectLobbyParam ) + 1;
|
||||
}
|
||||
|
||||
|
||||
// Construct a new instance of the game engine
|
||||
@@ -106,7 +122,6 @@ int APIENTRY RealMain(HINSTANCE hInstance,
|
||||
// If +connect was used to specify a server address, connect now
|
||||
if ( pchServerAddress )
|
||||
{
|
||||
|
||||
int32 octet0 = 0, octet1 = 0, octet2 = 0, octet3 = 0;
|
||||
int32 uPort = 0;
|
||||
int nConverted = sscanf( pchServerAddress, "%d.%d.%d.%d:%d", &octet0, &octet1, &octet2, &octet3, &uPort );
|
||||
@@ -119,6 +134,18 @@ int APIENTRY RealMain(HINSTANCE hInstance,
|
||||
}
|
||||
}
|
||||
|
||||
// if +connect_lobby was used to specify a lobby to join, connect now
|
||||
if ( pchLobbyID )
|
||||
{
|
||||
CSteamID steamIDLobby( (uint64)_atoi64( pchLobbyID ) );
|
||||
if ( steamIDLobby.IsValid() )
|
||||
{
|
||||
// act just like we had selected it from the menu
|
||||
LobbyBrowserMenuItem_t menuItem = { steamIDLobby, k_EClientJoiningLobby };
|
||||
pGameClient->OnMenuSelection( menuItem );
|
||||
}
|
||||
}
|
||||
|
||||
while( !pGameEngine->BShuttingDown() )
|
||||
{
|
||||
if ( pGameEngine->StartFrame() )
|
||||
|
||||
@@ -92,7 +92,11 @@ struct MsgClientBeginAuthentication_t
|
||||
const DWORD m_dwMessageType;
|
||||
|
||||
uint32 m_uTokenLen;
|
||||
#ifdef USE_GS_AUTH_API
|
||||
char m_rgchToken[1024];
|
||||
#else
|
||||
CSteamID m_SteamID;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Msg from client to server when sending state update
|
||||
|
||||
@@ -8,6 +8,26 @@
|
||||
#ifndef SPACEWAR_H
|
||||
#define SPACEWAR_H
|
||||
|
||||
// The Steamworks API's are modular, you can use some subsystems without using others
|
||||
// When USE_GS_AUTH_API is defined you get the following Steam features:
|
||||
// - Strong user authentication and authorization
|
||||
// - Game server matchmaking
|
||||
// - VAC cheat protection
|
||||
// - Access to achievement/community API's
|
||||
// - P2P networking capability
|
||||
|
||||
// Remove this define to disable using the native Steam authentication and matchmaking system
|
||||
// You can use this as a sample of how to integrate your game without replacing an existing matchmaking system
|
||||
// When you un-define USE_GS_AUTH_API you get:
|
||||
// - Access to achievement/community API's
|
||||
// - P2P networking capability
|
||||
// You CANNOT use:
|
||||
// - VAC cheat protection
|
||||
// - Game server matchmaking
|
||||
// as these function depend on using Steam authentication
|
||||
#define USE_GS_AUTH_API
|
||||
|
||||
|
||||
// Current game server version
|
||||
#define SPACEWAR_SERVER_VERSION "1.0.0.0"
|
||||
|
||||
|
||||
@@ -157,7 +157,14 @@ void CSpaceWarClient::OnReceiveServerInfo( CSteamID steamIDGameServer, bool bVAC
|
||||
m_pQuitMenu->SetHeading( pchServerName );
|
||||
|
||||
MsgClientBeginAuthentication_t msg;
|
||||
#ifdef USE_GS_AUTH_API
|
||||
msg.m_uTokenLen = SteamUser()->InitiateGameConnection( (void*)&msg.m_rgchToken, ARRAYSIZE( msg.m_rgchToken ), steamIDGameServer, m_unServerIP, m_usServerPort, bVACSecure );
|
||||
#else
|
||||
// When you aren't using Steam auth you still call InitiateGameConnection() so you can communicate presence data to the friends
|
||||
// system. Make sure to pass k_steamIDNonSteamGS so Steam won't try to authenticate your user.
|
||||
msg.m_uTokenLen = SteamUser()->InitiateGameConnection( NULL, 0, k_steamIDNonSteamGS, m_unServerIP, m_usServerPort, false );
|
||||
msg.m_SteamID = SteamUser()->GetSteamID();
|
||||
#endif
|
||||
|
||||
if ( msg.m_uTokenLen < 1 )
|
||||
OutputDebugString( "Warning: Looks like InitiateGameConnection didn't give us a good token\n" );
|
||||
@@ -975,8 +982,8 @@ void CSpaceWarClient::DrawHUDText()
|
||||
const int32 width = m_pGameEngine->GetViewportWidth();
|
||||
const int32 height = m_pGameEngine->GetViewportHeight();
|
||||
|
||||
const int32 nAvatarWidth = 40; // scaled up from 32 which steam gives us
|
||||
const int32 nAvatarHeight = 40;
|
||||
const int32 nAvatarWidth = 64;
|
||||
const int32 nAvatarHeight = 64;
|
||||
|
||||
const int32 nSpaceBetweenAvatarAndScore = 6;
|
||||
|
||||
@@ -1007,7 +1014,7 @@ void CSpaceWarClient::DrawHUDText()
|
||||
// We also want to use the Steam Avatar image inside the HUD if it is available.
|
||||
// We look it up via GetFriendAvatar, which returns an image index we use
|
||||
// to look up the actual RGBA data below.
|
||||
int iImage = SteamFriends()->GetFriendAvatar( m_rgSteamIDPlayers[i] );
|
||||
int iImage = SteamFriends()->GetFriendAvatar( m_rgSteamIDPlayers[i], k_EAvatarSize64x64 );
|
||||
HGAMETEXTURE hTexture = GetSteamImageAsTexture( iImage );
|
||||
|
||||
RECT rect;
|
||||
|
||||
@@ -30,14 +30,21 @@ CSpaceWarServer::CSpaceWarServer( CGameEngine *pGameEngine ) :
|
||||
uint16 usSpectatorPort = 0; // We don't support specators in our game
|
||||
uint16 usMasterServerUpdaterPort = SPACEWAR_MASTER_SERVER_UPDATER_PORT;
|
||||
|
||||
#ifdef USE_GS_AUTH_API
|
||||
EServerMode eMode = eServerModeAuthenticationAndSecure;
|
||||
#else
|
||||
// Don't let Steam do authentication
|
||||
EServerMode eMode = eServerModeNoAuthentication;
|
||||
#endif
|
||||
// Initialize the SteamGameServer interface, we tell it some info about us, and we request support
|
||||
// for both Authentication (making sure users own games) and secure mode, VAC running in our game
|
||||
// and kicking users who are VAC banned
|
||||
if ( !SteamGameServer_Init( unIP, SPACEWAR_AUTHENTICATION_PORT, SPACEWAR_SERVER_PORT, usSpectatorPort, usMasterServerUpdaterPort, eServerModeAuthenticationAndSecure, pchGameDir, SPACEWAR_SERVER_VERSION ) )
|
||||
if ( !SteamGameServer_Init( unIP, SPACEWAR_AUTHENTICATION_PORT, SPACEWAR_SERVER_PORT, usSpectatorPort, usMasterServerUpdaterPort, eMode, pchGameDir, SPACEWAR_SERVER_VERSION ) )
|
||||
{
|
||||
OutputDebugString( "SteamGameServer_Init call failed\n" );
|
||||
}
|
||||
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// We want to actively update the master server with our presence so players can
|
||||
// find us via the steam matchmaking/server browser interfaces
|
||||
if ( SteamMasterServerUpdater() )
|
||||
@@ -58,6 +65,7 @@ CSpaceWarServer::CSpaceWarServer( CGameEngine *pGameEngine ) :
|
||||
{
|
||||
OutputDebugString( "SteamMasterServerUpdater() interface is invalid\n" );
|
||||
}
|
||||
#endif
|
||||
|
||||
m_uPlayerCount = 0;
|
||||
m_pGameEngine = pGameEngine;
|
||||
@@ -107,8 +115,10 @@ CSpaceWarServer::CSpaceWarServer( CGameEngine *pGameEngine ) :
|
||||
//-----------------------------------------------------------------------------
|
||||
CSpaceWarServer::~CSpaceWarServer()
|
||||
{
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// Notify Steam master server we are going offline
|
||||
SteamMasterServerUpdater()->SetActive( false );
|
||||
#endif
|
||||
|
||||
delete m_pSun;
|
||||
|
||||
@@ -125,8 +135,10 @@ CSpaceWarServer::~CSpaceWarServer()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// Disconnect from the steam servers
|
||||
SteamGameServer()->LogOff();
|
||||
#endif
|
||||
|
||||
// Close down our socket if it appears to be valid
|
||||
if ( m_hSocketServer )
|
||||
@@ -264,6 +276,7 @@ void CSpaceWarServer::OnClientBeginAuthentication( SNetSocket_t hSocketClient, v
|
||||
uint32 unIPClient = 0;
|
||||
SteamGameServerNetworking()->GetSocketInfo( hSocketClient, NULL, NULL, &unIPClient, NULL );
|
||||
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// authenticate the user with the Steam back-end servers
|
||||
m_rgPendingClientData[i].m_bActive = SteamGameServer()->SendUserConnectAndAuthenticate( unIPClient, pToken, uTokenLen, &m_rgPendingClientData[i].m_SteamIDUser );
|
||||
if ( !m_rgPendingClientData[i].m_bActive )
|
||||
@@ -272,6 +285,15 @@ void CSpaceWarServer::OnClientBeginAuthentication( SNetSocket_t hSocketClient, v
|
||||
BSendDataToClientOnSocket( hSocketClient, (char*)&msg, sizeof( msg ) );
|
||||
}
|
||||
break;
|
||||
#else
|
||||
m_rgPendingClientData[i].m_bActive = true;
|
||||
// we need to tell the server our Steam id in the non-auth case, so we stashed it in the login message, pull it back out
|
||||
m_rgPendingClientData[i].m_SteamIDUser = *(CSteamID *)pToken;
|
||||
// You would typically do your own authentication method here and later call OnAuthCompleted
|
||||
// In this sample we just automatically auth anyone who connects
|
||||
OnAuthCompleted( true, i );
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,9 +311,10 @@ void CSpaceWarServer::OnAuthCompleted( bool bAuthSuccessful, uint32 iPendingAuth
|
||||
|
||||
if ( !bAuthSuccessful )
|
||||
{
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// Tell the GS the user is leaving the server
|
||||
SteamGameServer()->SendUserDisconnect( m_rgPendingClientData[iPendingAuthIndex].m_SteamIDUser );
|
||||
|
||||
#endif
|
||||
// Send a deny for the client, and zero out the pending data
|
||||
MsgServerFailAuthentication_t msg;
|
||||
BSendDataToClientOnSocket( m_rgPendingClientData[iPendingAuthIndex].m_hSocket, (char*)&msg, sizeof( msg ) );
|
||||
@@ -436,9 +459,10 @@ void CSpaceWarServer::RemovePlayerFromServer( uint32 uShipPosition )
|
||||
m_rgpShips[uShipPosition] = NULL;
|
||||
m_rguPlayerScores[uShipPosition] = 0;
|
||||
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// Tell the GS the user is leaving the server
|
||||
SteamGameServer()->SendUserDisconnect( m_rgClientData[uShipPosition].m_SteamIDUser );
|
||||
|
||||
#endif
|
||||
memset( &m_rgClientData[uShipPosition], 0, sizeof( ClientConnectionData_t ) );
|
||||
}
|
||||
|
||||
@@ -521,7 +545,10 @@ void CSpaceWarServer::ReceiveNetworkData()
|
||||
// the authentication phase of the connection which comes next
|
||||
MsgServerSendInfo_t msg;
|
||||
msg.m_ulSteamIDServer = SteamGameServer()->GetSteamID().ConvertToUint64();
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// You can only make use of VAC when using the Steam authentication system
|
||||
msg.m_bIsVACSecure = SteamGameServer()->BSecure();
|
||||
#endif
|
||||
_snprintf( msg.m_rgchServerName, sizeof( msg.m_rgchServerName ), "%s", m_sServerName.c_str() );
|
||||
BSendDataToClientOnSocket( hSocketClient, (char*)&msg, sizeof( MsgServerSendInfo_t ) );
|
||||
}
|
||||
@@ -534,7 +561,11 @@ void CSpaceWarServer::ReceiveNetworkData()
|
||||
continue;
|
||||
}
|
||||
MsgClientBeginAuthentication_t *pMsg = (MsgClientBeginAuthentication_t*)pchRecvBuf;
|
||||
#ifdef USE_GS_AUTH_API
|
||||
OnClientBeginAuthentication( hSocketClient, &pMsg->m_rgchToken, pMsg->m_uTokenLen );
|
||||
#else
|
||||
OnClientBeginAuthentication( hSocketClient, &pMsg->m_SteamID, 0 );
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case k_EMsgClientSendLocalUpdate:
|
||||
@@ -581,9 +612,10 @@ void CSpaceWarServer::ReceiveNetworkData()
|
||||
// Also check for pending connections that may match
|
||||
if ( m_rgPendingClientData[i].m_hSocket == hSocketClient )
|
||||
{
|
||||
#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;
|
||||
@@ -847,6 +879,7 @@ void CSpaceWarServer::OnSteamServersConnected( SteamServersConnected_t *pLogonSu
|
||||
//-----------------------------------------------------------------------------
|
||||
void CSpaceWarServer::OnPolicyResponse( GSPolicyResponse_t *pPolicyResponse )
|
||||
{
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// Check if we were able to go VAC secure or not
|
||||
if ( SteamGameServer()->BSecure() )
|
||||
{
|
||||
@@ -856,6 +889,7 @@ void CSpaceWarServer::OnPolicyResponse( GSPolicyResponse_t *pPolicyResponse )
|
||||
{
|
||||
OutputDebugString( "SpaceWarServer is not VAC Secure!\n" );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -876,6 +910,7 @@ void CSpaceWarServer::SendUpdatedServerDetailsToSteam()
|
||||
{
|
||||
char *pchGameDir = "spacewar";
|
||||
|
||||
#ifdef USE_GS_AUTH_API
|
||||
// Tell the Steam Master Server about our game
|
||||
SteamMasterServerUpdater()->SetBasicServerData(
|
||||
7, // Protocol version to talk to the master server with, use the magic number 7
|
||||
@@ -886,6 +921,7 @@ void CSpaceWarServer::SendUpdatedServerDetailsToSteam()
|
||||
false, // Does our server require a password?
|
||||
"Steamworks Example" // Description of our game
|
||||
);
|
||||
#endif
|
||||
|
||||
// Tell the Steam authentication servers about our game
|
||||
char rgchServerName[128];
|
||||
@@ -901,6 +937,7 @@ void CSpaceWarServer::SendUpdatedServerDetailsToSteam()
|
||||
}
|
||||
m_sServerName = rgchServerName;
|
||||
|
||||
#ifdef USE_GS_AUTH_API
|
||||
SteamGameServer()->UpdateServerStatus(
|
||||
m_uPlayerCount, // Current player count
|
||||
4, // Maximum number of players
|
||||
@@ -918,6 +955,7 @@ void CSpaceWarServer::SendUpdatedServerDetailsToSteam()
|
||||
SteamGameServer()->BUpdateUserData( m_rgClientData[i].m_SteamIDUser, m_rgpShips[i]->GetPlayerName(), m_rguPlayerScores[i] );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// game type is a special string you can use for your game to differentiate different game play types occurring on the same maps
|
||||
// When users search for this parameter they do a sub-string search of this string
|
||||
@@ -1032,5 +1070,10 @@ uint16 CSpaceWarServer::GetPort()
|
||||
//-----------------------------------------------------------------------------
|
||||
CSteamID CSpaceWarServer::GetSteamID()
|
||||
{
|
||||
#ifdef USE_GS_AUTH_API
|
||||
return SteamGameServer()->GetSteamID();
|
||||
#else
|
||||
// this is a placeholder steam id to use when not making use of Steam auth or matchmaking
|
||||
return k_steamIDNonSteamGS;
|
||||
#endif
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: Main interface for loading and accessing Steamworks API's from the
|
||||
// Steam client.
|
||||
@@ -19,7 +19,7 @@ typedef int32 HSteamPipe;
|
||||
// handle to single instance of a steam user
|
||||
typedef int32 HSteamUser;
|
||||
// function prototype
|
||||
#ifdef _LINUX
|
||||
#if defined( POSIX ) && !defined( _CYGWIN )
|
||||
#define __cdecl
|
||||
#endif
|
||||
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
|
||||
@@ -141,6 +141,9 @@ enum { k_iSteamAppsCallbacks = 1000 };
|
||||
enum { k_iSteamUserStatsCallbacks = 1100 };
|
||||
enum { k_iSteamNetworkingCallbacks = 1200 };
|
||||
enum { k_iClientRemoteStorageCallbacks = 1300 };
|
||||
enum { k_iSteamUserItemsCallbacks = 1400 };
|
||||
enum { k_iSteamGameServerItemsCallbacks = 1500 };
|
||||
enum { k_iClientUtilsCallbacks = 1600 };
|
||||
|
||||
|
||||
#endif // ISTEAMCLIENT_H
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#endif
|
||||
|
||||
#include "isteamclient.h"
|
||||
#include "steamclientpublic.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: set of relationships to other users
|
||||
@@ -44,7 +45,7 @@ enum EPersonaState
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: flags for enumerating friends list, or quickly checking a the relationship between users
|
||||
//-----------------------------------------------------------------------------
|
||||
enum k_EFriendFlags
|
||||
enum EFriendFlags
|
||||
{
|
||||
k_EFriendFlagNone = 0x00,
|
||||
k_EFriendFlagBlocked = 0x01,
|
||||
@@ -61,6 +62,17 @@ enum k_EFriendFlags
|
||||
k_EFriendFlagAll = 0xFFFF,
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: avatar sizes, used in ISteamFriends::GetFriendAvatar()
|
||||
//-----------------------------------------------------------------------------
|
||||
enum EAvatarSize
|
||||
{
|
||||
k_EAvatarSize32x32 = 0,
|
||||
k_EAvatarSize64x64 = 1,
|
||||
};
|
||||
|
||||
|
||||
// maximum number of characters in a users name
|
||||
enum { k_cchPersonaNameMax = 128 };
|
||||
|
||||
@@ -112,7 +124,7 @@ public:
|
||||
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;
|
||||
|
||||
// gets the avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
|
||||
virtual int GetFriendAvatar( CSteamID steamIDFriend ) = 0;
|
||||
virtual int GetFriendAvatar( CSteamID steamIDFriend, int eAvatarSize ) = 0;
|
||||
// returns true if the friend is actually in a game
|
||||
virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, uint64 *pulGameID, uint32 *punGameIP, uint16 *pusGamePort, uint16 *pusQueryPort ) = 0;
|
||||
// accesses old friends names - returns an empty string when their are no more items in the history
|
||||
@@ -143,7 +155,7 @@ public:
|
||||
virtual void ActivateGameOverlay( const char *pchDialog ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends003"
|
||||
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends004"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: called when a friends' status changes
|
||||
|
||||
@@ -138,6 +138,7 @@ struct GSClientKick_t
|
||||
// NOTE: callback values 4 and 5 are skipped because they are used for old deprecated callbacks,
|
||||
// do not reuse them here.
|
||||
|
||||
|
||||
// client achievement info
|
||||
struct GSClientAchievementStatus_t
|
||||
{
|
||||
@@ -147,7 +148,6 @@ struct GSClientAchievementStatus_t
|
||||
bool m_bUnlocked;
|
||||
};
|
||||
|
||||
|
||||
// received when the game server requests to be displayed as secure (VAC protected)
|
||||
// m_bSecure is true if the game server should display itself as secure to users, false otherwise
|
||||
struct GSPolicyResponse_t
|
||||
|
||||
@@ -53,6 +53,15 @@ public:
|
||||
// a LobbyMatchList_t callback will be posted immediately with no servers
|
||||
virtual void RequestLobbyList() = 0;
|
||||
|
||||
// filters for lobbies
|
||||
// this needs to be called before RequestLobbyList() to take effect
|
||||
// these are cleared on each call to RequestLobbyList()
|
||||
virtual void AddRequestLobbyListFilter( const char *pchKeyToMatch, const char *pchValueToMatch ) = 0;
|
||||
// numerical comparison - 0 is equal, -1 is the lobby value is less than nValueToMatch, 1 is the lobby value is greater than nValueToMatch
|
||||
virtual void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, int nComparisonType /* 0 is equal, -1 is less than, 1 is greater than */ ) = 0;
|
||||
// sets RequestLobbyList() to only returns lobbies which aren't yet full - needs SetLobbyMemberLimit() called on the lobby to set an initial limit
|
||||
virtual void AddRequestLobbyListSlotsAvailableFilter() = 0;
|
||||
|
||||
// returns the CSteamID of a lobby, as retrieved by a RequestLobbyList call
|
||||
// should only be called after a LobbyMatchList_t callback is received
|
||||
// iLobby is of the range [0, LobbyMatchList_t::m_nLobbiesMatching)
|
||||
@@ -71,6 +80,7 @@ public:
|
||||
// Joins an existing lobby
|
||||
// this is an asynchronous request
|
||||
// results will be returned by LobbyEnter_t callback when the lobby has been joined
|
||||
// users already in the lobby will receive LobbyChatUpdate_t callback after this user has successfully joined
|
||||
virtual void JoinLobby( CSteamID steamIDLobby ) = 0;
|
||||
|
||||
// Leave a lobby; this will take effect immediately on the client side
|
||||
@@ -133,9 +143,21 @@ public:
|
||||
// usually at this point, the users will leave the lobby and join the specified game server
|
||||
// either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect
|
||||
virtual void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer ) = 0;
|
||||
// returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist
|
||||
virtual bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, CSteamID *psteamIDGameServer ) = 0;
|
||||
|
||||
// set the limit on the # of users who can join the lobby
|
||||
virtual bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers ) = 0;
|
||||
// returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined
|
||||
virtual int GetLobbyMemberLimit( CSteamID steamIDLobby ) = 0;
|
||||
|
||||
// asks the Steam servers for a list of lobbies that friends are in
|
||||
// returns results by posting one RequestFriendsLobbiesResponse_t callback per friend/lobby pair
|
||||
// if no friends are in lobbies, RequestFriendsLobbiesResponse_t will be posted but with 0 results
|
||||
// filters don't apply to lobbies (currently)
|
||||
virtual bool RequestFriendsLobbies() = 0;
|
||||
};
|
||||
#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking002"
|
||||
#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking004"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -371,6 +393,9 @@ struct FavoritesListChanged_t
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Someone has invited you to join a Lobby
|
||||
// normally you don't need to do anything with this, since
|
||||
// the Steam UI will also display a '<user> has invited you to the lobby, join?' dialog
|
||||
// if the user outside a game chooses to join, your game will be launched with the parameter "+connect_lobby <64-bit lobby id>"
|
||||
//-----------------------------------------------------------------------------
|
||||
struct LobbyInvite_t
|
||||
{
|
||||
@@ -506,4 +531,23 @@ struct LobbyCreated_t
|
||||
uint64 m_ulSteamIDLobby; // chat room, zero if failed
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Response to a RequestFriendsLobbies() call
|
||||
// One of these callbacks will be received per friend who is in a lobby
|
||||
// if no friends are in a lobby, then one of these will be called with 0 values
|
||||
//-----------------------------------------------------------------------------
|
||||
struct RequestFriendsLobbiesResponse_t
|
||||
{
|
||||
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 14 };
|
||||
|
||||
uint64 m_ulSteamIDFriend; // friend who is in a lobby; 0 if no friends in lobbies are found
|
||||
uint64 m_ulSteamIDLobby; // lobby that the friend is in; 0 if no friends in lobbies are found
|
||||
|
||||
int m_cResultIndex; // result #, [1, m_cResultsTotal] if any are found; 0 if no friends in lobbies are found
|
||||
int m_cResultsTotal; // total number of results; 0 if no friends in lobbies are found
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // ISTEAMMATCHMAKING
|
||||
|
||||
@@ -65,8 +65,8 @@ public:
|
||||
|
||||
// creates a socket and begin connection to a remote destination
|
||||
// can connect via a known steamID (client or game server), or directly to an IP
|
||||
// on success will trigger a SocketConnectCallback_t callback
|
||||
// on failure or timeout will trigger a SocketConnectionFailureCallback_t callback
|
||||
// on success will trigger a SocketStatusCallback_t callback
|
||||
// on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState
|
||||
virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec ) = 0;
|
||||
virtual SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 0;
|
||||
|
||||
|
||||
@@ -71,9 +71,30 @@ public:
|
||||
|
||||
// used by only a few games to track usage events
|
||||
virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0;
|
||||
|
||||
// get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
|
||||
// this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
|
||||
virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0;
|
||||
|
||||
// Starts voice recording. Once started, use GetCompressedVoice() to get the data
|
||||
virtual void StartVoiceRecording( ) = 0;
|
||||
|
||||
// Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for
|
||||
// a little bit after this function is called. GetCompressedVoice() should continue to be called until it returns
|
||||
// k_eVoiceResultNotRecording
|
||||
virtual void StopVoiceRecording( ) = 0;
|
||||
|
||||
// Gets the latest voice data. It should be called as often as possible once recording has started.
|
||||
// nBytesWritten is set to the number of bytes written to pDestBuffer.
|
||||
virtual EVoiceResult GetCompressedVoice( void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten ) = 0;
|
||||
|
||||
// Decompresses a chunk of data produced by GetCompressedVoice(). nBytesWritten is set to the
|
||||
// number of bytes written to pDestBuffer. The output format of the data is 16-bit signed at
|
||||
// 11025 samples per second.
|
||||
virtual EVoiceResult DecompressVoice( void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMUSER_INTERFACE_VERSION "SteamUser010"
|
||||
#define STEAMUSER_INTERFACE_VERSION "SteamUser011"
|
||||
|
||||
|
||||
// callbacks
|
||||
|
||||
@@ -48,6 +48,10 @@ public:
|
||||
|
||||
// returns the appID of the current process
|
||||
virtual uint32 GetAppID() = 0;
|
||||
|
||||
// Sets the position where the overlay instance for the currently calling game should show notifications.
|
||||
// This position is per-game and if this function is called from outside of a game context it will do nothing.
|
||||
virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils002"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -12,6 +12,10 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef POSIX
|
||||
#define _snprintf snprintf
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//====== Copyright 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -28,7 +28,7 @@
|
||||
#else
|
||||
#define S_API extern "C" __declspec( dllimport )
|
||||
#endif // STEAM_API_EXPORTS
|
||||
#elif defined( _LINUX )
|
||||
#elif defined( GNUC )
|
||||
#if defined( STEAM_API_EXPORTS )
|
||||
#define S_API extern "C" __attribute__ ((visibility("default")))
|
||||
#else
|
||||
|
||||
@@ -69,9 +69,21 @@ enum EResult
|
||||
k_EResultNoMatch = 42, // nothing matching the request found
|
||||
};
|
||||
|
||||
// Error codes for use with the voice functions
|
||||
enum EVoiceResult
|
||||
{
|
||||
k_EVoiceResultOK = 0,
|
||||
k_EVoiceResultNotInitialized = 1,
|
||||
k_EVoiceResultNotRecording = 2,
|
||||
k_EVoiceResultNoData = 3,
|
||||
k_EVoiceResultBufferTooSmall = 4,
|
||||
k_EVoiceResultDataCorrupted = 5,
|
||||
};
|
||||
|
||||
// Result codes to GSHandleClientDeny/Kick
|
||||
typedef enum
|
||||
{
|
||||
k_EDenyInvalid = 0,
|
||||
k_EDenyInvalidVersion = 1,
|
||||
k_EDenyGeneric = 2,
|
||||
k_EDenyNotLoggedOn = 3,
|
||||
@@ -86,6 +98,7 @@ typedef enum
|
||||
k_EDenySteamConnectionError = 12,
|
||||
k_EDenySteamResponseTimedOut = 13,
|
||||
k_EDenySteamValidationStalled = 14,
|
||||
k_EDenySteamOwnerLeftGuestUser = 15,
|
||||
} EDenyReason;
|
||||
|
||||
// Steam universes. Each universe is a self-contained Steam instance.
|
||||
@@ -97,7 +110,6 @@ enum EUniverse
|
||||
k_EUniverseInternal = 3,
|
||||
k_EUniverseDev = 4,
|
||||
k_EUniverseRC = 5,
|
||||
|
||||
k_EUniverseMax
|
||||
};
|
||||
|
||||
@@ -169,6 +181,83 @@ typedef void (*PFNLegacyKeyRegistration)( const char *pchCDKey, const char *pchI
|
||||
typedef bool (*PFNLegacyKeyInstalled)();
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Persistent item constants
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef int32 HNewItemRequest; // Handle to an item generation request
|
||||
const int k_cchCreateItemLen = 64; // Maximum string length in item create APIs
|
||||
const uint64 INVALID_ITEM_ID = (uint64)-1;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Persistent item quality (rarity)
|
||||
//-----------------------------------------------------------------------------
|
||||
enum EItemQuality
|
||||
{
|
||||
// If k_EItemQuality_Any is used in an item request a random quality will be chosen
|
||||
k_EItemQuality_Any = -1,
|
||||
k_EItemQuality_Normal = 0,
|
||||
k_EItemQuality_Common = 1,
|
||||
k_EItemQuality_Rare = 2,
|
||||
k_EItemQuality_Unique = 3,
|
||||
|
||||
//Must be last
|
||||
k_EItemQuality_Count = 4,
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Result codes for SendNewItemReqeust
|
||||
//-----------------------------------------------------------------------------
|
||||
enum EItemRequestResult
|
||||
{
|
||||
k_EItemRequestResultOK = 0, // Request succeeded
|
||||
k_EItemRequestResultDenied = 1, // Request denied
|
||||
k_EItemRequestResultServerError = 2, // Request failed due to a temporary server error
|
||||
k_EItemRequestResultTimeout = 3, // Request timed out
|
||||
k_EItemRequestResultInvalid = 4, // Request was corrupt
|
||||
k_EItemRequestResultNoMatch = 5, // No item definition matched the request
|
||||
k_EItemRequestResultUnknownError = 6, // Request failed with an unknown error
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Valid operators for BAddNewItemCriteria
|
||||
//-----------------------------------------------------------------------------
|
||||
enum EItemCriteriaOperator
|
||||
{
|
||||
k_EOperator_String_EQ = 0, // Field is string equal to value
|
||||
k_EOperator_Not = 1, // Logical not
|
||||
k_EOperator_String_Not_EQ = 1, // Field is not string equal to value
|
||||
k_EOperator_Float_EQ = 2, // Field as a float is equal to value
|
||||
k_EOperator_Float_Not_EQ = 3, // Field as a float is not equal to value
|
||||
k_EOperator_Float_LT = 4, // Field as a float is less than value
|
||||
k_EOperator_Float_Not_LT = 5, // Field as a float is not less than value
|
||||
k_EOperator_Float_LTE = 6, // Field as a float is less than or equal value
|
||||
k_EOperator_Float_Not_LTE = 7, // Field as a float is not less than or equal value
|
||||
k_EOperator_Float_GT = 8, // Field as a float is greater than value
|
||||
k_EOperator_Float_Not_GT = 9, // Field as a float is not greater than value
|
||||
k_EOperator_Float_GTE = 10, // Field as a float is greater than or equal value
|
||||
k_EOperator_Float_Not_GTE = 11, // Field as a float is not greater than or equal value
|
||||
k_EOperator_Subkey_Contains = 12, // Field contains value as a subkey
|
||||
k_EOperator_Subkey_Not_Contains = 13, // Field does not contain value as a subkey
|
||||
|
||||
// Must be last
|
||||
k_EItemCriteriaOperator_Count = 14,
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Possible positions to tell the overlay to show notifications in
|
||||
//-----------------------------------------------------------------------------
|
||||
enum ENotificationPosition
|
||||
{
|
||||
k_EPositionTopLeft = 0,
|
||||
k_EPositionTopRight = 1,
|
||||
k_EPositionBottomLeft = 2,
|
||||
k_EPositionBottomRight = 3,
|
||||
};
|
||||
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
|
||||
// Steam ID structure (64 bits total)
|
||||
@@ -512,6 +601,9 @@ const CSteamID k_steamIDLanModeGS( 0, 0, k_EUniversePublic, k_EAccountTypeInvali
|
||||
// This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized
|
||||
// its steam3 component and started logging on.
|
||||
const CSteamID k_steamIDNotInitYetGS( 1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid );
|
||||
// This steamID can come from a user game connection to a GS that isn't using the steam authentication system but still
|
||||
// wants to support the "Join Game" option in the friends list
|
||||
const CSteamID k_steamIDNonSteamGS( 2, 0, k_EUniverseInvalid, k_EAccountTypeInvalid );
|
||||
|
||||
|
||||
#ifdef STEAM
|
||||
|
||||
@@ -58,10 +58,7 @@ typedef unsigned int uintp;
|
||||
|
||||
#endif // else _WIN32
|
||||
|
||||
const int k_cubDigestSize = 20; // CryptoPP::SHA::DIGESTSIZE
|
||||
const int k_cubSaltSize = 8;
|
||||
|
||||
typedef uint8 SHADigest_t[ k_cubDigestSize ];
|
||||
typedef uint8 Salt_t[ k_cubSaltSize ];
|
||||
|
||||
typedef uint64 GID_t; // globally unique identifier
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user