Steamworks 144

This commit is contained in:
Garry Newman 2019-04-11 16:19:09 +01:00
parent 15b04eec2a
commit 0bf379a41b
38 changed files with 7780 additions and 1888 deletions

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
#include "steamtypes.h"
//-----------------------------------------------------------------------------
@ -25,7 +25,7 @@ public:
virtual uint32 GetNumInstalledApps() = 0;
virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0;
virtual int GetAppName( AppId_t nAppID, OUT_STRING() char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found
virtual int GetAppName( AppId_t nAppID, STEAM_OUT_STRING() char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found
virtual int GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) = 0; // returns -1 if no dir was found
virtual int GetAppBuildId( AppId_t nAppID ) = 0; // return the buildid of this app, may change at any time based on backend updates to the game
@ -33,30 +33,34 @@ public:
#define STEAMAPPLIST_INTERFACE_VERSION "STEAMAPPLIST_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamAppList *SteamAppList();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamAppList *, SteamAppList, STEAMAPPLIST_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//---------------------------------------------------------------------------------
// Purpose: Sent when a new app is installed
//---------------------------------------------------------------------------------
DEFINE_CALLBACK( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 );
CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
END_DEFINE_CALLBACK_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
//---------------------------------------------------------------------------------
DEFINE_CALLBACK( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 );
CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
END_DEFINE_CALLBACK_1()
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)
#pragma pack( pop )

View File

@ -10,6 +10,8 @@
#pragma once
#endif
#include "steam_api_common.h"
const int k_cubAppProofOfPurchaseKeyMax = 240; // max supported length of a legacy cd key
@ -65,12 +67,15 @@ public:
virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0;
virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned)
virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed
// returns the SteamID of the original owner. If this CSteamID is different from ISteamUser::GetSteamID(),
// the user has a temporary license borrowed via Family Sharing
virtual CSteamID GetAppOwner() = 0;
// Returns the associated launch param if the game is run via steam://run/<appid>//?param1=value1;param2=value2;param3=value3 etc.
// Returns the associated launch param if the game is run via steam://run/<appid>//?param1=value1&param2=value2&param3=value3 etc.
// Parameter names starting with the character '@' are reserved for internal use and will always return and empty string.
// Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game,
// but it is advised that you not param names beginning with an underscore for your own features.
// Check for new launch parameters on callback NewUrlLaunchParameters_t
virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0;
// get download progress for optional DLC
@ -85,19 +90,40 @@ public:
// member is k_uAppIdInvalid (zero).
virtual void RequestAllProofOfPurchaseKeys() = 0;
CALL_RESULT( FileDetailsResult_t )
STEAM_CALL_RESULT( FileDetailsResult_t )
virtual SteamAPICall_t GetFileDetails( const char* pszFileName ) = 0;
// Get command line if game was launched via Steam URL, e.g. steam://run/<appid>//<command line>/.
// This method of passing a connect string (used when joining via rich presence, accepting an
// invite, etc) is preferable to passing the connect string on the operating system command
// line, which is a security risk. In order for rich presence joins to go through this
// path and not be placed on the OS command line, you must set a value in your app's
// configuration on Steam. Ask Valve for help with this.
//
// If game was already running and launched again, the NewUrlLaunchParameters_t will be fired.
virtual int GetLaunchCommandLine( char *pszCommandLine, int cubCommandLine ) = 0;
// Check if user borrowed this game via Family Sharing, If true, call GetAppOwner() to get the lender SteamID
virtual bool BIsSubscribedFromFamilySharing() = 0;
};
#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION008"
// Global interface accessor
inline ISteamApps *SteamApps();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamApps *, SteamApps, STEAMAPPS_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamApps *SteamGameServerApps();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamApps *, SteamGameServerApps, STEAMAPPS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: posted after the user gains ownership of DLC & that DLC is installed
@ -134,12 +160,12 @@ struct RegisterActivationCodeResponse_t
//---------------------------------------------------------------------------------
// Purpose: posted after the user gains executes a steam url with query parameters
// such as steam://run/<appid>//?param1=value1;param2=value2;param3=value3; etc
// Purpose: posted after the user gains executes a Steam URL with command line or query parameters
// such as steam://run/<appid>//-commandline/?param1=value1&param2=value2&param3=value3 etc
// while the game is already running. The new params can be queried
// with GetLaunchQueryParam.
// with GetLaunchQueryParam and GetLaunchCommandLine
//---------------------------------------------------------------------------------
struct NewLaunchQueryParameters_t
struct NewUrlLaunchParameters_t
{
enum { k_iCallback = k_iSteamAppsCallbacks + 14 };
};

View File

@ -1,8 +1,9 @@
//====== Copyright <EFBFBD> 1996-2008, Valve Corporation, All rights reserved. =======
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose: Main interface for loading and accessing Steamworks API's from the
// Steam client.
// For most uses, this code is wrapped inside of SteamAPI_Init()
// Internal low-level access to Steamworks interfaces.
//
// Most users of the Steamworks SDK do not need to include this file.
// You should only include this if you are doing something special.
//=============================================================================
#ifndef ISTEAMCLIENT_H
@ -11,102 +12,7 @@
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
// Define compile time assert macros to let us validate the structure sizes.
#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1];
#ifndef REFERENCE
#define REFERENCE(arg) ((void)arg)
#endif
#if ( defined(STEAM_API_EXPORTS) || defined(STEAM_API_NODLL) ) && !defined(API_GEN)
#define STEAM_PRIVATE_API( ... ) __VA_ARGS__
#elif defined(STEAM_API_EXPORTS) && defined(API_GEN)
#define STEAM_PRIVATE_API( ... )
#else
#define STEAM_PRIVATE_API( ... ) protected: __VA_ARGS__ public:
#endif
#if defined(__linux__) || defined(__APPLE__)
// The 32-bit version of gcc has the alignment requirement for uint64 and double set to
// 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned.
// The 64-bit version of gcc has the alignment requirement for these types set to
// 8 meaning that unless we use #pragma pack(4) our structures will get bigger.
// The 64-bit structure packing has to match the 32-bit structure packing for each platform.
#define VALVE_CALLBACK_PACK_SMALL
#else
#define VALVE_CALLBACK_PACK_LARGE
#endif
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error ???
#endif
typedef struct ValvePackingSentinel_t
{
uint32 m_u32;
uint64 m_u64;
uint16 m_u16;
double m_d;
} ValvePackingSentinel_t;
#pragma pack( pop )
#if defined(VALVE_CALLBACK_PACK_SMALL)
VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 24 )
#elif defined(VALVE_CALLBACK_PACK_LARGE)
VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 32 )
#else
#error ???
#endif
// handle to a communication pipe to the Steam client
typedef int32 HSteamPipe;
// handle to single instance of a steam user
typedef int32 HSteamUser;
// function prototype
#if defined( POSIX )
#define __cdecl
#endif
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
extern "C" typedef uint32 ( *SteamAPI_CheckCallbackRegistered_t )( int iCallbackNum );
#if defined( __SNC__ )
#pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor
#endif
// interface predec
class ISteamUser;
class ISteamGameServer;
class ISteamFriends;
class ISteamUtils;
class ISteamMatchmaking;
class ISteamContentServer;
class ISteamMatchmakingServers;
class ISteamUserStats;
class ISteamApps;
class ISteamNetworking;
class ISteamRemoteStorage;
class ISteamScreenshots;
class ISteamMusic;
class ISteamMusicRemote;
class ISteamGameServerStats;
class ISteamPS3OverlayRender;
class ISteamHTTP;
class ISteamController;
class ISteamUGC;
class ISteamAppList;
class ISteamHTMLSurface;
class ISteamInventory;
class ISteamVideo;
class ISteamParentalSettings;
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Interface to creating a new steam instance, or to
@ -185,6 +91,9 @@ public:
// user screenshots
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// game search
virtual ISteamGameSearch *GetISteamGameSearch( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Deprecated. Applications should use SteamAPI_RunCallbacks() or SteamGameServer_RunCallbacks() instead.
STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
@ -209,7 +118,7 @@ public:
// Deprecated - the ISteamUnifiedMessages interface is no longer intended for public consumption.
STEAM_PRIVATE_API( virtual void *DEPRECATED_GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0 ; )
// Exposes the ISteamController interface
// Exposes the ISteamController interface - deprecated in favor of Steam Input
virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the ISteamUGC interface
@ -240,287 +149,26 @@ public:
// Parental controls
virtual ISteamParentalSettings *GetISteamParentalSettings( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Exposes the Steam Input interface for controller support
virtual ISteamInput *GetISteamInput( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
// Steam Parties interface
virtual ISteamParties *GetISteamParties( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
};
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient018"
#ifndef STEAM_API_EXPORTS
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient017"
// Global ISteamClient interface accessor
inline ISteamClient *SteamClient();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamClient *, SteamClient, SteamInternal_CreateInterface( STEAMCLIENT_INTERFACE_VERSION ) );
//-----------------------------------------------------------------------------
// Purpose: Base values for callback identifiers, each callback must
// have a unique ID.
//-----------------------------------------------------------------------------
enum { k_iSteamUserCallbacks = 100 };
enum { k_iSteamGameServerCallbacks = 200 };
enum { k_iSteamFriendsCallbacks = 300 };
enum { k_iSteamBillingCallbacks = 400 };
enum { k_iSteamMatchmakingCallbacks = 500 };
enum { k_iSteamContentServerCallbacks = 600 };
enum { k_iSteamUtilsCallbacks = 700 };
enum { k_iClientFriendsCallbacks = 800 };
enum { k_iClientUserCallbacks = 900 };
enum { k_iSteamAppsCallbacks = 1000 };
enum { k_iSteamUserStatsCallbacks = 1100 };
enum { k_iSteamNetworkingCallbacks = 1200 };
enum { k_iClientRemoteStorageCallbacks = 1300 };
enum { k_iClientDepotBuilderCallbacks = 1400 };
enum { k_iSteamGameServerItemsCallbacks = 1500 };
enum { k_iClientUtilsCallbacks = 1600 };
enum { k_iSteamGameCoordinatorCallbacks = 1700 };
enum { k_iSteamGameServerStatsCallbacks = 1800 };
enum { k_iSteam2AsyncCallbacks = 1900 };
enum { k_iSteamGameStatsCallbacks = 2000 };
enum { k_iClientHTTPCallbacks = 2100 };
enum { k_iClientScreenshotsCallbacks = 2200 };
enum { k_iSteamScreenshotsCallbacks = 2300 };
enum { k_iClientAudioCallbacks = 2400 };
enum { k_iClientUnifiedMessagesCallbacks = 2500 };
enum { k_iSteamStreamLauncherCallbacks = 2600 };
enum { k_iClientControllerCallbacks = 2700 };
enum { k_iSteamControllerCallbacks = 2800 };
enum { k_iClientParentalSettingsCallbacks = 2900 };
enum { k_iClientDeviceAuthCallbacks = 3000 };
enum { k_iClientNetworkDeviceManagerCallbacks = 3100 };
enum { k_iClientMusicCallbacks = 3200 };
enum { k_iClientRemoteClientManagerCallbacks = 3300 };
enum { k_iClientUGCCallbacks = 3400 };
enum { k_iSteamStreamClientCallbacks = 3500 };
enum { k_IClientProductBuilderCallbacks = 3600 };
enum { k_iClientShortcutsCallbacks = 3700 };
enum { k_iClientRemoteControlManagerCallbacks = 3800 };
enum { k_iSteamAppListCallbacks = 3900 };
enum { k_iSteamMusicCallbacks = 4000 };
enum { k_iSteamMusicRemoteCallbacks = 4100 };
enum { k_iClientVRCallbacks = 4200 };
enum { k_iClientGameNotificationCallbacks = 4300 };
enum { k_iSteamGameNotificationCallbacks = 4400 };
enum { k_iSteamHTMLSurfaceCallbacks = 4500 };
enum { k_iClientVideoCallbacks = 4600 };
enum { k_iClientInventoryCallbacks = 4700 };
enum { k_iClientBluetoothManagerCallbacks = 4800 };
enum { k_iClientSharedConnectionCallbacks = 4900 };
enum { k_ISteamParentalSettingsCallbacks = 5000 };
enum { k_iClientShaderCallbacks = 5100 };
//-----------------------------------------------------------------------------
// The CALLBACK macros are for client side callback logging enabled with
// log_callback <first callnbackID> <last callbackID>
// Do not change any of these.
//-----------------------------------------------------------------------------
#ifdef STEAM_CALLBACK_INSPECTION_ENABLED
#define DEFINE_CALLBACK( callbackname, callbackid ) \
struct callbackname { \
typedef callbackname SteamCallback_t; \
enum { k_iCallback = callbackid }; \
static callbackname *GetNullPointer() { return 0; } \
static const char *GetCallbackName() { return #callbackname; } \
static uint32 GetCallbackID() { return callbackname::k_iCallback; }
#define CALLBACK_MEMBER( varidx, vartype, varname ) \
public: vartype varname ; \
static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \
varOffset = (unsigned int)(size_t)&GetNullPointer()->varname; \
varSize = sizeof( vartype ); \
varCount = 1; \
*pszName = #varname; *pszType = #vartype; }
#define CALLBACK_ARRAY( varidx, vartype, varname, varcount ) \
public: vartype varname [ varcount ]; \
static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \
varOffset = (unsigned int)(size_t)&GetNullPointer()->varname[0]; \
varSize = sizeof( vartype ); \
varCount = varcount; \
*pszName = #varname; *pszType = #vartype; }
#define END_CALLBACK_INTERNAL_BEGIN( numvars ) \
static uint32 GetNumMemberVariables() { return numvars; } \
static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \
switch ( index ) { default : return false;
#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true;
#define END_CALLBACK_INTERNAL_END() }; } };
#define END_DEFINE_CALLBACK_0() \
static uint32 GetNumMemberVariables() { return 0; } \
static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { REFERENCE( pszType ); REFERENCE( pszName ); REFERENCE( varCount ); REFERENCE( varSize ); REFERENCE( varOffset ); REFERENCE( index ); return false; } \
};
#else
#define DEFINE_CALLBACK( callbackname, callbackid ) struct callbackname { typedef callbackname SteamCallback_t; enum { k_iCallback = callbackid };
#define CALLBACK_MEMBER( varidx, vartype, varname ) public: vartype varname ;
#define CALLBACK_ARRAY( varidx, vartype, varname, varcount ) public: vartype varname [ varcount ];
#define END_CALLBACK_INTERNAL_BEGIN( numvars )
#define END_CALLBACK_INTERNAL_SWITCH( varidx )
#define END_CALLBACK_INTERNAL_END() };
#define END_DEFINE_CALLBACK_0() };
// The internal ISteamClient used for the gameserver interface.
// (This is actually the same thing. You really shouldn't need to access any of this stuff directly.)
inline ISteamClient *SteamGameServerClient() { return SteamClient(); }
#endif
#define END_DEFINE_CALLBACK_1() \
END_CALLBACK_INTERNAL_BEGIN( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_2() \
END_CALLBACK_INTERNAL_BEGIN( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_3() \
END_CALLBACK_INTERNAL_BEGIN( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_4() \
END_CALLBACK_INTERNAL_BEGIN( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_5() \
END_CALLBACK_INTERNAL_BEGIN( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_6() \
END_CALLBACK_INTERNAL_BEGIN( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_7() \
END_CALLBACK_INTERNAL_BEGIN( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_8() \
END_CALLBACK_INTERNAL_BEGIN( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_9() \
END_CALLBACK_INTERNAL_BEGIN( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_10() \
END_CALLBACK_INTERNAL_BEGIN( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_11() \
END_CALLBACK_INTERNAL_BEGIN( 11 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_12() \
END_CALLBACK_INTERNAL_BEGIN( 12 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_13() \
END_CALLBACK_INTERNAL_BEGIN( 13 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
END_CALLBACK_INTERNAL_SWITCH( 12 ) \
END_CALLBACK_INTERNAL_END()
#define END_DEFINE_CALLBACK_14() \
END_CALLBACK_INTERNAL_BEGIN( 14 ) \
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
END_CALLBACK_INTERNAL_SWITCH( 12 ) \
END_CALLBACK_INTERNAL_SWITCH( 13 ) \
END_CALLBACK_INTERNAL_END()
#endif // ISTEAMCLIENT_H

View File

@ -1,6 +1,12 @@
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
//====== Copyright 1996-2018, Valve Corporation, All rights reserved. =======
// Note: The older ISteamController interface has been deprecated in favor of ISteamInput - this interface
// was updated in this SDK but will be removed from future SDK's. The Steam Client will retain
// compatibility with the older interfaces so your any existing integrations should be unaffected.
//
// Purpose: interface to valve controller
// Purpose: Steam Input is a flexible input API that supports over three hundred devices including all
// common variants of Xbox, Playstation, Nintendo Switch Pro, and Steam Controllers.
// For more info including a getting started guide for developers
// please visit: https://partner.steamgames.com/doc/features/steam_controller
//
//=============================================================================
@ -10,7 +16,8 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
#include "isteaminput.h"
#define STEAM_CONTROLLER_MAX_COUNT 16
@ -26,11 +33,13 @@
#define STEAM_CONTROLLER_MIN_ANALOG_ACTION_DATA -1.0f
#define STEAM_CONTROLLER_MAX_ANALOG_ACTION_DATA 1.0f
#ifndef ISTEAMINPUT_H
enum ESteamControllerPad
{
k_ESteamControllerPad_Left,
k_ESteamControllerPad_Right
};
#endif
enum EControllerSource
{
@ -42,12 +51,15 @@ enum EControllerSource
k_EControllerSource_Switch,
k_EControllerSource_LeftTrigger,
k_EControllerSource_RightTrigger,
k_EControllerSource_LeftBumper,
k_EControllerSource_RightBumper,
k_EControllerSource_Gyro,
k_EControllerSource_CenterTrackpad, // PS4
k_EControllerSource_RightJoystick, // Traditional Controllers
k_EControllerSource_DPad, // Traditional Controllers
k_EControllerSource_Key, // Keyboards with scan codes
k_EControllerSource_Mouse, // Traditional mouse
k_EControllerSource_Key, // Keyboards with scan codes - Unused
k_EControllerSource_Mouse, // Traditional mouse - Unused
k_EControllerSource_LeftGyro, // Secondary Gyro - Switch - Unused
k_EControllerSource_Count
};
@ -72,6 +84,10 @@ enum EControllerSourceMode
k_EControllerSourceMode_Switches
};
// Note: Please do not use action origins as a way to identify controller types. There is no
// guarantee that they will be added in a contiguous manner - use GetInputTypeForHandle instead
// Versions of Steam that add new controller types in the future will extend this enum if you're
// using a lookup table please check the bounds of any origins returned by Steam.
enum EControllerActionOrigin
{
// Steam Controller
@ -237,9 +253,9 @@ enum EControllerActionOrigin
k_EControllerActionOrigin_SteamV2_Y,
k_EControllerActionOrigin_SteamV2_LeftBumper,
k_EControllerActionOrigin_SteamV2_RightBumper,
k_EControllerActionOrigin_SteamV2_LeftGrip,
k_EControllerActionOrigin_SteamV2_RightGrip,
k_EControllerActionOrigin_SteamV2_LeftGrip_Lower,
k_EControllerActionOrigin_SteamV2_LeftGrip_Upper,
k_EControllerActionOrigin_SteamV2_RightGrip_Lower,
k_EControllerActionOrigin_SteamV2_RightGrip_Upper,
k_EControllerActionOrigin_SteamV2_LeftBumper_Pressure,
k_EControllerActionOrigin_SteamV2_RightBumper_Pressure,
@ -280,13 +296,90 @@ enum EControllerActionOrigin
k_EControllerActionOrigin_SteamV2_Gyro_Yaw,
k_EControllerActionOrigin_SteamV2_Gyro_Roll,
k_EControllerActionOrigin_Count
// Switch - Pro or Joycons used as a single input device.
// This does not apply to a single joycon
k_EControllerActionOrigin_Switch_A,
k_EControllerActionOrigin_Switch_B,
k_EControllerActionOrigin_Switch_X,
k_EControllerActionOrigin_Switch_Y,
k_EControllerActionOrigin_Switch_LeftBumper,
k_EControllerActionOrigin_Switch_RightBumper,
k_EControllerActionOrigin_Switch_Plus, //Start
k_EControllerActionOrigin_Switch_Minus, //Back
k_EControllerActionOrigin_Switch_Capture,
k_EControllerActionOrigin_Switch_LeftTrigger_Pull,
k_EControllerActionOrigin_Switch_LeftTrigger_Click,
k_EControllerActionOrigin_Switch_RightTrigger_Pull,
k_EControllerActionOrigin_Switch_RightTrigger_Click,
k_EControllerActionOrigin_Switch_LeftStick_Move,
k_EControllerActionOrigin_Switch_LeftStick_Click,
k_EControllerActionOrigin_Switch_LeftStick_DPadNorth,
k_EControllerActionOrigin_Switch_LeftStick_DPadSouth,
k_EControllerActionOrigin_Switch_LeftStick_DPadWest,
k_EControllerActionOrigin_Switch_LeftStick_DPadEast,
k_EControllerActionOrigin_Switch_RightStick_Move,
k_EControllerActionOrigin_Switch_RightStick_Click,
k_EControllerActionOrigin_Switch_RightStick_DPadNorth,
k_EControllerActionOrigin_Switch_RightStick_DPadSouth,
k_EControllerActionOrigin_Switch_RightStick_DPadWest,
k_EControllerActionOrigin_Switch_RightStick_DPadEast,
k_EControllerActionOrigin_Switch_DPad_North,
k_EControllerActionOrigin_Switch_DPad_South,
k_EControllerActionOrigin_Switch_DPad_West,
k_EControllerActionOrigin_Switch_DPad_East,
k_EControllerActionOrigin_Switch_ProGyro_Move, // Primary Gyro in Pro Controller, or Right JoyCon
k_EControllerActionOrigin_Switch_ProGyro_Pitch, // Primary Gyro in Pro Controller, or Right JoyCon
k_EControllerActionOrigin_Switch_ProGyro_Yaw, // Primary Gyro in Pro Controller, or Right JoyCon
k_EControllerActionOrigin_Switch_ProGyro_Roll, // Primary Gyro in Pro Controller, or Right JoyCon
// Switch JoyCon Specific
k_EControllerActionOrigin_Switch_RightGyro_Move, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_RightGyro_Pitch, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_RightGyro_Yaw, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_RightGyro_Roll, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EControllerActionOrigin_Switch_LeftGyro_Move,
k_EControllerActionOrigin_Switch_LeftGyro_Pitch,
k_EControllerActionOrigin_Switch_LeftGyro_Yaw,
k_EControllerActionOrigin_Switch_LeftGyro_Roll,
k_EControllerActionOrigin_Switch_LeftGrip_Lower, // Left JoyCon SR Button
k_EControllerActionOrigin_Switch_LeftGrip_Upper, // Left JoyCon SL Button
k_EControllerActionOrigin_Switch_RightGrip_Lower, // Right JoyCon SL Button
k_EControllerActionOrigin_Switch_RightGrip_Upper, // Right JoyCon SR Button
k_EControllerActionOrigin_Count, // If Steam has added support for new controllers origins will go here.
k_EControllerActionOrigin_MaximumPossibleValue = 32767, // Origins are currently a maximum of 16 bits.
};
enum ESteamControllerLEDFlag
#ifndef ISTEAMINPUT_H
enum EXboxOrigin
{
k_ESteamControllerLEDFlag_SetColor,
k_ESteamControllerLEDFlag_RestoreUserDefault
k_EXboxOrigin_A,
k_EXboxOrigin_B,
k_EXboxOrigin_X,
k_EXboxOrigin_Y,
k_EXboxOrigin_LeftBumper,
k_EXboxOrigin_RightBumper,
k_EXboxOrigin_Menu, //Start
k_EXboxOrigin_View, //Back
k_EXboxOrigin_LeftTrigger_Pull,
k_EXboxOrigin_LeftTrigger_Click,
k_EXboxOrigin_RightTrigger_Pull,
k_EXboxOrigin_RightTrigger_Click,
k_EXboxOrigin_LeftStick_Move,
k_EXboxOrigin_LeftStick_Click,
k_EXboxOrigin_LeftStick_DPadNorth,
k_EXboxOrigin_LeftStick_DPadSouth,
k_EXboxOrigin_LeftStick_DPadWest,
k_EXboxOrigin_LeftStick_DPadEast,
k_EXboxOrigin_RightStick_Move,
k_EXboxOrigin_RightStick_Click,
k_EXboxOrigin_RightStick_DPadNorth,
k_EXboxOrigin_RightStick_DPadSouth,
k_EXboxOrigin_RightStick_DPadWest,
k_EXboxOrigin_RightStick_DPadEast,
k_EXboxOrigin_DPad_North,
k_EXboxOrigin_DPad_South,
k_EXboxOrigin_DPad_West,
k_EXboxOrigin_DPad_East,
};
enum ESteamInputType
@ -295,8 +388,24 @@ enum ESteamInputType
k_ESteamInputType_SteamController,
k_ESteamInputType_XBox360Controller,
k_ESteamInputType_XBoxOneController,
k_ESteamInputType_GenericXInput,
k_ESteamInputType_GenericGamepad, // DirectInput controllers
k_ESteamInputType_PS4Controller,
k_ESteamInputType_AppleMFiController, // Unused
k_ESteamInputType_AndroidController, // Unused
k_ESteamInputType_SwitchJoyConPair, // Unused
k_ESteamInputType_SwitchJoyConSingle, // Unused
k_ESteamInputType_SwitchProController,
k_ESteamInputType_MobileTouch, // Steam Link App On-screen Virtual Controller
k_ESteamInputType_PS3Controller, // Currently uses PS4 Origins
k_ESteamInputType_Count,
k_ESteamInputType_MaximumPossibleValue = 255,
};
#endif
enum ESteamControllerLEDFlag
{
k_ESteamControllerLEDFlag_SetColor,
k_ESteamControllerLEDFlag_RestoreUserDefault
};
// ControllerHandle_t is used to refer to a specific controller.
@ -312,6 +421,11 @@ typedef uint64 ControllerAnalogActionHandle_t;
#pragma pack( push, 1 )
#ifdef ISTEAMINPUT_H
#define ControllerAnalogActionData_t InputAnalogActionData_t
#define ControllerDigitalActionData_t InputDigitalActionData_t
#define ControllerMotionData_t InputMotionData_t
#else
struct ControllerAnalogActionData_t
{
// Type of data coming from this action, this will match what got specified in the action set
@ -351,12 +465,12 @@ struct ControllerMotionData_t
float rotVelY;
float rotVelZ;
};
#endif
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Native Steam controller support API
// Purpose: Steam Input API
//-----------------------------------------------------------------------------
class ISteamController
{
@ -368,7 +482,8 @@ public:
// Synchronize API state with the latest Steam Controller inputs available. This
// is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest
// possible latency, you call this directly before reading controller state.
// possible latency, you call this directly before reading controller state. This must
// be called from somewhere before GetConnectedControllers will return any handles
virtual void RunFrame() = 0;
// Enumerate currently connected controllers
@ -376,11 +491,10 @@ public:
// Returns the number of handles written to handlesOut
virtual int GetConnectedControllers( ControllerHandle_t *handlesOut ) = 0;
// Invokes the Steam overlay and brings up the binding screen
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
virtual bool ShowBindingPanel( ControllerHandle_t controllerHandle ) = 0;
//-----------------------------------------------------------------------------
// ACTION SETS
//-----------------------------------------------------------------------------
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0;
@ -390,13 +504,16 @@ public:
virtual void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) = 0;
virtual ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) = 0;
// ACTION SET LAYERS
virtual void ActivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
virtual void DeactivateActionSetLayer( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle ) = 0;
virtual void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle ) = 0;
virtual int GetActiveActionSetLayers( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t *handlesOut ) = 0;
//-----------------------------------------------------------------------------
// ACTIONS
//-----------------------------------------------------------------------------
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
virtual ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0;
@ -404,7 +521,8 @@ public:
virtual ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) = 0;
// Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles. The EControllerActionOrigin enum will get extended as support for new controller controllers gets added to
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
virtual int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin *originsOut ) = 0;
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
@ -414,11 +532,25 @@ public:
virtual ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) = 0;
// Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles
// originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles. The EControllerActionOrigin enum will get extended as support for new controller controllers gets added to
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
virtual int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin *originsOut ) = 0;
// Get a local path to art for on-screen glyph for a particular origin - this call is cheap
virtual const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
// Returns a localized string (from Steam's language setting) for the specified origin - this call is serialized
virtual const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
virtual void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) = 0;
// Returns raw motion data from the specified controller
virtual ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle ) = 0;
//-----------------------------------------------------------------------------
// OUTPUTS
//-----------------------------------------------------------------------------
// Trigger a haptic pulse on a controller
virtual void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0;
@ -426,36 +558,48 @@ public:
// nFlags is currently unused and reserved for future use.
virtual void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0;
// Tigger a vibration event on supported controllers.
// Trigger a vibration event on supported controllers.
virtual void TriggerVibration( ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) = 0;
// Set the controller LED color on supported controllers.
virtual void SetLEDColor( ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) = 0;
// Returns the associated gamepad index for the specified controller, if emulating a gamepad
virtual int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle ) = 0;
//-----------------------------------------------------------------------------
// Utility functions availible without using the rest of Steam Input API
//-----------------------------------------------------------------------------
// Returns the associated controller handle for the specified emulated gamepad
virtual ControllerHandle_t GetControllerForGamepadIndex( int nIndex ) = 0;
// Returns raw motion data from the specified controller
virtual ControllerMotionData_t GetMotionData( ControllerHandle_t controllerHandle ) = 0;
// Attempt to display origins of given action in the controller HUD, for the currently active action set
// Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode
virtual bool ShowDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle, float flScale, float flXPosition, float flYPosition ) = 0;
virtual bool ShowAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle, float flScale, float flXPosition, float flYPosition ) = 0;
// Returns a localized string (from Steam's language setting) for the specified origin
virtual const char *GetStringForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
// Get a local path to art for on-screen glyph for a particular origin
virtual const char *GetGlyphForActionOrigin( EControllerActionOrigin eOrigin ) = 0;
// Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode
// If the user is not in Big Picture Mode it will open up the binding in a new window
virtual bool ShowBindingPanel( ControllerHandle_t controllerHandle ) = 0;
// Returns the input type for a particular handle
virtual ESteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle ) = 0;
// Returns the associated controller handle for the specified emulated gamepad - can be used with the above 2 functions
// to identify controllers presented to your game over Xinput. Returns 0 if the Xinput index isn't associated with Steam Input
virtual ControllerHandle_t GetControllerForGamepadIndex( int nIndex ) = 0;
// Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index
virtual int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle ) = 0;
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin. This function is cheap.
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
// Get a local path to art for on-screen glyph for a particular Xbox controller origin. This function is serialized.
virtual const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) = 0;
// Get the equivalent ActionOrigin for a given Xbox controller origin this can be chained with GetGlyphForActionOrigin to provide future proof glyphs for
// non-Steam Input API action games. Note - this only translates the buttons directly and doesn't take into account any remapping a user has made in their configuration
virtual EControllerActionOrigin GetActionOriginFromXboxOrigin( ControllerHandle_t controllerHandle, EXboxOrigin eOrigin ) = 0;
// Convert an origin to another controller type - for inputs not present on the other controller type this will return k_EControllerActionOrigin_None
virtual EControllerActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin ) = 0;
};
#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController006"
#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController007"
// Global interface accessor
inline ISteamController *SteamController();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamController *, SteamController, STEAMCONTROLLER_INTERFACE_VERSION );
#endif // ISTEAMCONTROLLER_H

View File

@ -1,4 +1,4 @@
//====== Copyright (C) 1996-2008, Valve Corporation, All rights reserved. =====
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose: interface to both friends list data and general information about users
//
@ -10,9 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steamclientpublic.h"
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: set of relationships to other users
@ -59,6 +57,7 @@ enum EPersonaState
k_EPersonaStateSnooze = 4, // auto-away for a long time
k_EPersonaStateLookingToTrade = 5, // Online, trading
k_EPersonaStateLookingToPlay = 6, // Online, wanting to play
k_EPersonaStateInvisible = 7, // Online, but appears offline to friends. This status is never published to clients.
k_EPersonaStateMax,
};
@ -92,7 +91,7 @@ enum EFriendFlags
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct FriendGameInfo_t
{
@ -143,7 +142,7 @@ struct FriendSessionStateInfo_t
const uint32 k_cubChatMetadataMax = 8192;
// size limits on Rich Presence data
enum { k_cchMaxRichPresenceKeys = 20 };
enum { k_cchMaxRichPresenceKeys = 30 };
enum { k_cchMaxRichPresenceKeyLength = 64 };
enum { k_cchMaxRichPresenceValueLength = 256 };
@ -155,6 +154,21 @@ enum EOverlayToStoreFlag
k_EOverlayToStoreFlag_AddToCartAndShow = 2,
};
//-----------------------------------------------------------------------------
// Purpose: Tells Steam where to place the browser window inside the overlay
//-----------------------------------------------------------------------------
enum EActivateGameOverlayToWebPageMode
{
k_EActivateGameOverlayToWebPageMode_Default = 0, // Browser will open next to all other windows that the user has open in the overlay.
// The window will remain open, even if the user closes then re-opens the overlay.
k_EActivateGameOverlayToWebPageMode_Modal = 1 // Browser will be opened in a special overlay configuration which hides all other windows
// that the user has open in the overlay. When the user closes the overlay, the browser window
// will also close. When the user closes the browser window, the overlay will automatically close.
};
//-----------------------------------------------------------------------------
// Purpose: interface to accessing information about individual users,
// that can be a friend, in a group, on a game server or in a lobby with the local user
@ -176,7 +190,7 @@ public:
//
// If the name change fails to happen on the server, then an additional global PersonaStateChange_t will be posted
// to change the name back, in addition to the SetPersonaNameResponse_t callback.
CALL_RESULT( SetPersonaNameResponse_t )
STEAM_CALL_RESULT( SetPersonaNameResponse_t )
virtual SteamAPICall_t SetPersonaName( const char *pchPersonaName ) = 0;
// gets the status of the current user
@ -207,13 +221,14 @@ public:
virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;
// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details
virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo ) = 0;
virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo ) = 0;
// accesses old friends names - returns an empty string when their are no more items in the history
virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0;
// friends steam level
virtual int GetFriendSteamLevel( CSteamID steamIDFriend ) = 0;
// Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player.
// DEPRECATED: GetPersonaName follows the Steam nickname preferences, so apps shouldn't need to care about nicknames explicitly.
virtual const char *GetPlayerNickname( CSteamID steamIDPlayer ) = 0;
// friend grouping (tag) apis
@ -226,7 +241,7 @@ public:
// returns the number of members in a given friends group
virtual int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID ) = 0;
// gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid
virtual void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID ) CSteamID *pOutSteamIDMembers, int nMembersCount ) = 0;
virtual void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, STEAM_OUT_ARRAY_CALL(nMembersCount, GetFriendsGroupMembersCount, friendsGroupID ) CSteamID *pOutSteamIDMembers, int nMembersCount ) = 0;
// returns true if the specified user meets any of the criteria specified in iFriendFlags
// iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values
@ -240,7 +255,7 @@ public:
// returns the most recent information we have about what's happening in a clan
virtual bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting ) = 0;
// for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest
virtual SteamAPICall_t DownloadClanActivityCounts( ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest ) = 0;
virtual SteamAPICall_t DownloadClanActivityCounts( STEAM_ARRAY_COUNT(cClansToRequest) CSteamID *psteamIDClans, int cClansToRequest ) = 0;
// iterators for getting users in a chat room, lobby, game server or clan
// note that large clans that cannot be iterated by the local user
@ -256,7 +271,8 @@ public:
virtual void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) = 0;
// activates the game overlay, with an optional dialog to open
// valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements"
// valid options include "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements",
// "chatroomgroup/nnnn"
virtual void ActivateGameOverlay( const char *pchDialog ) = 0;
// activates game overlay to a specific place
@ -274,7 +290,7 @@ public:
// activates game overlay web browser directly to the specified URL
// full address with protocol type is required, e.g. http://www.steamgames.com/
virtual void ActivateGameOverlayToWebPage( const char *pchURL ) = 0;
virtual void ActivateGameOverlayToWebPage( const char *pchURL, EActivateGameOverlayToWebPageMode eMode = k_EActivateGameOverlayToWebPageMode_Default ) = 0;
// activates game overlay to store page for app
virtual void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag ) = 0;
@ -309,7 +325,7 @@ public:
// you can only ask about clans that a user is a member of
// note that this won't download avatars automatically; if you get an officer,
// and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar
CALL_RESULT( ClanOfficerListResponse_t )
STEAM_CALL_RESULT( ClanOfficerListResponse_t )
virtual SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) = 0;
// iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed
@ -343,10 +359,10 @@ public:
// Requests rich presence for a specific user.
virtual void RequestFriendRichPresence( CSteamID steamIDFriend ) = 0;
// rich invite support
// if the target accepts the invite, the pchConnectString gets added to the command-line for launching the game
// if the game is already running, a GameRichPresenceJoinRequested_t callback is posted containing the connect string
// invites can only be sent to friends
// Rich invite support.
// If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string.
// (Or you can configure yout game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.)
// Invites can only be sent to friends.
virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0;
// recently-played-with friends iteration
@ -361,13 +377,13 @@ public:
// this allows in-game access to group (clan) chats from in the game
// the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay
// use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat
CALL_RESULT( JoinClanChatRoomCompletionResult_t )
STEAM_CALL_RESULT( JoinClanChatRoomCompletionResult_t )
virtual SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan ) = 0;
virtual bool LeaveClanChatRoom( CSteamID steamIDClan ) = 0;
virtual int GetClanChatMemberCount( CSteamID steamIDClan ) = 0;
virtual CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) = 0;
virtual bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) = 0;
virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, OUT_STRUCT() CSteamID *psteamidChatter ) = 0;
virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, STEAM_OUT_STRUCT() CSteamID *psteamidChatter ) = 0;
virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0;
// interact with the Steam (game overlay / desktop)
@ -382,18 +398,30 @@ public:
virtual int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
// following apis
CALL_RESULT( FriendsGetFollowerCount_t )
STEAM_CALL_RESULT( FriendsGetFollowerCount_t )
virtual SteamAPICall_t GetFollowerCount( CSteamID steamID ) = 0;
CALL_RESULT( FriendsIsFollowing_t )
STEAM_CALL_RESULT( FriendsIsFollowing_t )
virtual SteamAPICall_t IsFollowing( CSteamID steamID ) = 0;
CALL_RESULT( FriendsEnumerateFollowingList_t )
STEAM_CALL_RESULT( FriendsEnumerateFollowingList_t )
virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0;
virtual bool IsClanPublic( CSteamID steamIDClan ) = 0;
virtual bool IsClanOfficialGameGroup( CSteamID steamIDClan ) = 0;
/// Return the number of chats (friends or chat rooms) with unread messages.
/// A "priority" message is one that would generate some sort of toast or
/// notification, and depends on user settings.
///
/// You can register for UnreadChatMessagesChanged_t callbacks to know when this
/// has potentially changed.
virtual int GetNumChatsWithUnreadPriorityMessages() = 0;
};
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends015"
#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends017"
// Global interface accessor
inline ISteamFriends *SteamFriends();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamFriends *, SteamFriends, STEAMFRIENDS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -401,7 +429,7 @@ public:
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
@ -431,9 +459,10 @@ enum EPersonaChange
k_EPersonaChangeLeftSource = 0x0100,
k_EPersonaChangeRelationshipChanged = 0x0200,
k_EPersonaChangeNameFirstSet = 0x0400,
k_EPersonaChangeFacebookInfo = 0x0800,
k_EPersonaChangeBroadcast = 0x0800,
k_EPersonaChangeNickname = 0x1000,
k_EPersonaChangeSteamLevel = 0x2000,
k_EPersonaChangeRichPresence = 0x4000,
};
@ -633,6 +662,13 @@ struct SetPersonaNameResponse_t
EResult m_result; // detailed result code
};
//-----------------------------------------------------------------------------
// Purpose: Invoked when the status of unread messages changes
//-----------------------------------------------------------------------------
struct UnreadChatMessagesChanged_t
{
enum { k_iCallback = k_iSteamFriendsCallbacks + 48 };
};
#pragma pack( pop )

View File

@ -10,8 +10,7 @@
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
#include "steam_api_common.h"
// list of possible return values from the ISteamGameCoordinator API
@ -54,7 +53,7 @@ public:
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// callback notification - A new message is available for reading from the message queue

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
#define MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE ((uint16)-1)
@ -193,7 +193,7 @@ public:
// these two functions s are deprecated, and will not return results
// they will be removed in a future version of the SDK
virtual void GetGameplayStats( ) = 0;
CALL_RESULT( GSReputation_t )
STEAM_CALL_RESULT( GSReputation_t )
virtual SteamAPICall_t GetServerReputation() = 0;
// Returns the public IP of the server according to Steam, useful when the server is
@ -241,17 +241,21 @@ public:
virtual void ForceHeartbeat() = 0;
// associate this game server with this clan for the purposes of computing player compat
CALL_RESULT( AssociateWithClanResult_t )
STEAM_CALL_RESULT( AssociateWithClanResult_t )
virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0;
// ask if any of the current players dont want to play with this new player - or vice versa
CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
STEAM_CALL_RESULT( ComputeNewPlayerCompatibilityResult_t )
virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0;
};
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012"
// Global accessor
inline ISteamGameServer *SteamGameServer();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamGameServer *, SteamGameServer, STEAMGAMESERVER_INTERFACE_VERSION );
// game server flags
const uint32 k_unServerFlagNone = 0x00;
const uint32 k_unServerFlagActive = 0x01; // server has users playing
@ -271,7 +275,7 @@ const uint32 k_unServerFlagPrivate = 0x20; // server shouldn't list on master
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose: Functions for authenticating users via Steam to play on a game server
@ -23,7 +23,7 @@ public:
// if the user has no stats, GSStatsReceived_t.m_eResult will be set to k_EResultFail
// these stats will only be auto-updated for clients playing on the server. For other
// users you'll need to call RequestUserStats() again to refresh any data
CALL_RESULT( GSStatsReceived_t )
STEAM_CALL_RESULT( GSStatsReceived_t )
virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0;
// requests stat information for a user, usable after a successful call to RequestUserStats()
@ -48,19 +48,23 @@ public:
// uploaded has been rejected, either because they broke constraints
// or were out of date. In this case the server sends back updated values.
// The stats should be re-iterated to keep in sync.
CALL_RESULT( GSStatsStored_t )
STEAM_CALL_RESULT( GSStatsStored_t )
virtual SteamAPICall_t StoreUserStats( CSteamID steamIDUser ) = 0;
};
#define STEAMGAMESERVERSTATS_INTERFACE_VERSION "SteamGameServerStats001"
// Global accessor
inline ISteamGameServerStats *SteamGameServerStats();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamGameServerStats *, SteamGameServerStats, STEAMGAMESERVERSTATS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
typedef uint32 HHTMLBrowser;
const uint32 INVALID_HTMLBROWSER = 0;
@ -40,7 +40,7 @@ public:
// not implement these callback handlers, the browser may appear to hang instead of
// navigating to new pages or triggering javascript popups.
//
CALL_RESULT( HTML_BrowserReady_t )
STEAM_CALL_RESULT( HTML_BrowserReady_t )
virtual SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS ) = 0;
// Call this when you are done with a html surface, this lets us free the resources being used by it
@ -137,8 +137,9 @@ public:
k_eHTMLKeyModifier_ShiftDown = 1 << 2,
};
// keyboard interactions, native keycode is the virtual key code value from your OS
virtual void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
// keyboard interactions, native keycode is the virtual key code value from your OS, system key flags the key to not
// be sent as a typed character as well as a key down
virtual void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey = false ) = 0;
virtual void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
// cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
virtual void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
@ -181,6 +182,9 @@ public:
// Specifies the ratio between physical and logical pixels.
virtual void SetDPIScalingFactor( HHTMLBrowser unBrowserHandle, float flDPIScaling ) = 0;
// Open HTML/JS developer tools
virtual void OpenDeveloperTools( HHTMLBrowser unBrowserHandle ) = 0;
// CALLBACKS
//
// These set of functions are used as responses to callback requests
@ -197,11 +201,15 @@ public:
virtual void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) = 0;
// You MUST call this in response to a HTML_FileOpenDialog_t callback
IGNOREATTR()
STEAM_IGNOREATTR()
virtual void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) = 0;
};
#define STEAMHTMLSURFACE_INTERFACE_VERSION "STEAMHTMLSURFACE_INTERFACE_VERSION_004"
#define STEAMHTMLSURFACE_INTERFACE_VERSION "STEAMHTMLSURFACE_INTERFACE_VERSION_005"
// Global interface accessor
inline ISteamHTMLSurface *SteamHTMLSurface();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamHTMLSurface *, SteamHTMLSurface, STEAMHTMLSURFACE_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -209,156 +217,156 @@ public:
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: The browser is ready for use
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_BrowserReady_t, k_iSteamHTMLSurfaceCallbacks + 1 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this browser is now fully created and ready to navigate to pages
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( HTML_BrowserReady_t, k_iSteamHTMLSurfaceCallbacks + 1 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this browser is now fully created and ready to navigate to pages
STEAM_CALLBACK_END(1)
//-----------------------------------------------------------------------------
// Purpose: the browser has a pending paint
//-----------------------------------------------------------------------------
DEFINE_CALLBACK(HTML_NeedsPaint_t, k_iSteamHTMLSurfaceCallbacks + 2)
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the browser that needs the paint
CALLBACK_MEMBER(1, const char *, pBGRA ) // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called
CALLBACK_MEMBER(2, uint32, unWide) // the total width of the pBGRA texture
CALLBACK_MEMBER(3, uint32, unTall) // the total height of the pBGRA texture
CALLBACK_MEMBER(4, uint32, unUpdateX) // the offset in X for the damage rect for this update
CALLBACK_MEMBER(5, uint32, unUpdateY) // the offset in Y for the damage rect for this update
CALLBACK_MEMBER(6, uint32, unUpdateWide) // the width of the damage rect for this update
CALLBACK_MEMBER(7, uint32, unUpdateTall) // the height of the damage rect for this update
CALLBACK_MEMBER(8, uint32, unScrollX) // the page scroll the browser was at when this texture was rendered
CALLBACK_MEMBER(9, uint32, unScrollY) // the page scroll the browser was at when this texture was rendered
CALLBACK_MEMBER(10, float, flPageScale) // the page scale factor on this page when rendered
CALLBACK_MEMBER(11, uint32, unPageSerial) // incremented on each new page load, you can use this to reject draws while navigating to new pages
END_DEFINE_CALLBACK_12()
STEAM_CALLBACK_BEGIN(HTML_NeedsPaint_t, k_iSteamHTMLSurfaceCallbacks + 2)
STEAM_CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the browser that needs the paint
STEAM_CALLBACK_MEMBER(1, const char *, pBGRA ) // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called
STEAM_CALLBACK_MEMBER(2, uint32, unWide) // the total width of the pBGRA texture
STEAM_CALLBACK_MEMBER(3, uint32, unTall) // the total height of the pBGRA texture
STEAM_CALLBACK_MEMBER(4, uint32, unUpdateX) // the offset in X for the damage rect for this update
STEAM_CALLBACK_MEMBER(5, uint32, unUpdateY) // the offset in Y for the damage rect for this update
STEAM_CALLBACK_MEMBER(6, uint32, unUpdateWide) // the width of the damage rect for this update
STEAM_CALLBACK_MEMBER(7, uint32, unUpdateTall) // the height of the damage rect for this update
STEAM_CALLBACK_MEMBER(8, uint32, unScrollX) // the page scroll the browser was at when this texture was rendered
STEAM_CALLBACK_MEMBER(9, uint32, unScrollY) // the page scroll the browser was at when this texture was rendered
STEAM_CALLBACK_MEMBER(10, float, flPageScale) // the page scale factor on this page when rendered
STEAM_CALLBACK_MEMBER(11, uint32, unPageSerial) // incremented on each new page load, you can use this to reject draws while navigating to new pages
STEAM_CALLBACK_END(12)
//-----------------------------------------------------------------------------
// Purpose: The browser wanted to navigate to a new page
// NOTE - you MUST call AllowStartRequest in response to this callback
//-----------------------------------------------------------------------------
DEFINE_CALLBACK(HTML_StartRequest_t, k_iSteamHTMLSurfaceCallbacks + 3)
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface navigating
CALLBACK_MEMBER(1, const char *, pchURL) // the url they wish to navigate to
CALLBACK_MEMBER(2, const char *, pchTarget) // the html link target type (i.e _blank, _self, _parent, _top )
CALLBACK_MEMBER(3, const char *, pchPostData ) // any posted data for the request
CALLBACK_MEMBER(4, bool, bIsRedirect) // true if this was a http/html redirect from the last load request
END_DEFINE_CALLBACK_5()
STEAM_CALLBACK_BEGIN(HTML_StartRequest_t, k_iSteamHTMLSurfaceCallbacks + 3)
STEAM_CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface navigating
STEAM_CALLBACK_MEMBER(1, const char *, pchURL) // the url they wish to navigate to
STEAM_CALLBACK_MEMBER(2, const char *, pchTarget) // the html link target type (i.e _blank, _self, _parent, _top )
STEAM_CALLBACK_MEMBER(3, const char *, pchPostData ) // any posted data for the request
STEAM_CALLBACK_MEMBER(4, bool, bIsRedirect) // true if this was a http/html redirect from the last load request
STEAM_CALLBACK_END(5)
//-----------------------------------------------------------------------------
// Purpose: The browser has been requested to close due to user interaction (usually from a javascript window.close() call)
//-----------------------------------------------------------------------------
DEFINE_CALLBACK(HTML_CloseBrowser_t, k_iSteamHTMLSurfaceCallbacks + 4)
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN(HTML_CloseBrowser_t, k_iSteamHTMLSurfaceCallbacks + 4)
STEAM_CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface
STEAM_CALLBACK_END(1)
//-----------------------------------------------------------------------------
// Purpose: the browser is navigating to a new url
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_URLChanged_t, k_iSteamHTMLSurfaceCallbacks + 5 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface navigating
CALLBACK_MEMBER( 1, const char *, pchURL ) // the url they wish to navigate to
CALLBACK_MEMBER( 2, const char *, pchPostData ) // any posted data for the request
CALLBACK_MEMBER( 3, bool, bIsRedirect ) // true if this was a http/html redirect from the last load request
CALLBACK_MEMBER( 4, const char *, pchPageTitle ) // the title of the page
CALLBACK_MEMBER( 5, bool, bNewNavigation ) // true if this was from a fresh tab and not a click on an existing page
END_DEFINE_CALLBACK_6()
STEAM_CALLBACK_BEGIN( HTML_URLChanged_t, k_iSteamHTMLSurfaceCallbacks + 5 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface navigating
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) // the url they wish to navigate to
STEAM_CALLBACK_MEMBER( 2, const char *, pchPostData ) // any posted data for the request
STEAM_CALLBACK_MEMBER( 3, bool, bIsRedirect ) // true if this was a http/html redirect from the last load request
STEAM_CALLBACK_MEMBER( 4, const char *, pchPageTitle ) // the title of the page
STEAM_CALLBACK_MEMBER( 5, bool, bNewNavigation ) // true if this was from a fresh tab and not a click on an existing page
STEAM_CALLBACK_END(6)
//-----------------------------------------------------------------------------
// Purpose: A page is finished loading
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_FinishedRequest_t, k_iSteamHTMLSurfaceCallbacks + 6 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchURL ) //
CALLBACK_MEMBER( 2, const char *, pchPageTitle ) //
END_DEFINE_CALLBACK_3()
STEAM_CALLBACK_BEGIN( HTML_FinishedRequest_t, k_iSteamHTMLSurfaceCallbacks + 6 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) //
STEAM_CALLBACK_MEMBER( 2, const char *, pchPageTitle ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: a request to load this url in a new tab
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_OpenLinkInNewTab_t, k_iSteamHTMLSurfaceCallbacks + 7 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchURL ) //
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_OpenLinkInNewTab_t, k_iSteamHTMLSurfaceCallbacks + 7 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: the page has a new title now
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_ChangedTitle_t, k_iSteamHTMLSurfaceCallbacks + 8 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchTitle ) //
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_ChangedTitle_t, k_iSteamHTMLSurfaceCallbacks + 8 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchTitle ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: results from a search
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_SearchResults_t, k_iSteamHTMLSurfaceCallbacks + 9 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, unResults ) //
CALLBACK_MEMBER( 2, uint32, unCurrentMatch ) //
END_DEFINE_CALLBACK_3()
STEAM_CALLBACK_BEGIN( HTML_SearchResults_t, k_iSteamHTMLSurfaceCallbacks + 9 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, unResults ) //
STEAM_CALLBACK_MEMBER( 2, uint32, unCurrentMatch ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: page history status changed on the ability to go backwards and forward
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_CanGoBackAndForward_t, k_iSteamHTMLSurfaceCallbacks + 10 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, bool, bCanGoBack ) //
CALLBACK_MEMBER( 2, bool, bCanGoForward ) //
END_DEFINE_CALLBACK_3()
STEAM_CALLBACK_BEGIN( HTML_CanGoBackAndForward_t, k_iSteamHTMLSurfaceCallbacks + 10 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, bool, bCanGoBack ) //
STEAM_CALLBACK_MEMBER( 2, bool, bCanGoForward ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: details on the visibility and size of the horizontal scrollbar
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_HorizontalScroll_t, k_iSteamHTMLSurfaceCallbacks + 11 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
CALLBACK_MEMBER( 3, float, flPageScale ) //
CALLBACK_MEMBER( 4, bool , bVisible ) //
CALLBACK_MEMBER( 5, uint32, unPageSize ) //
END_DEFINE_CALLBACK_6()
STEAM_CALLBACK_BEGIN( HTML_HorizontalScroll_t, k_iSteamHTMLSurfaceCallbacks + 11 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
STEAM_CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
STEAM_CALLBACK_MEMBER( 3, float, flPageScale ) //
STEAM_CALLBACK_MEMBER( 4, bool , bVisible ) //
STEAM_CALLBACK_MEMBER( 5, uint32, unPageSize ) //
STEAM_CALLBACK_END(6)
//-----------------------------------------------------------------------------
// Purpose: details on the visibility and size of the vertical scrollbar
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_VerticalScroll_t, k_iSteamHTMLSurfaceCallbacks + 12 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
CALLBACK_MEMBER( 3, float, flPageScale ) //
CALLBACK_MEMBER( 4, bool, bVisible ) //
CALLBACK_MEMBER( 5, uint32, unPageSize ) //
END_DEFINE_CALLBACK_6()
STEAM_CALLBACK_BEGIN( HTML_VerticalScroll_t, k_iSteamHTMLSurfaceCallbacks + 12 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
STEAM_CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
STEAM_CALLBACK_MEMBER( 3, float, flPageScale ) //
STEAM_CALLBACK_MEMBER( 4, bool, bVisible ) //
STEAM_CALLBACK_MEMBER( 5, uint32, unPageSize ) //
STEAM_CALLBACK_END(6)
//-----------------------------------------------------------------------------
// Purpose: response to GetLinkAtPosition call
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_LinkAtPosition_t, k_iSteamHTMLSurfaceCallbacks + 13 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, x ) // NOTE - Not currently set
CALLBACK_MEMBER( 2, uint32, y ) // NOTE - Not currently set
CALLBACK_MEMBER( 3, const char *, pchURL ) //
CALLBACK_MEMBER( 4, bool, bInput ) //
CALLBACK_MEMBER( 5, bool, bLiveLink ) //
END_DEFINE_CALLBACK_6()
STEAM_CALLBACK_BEGIN( HTML_LinkAtPosition_t, k_iSteamHTMLSurfaceCallbacks + 13 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, x ) // NOTE - Not currently set
STEAM_CALLBACK_MEMBER( 2, uint32, y ) // NOTE - Not currently set
STEAM_CALLBACK_MEMBER( 3, const char *, pchURL ) //
STEAM_CALLBACK_MEMBER( 4, bool, bInput ) //
STEAM_CALLBACK_MEMBER( 5, bool, bLiveLink ) //
STEAM_CALLBACK_END(6)
@ -366,98 +374,104 @@ END_DEFINE_CALLBACK_6()
// Purpose: show a Javascript alert dialog, call JSDialogResponse
// when the user dismisses this dialog (or right away to ignore it)
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_JSAlert_t, k_iSteamHTMLSurfaceCallbacks + 14 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMessage ) //
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_JSAlert_t, k_iSteamHTMLSurfaceCallbacks + 14 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMessage ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: show a Javascript confirmation dialog, call JSDialogResponse
// when the user dismisses this dialog (or right away to ignore it)
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_JSConfirm_t, k_iSteamHTMLSurfaceCallbacks + 15 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMessage ) //
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_JSConfirm_t, k_iSteamHTMLSurfaceCallbacks + 15 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMessage ) //
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: when received show a file open dialog
// then call FileLoadDialogResponse with the file(s) the user selected.
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_FileOpenDialog_t, k_iSteamHTMLSurfaceCallbacks + 16 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchTitle ) //
CALLBACK_MEMBER( 2, const char *, pchInitialFile ) //
END_DEFINE_CALLBACK_3()
STEAM_CALLBACK_BEGIN( HTML_FileOpenDialog_t, k_iSteamHTMLSurfaceCallbacks + 16 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchTitle ) //
STEAM_CALLBACK_MEMBER( 2, const char *, pchInitialFile ) //
STEAM_CALLBACK_END(3)
//-----------------------------------------------------------------------------
// Purpose: a new html window has been created
// Purpose: a new html window is being created.
//
// IMPORTANT NOTE: at this time, the API does not allow you to acknowledge or
// render the contents of this new window, so the new window is always destroyed
// immediately. The URL and other parameters of the new window are passed here
// to give your application the opportunity to call CreateBrowser and set up
// a new browser in response to the attempted popup, if you wish to do so.
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_NewWindow_t, k_iSteamHTMLSurfaceCallbacks + 21 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the current surface
CALLBACK_MEMBER( 1, const char *, pchURL ) // the page to load
CALLBACK_MEMBER( 2, uint32, unX ) // the x pos into the page to display the popup
CALLBACK_MEMBER( 3, uint32, unY ) // the y pos into the page to display the popup
CALLBACK_MEMBER( 4, uint32, unWide ) // the total width of the pBGRA texture
CALLBACK_MEMBER( 5, uint32, unTall ) // the total height of the pBGRA texture
CALLBACK_MEMBER( 6, HHTMLBrowser, unNewWindow_BrowserHandle ) // the handle of the new window surface
END_DEFINE_CALLBACK_7()
STEAM_CALLBACK_BEGIN( HTML_NewWindow_t, k_iSteamHTMLSurfaceCallbacks + 21 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the current surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchURL ) // the page to load
STEAM_CALLBACK_MEMBER( 2, uint32, unX ) // the x pos into the page to display the popup
STEAM_CALLBACK_MEMBER( 3, uint32, unY ) // the y pos into the page to display the popup
STEAM_CALLBACK_MEMBER( 4, uint32, unWide ) // the total width of the pBGRA texture
STEAM_CALLBACK_MEMBER( 5, uint32, unTall ) // the total height of the pBGRA texture
STEAM_CALLBACK_MEMBER( 6, HHTMLBrowser, unNewWindow_BrowserHandle_IGNORE )
STEAM_CALLBACK_END(7)
//-----------------------------------------------------------------------------
// Purpose: change the cursor to display
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_SetCursor_t, k_iSteamHTMLSurfaceCallbacks + 22 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, uint32, eMouseCursor ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_SetCursor_t, k_iSteamHTMLSurfaceCallbacks + 22 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, uint32, eMouseCursor ) // the EMouseCursor to display
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: informational message from the browser
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_StatusText_t, k_iSteamHTMLSurfaceCallbacks + 23 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_StatusText_t, k_iSteamHTMLSurfaceCallbacks + 23 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: show a tooltip
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_ShowToolTip_t, k_iSteamHTMLSurfaceCallbacks + 24 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_ShowToolTip_t, k_iSteamHTMLSurfaceCallbacks + 24 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: update the text of an existing tooltip
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_UpdateToolTip_t, k_iSteamHTMLSurfaceCallbacks + 25 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_UpdateToolTip_t, k_iSteamHTMLSurfaceCallbacks + 25 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
STEAM_CALLBACK_END(2)
//-----------------------------------------------------------------------------
// Purpose: hide the tooltip you are showing
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_HideToolTip_t, k_iSteamHTMLSurfaceCallbacks + 26 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( HTML_HideToolTip_t, k_iSteamHTMLSurfaceCallbacks + 26 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
STEAM_CALLBACK_END(1)
//-----------------------------------------------------------------------------
// Purpose: The browser has restarted due to an internal failure, use this new handle value
//-----------------------------------------------------------------------------
DEFINE_CALLBACK( HTML_BrowserRestarted_t, k_iSteamHTMLSurfaceCallbacks + 27 )
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this is the new browser handle after the restart
CALLBACK_MEMBER( 1, HHTMLBrowser, unOldBrowserHandle ) // the handle for the browser before the restart, if your handle was this then switch to using unBrowserHandle for API calls
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( HTML_BrowserRestarted_t, k_iSteamHTMLSurfaceCallbacks + 27 )
STEAM_CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this is the new browser handle after the restart
STEAM_CALLBACK_MEMBER( 1, HHTMLBrowser, unOldBrowserHandle ) // the handle for the browser before the restart, if your handle was this then switch to using unBrowserHandle for API calls
STEAM_CALLBACK_END(2)
#pragma pack( pop )

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
#include "steamhttpenums.h"
// Handle to a HTTP Request handle
@ -128,7 +128,8 @@ public:
// Set the extra user agent info for a request, this doesn't clobber the normal user agent, it just adds the extra info on the end
virtual bool SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest, const char *pchUserAgentInfo ) = 0;
// Set that https request should require verified SSL certificate via machines certificate trust store
// Disable or re-enable verification of SSL/TLS certificates.
// By default, certificates are checked for all HTTPS requests.
virtual bool SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate ) = 0;
// Set an absolute timeout on the HTTP request, this is just a total time timeout different than the network activity timeout
@ -139,7 +140,15 @@ public:
virtual bool GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut ) = 0;
};
#define STEAMHTTP_INTERFACE_VERSION "STEAMHTTP_INTERFACE_VERSION002"
#define STEAMHTTP_INTERFACE_VERSION "STEAMHTTP_INTERFACE_VERSION003"
// Global interface accessor
inline ISteamHTTP *SteamHTTP();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamHTTP *, SteamHTTP, STEAMHTTP_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamHTTP *SteamGameServerHTTP();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamHTTP *, SteamGameServerHTTP, STEAMHTTP_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -147,7 +156,7 @@ public:
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct HTTPRequestCompleted_t

View File

@ -0,0 +1,619 @@
//====== Copyright 1996-2018, Valve Corporation, All rights reserved. =======
//
// Purpose: Steam Input is a flexible input API that supports over three hundred devices including all
// common variants of Xbox, Playstation, Nintendo Switch Pro, and Steam Controllers.
// For more info including a getting started guide for developers
// please visit: https://partner.steamgames.com/doc/features/steam_controller
//
//=============================================================================
#ifndef ISTEAMINPUT_H
#define ISTEAMINPUT_H
#ifdef _WIN32
#pragma once
#endif
#include "steam_api_common.h"
#define STEAM_INPUT_MAX_COUNT 16
#define STEAM_INPUT_MAX_ANALOG_ACTIONS 16
#define STEAM_INPUT_MAX_DIGITAL_ACTIONS 128
#define STEAM_INPUT_MAX_ORIGINS 8
// When sending an option to a specific controller handle, you can send to all devices via this command
#define STEAM_INPUT_HANDLE_ALL_CONTROLLERS UINT64_MAX
#define STEAM_INPUT_MIN_ANALOG_ACTION_DATA -1.0f
#define STEAM_INPUT_MAX_ANALOG_ACTION_DATA 1.0f
enum EInputSource
{
k_EInputSource_None,
k_EInputSource_LeftTrackpad,
k_EInputSource_RightTrackpad,
k_EInputSource_Joystick,
k_EInputSource_ABXY,
k_EInputSource_Switch,
k_EInputSource_LeftTrigger,
k_EInputSource_RightTrigger,
k_EInputSource_LeftBumper,
k_EInputSource_RightBumper,
k_EInputSource_Gyro,
k_EInputSource_CenterTrackpad, // PS4
k_EInputSource_RightJoystick, // Traditional Controllers
k_EInputSource_DPad, // Traditional Controllers
k_EInputSource_Key, // Keyboards with scan codes - Unused
k_EInputSource_Mouse, // Traditional mouse - Unused
k_EInputSource_LeftGyro, // Secondary Gyro - Switch - Unused
k_EInputSource_Count
};
enum EInputSourceMode
{
k_EInputSourceMode_None,
k_EInputSourceMode_Dpad,
k_EInputSourceMode_Buttons,
k_EInputSourceMode_FourButtons,
k_EInputSourceMode_AbsoluteMouse,
k_EInputSourceMode_RelativeMouse,
k_EInputSourceMode_JoystickMove,
k_EInputSourceMode_JoystickMouse,
k_EInputSourceMode_JoystickCamera,
k_EInputSourceMode_ScrollWheel,
k_EInputSourceMode_Trigger,
k_EInputSourceMode_TouchMenu,
k_EInputSourceMode_MouseJoystick,
k_EInputSourceMode_MouseRegion,
k_EInputSourceMode_RadialMenu,
k_EInputSourceMode_SingleButton,
k_EInputSourceMode_Switches
};
// Note: Please do not use action origins as a way to identify controller types. There is no
// guarantee that they will be added in a contiguous manner - use GetInputTypeForHandle instead.
// Versions of Steam that add new controller types in the future will extend this enum so if you're
// using a lookup table please check the bounds of any origins returned by Steam.
enum EInputActionOrigin
{
// Steam Controller
k_EInputActionOrigin_None,
k_EInputActionOrigin_SteamController_A,
k_EInputActionOrigin_SteamController_B,
k_EInputActionOrigin_SteamController_X,
k_EInputActionOrigin_SteamController_Y,
k_EInputActionOrigin_SteamController_LeftBumper,
k_EInputActionOrigin_SteamController_RightBumper,
k_EInputActionOrigin_SteamController_LeftGrip,
k_EInputActionOrigin_SteamController_RightGrip,
k_EInputActionOrigin_SteamController_Start,
k_EInputActionOrigin_SteamController_Back,
k_EInputActionOrigin_SteamController_LeftPad_Touch,
k_EInputActionOrigin_SteamController_LeftPad_Swipe,
k_EInputActionOrigin_SteamController_LeftPad_Click,
k_EInputActionOrigin_SteamController_LeftPad_DPadNorth,
k_EInputActionOrigin_SteamController_LeftPad_DPadSouth,
k_EInputActionOrigin_SteamController_LeftPad_DPadWest,
k_EInputActionOrigin_SteamController_LeftPad_DPadEast,
k_EInputActionOrigin_SteamController_RightPad_Touch,
k_EInputActionOrigin_SteamController_RightPad_Swipe,
k_EInputActionOrigin_SteamController_RightPad_Click,
k_EInputActionOrigin_SteamController_RightPad_DPadNorth,
k_EInputActionOrigin_SteamController_RightPad_DPadSouth,
k_EInputActionOrigin_SteamController_RightPad_DPadWest,
k_EInputActionOrigin_SteamController_RightPad_DPadEast,
k_EInputActionOrigin_SteamController_LeftTrigger_Pull,
k_EInputActionOrigin_SteamController_LeftTrigger_Click,
k_EInputActionOrigin_SteamController_RightTrigger_Pull,
k_EInputActionOrigin_SteamController_RightTrigger_Click,
k_EInputActionOrigin_SteamController_LeftStick_Move,
k_EInputActionOrigin_SteamController_LeftStick_Click,
k_EInputActionOrigin_SteamController_LeftStick_DPadNorth,
k_EInputActionOrigin_SteamController_LeftStick_DPadSouth,
k_EInputActionOrigin_SteamController_LeftStick_DPadWest,
k_EInputActionOrigin_SteamController_LeftStick_DPadEast,
k_EInputActionOrigin_SteamController_Gyro_Move,
k_EInputActionOrigin_SteamController_Gyro_Pitch,
k_EInputActionOrigin_SteamController_Gyro_Yaw,
k_EInputActionOrigin_SteamController_Gyro_Roll,
k_EInputActionOrigin_SteamController_Reserved0,
k_EInputActionOrigin_SteamController_Reserved1,
k_EInputActionOrigin_SteamController_Reserved2,
k_EInputActionOrigin_SteamController_Reserved3,
k_EInputActionOrigin_SteamController_Reserved4,
k_EInputActionOrigin_SteamController_Reserved5,
k_EInputActionOrigin_SteamController_Reserved6,
k_EInputActionOrigin_SteamController_Reserved7,
k_EInputActionOrigin_SteamController_Reserved8,
k_EInputActionOrigin_SteamController_Reserved9,
k_EInputActionOrigin_SteamController_Reserved10,
// PS4 Dual Shock
k_EInputActionOrigin_PS4_X,
k_EInputActionOrigin_PS4_Circle,
k_EInputActionOrigin_PS4_Triangle,
k_EInputActionOrigin_PS4_Square,
k_EInputActionOrigin_PS4_LeftBumper,
k_EInputActionOrigin_PS4_RightBumper,
k_EInputActionOrigin_PS4_Options, //Start
k_EInputActionOrigin_PS4_Share, //Back
k_EInputActionOrigin_PS4_LeftPad_Touch,
k_EInputActionOrigin_PS4_LeftPad_Swipe,
k_EInputActionOrigin_PS4_LeftPad_Click,
k_EInputActionOrigin_PS4_LeftPad_DPadNorth,
k_EInputActionOrigin_PS4_LeftPad_DPadSouth,
k_EInputActionOrigin_PS4_LeftPad_DPadWest,
k_EInputActionOrigin_PS4_LeftPad_DPadEast,
k_EInputActionOrigin_PS4_RightPad_Touch,
k_EInputActionOrigin_PS4_RightPad_Swipe,
k_EInputActionOrigin_PS4_RightPad_Click,
k_EInputActionOrigin_PS4_RightPad_DPadNorth,
k_EInputActionOrigin_PS4_RightPad_DPadSouth,
k_EInputActionOrigin_PS4_RightPad_DPadWest,
k_EInputActionOrigin_PS4_RightPad_DPadEast,
k_EInputActionOrigin_PS4_CenterPad_Touch,
k_EInputActionOrigin_PS4_CenterPad_Swipe,
k_EInputActionOrigin_PS4_CenterPad_Click,
k_EInputActionOrigin_PS4_CenterPad_DPadNorth,
k_EInputActionOrigin_PS4_CenterPad_DPadSouth,
k_EInputActionOrigin_PS4_CenterPad_DPadWest,
k_EInputActionOrigin_PS4_CenterPad_DPadEast,
k_EInputActionOrigin_PS4_LeftTrigger_Pull,
k_EInputActionOrigin_PS4_LeftTrigger_Click,
k_EInputActionOrigin_PS4_RightTrigger_Pull,
k_EInputActionOrigin_PS4_RightTrigger_Click,
k_EInputActionOrigin_PS4_LeftStick_Move,
k_EInputActionOrigin_PS4_LeftStick_Click,
k_EInputActionOrigin_PS4_LeftStick_DPadNorth,
k_EInputActionOrigin_PS4_LeftStick_DPadSouth,
k_EInputActionOrigin_PS4_LeftStick_DPadWest,
k_EInputActionOrigin_PS4_LeftStick_DPadEast,
k_EInputActionOrigin_PS4_RightStick_Move,
k_EInputActionOrigin_PS4_RightStick_Click,
k_EInputActionOrigin_PS4_RightStick_DPadNorth,
k_EInputActionOrigin_PS4_RightStick_DPadSouth,
k_EInputActionOrigin_PS4_RightStick_DPadWest,
k_EInputActionOrigin_PS4_RightStick_DPadEast,
k_EInputActionOrigin_PS4_DPad_North,
k_EInputActionOrigin_PS4_DPad_South,
k_EInputActionOrigin_PS4_DPad_West,
k_EInputActionOrigin_PS4_DPad_East,
k_EInputActionOrigin_PS4_Gyro_Move,
k_EInputActionOrigin_PS4_Gyro_Pitch,
k_EInputActionOrigin_PS4_Gyro_Yaw,
k_EInputActionOrigin_PS4_Gyro_Roll,
k_EInputActionOrigin_PS4_Reserved0,
k_EInputActionOrigin_PS4_Reserved1,
k_EInputActionOrigin_PS4_Reserved2,
k_EInputActionOrigin_PS4_Reserved3,
k_EInputActionOrigin_PS4_Reserved4,
k_EInputActionOrigin_PS4_Reserved5,
k_EInputActionOrigin_PS4_Reserved6,
k_EInputActionOrigin_PS4_Reserved7,
k_EInputActionOrigin_PS4_Reserved8,
k_EInputActionOrigin_PS4_Reserved9,
k_EInputActionOrigin_PS4_Reserved10,
// XBox One
k_EInputActionOrigin_XBoxOne_A,
k_EInputActionOrigin_XBoxOne_B,
k_EInputActionOrigin_XBoxOne_X,
k_EInputActionOrigin_XBoxOne_Y,
k_EInputActionOrigin_XBoxOne_LeftBumper,
k_EInputActionOrigin_XBoxOne_RightBumper,
k_EInputActionOrigin_XBoxOne_Menu, //Start
k_EInputActionOrigin_XBoxOne_View, //Back
k_EInputActionOrigin_XBoxOne_LeftTrigger_Pull,
k_EInputActionOrigin_XBoxOne_LeftTrigger_Click,
k_EInputActionOrigin_XBoxOne_RightTrigger_Pull,
k_EInputActionOrigin_XBoxOne_RightTrigger_Click,
k_EInputActionOrigin_XBoxOne_LeftStick_Move,
k_EInputActionOrigin_XBoxOne_LeftStick_Click,
k_EInputActionOrigin_XBoxOne_LeftStick_DPadNorth,
k_EInputActionOrigin_XBoxOne_LeftStick_DPadSouth,
k_EInputActionOrigin_XBoxOne_LeftStick_DPadWest,
k_EInputActionOrigin_XBoxOne_LeftStick_DPadEast,
k_EInputActionOrigin_XBoxOne_RightStick_Move,
k_EInputActionOrigin_XBoxOne_RightStick_Click,
k_EInputActionOrigin_XBoxOne_RightStick_DPadNorth,
k_EInputActionOrigin_XBoxOne_RightStick_DPadSouth,
k_EInputActionOrigin_XBoxOne_RightStick_DPadWest,
k_EInputActionOrigin_XBoxOne_RightStick_DPadEast,
k_EInputActionOrigin_XBoxOne_DPad_North,
k_EInputActionOrigin_XBoxOne_DPad_South,
k_EInputActionOrigin_XBoxOne_DPad_West,
k_EInputActionOrigin_XBoxOne_DPad_East,
k_EInputActionOrigin_XBoxOne_Reserved0,
k_EInputActionOrigin_XBoxOne_Reserved1,
k_EInputActionOrigin_XBoxOne_Reserved2,
k_EInputActionOrigin_XBoxOne_Reserved3,
k_EInputActionOrigin_XBoxOne_Reserved4,
k_EInputActionOrigin_XBoxOne_Reserved5,
k_EInputActionOrigin_XBoxOne_Reserved6,
k_EInputActionOrigin_XBoxOne_Reserved7,
k_EInputActionOrigin_XBoxOne_Reserved8,
k_EInputActionOrigin_XBoxOne_Reserved9,
k_EInputActionOrigin_XBoxOne_Reserved10,
// XBox 360
k_EInputActionOrigin_XBox360_A,
k_EInputActionOrigin_XBox360_B,
k_EInputActionOrigin_XBox360_X,
k_EInputActionOrigin_XBox360_Y,
k_EInputActionOrigin_XBox360_LeftBumper,
k_EInputActionOrigin_XBox360_RightBumper,
k_EInputActionOrigin_XBox360_Start, //Start
k_EInputActionOrigin_XBox360_Back, //Back
k_EInputActionOrigin_XBox360_LeftTrigger_Pull,
k_EInputActionOrigin_XBox360_LeftTrigger_Click,
k_EInputActionOrigin_XBox360_RightTrigger_Pull,
k_EInputActionOrigin_XBox360_RightTrigger_Click,
k_EInputActionOrigin_XBox360_LeftStick_Move,
k_EInputActionOrigin_XBox360_LeftStick_Click,
k_EInputActionOrigin_XBox360_LeftStick_DPadNorth,
k_EInputActionOrigin_XBox360_LeftStick_DPadSouth,
k_EInputActionOrigin_XBox360_LeftStick_DPadWest,
k_EInputActionOrigin_XBox360_LeftStick_DPadEast,
k_EInputActionOrigin_XBox360_RightStick_Move,
k_EInputActionOrigin_XBox360_RightStick_Click,
k_EInputActionOrigin_XBox360_RightStick_DPadNorth,
k_EInputActionOrigin_XBox360_RightStick_DPadSouth,
k_EInputActionOrigin_XBox360_RightStick_DPadWest,
k_EInputActionOrigin_XBox360_RightStick_DPadEast,
k_EInputActionOrigin_XBox360_DPad_North,
k_EInputActionOrigin_XBox360_DPad_South,
k_EInputActionOrigin_XBox360_DPad_West,
k_EInputActionOrigin_XBox360_DPad_East,
k_EInputActionOrigin_XBox360_Reserved0,
k_EInputActionOrigin_XBox360_Reserved1,
k_EInputActionOrigin_XBox360_Reserved2,
k_EInputActionOrigin_XBox360_Reserved3,
k_EInputActionOrigin_XBox360_Reserved4,
k_EInputActionOrigin_XBox360_Reserved5,
k_EInputActionOrigin_XBox360_Reserved6,
k_EInputActionOrigin_XBox360_Reserved7,
k_EInputActionOrigin_XBox360_Reserved8,
k_EInputActionOrigin_XBox360_Reserved9,
k_EInputActionOrigin_XBox360_Reserved10,
// Switch - Pro or Joycons used as a single input device.
// This does not apply to a single joycon
k_EInputActionOrigin_Switch_A,
k_EInputActionOrigin_Switch_B,
k_EInputActionOrigin_Switch_X,
k_EInputActionOrigin_Switch_Y,
k_EInputActionOrigin_Switch_LeftBumper,
k_EInputActionOrigin_Switch_RightBumper,
k_EInputActionOrigin_Switch_Plus, //Start
k_EInputActionOrigin_Switch_Minus, //Back
k_EInputActionOrigin_Switch_Capture,
k_EInputActionOrigin_Switch_LeftTrigger_Pull,
k_EInputActionOrigin_Switch_LeftTrigger_Click,
k_EInputActionOrigin_Switch_RightTrigger_Pull,
k_EInputActionOrigin_Switch_RightTrigger_Click,
k_EInputActionOrigin_Switch_LeftStick_Move,
k_EInputActionOrigin_Switch_LeftStick_Click,
k_EInputActionOrigin_Switch_LeftStick_DPadNorth,
k_EInputActionOrigin_Switch_LeftStick_DPadSouth,
k_EInputActionOrigin_Switch_LeftStick_DPadWest,
k_EInputActionOrigin_Switch_LeftStick_DPadEast,
k_EInputActionOrigin_Switch_RightStick_Move,
k_EInputActionOrigin_Switch_RightStick_Click,
k_EInputActionOrigin_Switch_RightStick_DPadNorth,
k_EInputActionOrigin_Switch_RightStick_DPadSouth,
k_EInputActionOrigin_Switch_RightStick_DPadWest,
k_EInputActionOrigin_Switch_RightStick_DPadEast,
k_EInputActionOrigin_Switch_DPad_North,
k_EInputActionOrigin_Switch_DPad_South,
k_EInputActionOrigin_Switch_DPad_West,
k_EInputActionOrigin_Switch_DPad_East,
k_EInputActionOrigin_Switch_ProGyro_Move, // Primary Gyro in Pro Controller, or Right JoyCon
k_EInputActionOrigin_Switch_ProGyro_Pitch, // Primary Gyro in Pro Controller, or Right JoyCon
k_EInputActionOrigin_Switch_ProGyro_Yaw, // Primary Gyro in Pro Controller, or Right JoyCon
k_EInputActionOrigin_Switch_ProGyro_Roll, // Primary Gyro in Pro Controller, or Right JoyCon
k_EInputActionOrigin_Switch_Reserved0,
k_EInputActionOrigin_Switch_Reserved1,
k_EInputActionOrigin_Switch_Reserved2,
k_EInputActionOrigin_Switch_Reserved3,
k_EInputActionOrigin_Switch_Reserved4,
k_EInputActionOrigin_Switch_Reserved5,
k_EInputActionOrigin_Switch_Reserved6,
k_EInputActionOrigin_Switch_Reserved7,
k_EInputActionOrigin_Switch_Reserved8,
k_EInputActionOrigin_Switch_Reserved9,
k_EInputActionOrigin_Switch_Reserved10,
// Switch JoyCon Specific
k_EInputActionOrigin_Switch_RightGyro_Move, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EInputActionOrigin_Switch_RightGyro_Pitch, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EInputActionOrigin_Switch_RightGyro_Yaw, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EInputActionOrigin_Switch_RightGyro_Roll, // Right JoyCon Gyro generally should correspond to Pro's single gyro
k_EInputActionOrigin_Switch_LeftGyro_Move,
k_EInputActionOrigin_Switch_LeftGyro_Pitch,
k_EInputActionOrigin_Switch_LeftGyro_Yaw,
k_EInputActionOrigin_Switch_LeftGyro_Roll,
k_EInputActionOrigin_Switch_LeftGrip_Lower, // Left JoyCon SR Button
k_EInputActionOrigin_Switch_LeftGrip_Upper, // Left JoyCon SL Button
k_EInputActionOrigin_Switch_RightGrip_Lower, // Right JoyCon SL Button
k_EInputActionOrigin_Switch_RightGrip_Upper, // Right JoyCon SR Button
k_EInputActionOrigin_Switch_Reserved11,
k_EInputActionOrigin_Switch_Reserved12,
k_EInputActionOrigin_Switch_Reserved13,
k_EInputActionOrigin_Switch_Reserved14,
k_EInputActionOrigin_Switch_Reserved15,
k_EInputActionOrigin_Switch_Reserved16,
k_EInputActionOrigin_Switch_Reserved17,
k_EInputActionOrigin_Switch_Reserved18,
k_EInputActionOrigin_Switch_Reserved19,
k_EInputActionOrigin_Switch_Reserved20,
k_EInputActionOrigin_Count, // If Steam has added support for new controllers origins will go here.
k_EInputActionOrigin_MaximumPossibleValue = 32767, // Origins are currently a maximum of 16 bits.
};
enum EXboxOrigin
{
k_EXboxOrigin_A,
k_EXboxOrigin_B,
k_EXboxOrigin_X,
k_EXboxOrigin_Y,
k_EXboxOrigin_LeftBumper,
k_EXboxOrigin_RightBumper,
k_EXboxOrigin_Menu, //Start
k_EXboxOrigin_View, //Back
k_EXboxOrigin_LeftTrigger_Pull,
k_EXboxOrigin_LeftTrigger_Click,
k_EXboxOrigin_RightTrigger_Pull,
k_EXboxOrigin_RightTrigger_Click,
k_EXboxOrigin_LeftStick_Move,
k_EXboxOrigin_LeftStick_Click,
k_EXboxOrigin_LeftStick_DPadNorth,
k_EXboxOrigin_LeftStick_DPadSouth,
k_EXboxOrigin_LeftStick_DPadWest,
k_EXboxOrigin_LeftStick_DPadEast,
k_EXboxOrigin_RightStick_Move,
k_EXboxOrigin_RightStick_Click,
k_EXboxOrigin_RightStick_DPadNorth,
k_EXboxOrigin_RightStick_DPadSouth,
k_EXboxOrigin_RightStick_DPadWest,
k_EXboxOrigin_RightStick_DPadEast,
k_EXboxOrigin_DPad_North,
k_EXboxOrigin_DPad_South,
k_EXboxOrigin_DPad_West,
k_EXboxOrigin_DPad_East,
k_EXboxOrigin_Count,
};
enum ESteamControllerPad
{
k_ESteamControllerPad_Left,
k_ESteamControllerPad_Right
};
enum ESteamInputType
{
k_ESteamInputType_Unknown,
k_ESteamInputType_SteamController,
k_ESteamInputType_XBox360Controller,
k_ESteamInputType_XBoxOneController,
k_ESteamInputType_GenericGamepad, // DirectInput controllers
k_ESteamInputType_PS4Controller,
k_ESteamInputType_AppleMFiController, // Unused
k_ESteamInputType_AndroidController, // Unused
k_ESteamInputType_SwitchJoyConPair, // Unused
k_ESteamInputType_SwitchJoyConSingle, // Unused
k_ESteamInputType_SwitchProController,
k_ESteamInputType_MobileTouch, // Steam Link App On-screen Virtual Controller
k_ESteamInputType_PS3Controller, // Currently uses PS4 Origins
k_ESteamInputType_Count,
k_ESteamInputType_MaximumPossibleValue = 255,
};
// These values are passed into SetLEDColor
enum ESteamInputLEDFlag
{
k_ESteamInputLEDFlag_SetColor,
// Restore the LED color to the user's preference setting as set in the controller personalization menu.
// This also happens automatically on exit of your game.
k_ESteamInputLEDFlag_RestoreUserDefault
};
// InputHandle_t is used to refer to a specific controller.
// This handle will consistently identify a controller, even if it is disconnected and re-connected
typedef uint64 InputHandle_t;
// These handles are used to refer to a specific in-game action or action set
// All action handles should be queried during initialization for performance reasons
typedef uint64 InputActionSetHandle_t;
typedef uint64 InputDigitalActionHandle_t;
typedef uint64 InputAnalogActionHandle_t;
#pragma pack( push, 1 )
struct InputAnalogActionData_t
{
// Type of data coming from this action, this will match what got specified in the action set
EInputSourceMode eMode;
// The current state of this action; will be delta updates for mouse actions
float x, y;
// Whether or not this action is currently available to be bound in the active action set
bool bActive;
};
struct InputDigitalActionData_t
{
// The current state of this action; will be true if currently pressed
bool bState;
// Whether or not this action is currently available to be bound in the active action set
bool bActive;
};
struct InputMotionData_t
{
// Sensor-fused absolute rotation; will drift in heading
float rotQuatX;
float rotQuatY;
float rotQuatZ;
float rotQuatW;
// Positional acceleration
float posAccelX;
float posAccelY;
float posAccelZ;
// Angular velocity
float rotVelX;
float rotVelY;
float rotVelZ;
};
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Steam Input API
//-----------------------------------------------------------------------------
class ISteamInput
{
public:
// Init and Shutdown must be called when starting/ending use of this interface
virtual bool Init() = 0;
virtual bool Shutdown() = 0;
// Synchronize API state with the latest Steam Controller inputs available. This
// is performed automatically by SteamAPI_RunCallbacks, but for the absolute lowest
// possible latency, you call this directly before reading controller state. This must
// be called from somewhere before GetConnectedControllers will return any handles
virtual void RunFrame() = 0;
// Enumerate currently connected Steam Input enabled devices - developers can opt in controller by type (ex: Xbox/Playstation/etc) via
// the Steam Input settings in the Steamworks site or users can opt-in in their controller settings in Steam.
// handlesOut should point to a STEAM_INPUT_MAX_COUNT sized array of InputHandle_t handles
// Returns the number of handles written to handlesOut
virtual int GetConnectedControllers( InputHandle_t *handlesOut ) = 0;
//-----------------------------------------------------------------------------
// ACTION SETS
//-----------------------------------------------------------------------------
// Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls.
virtual InputActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0;
// Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive')
// This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in
// your state loops, instead of trying to place it in all of your state transitions.
virtual void ActivateActionSet( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle ) = 0;
virtual InputActionSetHandle_t GetCurrentActionSet( InputHandle_t inputHandle ) = 0;
// ACTION SET LAYERS
virtual void ActivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle ) = 0;
virtual void DeactivateActionSetLayer( InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle ) = 0;
virtual void DeactivateAllActionSetLayers( InputHandle_t inputHandle ) = 0;
virtual int GetActiveActionSetLayers( InputHandle_t inputHandle, InputActionSetHandle_t *handlesOut ) = 0;
//-----------------------------------------------------------------------------
// ACTIONS
//-----------------------------------------------------------------------------
// Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls.
virtual InputDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0;
// Returns the current state of the supplied digital game action
virtual InputDigitalActionData_t GetDigitalActionData( InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle ) = 0;
// Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
virtual int GetDigitalActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin *originsOut ) = 0;
// Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls.
virtual InputAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) = 0;
// Returns the current state of these supplied analog game action
virtual InputAnalogActionData_t GetAnalogActionData( InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle ) = 0;
// Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action.
// originsOut should point to a STEAM_INPUT_MAX_ORIGINS sized array of EInputActionOrigin handles. The EInputActionOrigin enum will get extended as support for new controller controllers gets added to
// the Steam client and will exceed the values from this header, please check bounds if you are using a look up table.
virtual int GetAnalogActionOrigins( InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin *originsOut ) = 0;
// Get a local path to art for on-screen glyph for a particular origin - this call is cheap
virtual const char *GetGlyphForActionOrigin( EInputActionOrigin eOrigin ) = 0;
// Returns a localized string (from Steam's language setting) for the specified origin - this call is serialized
virtual const char *GetStringForActionOrigin( EInputActionOrigin eOrigin ) = 0;
// Stop analog momentum for the action if it is a mouse action in trackball mode
virtual void StopAnalogActionMomentum( InputHandle_t inputHandle, InputAnalogActionHandle_t eAction ) = 0;
// Returns raw motion data from the specified device
virtual InputMotionData_t GetMotionData( InputHandle_t inputHandle ) = 0;
//-----------------------------------------------------------------------------
// OUTPUTS
//-----------------------------------------------------------------------------
// Trigger a vibration event on supported controllers - Steam will translate these commands into haptic pulses for Steam Controllers
virtual void TriggerVibration( InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed ) = 0;
// Set the controller LED color on supported controllers. nFlags is a bitmask of values from ESteamInputLEDFlag - 0 will default to setting a color. Steam will handle
// the behavior on exit of your program so you don't need to try restore the default as you are shutting down
virtual void SetLEDColor( InputHandle_t inputHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags ) = 0;
// Trigger a haptic pulse on a Steam Controller - if you are approximating rumble you may want to use TriggerVibration instead.
// Good uses for Haptic pulses include chimes, noises, or directional gameplay feedback (taking damage, footstep locations, etc).
virtual void TriggerHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0;
// Trigger a haptic pulse with a duty cycle of usDurationMicroSec / usOffMicroSec, unRepeat times. If you are approximating rumble you may want to use TriggerVibration instead.
// nFlags is currently unused and reserved for future use.
virtual void TriggerRepeatedHapticPulse( InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags ) = 0;
//-----------------------------------------------------------------------------
// Utility functions availible without using the rest of Steam Input API
//-----------------------------------------------------------------------------
// Invokes the Steam overlay and brings up the binding screen if the user is using Big Picture Mode
// If the user is not in Big Picture Mode it will open up the binding in a new window
virtual bool ShowBindingPanel( InputHandle_t inputHandle ) = 0;
// Returns the input type for a particular handle
virtual ESteamInputType GetInputTypeForHandle( InputHandle_t inputHandle ) = 0;
// Returns the associated controller handle for the specified emulated gamepad - can be used with the above 2 functions
// to identify controllers presented to your game over Xinput. Returns 0 if the Xinput index isn't associated with Steam Input
virtual InputHandle_t GetControllerForGamepadIndex( int nIndex ) = 0;
// Returns the associated gamepad index for the specified controller, if emulating a gamepad or -1 if not associated with an Xinput index
virtual int GetGamepadIndexForController( InputHandle_t ulinputHandle ) = 0;
// Returns a localized string (from Steam's language setting) for the specified Xbox controller origin. This function is cheap.
virtual const char *GetStringForXboxOrigin( EXboxOrigin eOrigin ) = 0;
// Get a local path to art for on-screen glyph for a particular Xbox controller origin. This function is serialized.
virtual const char *GetGlyphForXboxOrigin( EXboxOrigin eOrigin ) = 0;
// Get the equivalent ActionOrigin for a given Xbox controller origin this can be chained with GetGlyphForActionOrigin to provide future proof glyphs for
// non-Steam Input API action games. Note - this only translates the buttons directly and doesn't take into account any remapping a user has made in their configuration
virtual EInputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle, EXboxOrigin eOrigin ) = 0;
// Convert an origin to another controller type - for inputs not present on the other controller type this will return k_EInputActionOrigin_None
// When a new input type is added you will be able to pass in k_ESteamInputType_Unknown amd the closest origin that your version of the SDK regonized will be returned
// ex: if a Playstation 5 controller was released this function would return Playstation 4 origins.
virtual EInputActionOrigin TranslateActionOrigin( ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin ) = 0;
};
#define STEAMINPUT_INTERFACE_VERSION "SteamInput001"
// Global interface accessor
inline ISteamInput *SteamInput();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamInput *, SteamInput, STEAMINPUT_INTERFACE_VERSION );
#endif // ISTEAMINPUT_H

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -18,7 +18,7 @@
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -86,14 +86,14 @@ public:
// k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later
// k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits
// k_EResultFail - ERROR: unknown / generic error
METHOD_DESC(Find out the status of an asynchronous inventory result handle.)
STEAM_METHOD_DESC(Find out the status of an asynchronous inventory result handle.)
virtual EResult GetResultStatus( SteamInventoryResult_t resultHandle ) = 0;
// Copies the contents of a result set into a flat array. The specific
// contents of the result set depend on which query which was used.
METHOD_DESC(Copies the contents of a result set into a flat array. The specific contents of the result set depend on which query which was used.)
STEAM_METHOD_DESC(Copies the contents of a result set into a flat array. The specific contents of the result set depend on which query which was used.)
virtual bool GetResultItems( SteamInventoryResult_t resultHandle,
OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray,
STEAM_OUT_ARRAY_COUNT( punOutItemsArraySize,Output array) SteamItemDetails_t *pOutItemsArray,
uint32 *punOutItemsArraySize ) = 0;
// In combination with GetResultItems, you can use GetResultItemProperty to retrieve
@ -111,21 +111,21 @@ public:
virtual bool GetResultItemProperty( SteamInventoryResult_t resultHandle,
uint32 unItemIndex,
const char *pchPropertyName,
OUT_STRING_COUNT( punValueBufferSizeOut ) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
STEAM_OUT_STRING_COUNT( punValueBufferSizeOut ) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
// Returns the server time at which the result was generated. Compare against
// the value of IClientUtils::GetServerRealTime() to determine age.
METHOD_DESC(Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.)
STEAM_METHOD_DESC(Returns the server time at which the result was generated. Compare against the value of IClientUtils::GetServerRealTime() to determine age.)
virtual uint32 GetResultTimestamp( SteamInventoryResult_t resultHandle ) = 0;
// Returns true if the result belongs to the target steam ID, false if the
// result does not. This is important when using DeserializeResult, to verify
// that a remote player is not pretending to have a different user's inventory.
METHOD_DESC(Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.)
STEAM_METHOD_DESC(Returns true if the result belongs to the target steam ID or false if the result does not. This is important when using DeserializeResult to verify that a remote player is not pretending to have a different users inventory.)
virtual bool CheckResultSteamID( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected ) = 0;
// Destroys a result handle and frees all associated memory.
METHOD_DESC(Destroys a result handle and frees all associated memory.)
STEAM_METHOD_DESC(Destroys a result handle and frees all associated memory.)
virtual void DestroyResult( SteamInventoryResult_t resultHandle ) = 0;
@ -139,7 +139,7 @@ public:
// cached results if called too frequently. It is suggested that you call
// this function only when you are about to display the user's full inventory,
// or if you expect that the inventory may have changed.
METHOD_DESC(Captures the entire state of the current users Steam inventory.)
STEAM_METHOD_DESC(Captures the entire state of the current users Steam inventory.)
virtual bool GetAllItems( SteamInventoryResult_t *pResultHandle ) = 0;
@ -150,8 +150,8 @@ public:
// For example, you could call GetItemsByID with the IDs of the user's
// currently equipped cosmetic items and serialize this to a buffer, and
// then transmit this buffer to other players upon joining a game.
METHOD_DESC(Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.)
virtual bool GetItemsByID( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT( unCountInstanceIDs ) const SteamItemInstanceID_t *pInstanceIDs, uint32 unCountInstanceIDs ) = 0;
STEAM_METHOD_DESC(Captures the state of a subset of the current users Steam inventory identified by an array of item instance IDs.)
virtual bool GetItemsByID( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT( unCountInstanceIDs ) const SteamItemInstanceID_t *pInstanceIDs, uint32 unCountInstanceIDs ) = 0;
// RESULT SERIALIZATION AND AUTHENTICATION
@ -169,7 +169,7 @@ public:
// recommended to use "GetItemsByID" first to create a minimal result set.
// Results have a built-in timestamp which will be considered "expired" after
// an hour has elapsed. See DeserializeResult for expiration handling.
virtual bool SerializeResult( SteamInventoryResult_t resultHandle, OUT_BUFFER_COUNT(punOutBufferSize) void *pOutBuffer, uint32 *punOutBufferSize ) = 0;
virtual bool SerializeResult( SteamInventoryResult_t resultHandle, STEAM_OUT_BUFFER_COUNT(punOutBufferSize) void *pOutBuffer, uint32 *punOutBufferSize ) = 0;
// Deserializes a result set and verifies the signature bytes. Returns false
// if bRequireFullOnlineVerify is set but Steam is running in Offline mode.
@ -187,7 +187,7 @@ public:
// ISteamUtils::GetServerRealTime() to determine how old the data is. You could
// simply ignore the "expired" result code and continue as normal, or you
// could challenge the player with expired data to send an updated result set.
virtual bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, BUFFER_COUNT(punOutBufferSize) const void *pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE = false ) = 0;
virtual bool DeserializeResult( SteamInventoryResult_t *pOutResultHandle, STEAM_BUFFER_COUNT(punOutBufferSize) const void *pBuffer, uint32 unBufferSize, bool bRESERVED_MUST_BE_FALSE = false ) = 0;
// INVENTORY ASYNC MODIFICATION
@ -199,13 +199,13 @@ public:
// for your game.
// If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should
// describe the quantity of each item to generate.
virtual bool GenerateItems( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0;
virtual bool GenerateItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0;
// GrantPromoItems() checks the list of promotional items for which the user may be eligible
// and grants the items (one time only). On success, the result set will include items which
// were granted, if any. If no items were granted because the user isn't eligible for any
// promotions, this is still considered a success.
METHOD_DESC(GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).)
STEAM_METHOD_DESC(GrantPromoItems() checks the list of promotional items for which the user may be eligible and grants the items (one time only).)
virtual bool GrantPromoItems( SteamInventoryResult_t *pResultHandle ) = 0;
// AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of
@ -213,12 +213,12 @@ public:
// definition or set of item definitions. This can be useful if your game has custom UI for
// showing a specific promo item to the user.
virtual bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef ) = 0;
virtual bool AddPromoItems( SteamInventoryResult_t *pResultHandle, ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength ) = 0;
virtual bool AddPromoItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength ) = 0;
// ConsumeItem() removes items from the inventory, permanently. They cannot be recovered.
// Not for the faint of heart - if your game implements item removal at all, a high-friction
// UI confirmation process is highly recommended.
METHOD_DESC(ConsumeItem() removes items from the inventory permanently.)
STEAM_METHOD_DESC(ConsumeItem() removes items from the inventory permanently.)
virtual bool ConsumeItem( SteamInventoryResult_t *pResultHandle, SteamItemInstanceID_t itemConsume, uint32 unQuantity ) = 0;
// ExchangeItems() is an atomic combination of item generation and consumption.
@ -230,8 +230,8 @@ public:
// components do not match the recipe, or do not contain sufficient quantity, the
// exchange will fail.
virtual bool ExchangeItems( SteamInventoryResult_t *pResultHandle,
ARRAY_COUNT(unArrayGenerateLength) const SteamItemDef_t *pArrayGenerate, ARRAY_COUNT(unArrayGenerateLength) const uint32 *punArrayGenerateQuantity, uint32 unArrayGenerateLength,
ARRAY_COUNT(unArrayDestroyLength) const SteamItemInstanceID_t *pArrayDestroy, ARRAY_COUNT(unArrayDestroyLength) const uint32 *punArrayDestroyQuantity, uint32 unArrayDestroyLength ) = 0;
STEAM_ARRAY_COUNT(unArrayGenerateLength) const SteamItemDef_t *pArrayGenerate, STEAM_ARRAY_COUNT(unArrayGenerateLength) const uint32 *punArrayGenerateQuantity, uint32 unArrayGenerateLength,
STEAM_ARRAY_COUNT(unArrayDestroyLength) const SteamItemInstanceID_t *pArrayDestroy, STEAM_ARRAY_COUNT(unArrayDestroyLength) const uint32 *punArrayDestroyQuantity, uint32 unArrayDestroyLength ) = 0;
// TransferItemQuantity() is intended for use with items which are "stackable" (can have
@ -245,7 +245,7 @@ public:
//
// Deprecated. Calling this method is not required for proper playtime accounting.
METHOD_DESC( Deprecated method. Playtime accounting is performed on the Steam servers. )
STEAM_METHOD_DESC( Deprecated method. Playtime accounting is performed on the Steam servers. )
virtual void SendItemDropHeartbeat() = 0;
// Playtime credit must be consumed and turned into item drops by your game. Only item
@ -257,14 +257,14 @@ public:
// to directly control rarity.
// See your Steamworks configuration to set playtime drop rates for individual itemdefs.
// The client library will suppress too-frequent calls to this method.
METHOD_DESC(Playtime credit must be consumed and turned into item drops by your game.)
STEAM_METHOD_DESC(Playtime credit must be consumed and turned into item drops by your game.)
virtual bool TriggerItemDrop( SteamInventoryResult_t *pResultHandle, SteamItemDef_t dropListDefinition ) = 0;
// Deprecated. This method is not supported.
virtual bool TradeItems( SteamInventoryResult_t *pResultHandle, CSteamID steamIDTradePartner,
ARRAY_COUNT(nArrayGiveLength) const SteamItemInstanceID_t *pArrayGive, ARRAY_COUNT(nArrayGiveLength) const uint32 *pArrayGiveQuantity, uint32 nArrayGiveLength,
ARRAY_COUNT(nArrayGetLength) const SteamItemInstanceID_t *pArrayGet, ARRAY_COUNT(nArrayGetLength) const uint32 *pArrayGetQuantity, uint32 nArrayGetLength ) = 0;
STEAM_ARRAY_COUNT(nArrayGiveLength) const SteamItemInstanceID_t *pArrayGive, STEAM_ARRAY_COUNT(nArrayGiveLength) const uint32 *pArrayGiveQuantity, uint32 nArrayGiveLength,
STEAM_ARRAY_COUNT(nArrayGetLength) const SteamItemInstanceID_t *pArrayGet, STEAM_ARRAY_COUNT(nArrayGetLength) const uint32 *pArrayGetQuantity, uint32 nArrayGetLength ) = 0;
// ITEM DEFINITIONS
@ -281,7 +281,7 @@ public:
// Every time new item definitions are available (eg, from the dynamic addition of new
// item types while players are still in-game), a SteamInventoryDefinitionUpdate_t
// callback will be fired.
METHOD_DESC(LoadItemDefinitions triggers the automatic load and refresh of item definitions.)
STEAM_METHOD_DESC(LoadItemDefinitions triggers the automatic load and refresh of item definitions.)
virtual bool LoadItemDefinitions() = 0;
// GetItemDefinitionIDs returns the set of all defined item definition IDs (which are
@ -290,8 +290,8 @@ public:
// contain the total size necessary for a subsequent call. Otherwise, the call will
// return false if and only if there is not enough space in the output array.
virtual bool GetItemDefinitionIDs(
OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0;
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0;
// GetItemDefinitionProperty returns a string property from a given item definition.
// Note that some properties (for example, "name") may be localized and will depend
@ -303,12 +303,12 @@ public:
// to pchValueBuffer. If the results do not fit in the given buffer, partial
// results may be copied.
virtual bool GetItemDefinitionProperty( SteamItemDef_t iDefinition, const char *pchPropertyName,
OUT_STRING_COUNT(punValueBufferSizeOut) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
STEAM_OUT_STRING_COUNT(punValueBufferSizeOut) char *pchValueBuffer, uint32 *punValueBufferSizeOut ) = 0;
// Request the list of "eligible" promo items that can be manually granted to the given
// user. These are promo items of type "manual" that won't be granted automatically.
// An example usage of this is an item that becomes available every week.
CALL_RESULT( SteamInventoryEligiblePromoItemDefIDs_t )
STEAM_CALL_RESULT( SteamInventoryEligiblePromoItemDefIDs_t )
virtual SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID ) = 0;
// After handling a SteamInventoryEligiblePromoItemDefIDs_t call result, use this
@ -316,19 +316,19 @@ public:
// manually granted via the AddPromoItems() call.
virtual bool GetEligiblePromoItemDefinitionIDs(
CSteamID steamID,
OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0;
STEAM_OUT_ARRAY_COUNT(punItemDefIDsArraySize,List of item definition IDs) SteamItemDef_t *pItemDefIDs,
STEAM_DESC(Size of array is passed in and actual size used is returned in this param) uint32 *punItemDefIDsArraySize ) = 0;
// Starts the purchase process for the given item definitions. The callback SteamInventoryStartPurchaseResult_t
// will be posted if Steam was able to initialize the transaction.
//
// Once the purchase has been authorized and completed by the user, the callback SteamInventoryResultReady_t
// will be posted.
CALL_RESULT( SteamInventoryStartPurchaseResult_t )
virtual SteamAPICall_t StartPurchase( ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0;
STEAM_CALL_RESULT( SteamInventoryStartPurchaseResult_t )
virtual SteamAPICall_t StartPurchase( STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, STEAM_ARRAY_COUNT(unArrayLength) const uint32 *punArrayQuantity, uint32 unArrayLength ) = 0;
// Request current prices for all applicable item definitions
CALL_RESULT( SteamInventoryRequestPricesResult_t )
STEAM_CALL_RESULT( SteamInventoryRequestPricesResult_t )
virtual SteamAPICall_t RequestPrices() = 0;
// Returns the number of items with prices. Need to call RequestPrices() first.
@ -336,13 +336,14 @@ public:
// Returns item definition ids and their prices in the user's local currency.
// Need to call RequestPrices() first.
virtual bool GetItemsWithPrices( ARRAY_COUNT(unArrayLength) OUT_ARRAY_COUNT(pArrayItemDefs, Items with prices) SteamItemDef_t *pArrayItemDefs,
ARRAY_COUNT(unArrayLength) OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pPrices,
virtual bool GetItemsWithPrices( STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pArrayItemDefs, Items with prices) SteamItemDef_t *pArrayItemDefs,
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pCurrentPrices,
STEAM_ARRAY_COUNT(unArrayLength) STEAM_OUT_ARRAY_COUNT(pPrices, List of prices for the given item defs) uint64 *pBasePrices,
uint32 unArrayLength ) = 0;
// Retrieves the price for the item definition id
// Returns false if there is no price stored for the item definition.
virtual bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pPrice ) = 0;
virtual bool GetItemPrice( SteamItemDef_t iDefinition, uint64 *pCurrentPrice, uint64 *pBasePrice ) = 0;
// Create a request to update properties on items
virtual SteamInventoryUpdateHandle_t StartUpdateProperties() = 0;
@ -358,8 +359,15 @@ public:
};
#define STEAMINVENTORY_INTERFACE_VERSION "STEAMINVENTORY_INTERFACE_V002"
#define STEAMINVENTORY_INTERFACE_VERSION "STEAMINVENTORY_INTERFACE_V003"
// Global interface accessor
inline ISteamInventory *SteamInventory();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamInventory *, SteamInventory, STEAMINVENTORY_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamInventory *SteamGameServerInventory();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamInventory *, SteamGameServerInventory, STEAMINVENTORY_INTERFACE_VERSION );
// SteamInventoryResultReady_t callbacks are fired whenever asynchronous
// results transition from "Pending" to "OK" or an error state. There will

View File

@ -10,10 +10,8 @@
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
#include "steam_api_common.h"
#include "matchmakingtypes.h"
#include "isteamclient.h"
#include "isteamfriends.h"
// lobby type description
@ -103,7 +101,7 @@ public:
}
*/
//
CALL_RESULT( LobbyMatchList_t )
STEAM_CALL_RESULT( LobbyMatchList_t )
virtual SteamAPICall_t RequestLobbyList() = 0;
// filters for lobbies
// this needs to be called before RequestLobbyList() to take effect
@ -134,14 +132,14 @@ public:
// this is an asynchronous request
// results will be returned by LobbyCreated_t callback and call result; lobby is joined & ready to use at this point
// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
CALL_RESULT( LobbyCreated_t )
STEAM_CALL_RESULT( LobbyCreated_t )
virtual SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers ) = 0;
// Joins an existing lobby
// this is an asynchronous request
// results will be returned by LobbyEnter_t callback & call result, check m_EChatRoomEnterResponse to see if was successful
// lobby metadata is available to use immediately on this call completing
CALL_RESULT( LobbyEnter_t )
STEAM_CALL_RESULT( LobbyEnter_t )
virtual SteamAPICall_t JoinLobby( CSteamID steamIDLobby ) = 0;
// Leave a lobby; this will take effect immediately on the client side
@ -204,7 +202,7 @@ public:
// *pSteamIDUser is filled in with the CSteamID of the member
// *pvData is filled in with the message itself
// return value is the number of bytes written into the buffer
virtual int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, OUT_STRUCT() CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
virtual int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, STEAM_OUT_STRUCT() CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0;
// Refreshes metadata for a lobby you're not necessarily in right now
// you never do this for lobbies you're a member of, only if your
@ -220,7 +218,7 @@ public:
// 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, OUT_STRUCT() CSteamID *psteamIDGameServer ) = 0;
virtual bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, STEAM_OUT_STRUCT() CSteamID *psteamIDGameServer ) = 0;
// set the limit on the # of users who can join the lobby
virtual bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers ) = 0;
@ -256,10 +254,13 @@ public:
// after completion, the local user will no longer be the owner
virtual void CheckForPSNGameBootInvite( unsigned int iGameBootAttributes ) = 0;
#endif
CALL_BACK( LobbyChatUpdate_t )
STEAM_CALL_BACK( LobbyChatUpdate_t )
};
#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking009"
// Global interface accessor
inline ISteamMatchmaking *SteamMatchmaking();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMatchmaking *, SteamMatchmaking, STEAMMATCHMAKING_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Callback interfaces for server list functions (see ISteamMatchmakingServers below)
@ -391,12 +392,12 @@ public:
// Request a new list of servers of a particular type. These calls each correspond to one of the EMatchMakingType values.
// Each call allocates a new asynchronous request object.
// Request object must be released by calling ReleaseRequest( hServerListRequest )
virtual HServerListRequest RequestInternetServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestInternetServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestFriendsServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestFavoritesServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestHistoryServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestSpectatorServerList( AppId_t iApp, ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestFriendsServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestFavoritesServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestHistoryServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
virtual HServerListRequest RequestSpectatorServerList( AppId_t iApp, STEAM_ARRAY_COUNT(nFilters) MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0;
// Releases the asynchronous request object and cancels any pending query on it if there's a pending query in progress.
// RefreshComplete callback is not posted when request is released.
@ -522,6 +523,10 @@ public:
};
#define STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION "SteamMatchMakingServers002"
// Global interface accessor
inline ISteamMatchmakingServers *SteamMatchmakingServers();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMatchmakingServers *, SteamMatchmakingServers, STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION );
// game server flags
const uint32 k_unFavoriteFlagNone = 0x00;
const uint32 k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list
@ -545,16 +550,181 @@ enum EChatMemberStateChange
#define BChatMemberStateChangeRemoved( rgfChatMemberStateChangeFlags ) ( rgfChatMemberStateChangeFlags & ( k_EChatMemberStateChangeDisconnected | k_EChatMemberStateChangeLeft | k_EChatMemberStateChangeKicked | k_EChatMemberStateChangeBanned ) )
//-----------------------------------------------------------------------------
// Callbacks for ISteamMatchmaking (which go through the regular Steam callback registration system)
// Purpose: Functions for match making services for clients to get to favorites
// and to operate on game lobbies.
//-----------------------------------------------------------------------------
class ISteamGameSearch
{
public:
// =============================================================================================
// Game Player APIs
// a keyname and a list of comma separated values: one of which is must be found in order for the match to qualify
// fails if a search is currently in progress
virtual EGameSearchErrorCode_t AddGameSearchParams( const char *pchKeyToFind, const char *pchValuesToFind ) = 0;
// all players in lobby enter the queue and await a SearchForGameNotificationCallback_t callback. fails if another search is currently in progress
// if not the owner of the lobby or search already in progress this call fails
// periodic callbacks will be sent as queue time estimates change
virtual EGameSearchErrorCode_t SearchForGameWithLobby( CSteamID steamIDLobby, int nPlayerMin, int nPlayerMax ) = 0;
// user enter the queue and await a SearchForGameNotificationCallback_t callback. fails if another search is currently in progress
// periodic callbacks will be sent as queue time estimates change
virtual EGameSearchErrorCode_t SearchForGameSolo( int nPlayerMin, int nPlayerMax ) = 0;
// after receiving SearchForGameResultCallback_t, accept or decline the game
// multiple SearchForGameResultCallback_t will follow as players accept game until the host starts or cancels the game
virtual EGameSearchErrorCode_t AcceptGame() = 0;
virtual EGameSearchErrorCode_t DeclineGame() = 0;
// after receiving GameStartedByHostCallback_t get connection details to server
virtual EGameSearchErrorCode_t RetrieveConnectionDetails( CSteamID steamIDHost, char *pchConnectionDetails, int cubConnectionDetails ) = 0;
// leaves queue if still waiting
virtual EGameSearchErrorCode_t EndGameSearch() = 0;
// =============================================================================================
// Game Host APIs
// a keyname and a list of comma separated values: all the values you allow
virtual EGameSearchErrorCode_t SetGameHostParams( const char *pchKey, const char *pchValue ) = 0;
// set connection details for players once game is found so they can connect to this server
virtual EGameSearchErrorCode_t SetConnectionDetails( const char *pchConnectionDetails, int cubConnectionDetails ) = 0;
// mark server as available for more players with nPlayerMin,nPlayerMax desired
// accept no lobbies with playercount greater than nMaxTeamSize
// the set of lobbies returned must be partitionable into teams of no more than nMaxTeamSize
// RequestPlayersForGameNotificationCallback_t callback will be sent when the search has started
// multple RequestPlayersForGameResultCallback_t callbacks will follow when players are found
virtual EGameSearchErrorCode_t RequestPlayersForGame( int nPlayerMin, int nPlayerMax, int nMaxTeamSize ) = 0;
// accept the player list and release connection details to players
// players will only be given connection details and host steamid when this is called
// ( allows host to accept after all players confirm, some confirm, or none confirm. decision is entirely up to the host )
virtual EGameSearchErrorCode_t HostConfirmGameStart( uint64 ullUniqueGameID ) = 0;
// cancel request and leave the pool of game hosts looking for players
// if a set of players has already been sent to host, all players will receive SearchForGameHostFailedToConfirm_t
virtual EGameSearchErrorCode_t CancelRequestPlayersForGame() = 0;
// submit a result for one player. does not end the game. ullUniqueGameID continues to describe this game
virtual EGameSearchErrorCode_t SubmitPlayerResult( uint64 ullUniqueGameID, CSteamID steamIDPlayer, EPlayerResult_t EPlayerResult ) = 0;
// ends the game. no further SubmitPlayerResults for ullUniqueGameID will be accepted
// any future requests will provide a new ullUniqueGameID
virtual EGameSearchErrorCode_t EndGame( uint64 ullUniqueGameID ) = 0;
};
#define STEAMGAMESEARCH_INTERFACE_VERSION "SteamMatchGameSearch001"
// Global interface accessor
inline ISteamGameSearch *SteamGameSearch();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamGameSearch *, SteamGameSearch, STEAMGAMESEARCH_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Purpose: Functions for quickly creating a Party with friends or acquaintances,
// EG from chat rooms.
//-----------------------------------------------------------------------------
enum ESteamPartyBeaconLocationType
{
k_ESteamPartyBeaconLocationType_Invalid = 0,
k_ESteamPartyBeaconLocationType_ChatGroup = 1,
k_ESteamPartyBeaconLocationType_Max,
};
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct SteamPartyBeaconLocation_t
{
ESteamPartyBeaconLocationType m_eType;
uint64 m_ulLocationID;
};
enum ESteamPartyBeaconLocationData
{
k_ESteamPartyBeaconLocationDataInvalid = 0,
k_ESteamPartyBeaconLocationDataName = 1,
k_ESteamPartyBeaconLocationDataIconURLSmall = 2,
k_ESteamPartyBeaconLocationDataIconURLMedium = 3,
k_ESteamPartyBeaconLocationDataIconURLLarge = 4,
};
class ISteamParties
{
public:
// =============================================================================================
// Party Client APIs
// Enumerate any active beacons for parties you may wish to join
virtual uint32 GetNumActiveBeacons() = 0;
virtual PartyBeaconID_t GetBeaconByIndex( uint32 unIndex ) = 0;
virtual bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, CSteamID *pSteamIDBeaconOwner, STEAM_OUT_STRUCT() SteamPartyBeaconLocation_t *pLocation, STEAM_OUT_STRING_COUNT(cchMetadata) char *pchMetadata, int cchMetadata ) = 0;
// Join an open party. Steam will reserve one beacon slot for your SteamID,
// and return the necessary JoinGame string for you to use to connect
STEAM_CALL_RESULT( JoinPartyCallback_t )
virtual SteamAPICall_t JoinParty( PartyBeaconID_t ulBeaconID ) = 0;
// =============================================================================================
// Party Host APIs
// Get a list of possible beacon locations
virtual bool GetNumAvailableBeaconLocations( uint32 *puNumLocations ) = 0;
virtual bool GetAvailableBeaconLocations( SteamPartyBeaconLocation_t *pLocationList, uint32 uMaxNumLocations ) = 0;
// Create a new party beacon and activate it in the selected location.
// unOpenSlots is the maximum number of users that Steam will send to you.
// When people begin responding to your beacon, Steam will send you
// PartyReservationCallback_t callbacks to let you know who is on the way.
STEAM_CALL_RESULT( CreateBeaconCallback_t )
virtual SteamAPICall_t CreateBeacon( uint32 unOpenSlots, SteamPartyBeaconLocation_t *pBeaconLocation, const char *pchConnectString, const char *pchMetadata ) = 0;
// Call this function when a user that had a reservation (see callback below)
// has successfully joined your party.
// Steam will manage the remaining open slots automatically.
virtual void OnReservationCompleted( PartyBeaconID_t ulBeacon, CSteamID steamIDUser ) = 0;
// To cancel a reservation (due to timeout or user input), call this.
// Steam will open a new reservation slot.
// Note: The user may already be in-flight to your game, so it's possible they will still connect and try to join your party.
virtual void CancelReservation( PartyBeaconID_t ulBeacon, CSteamID steamIDUser ) = 0;
// Change the number of open beacon reservation slots.
// Call this if, for example, someone without a reservation joins your party (eg a friend, or via your own matchmaking system).
STEAM_CALL_RESULT( ChangeNumOpenSlotsCallback_t )
virtual SteamAPICall_t ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint32 unOpenSlots ) = 0;
// Turn off the beacon.
virtual bool DestroyBeacon( PartyBeaconID_t ulBeacon ) = 0;
// Utils
virtual bool GetBeaconLocationData( SteamPartyBeaconLocation_t BeaconLocation, ESteamPartyBeaconLocationData eData, STEAM_OUT_STRING_COUNT(cchDataStringOut) char *pchDataStringOut, int cchDataStringOut ) = 0;
};
#define STEAMPARTIES_INTERFACE_VERSION "SteamParties002"
// Global interface accessor
inline ISteamParties *SteamParties();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamParties *, SteamParties, STEAMPARTIES_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Callbacks for ISteamMatchmaking (which go through the regular Steam callback registration system)
//-----------------------------------------------------------------------------
// Purpose: a server was added/removed from the favorites list, you should refresh now
//-----------------------------------------------------------------------------
@ -745,6 +915,171 @@ struct FavoritesListAccountsUpdated_t
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Callbacks for ISteamGameSearch (which go through the regular Steam callback registration system)
struct SearchForGameProgressCallback_t
{
enum { k_iCallback = k_iSteamGameSearchCallbacks + 1 };
uint64 m_ullSearchID; // all future callbacks referencing this search will include this Search ID
EResult m_eResult; // if search has started this result will be k_EResultOK, any other value indicates search has failed to start or has terminated
CSteamID m_lobbyID; // lobby ID if lobby search, invalid steamID otherwise
CSteamID m_steamIDEndedSearch; // if search was terminated, steamID that terminated search
int32 m_nSecondsRemainingEstimate;
int32 m_cPlayersSearching;
};
// notification to all players searching that a game has been found
struct SearchForGameResultCallback_t
{
enum { k_iCallback = k_iSteamGameSearchCallbacks + 2 };
uint64 m_ullSearchID;
EResult m_eResult; // if game/host was lost this will be an error value
// if m_bGameFound is true the following are non-zero
int32 m_nCountPlayersInGame;
int32 m_nCountAcceptedGame;
// if m_steamIDHost is valid the host has started the game
CSteamID m_steamIDHost;
bool m_bFinalCallback;
};
//-----------------------------------------------------------------------------
// ISteamGameSearch : Game Host API callbacks
// callback from RequestPlayersForGame when the matchmaking service has started or ended search
// callback will also follow a call from CancelRequestPlayersForGame - m_bSearchInProgress will be false
struct RequestPlayersForGameProgressCallback_t
{
enum { k_iCallback = k_iSteamGameSearchCallbacks + 11 };
EResult m_eResult; // m_ullSearchID will be non-zero if this is k_EResultOK
uint64 m_ullSearchID; // all future callbacks referencing this search will include this Search ID
};
// callback from RequestPlayersForGame
// one of these will be sent per player
// followed by additional callbacks when players accept or decline the game
struct RequestPlayersForGameResultCallback_t
{
enum { k_iCallback = k_iSteamGameSearchCallbacks + 12 };
EResult m_eResult; // m_ullSearchID will be non-zero if this is k_EResultOK
uint64 m_ullSearchID;
CSteamID m_SteamIDPlayerFound; // player steamID
CSteamID m_SteamIDLobby; // if the player is in a lobby, the lobby ID
enum PlayerAcceptState_t
{
k_EStateUnknown = 0,
k_EStatePlayerAccepted = 1,
k_EStatePlayerDeclined = 2,
};
PlayerAcceptState_t m_ePlayerAcceptState;
int32 m_nPlayerIndex;
int32 m_nTotalPlayersFound; // expect this many callbacks at minimum
int32 m_nTotalPlayersAcceptedGame;
int32 m_nSuggestedTeamIndex;
uint64 m_ullUniqueGameID;
};
struct RequestPlayersForGameFinalResultCallback_t
{
enum { k_iCallback = k_iSteamGameSearchCallbacks + 13 };
EResult m_eResult;
uint64 m_ullSearchID;
uint64 m_ullUniqueGameID;
};
// this callback confirms that results were received by the matchmaking service for this player
struct SubmitPlayerResultResultCallback_t
{
enum { k_iCallback = k_iSteamGameSearchCallbacks + 14 };
EResult m_eResult;
uint64 ullUniqueGameID;
CSteamID steamIDPlayer;
};
// this callback confirms that the game is recorded as complete on the matchmaking service
// the next call to RequestPlayersForGame will generate a new unique game ID
struct EndGameResultCallback_t
{
enum { k_iCallback = k_iSteamGameSearchCallbacks + 15 };
EResult m_eResult;
uint64 ullUniqueGameID;
};
// Steam has responded to the user request to join a party via the given Beacon ID.
// If successful, the connect string contains game-specific instructions to connect
// to the game with that party.
struct JoinPartyCallback_t
{
enum { k_iCallback = k_iSteamPartiesCallbacks + 1 };
EResult m_eResult;
PartyBeaconID_t m_ulBeaconID;
CSteamID m_SteamIDBeaconOwner;
char m_rgchConnectString[256];
};
// Response to CreateBeacon request. If successful, the beacon ID is provided.
struct CreateBeaconCallback_t
{
enum { k_iCallback = k_iSteamPartiesCallbacks + 2 };
EResult m_eResult;
PartyBeaconID_t m_ulBeaconID;
};
// Someone has used the beacon to join your party - they are in-flight now
// and we've reserved one of the open slots for them.
// You should confirm when they join your party by calling OnReservationCompleted().
// Otherwise, Steam may timeout their reservation eventually.
struct ReservationNotificationCallback_t
{
enum { k_iCallback = k_iSteamPartiesCallbacks + 3 };
PartyBeaconID_t m_ulBeaconID;
CSteamID m_steamIDJoiner;
};
// Response to ChangeNumOpenSlots call
struct ChangeNumOpenSlotsCallback_t
{
enum { k_iCallback = k_iSteamPartiesCallbacks + 4 };
EResult m_eResult;
};
// The list of possible Party beacon locations has changed
struct AvailableBeaconLocationsUpdated_t
{
enum { k_iCallback = k_iSteamPartiesCallbacks + 5 };
};
// The list of active beacons may have changed
struct ActiveBeaconsUpdated_t
{
enum { k_iCallback = k_iSteamPartiesCallbacks + 6 };
};
#pragma pack( pop )

View File

@ -6,7 +6,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
// Purpose:
@ -44,22 +44,26 @@ public:
#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamMusic *SteamMusic();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMusic *, SteamMusic, STEAMMUSIC_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 )
CALLBACK_MEMBER( 0, float, m_flNewVolume )
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 )
STEAM_CALLBACK_MEMBER( 0, float, m_flNewVolume )
STEAM_CALLBACK_END(1)
#pragma pack( pop )

View File

@ -6,7 +6,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
#include "isteammusic.h"
#define k_SteamMusicNameMaxLength 255
@ -64,63 +64,67 @@ public:
#define STEAMMUSICREMOTE_INTERFACE_VERSION "STEAMMUSICREMOTE_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamMusicRemote *SteamMusicRemote();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamMusicRemote *, SteamMusicRemote, STEAMMUSICREMOTE_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
DEFINE_CALLBACK( MusicPlayerRemoteWillActivate_t, k_iSteamMusicRemoteCallbacks + 1)
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteWillActivate_t, k_iSteamMusicRemoteCallbacks + 1)
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerRemoteWillDeactivate_t, k_iSteamMusicRemoteCallbacks + 2 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteWillDeactivate_t, k_iSteamMusicRemoteCallbacks + 2 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerRemoteToFront_t, k_iSteamMusicRemoteCallbacks + 3 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerRemoteToFront_t, k_iSteamMusicRemoteCallbacks + 3 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerWillQuit_t, k_iSteamMusicRemoteCallbacks + 4 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerWillQuit_t, k_iSteamMusicRemoteCallbacks + 4 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerWantsPlay_t, k_iSteamMusicRemoteCallbacks + 5 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlay_t, k_iSteamMusicRemoteCallbacks + 5 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerWantsPause_t, k_iSteamMusicRemoteCallbacks + 6 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPause_t, k_iSteamMusicRemoteCallbacks + 6 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerWantsPlayPrevious_t, k_iSteamMusicRemoteCallbacks + 7 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayPrevious_t, k_iSteamMusicRemoteCallbacks + 7 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerWantsPlayNext_t, k_iSteamMusicRemoteCallbacks + 8 )
END_DEFINE_CALLBACK_0()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayNext_t, k_iSteamMusicRemoteCallbacks + 8 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( MusicPlayerWantsShuffled_t, k_iSteamMusicRemoteCallbacks + 9 )
CALLBACK_MEMBER( 0, bool, m_bShuffled )
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsShuffled_t, k_iSteamMusicRemoteCallbacks + 9 )
STEAM_CALLBACK_MEMBER( 0, bool, m_bShuffled )
STEAM_CALLBACK_END(1)
DEFINE_CALLBACK( MusicPlayerWantsLooped_t, k_iSteamMusicRemoteCallbacks + 10 )
CALLBACK_MEMBER(0, bool, m_bLooped )
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsLooped_t, k_iSteamMusicRemoteCallbacks + 10 )
STEAM_CALLBACK_MEMBER(0, bool, m_bLooped )
STEAM_CALLBACK_END(1)
DEFINE_CALLBACK( MusicPlayerWantsVolume_t, k_iSteamMusicCallbacks + 11 )
CALLBACK_MEMBER(0, float, m_flNewVolume)
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsVolume_t, k_iSteamMusicCallbacks + 11 )
STEAM_CALLBACK_MEMBER(0, float, m_flNewVolume)
STEAM_CALLBACK_END(1)
DEFINE_CALLBACK( MusicPlayerSelectsQueueEntry_t, k_iSteamMusicCallbacks + 12 )
CALLBACK_MEMBER(0, int, nID )
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( MusicPlayerSelectsQueueEntry_t, k_iSteamMusicCallbacks + 12 )
STEAM_CALLBACK_MEMBER(0, int, nID )
STEAM_CALLBACK_END(1)
DEFINE_CALLBACK( MusicPlayerSelectsPlaylistEntry_t, k_iSteamMusicCallbacks + 13 )
CALLBACK_MEMBER(0, int, nID )
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( MusicPlayerSelectsPlaylistEntry_t, k_iSteamMusicCallbacks + 13 )
STEAM_CALLBACK_MEMBER(0, int, nID )
STEAM_CALLBACK_END(1)
DEFINE_CALLBACK( MusicPlayerWantsPlayingRepeatStatus_t, k_iSteamMusicRemoteCallbacks + 14 )
CALLBACK_MEMBER(0, int, m_nPlayingRepeatStatus )
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( MusicPlayerWantsPlayingRepeatStatus_t, k_iSteamMusicRemoteCallbacks + 14 )
STEAM_CALLBACK_MEMBER(0, int, m_nPlayingRepeatStatus )
STEAM_CALLBACK_END(1)
#pragma pack( pop )

View File

@ -10,9 +10,7 @@
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
#include "steam_api_common.h"
// list of possible errors returned by SendP2PPacket() API
// these will be posted in the P2PSessionConnectFail_t callback
@ -63,7 +61,7 @@ enum EP2PSend
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct P2PSessionState_t
{
@ -127,8 +125,14 @@ class ISteamNetworking
{
public:
////////////////////////////////////////////////////////////////////////////////////////////
// Session-less connection functions
// automatically establishes NAT-traversing or Relay server connections
//
// UDP-style (connectionless) networking interface. These functions send messages using
// an API organized around the destination. Reliable and unreliable messages are supported.
//
// For a more TCP-style interface (meaning you have a connection handle), see the functions below.
// Both interface styles can send both reliable and unreliable messages.
//
// Automatically establishes NAT-traversing or Relay server connections
// Sends a P2P packet to the specified user
// UDP-like, unreliable and a max packet size of 1200 bytes
@ -181,11 +185,18 @@ public:
////////////////////////////////////////////////////////////////////////////////////////////
// LISTEN / CONNECT style interface functions
//
// This is an older set of functions designed around the Berkeley TCP sockets model
// it's preferential that you use the above P2P functions, they're more robust
// and these older functions will be removed eventually
// LISTEN / CONNECT connection-oriented interface functions
//
// These functions are more like a client-server TCP API. One side is the "server"
// and "listens" for incoming connections, which then must be "accepted." The "client"
// initiates a connection by "connecting." Sending and receiving is done through a
// connection handle.
//
// For a more UDP-style interface, where you do not track connection handles but
// simply send messages to a SteamID, use the UDP-style functions above.
//
// Both methods can send both reliable and unreliable methods.
//
////////////////////////////////////////////////////////////////////////////////////////////
@ -261,13 +272,21 @@ public:
};
#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking005"
// Global interface accessor
inline ISteamNetworking *SteamNetworking();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworking *, SteamNetworking, STEAMNETWORKING_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamNetworking *SteamGameServerNetworking();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworking *, SteamGameServerNetworking, STEAMNETWORKING_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
// callback notification - a user wants to talk to us over the P2P channel via the SendP2PPacket() API

View File

@ -0,0 +1,489 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Networking API similar to Berkeley sockets, but for games.
// - connection-oriented API (like TCP, not UDP)
// - but unlike TCP, it's message-oriented, not stream-oriented
// - mix of reliable and unreliable messages
// - fragmentation and reassembly
// - Supports connectivity over plain UDPv4
// - Also supports SDR ("Steam Datagram Relay") connections, which are
// addressed by SteamID. There is a "P2P" use case and also a "hosted
// dedicated server" use case.
//
//=============================================================================
#ifndef ISTEAMNETWORKINGSOCKETS
#define ISTEAMNETWORKINGSOCKETS
#ifdef _WIN32
#pragma once
#endif
#include "steamnetworkingtypes.h"
class ISteamNetworkingSocketsCallbacks;
//-----------------------------------------------------------------------------
/// Lower level networking interface that more closely mirrors the standard
/// Berkeley sockets model. Sockets are hard! You should probably only use
/// this interface under the existing circumstances:
///
/// - You have an existing socket-based codebase you want to port, or coexist with.
/// - You want to be able to connect based on IP address, rather than (just) Steam ID.
/// - You need low-level control of bandwidth utilization, when to drop packets, etc.
///
/// Note that neither of the terms "connection" and "socket" will correspond
/// one-to-one with an underlying UDP socket. An attempt has been made to
/// keep the semantics as similar to the standard socket model when appropriate,
/// but some deviations do exist.
class ISteamNetworkingSockets
{
public:
/// Creates a "server" socket that listens for clients to connect to by
/// calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6)
///
/// You must select a specific local port to listen on and set it
/// the port field of the local address.
///
/// Usually you wil set the IP portion of the address to zero, (SteamNetworkingIPAddr::Clear()).
/// This means that you will not bind to any particular local interface. In addition,
/// if possible the socket will be bound in "dual stack" mode, which means that it can
/// accept both IPv4 and IPv6 clients. If you wish to bind a particular interface, then
/// set the local address to the appropriate IPv4 or IPv6 IP.
///
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
/// will be posted. The connection will be in the connecting state.
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress ) = 0;
/// 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
/// matching call to CreateListenSocketIP on the specified port.
///
/// A SteamNetConnectionStatusChangedCallback_t callback will be triggered when we start
/// connecting, and then another one on either timeout or successful connection.
///
/// If the server does not have any identity configured, then their network address
/// will be the only identity in use. Or, the network host may provide a platform-specific
/// identity with or without a valid certificate to authenticate that identity. (These
/// details will be contained in the SteamNetConnectionStatusChangedCallback_t.) It's
/// up to your application to decide whether to allow the connection.
///
/// By default, all connections will get basic encryption sufficient to prevent
/// casual eavesdropping. But note that without certificates (or a shared secret
/// distributed through some other out-of-band mechanism), you don't have any
/// way of knowing who is actually on the other end, and thus are vulnerable to
/// man-in-the-middle attacks.
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address ) = 0;
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P
///
/// nVirtualPort specifies how clients can connect to this socket using
/// ConnectP2P. It's very common for applications to only have one listening socket;
/// in that case, use zero. If you need to open multiple listen sockets and have clients
/// be able to connect to one or the other, then nVirtualPort should be a small integer (<1000)
/// unique to each listen socket you create.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
/// when your app initializes
virtual HSteamListenSocket CreateListenSocketP2P( int nVirtualPort ) = 0;
/// Begin connecting to a server that is identified using a platform-specific identifier.
/// This requires some sort of third party rendezvous service, and will depend on the
/// platform and what other libraries and services you are integrating with.
///
/// At the time of this writing, there is only one supported rendezvous service: Steam.
/// Set the SteamID (whether "user" or "gameserver") and Steam will determine if the
/// client is online and facilitate a relay connection. Note that all P2P connections on
/// Steam are currently relayed.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
/// when your app initializes
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) = 0;
#endif
/// Accept an incoming connection that has been received on a listen socket.
///
/// When a connection attempt is received (perhaps after a few basic handshake
/// packets have been exchanged to prevent trivial spoofing), a connection interface
/// object is created in the k_ESteamNetworkingConnectionState_Connecting state
/// and a SteamNetConnectionStatusChangedCallback_t is posted. At this point, your
/// application MUST either accept or close the connection. (It may not ignore it.)
/// Accepting the connection will transition it either into the connected state,
/// or the finding route state, depending on the connection type.
///
/// You should take action within a second or two, because accepting the connection is
/// what actually sends the reply notifying the client that they are connected. If you
/// delay taking action, from the client's perspective it is the same as the network
/// being unresponsive, and the client may timeout the connection attempt. In other
/// words, the client cannot distinguish between a delay caused by network problems
/// and a delay caused by the application.
///
/// This means that if your application goes for more than a few seconds without
/// processing callbacks (for example, while loading a map), then there is a chance
/// that a client may attempt to connect in that interval and fail due to timeout.
///
/// If the application does not respond to the connection attempt in a timely manner,
/// and we stop receiving communication from the client, the connection attempt will
/// be timed out locally, transitioning the connection to the
/// k_ESteamNetworkingConnectionState_ProblemDetectedLocally state. The client may also
/// close the connection before it is accepted, and a transition to the
/// k_ESteamNetworkingConnectionState_ClosedByPeer is also possible depending the exact
/// sequence of events.
///
/// Returns k_EResultInvalidParam if the handle is invalid.
/// Returns k_EResultInvalidState if the connection is not in the appropriate state.
/// (Remember that the connection state could change in between the time that the
/// notification being posted to the queue and when it is received by the application.)
virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0;
/// Disconnects from the remote host and invalidates the connection handle.
/// Any unread data on the connection is discarded.
///
/// nReason is an application defined code that will be received on the other
/// end and recorded (when possible) in backend analytics. The value should
/// come from a restricted range. (See ESteamNetConnectionEnd.) If you don't need
/// to communicate any information to the remote host, and do not want analytics to
/// be able to distinguish "normal" connection terminations from "exceptional" ones,
/// You may pass zero, in which case the generic value of
/// k_ESteamNetConnectionEnd_App_Generic will be used.
///
/// pszDebug is an optional human-readable diagnostic string that will be received
/// by the remote host and recorded (when possible) in backend analytics.
///
/// If you wish to put the socket into a "linger" state, where an attempt is made to
/// flush any remaining sent data, use bEnableLinger=true. Otherwise reliable data
/// is not flushed.
///
/// If the connection has already ended and you are just freeing up the
/// connection interface, the reason code, debug string, and linger flag are
/// ignored.
virtual bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger ) = 0;
/// Destroy a listen socket. All the connections that were accepting on the listen
/// socket are closed ungracefully.
virtual bool CloseListenSocket( HSteamListenSocket hSocket ) = 0;
/// Set connection user data. the data is returned in the following places
/// - You can query it using GetConnectionUserData.
/// - The SteamNetworkingmessage_t structure.
/// - The SteamNetConnectionInfo_t structure. (Which is a member of SteamNetConnectionStatusChangedCallback_t.)
///
/// Returns false if the handle is invalid.
virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) = 0;
/// Fetch connection user data. Returns -1 if handle is invalid
/// or if you haven't set any userdata on the connection.
virtual int64 GetConnectionUserData( HSteamNetConnection hPeer ) = 0;
/// Set a name for the connection, used mostly for debugging
virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) = 0;
/// Fetch connection name. Returns false if handle is invalid
virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) = 0;
/// Send a message to the remote host on the specified connection.
///
/// nSendFlags determines the delivery guarantees that will be provided,
/// when data should be buffered, etc. E.g. k_nSteamNetworkingSend_Unreliable
///
/// Note that the semantics we use for messages are not precisely
/// the same as the semantics of a standard "stream" socket.
/// (SOCK_STREAM) For an ordinary stream socket, the boundaries
/// between chunks are not considered relevant, and the sizes of
/// the chunks of data written will not necessarily match up to
/// the sizes of the chunks that are returned by the reads on
/// the other end. The remote host might read a partial chunk,
/// or chunks might be coalesced. For the message semantics
/// used here, however, the sizes WILL match. Each send call
/// will match a successful read call on the remote host
/// one-for-one. If you are porting existing stream-oriented
/// code to the semantics of reliable messages, your code should
/// work the same, since reliable message semantics are more
/// strict than stream semantics. The only caveat is related to
/// performance: there is per-message overhead to retain the
/// message sizes, and so if your code sends many small chunks
/// of data, performance will suffer. Any code based on stream
/// sockets that does not write excessively small chunks will
/// work without any changes.
///
/// Returns:
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
/// - k_EResultInvalidState: connection is in an invalid state
/// - k_EResultNoConnection: connection has ended
/// - k_EResultIgnored: You used k_nSteamNetworkingSend_NoDelay, and the message was dropped because
/// we were not ready to send it.
/// - k_EResultLimitExceeded: there was already too much data queued to be sent.
/// (See k_ESteamNetworkingConfig_SendBufferSize)
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags ) = 0;
/// Flush any messages waiting on the Nagle timer and send them
/// at the next transmission opportunity (often that means right now).
///
/// If Nagle is enabled (it's on by default) then when calling
/// SendMessageToConnection the message will be buffered, up to the Nagle time
/// before being sent, to merge small messages into the same packet.
/// (See k_ESteamNetworkingConfig_NagleTime)
///
/// Returns:
/// k_EResultInvalidParam: invalid connection handle
/// k_EResultInvalidState: connection is in an invalid state
/// k_EResultNoConnection: connection has ended
/// k_EResultIgnored: We weren't (yet) connected, so this operation has no effect.
virtual EResult FlushMessagesOnConnection( HSteamNetConnection hConn ) = 0;
/// Fetch the next available message(s) from the connection, if any.
/// Returns the number of messages returned into your array, up to nMaxMessages.
/// If the connection handle is invalid, -1 is returned.
///
/// The order of the messages returned in the array is relevant.
/// Reliable messages will be received in the order they were sent (and with the
/// same sizes --- see SendMessageToConnection for on this subtle difference from a stream socket).
///
/// Unreliable messages may be dropped, or delivered out of order withrespect to
/// each other or with respect to reliable messages. The same unreliable message
/// may be received multiple times.
///
/// If any messages are returned, you MUST call SteamNetworkingMessage_t::Release() on each
/// of them free up resources after you are done. It is safe to keep the object alive for
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
/// Same as ReceiveMessagesOnConnection, but will return the next message available
/// on any connection that was accepted through the specified listen socket. Examine
/// SteamNetworkingMessage_t::m_conn to know which client connection.
///
/// Delivery order of messages among different clients is not defined. They may
/// be returned in an order different from what they were actually received. (Delivery
/// order of messages from the same client is well defined, and thus the order of the
/// messages is relevant!)
virtual int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
/// Returns basic information about the high-level state of the connection.
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
/// Returns a small set of information about the real-time state of the connection
/// Returns false if the connection handle is invalid, or the connection has ended.
virtual bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats ) = 0;
/// Returns detailed connection stats in text format. Useful
/// for dumping to a log, etc.
///
/// Returns:
/// -1 failure (bad connection handle)
/// 0 OK, your buffer was filled in and '\0'-terminated
/// >0 Your buffer was either nullptr, or it was too small and the text got truncated.
/// Try again with a buffer of at least N bytes.
virtual int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf ) = 0;
/// Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to.
///
/// An IPv6 address of ::0 means "any IPv4 or IPv6"
/// An IPv6 address of ::ffff:0000:0000 means "any IPv4"
virtual bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address ) = 0;
/// Create a pair of connections that are talking to each other, e.g. a loopback connection.
/// This is very useful for testing, or so that your client/server code can work the same
/// even when you are running a local "server".
///
/// The two connections will immediately be placed into the connected state, and no callbacks
/// will be posted immediately. After this, if you close either connection, the other connection
/// will receive a callback, exactly as if they were communicating over the network. You must
/// close *both* sides in order to fully clean up the resources!
///
/// By default, internal buffers are used, completely bypassing the network, the chopping up of
/// messages into packets, encryption, copying the payload, etc. This means that loopback
/// packets, by default, will not simulate lag or loss. Passing true for bUseNetworkLoopback will
/// cause the socket pair to send packets through the local network loopback device (127.0.0.1)
/// on ephemeral ports. Fake lag and loss are supported in this case, and CPU time is expended
/// to encrypt and decrypt.
///
/// If you wish to assign a specific identity to either connection, you may pass a particular
/// identity. Otherwise, if you pass nullptr, the respective connection will assume a generic
/// "localhost" identity. If you use real network loopback, this might be translated to the
/// actual bound loopback port. Otherwise, the port will be zero.
virtual bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 ) = 0;
/// Get the identity assigned to this interface.
/// E.g. on Steam, this is the user's SteamID, or for the gameserver interface, the SteamID assigned
/// to the gameserver. Returns false and sets the result to an invalid identity if we don't know
/// our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID
/// even if they are not signed into Steam.)
virtual bool GetIdentity( SteamNetworkingIdentity *pIdentity ) = 0;
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
//
// Clients connecting to dedicated servers hosted in a data center,
// using central-authority-granted tickets.
//
/// Call this when you receive a ticket from your backend / matchmaking system. Puts the
/// ticket into a persistent cache, and optionally returns the parsed ticket.
///
/// See stamdatagram_ticketgen.h for more details.
virtual bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
/// Search cache for a ticket to talk to the server on the specified virtual port.
/// If found, returns the number of seconds until the ticket expires, and optionally
/// the complete cracked ticket. Returns 0 if we don't have a ticket.
///
/// Typically this is useful just to confirm that you have a ticket, before you
/// call ConnectToHostedDedicatedServer to connect to the server.
virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
/// 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 attempt will fail!
///
/// You may wonder why tickets are stored in a cache, instead of simply being passed as an argument
/// here. The reason is to make reconnection to a gameserver robust, even if the client computer loses
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
///
/// If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
/// when your app initializes
virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort ) = 0;
//
// Servers hosted in Valve data centers
//
/// Returns the value of the SDR_LISTEN_PORT environment variable. This
/// is the UDP server your server will be listening on. This will
/// configured automatically for you in production environments. (You
/// should set it yourself for testing.)
virtual uint16 GetHostedDedicatedServerPort() = 0;
/// If you are running in a production data center, this will return the data
/// center code. Returns 0 otherwise.
virtual SteamNetworkingPOPID GetHostedDedicatedServerPOPID() = 0;
/// Return info about the hosted server. You will need to send this information to your
/// backend, and put it in tickets, so that the relays will know how to forward traffic from
/// clients to your server. See SteamDatagramRelayAuthTicket for more info.
///
/// NOTE ABOUT DEVELOPMENT ENVIRONMENTS:
/// In production in our data centers, these parameters are configured via environment variables.
/// In development, the only one you need to set is SDR_LISTEN_PORT, which is the local port you
/// want to listen on. Furthermore, if you are running your server behind a corporate firewall,
/// you probably will not be able to put the routing information returned by this function into
/// tickets. Instead, it should be a public internet address that the relays can use to send
/// data to your server. So you might just end up hardcoding a public address and setup port
/// forwarding on your corporate firewall. In that case, the port you put into the ticket
/// needs to be the public-facing port opened on your firewall, if it is different from the
/// actual server port.
///
/// This function will fail if SteamDatagramServer_Init has not been called.
///
/// Returns false if the SDR_LISTEN_PORT environment variable is not set.
virtual bool GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) = 0;
/// Create a listen socket on the specified virtual port. The physical UDP port to use
/// will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not
/// configured, this call will fail.
///
/// Note that this call MUST be made through the SteamGameServerNetworkingSockets() interface
virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort ) = 0;
#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR
// Invoke all callbacks queued for this interface.
// On Steam, callbacks are dispatched via the ordinary Steamworks callbacks mechanism.
// So if you have code that is also targeting Steam, you should call this at about the
// same time you would call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks.
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
virtual void RunCallbacks( ISteamNetworkingSocketsCallbacks *pCallbacks ) = 0;
#endif
protected:
~ISteamNetworkingSockets(); // Silence some warnings
};
#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets002"
extern "C" {
// Global accessor.
#if defined( STEAMNETWORKINGSOCKETS_PARTNER )
// Standalone lib. Use different symbol name, so that we can dynamically switch between steamclient.dll
// and the standalone lib
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets_Lib();
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamGameServerNetworkingSockets_Lib();
inline ISteamNetworkingSockets *SteamNetworkingSockets() { return SteamNetworkingSockets_Lib(); }
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets() { return SteamGameServerNetworkingSockets_Lib(); }
#elif defined( STEAMNETWORKINGSOCKETS_OPENSOURCE )
// Opensource GameNetworkingSockets
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingSockets *SteamNetworkingSockets();
#else
// Steamworks SDK
inline ISteamNetworkingSockets *SteamNetworkingSockets();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamNetworkingSockets, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION );
inline ISteamNetworkingSockets *SteamGameServerNetworkingSockets();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworkingSockets *, SteamGameServerNetworkingSockets, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION );
#endif
/// Callback struct used to notify when a connection has changed state
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error "Must define VALVE_CALLBACK_PACK_SMALL or VALVE_CALLBACK_PACK_LARGE"
#endif
/// This callback is posted whenever a connection is created, destroyed, or changes state.
/// The m_info field will contain a complete description of the connection at the time the
/// change occurred and the callback was posted. In particular, m_eState will have the
/// new connection state.
///
/// You will usually need to listen for this callback to know when:
/// - A new connection arrives on a listen socket.
/// m_info.m_hListenSocket will be set, m_eOldState = k_ESteamNetworkingConnectionState_None,
/// and m_info.m_eState = k_ESteamNetworkingConnectionState_Connecting.
/// See ISteamNetworkigSockets::AcceptConnection.
/// - A connection you initiated has been accepted by the remote host.
/// m_eOldState = k_ESteamNetworkingConnectionState_Connecting, and
/// m_info.m_eState = k_ESteamNetworkingConnectionState_Connected.
/// Some connections might transition to k_ESteamNetworkingConnectionState_FindingRoute first.
/// - A connection has been actively rejected or closed by the remote host.
/// m_eOldState = k_ESteamNetworkingConnectionState_Connecting or k_ESteamNetworkingConnectionState_Connected,
/// and m_info.m_eState = k_ESteamNetworkingConnectionState_ClosedByPeer. m_info.m_eEndReason
/// and m_info.m_szEndDebug will have for more details.
/// NOTE: upon receiving this callback, you must still destroy the connection using
/// ISteamNetworkingSockets::CloseConnection to free up local resources. (The details
/// passed to the function are not used in this case, since the connection is already closed.)
/// - A problem was detected with the connection, and it has been closed by the local host.
/// The most common failure is timeout, but other configuration or authentication failures
/// can cause this. m_eOldState = k_ESteamNetworkingConnectionState_Connecting or
/// k_ESteamNetworkingConnectionState_Connected, and m_info.m_eState = k_ESteamNetworkingConnectionState_ProblemDetectedLocally.
/// m_info.m_eEndReason and m_info.m_szEndDebug will have for more details.
/// NOTE: upon receiving this callback, you must still destroy the connection using
/// ISteamNetworkingSockets::CloseConnection to free up local resources. (The details
/// passed to the function are not used in this case, since the connection is already closed.)
///
/// Remember that callbacks are posted to a queue, and networking connections can
/// change at any time. It is possible that the connection has already changed
/// state by the time you process this callback.
///
/// Also note that callbacks will be posted when connections are created and destroyed by your own API calls.
struct SteamNetConnectionStatusChangedCallback_t
{
enum { k_iCallback = k_iSteamNetworkingSocketsCallbacks + 1 };
/// Connection handle
HSteamNetConnection m_hConn;
/// Full connection info
SteamNetConnectionInfo_t m_info;
/// Previous state. (Current state is in m_info.m_eState)
ESteamNetworkingConnectionState m_eOldState;
};
#pragma pack( pop )
}
#endif // ISTEAMNETWORKINGSOCKETS

View File

@ -0,0 +1,302 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose: misc networking utilities
//
//=============================================================================
#ifndef ISTEAMNETWORKINGUTILS
#define ISTEAMNETWORKINGUTILS
#ifdef _WIN32
#pragma once
#endif
#include <stdint.h>
#include "steamnetworkingtypes.h"
struct SteamDatagramRelayAuthTicket;
//-----------------------------------------------------------------------------
/// Misc networking utilities for checking the local networking environment
/// and estimating pings.
class ISteamNetworkingUtils
{
public:
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
//
// Initialization
//
/// If you know that you are going to be using the relay network, call
/// this to initialize the relay network or check if that initialization
/// has completed. If you do not call this, the initialization will
/// happen the first time you use a feature that requires access to the
/// relay network, and that use will be delayed.
///
/// Returns true if initialization has completed successfully.
/// (It will probably return false on the first call.)
///
/// Typically initialization completes in a few seconds.
///
/// Note: dedicated servers hosted with Valve do *not* need to call
/// this, since they do not make routing decisions. However, if the
/// dedicated server will be using P2P functionality, it will act as
/// a "client" and this should be called.
inline bool InitializeRelayNetworkAccess();
//
// "Ping location" functions
//
// We use the ping times to the valve relays deployed worldwide to
// generate a "marker" that describes the location of an Internet host.
// Given two such markers, we can estimate the network latency between
// two hosts, without sending any packets. The estimate is based on the
// optimal route that is found through the Valve network. If you are
// using the Valve network to carry the traffic, then this is precisely
// the ping you want. If you are not, then the ping time will probably
// still be a reasonable estimate.
//
// This is extremely useful to select peers for matchmaking!
//
// The markers can also be converted to a string, so they can be transmitted.
// We have a separate library you can use on your backend to manipulate
// these objects. (See steamdatagram_ticketgen.h)
/// Return location info for the current host. Returns the approximate
/// age of the data, in seconds, or -1 if no data is available.
///
/// It takes a few seconds to initialize access to the relay network. If
/// you call this very soon after calling InitializeRelayNetworkAccess,
/// the data may not be available yet.
///
/// 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.
virtual float GetLocalPingLocation( SteamNetworkPingLocation_t &result ) = 0;
/// Estimate the round-trip latency between two arbitrary locations, in
/// milliseconds. This is a conservative estimate, based on routing through
/// the relay network. For most basic relayed connections, this ping time
/// will be pretty accurate, since it will be based on the route likely to
/// be actually used.
///
/// If a direct IP route is used (perhaps via NAT traversal), then the route
/// will be different, and the ping time might be better. Or it might actually
/// be a bit worse! Standard IP routing is frequently suboptimal!
///
/// But even in this case, the estimate obtained using this method is a
/// reasonable upper bound on the ping time. (Also it has the advantage
/// of returning immediately and not sending any packets.)
///
/// In a few cases we might not able to estimate the route. In this case
/// a negative value is returned. k_nSteamNetworkingPing_Failed means
/// the reason was because of some networking difficulty. (Failure to
/// ping, etc) k_nSteamNetworkingPing_Unknown is returned if we cannot
/// currently answer the question for some other reason.
///
/// Do you need to be able to do this from a backend/matchmaking server?
/// You are looking for the "ticketgen" library.
virtual int EstimatePingTimeBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 ) = 0;
/// 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
/// these in a loop to find the fastest one.
///
/// In rare cases this might return a slightly different estimate than combining
/// GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations. That's because
/// this function uses a slightly more complete set of information about what
/// route would be taken.
virtual int EstimatePingTimeFromLocalHost( const SteamNetworkPingLocation_t &remoteLocation ) = 0;
/// 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
/// so please do not parse it yourself. Your buffer must be at least
/// k_cchMaxSteamNetworkingPingLocationString bytes.
virtual void ConvertPingLocationToString( const SteamNetworkPingLocation_t &location, char *pszBuf, int cchBufSize ) = 0;
/// Parse back SteamNetworkPingLocation_t string. Returns false if we couldn't understand
/// the string.
virtual bool ParsePingLocationString( const char *pszString, SteamNetworkPingLocation_t &result ) = 0;
//
// Initialization / ping measurement status
//
/// Check if the ping data of sufficient recency is available, and if
/// it's too old, start refreshing it.
///
/// Please only call this function when you *really* do need to force an
/// immediate refresh of the data. (For example, in response to a specific
/// user input to refresh this information.) Don't call it "just in case",
/// before every connection, etc. That will cause extra traffic to be sent
/// for no benefit. The library will automatically refresh the information
/// as needed.
///
/// Returns true if sufficiently recent data is already available.
///
/// Returns false if sufficiently recent data is not available. In this
/// case, ping measurement is initiated, if it is not already active.
/// (You cannot restart a measurement already in progress.)
virtual bool CheckPingDataUpToDate( float flMaxAgeSeconds ) = 0;
/// Return true if we are taking ping measurements to update our ping
/// location or select optimal routing. Ping measurement typically takes
/// a few seconds, perhaps up to 10 seconds.
virtual bool IsPingMeasurementInProgress() = 0;
//
// List of Valve data centers, and ping times to them. This might
// be useful to you if you are use our hosting, or just need to measure
// latency to a cloud data center where we are running relays.
//
/// Fetch ping time of best available relayed route from this host to
/// the specified data center.
virtual int GetPingToDataCenter( SteamNetworkingPOPID popID, SteamNetworkingPOPID *pViaRelayPoP ) = 0;
/// Get *direct* ping time to the relays at the data center.
virtual int GetDirectPingToPOP( SteamNetworkingPOPID popID ) = 0;
/// Get number of network points of presence in the config
virtual int GetPOPCount() = 0;
/// Get list of all POP IDs. Returns the number of entries that were filled into
/// your list.
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
#endif // #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
//
// Misc
//
/// Fetch current timestamp. This timer has the following properties:
///
/// - Monotonicity is guaranteed.
/// - The initial value will be at least 24*3600*30*1e6, i.e. about
/// 30 days worth of microseconds. In this way, the timestamp value of
/// 0 will always be at least "30 days ago". Also, negative numbers
/// will never be returned.
/// - Wraparound / overflow is not a practical concern.
///
/// If you are running under the debugger and stop the process, the clock
/// might not advance the full wall clock time that has elapsed between
/// calls. If the process is not blocked from normal operation, the
/// timestamp values will track wall clock time, even if you don't call
/// the function frequently.
///
/// The value is only meaningful for this run of the process. Don't compare
/// it to values obtained on another computer, or other runs of the same process.
virtual SteamNetworkingMicroseconds GetLocalTimestamp() = 0;
/// Set a function to receive network-related information that is useful for debugging.
/// This can be very useful during development, but it can also be useful for troubleshooting
/// problems with tech savvy end users. If you have a console or other log that customers
/// can examine, these log messages can often be helpful to troubleshoot network issues.
/// (Especially any warning/error messages.)
///
/// The detail level indicates what message to invoke your callback on. Lower numeric
/// value means more important, and the value you pass is the lowest priority (highest
/// numeric value) you wish to receive callbacks for.
///
/// Except when debugging, you should only use k_ESteamNetworkingSocketsDebugOutputType_Msg
/// or k_ESteamNetworkingSocketsDebugOutputType_Warning. For best performance, do NOT
/// request a high detail level and then filter out messages in your callback. Instead,
/// call function function to adjust the desired level of detail.
///
/// IMPORTANT: This may be called from a service thread, while we own a mutex, etc.
/// Your output function must be threadsafe and fast! Do not make any other
/// Steamworks calls from within the handler.
virtual void SetDebugOutputFunction( ESteamNetworkingSocketsDebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc ) = 0;
//
// Set and get configuration values, see ESteamNetworkingConfigValue for individual descriptions.
//
// Shortcuts for common cases. (Implemented as inline functions below)
bool SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val );
bool SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val );
bool SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val );
bool SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val );
bool SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val );
bool SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val );
/// Set a configuration value.
/// - eValue: which value is being set
/// - eScope: Onto what type of object are you applying the setting?
/// - scopeArg: Which object you want to change? (Ignored for global scope). E.g. connection handle, listen socket handle, interface pointer, etc.
/// - eDataType: What type of data is in the buffer at pValue? This must match the type of the variable exactly!
/// - pArg: Value to set it to. You can pass NULL to remove a non-global sett at this scope,
/// causing the value for that object to use global defaults. Or at global scope, passing NULL
/// will reset any custom value and restore it to the system default.
/// NOTE: When setting callback functions, do not pass the function pointer directly.
/// Your argument should be a pointer to a function pointer.
virtual bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType eDataType, const void *pArg ) = 0;
/// Get a configuration value.
/// - eValue: which value to fetch
/// - eScopeType: query setting on what type of object
/// - eScopeArg: the object to query the setting for
/// - pOutDataType: If non-NULL, the data type of the value is returned.
/// - pResult: Where to put the result. Pass NULL to query the required buffer size. (k_ESteamNetworkingGetConfigValue_BufferTooSmall will be returned.)
/// - cbResult: IN: the size of your buffer. OUT: the number of bytes filled in or required.
virtual ESteamNetworkingGetConfigValueResult GetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj,
ESteamNetworkingConfigDataType *pOutDataType, void *pResult, size_t *cbResult ) = 0;
/// Returns info about a configuration value. Returns false if the value does not exist.
/// pOutNextValue can be used to iterate through all of the known configuration values.
/// (Use GetFirstConfigValue() to begin the iteration, will be k_ESteamNetworkingConfig_Invalid on the last value)
/// Any of the output parameters can be NULL if you do not need that information.
virtual bool GetConfigValueInfo( ESteamNetworkingConfigValue eValue, const char **pOutName, ESteamNetworkingConfigDataType *pOutDataType, ESteamNetworkingConfigScope *pOutScope, ESteamNetworkingConfigValue *pOutNextValue ) = 0;
/// Return the lowest numbered configuration value available in the current environment.
virtual ESteamNetworkingConfigValue GetFirstConfigValue() = 0;
// String conversions. You'll usually access these using the respective
// inline methods.
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 void SteamNetworkingIdentity_ToString( const SteamNetworkingIdentity &identity, char *buf, size_t cbBuf ) = 0;
virtual bool SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity *pIdentity, const char *pszStr ) = 0;
protected:
~ISteamNetworkingUtils(); // Silence some warnings
};
#define STEAMNETWORKINGUTILS_INTERFACE_VERSION "SteamNetworkingUtils001"
// Global accessor.
#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB
// Standalone lib
STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingUtils *SteamNetworkingUtils_Lib();
inline ISteamNetworkingUtils *SteamNetworkingUtils() { return SteamNetworkingUtils_Lib(); }
#else
// Steamworks SDK
inline ISteamNetworkingUtils *SteamNetworkingUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamNetworkingUtils *, SteamNetworkingUtils, SteamInternal_FindOrCreateUserInterface( 0, STEAMNETWORKINGUTILS_INTERFACE_VERSION ) );
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Internal stuff
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
inline bool ISteamNetworkingUtils::InitializeRelayNetworkAccess() { return CheckPingDataUpToDate( 1e10f ); }
#endif
inline bool ISteamNetworkingUtils::SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Int32, &val ); }
inline bool ISteamNetworkingUtils::SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Float, &val ); }
inline bool ISteamNetworkingUtils::SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_String, val ); }
inline bool ISteamNetworkingUtils::SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Int32, &val ); }
inline bool ISteamNetworkingUtils::SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Float, &val ); }
inline bool ISteamNetworkingUtils::SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_String, val ); }
#if !defined( STEAMNETWORKINGSOCKETS_STATIC_LINK ) && defined( STEAMNETWORKINGSOCKETS_STEAM )
inline void SteamNetworkingIPAddr::ToString( char *buf, size_t cbBuf, bool bWithPort ) const { SteamNetworkingUtils()->SteamNetworkingIPAddr_ToString( *this, buf, cbBuf, bWithPort ); }
inline bool SteamNetworkingIPAddr::ParseString( const char *pszStr ) { return SteamNetworkingUtils()->SteamNetworkingIPAddr_ParseString( this, pszStr ); }
inline void SteamNetworkingIdentity::ToString( char *buf, size_t cbBuf ) const { SteamNetworkingUtils()->SteamNetworkingIdentity_ToString( *this, buf, cbBuf ); }
inline bool SteamNetworkingIdentity::ParseString( const char *pszStr ) { return SteamNetworkingUtils()->SteamNetworkingIdentity_ParseString( this, pszStr ); }
#endif
#endif // ISTEAMNETWORKINGUTILS

View File

@ -10,6 +10,8 @@
#pragma once
#endif
#include "steam_api_common.h"
// Feature types for parental settings
enum EParentalFeature
{
@ -44,6 +46,9 @@ public:
#define STEAMPARENTALSETTINGS_INTERFACE_VERSION "STEAMPARENTALSETTINGS_INTERFACE_VERSION001"
// Global interface accessor
inline ISteamParentalSettings *SteamParentalSettings();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamParentalSettings *, SteamParentalSettings, STEAMPARENTALSETTINGS_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
//-----------------------------------------------------------------------------
@ -28,7 +28,7 @@ const uint32 k_unMaxCloudFileChunkSize = 100 * 1024 * 1024;
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct SteamParamStringArray_t
{
@ -66,6 +66,7 @@ enum ERemoteStoragePlatform
k_ERemoteStoragePlatformPS3 = (1 << 2),
k_ERemoteStoragePlatformLinux = (1 << 3),
k_ERemoteStoragePlatformReserved2 = (1 << 4),
k_ERemoteStoragePlatformAndroid = (1 << 5),
k_ERemoteStoragePlatformAll = 0xffffffff
};
@ -171,16 +172,16 @@ class ISteamRemoteStorage
virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0;
virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0;
CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0;
CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
STEAM_CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0;
virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0;
virtual bool FileForget( const char *pchFile ) = 0;
virtual bool FileDelete( const char *pchFile ) = 0;
CALL_RESULT( RemoteStorageFileShareResult_t )
STEAM_CALL_RESULT( RemoteStorageFileShareResult_t )
virtual SteamAPICall_t FileShare( const char *pchFile ) = 0;
virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0;
@ -212,7 +213,7 @@ class ISteamRemoteStorage
// Downloads a UGC file. A priority value of 0 will download the file immediately,
// otherwise it will wait to download the file until all downloads with a lower priority
// value are completed. Downloads with equal priority will occur simultaneously.
CALL_RESULT( RemoteStorageDownloadUGCResult_t )
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0;
// Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false
@ -220,7 +221,7 @@ class ISteamRemoteStorage
virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0;
// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0;
virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0;
// After download, gets the content of the file.
// Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file.
@ -253,7 +254,7 @@ class ISteamRemoteStorage
#endif
// publishing UGC
CALL_RESULT( RemoteStoragePublishFileProgress_t )
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0;
virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0;
virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0;
@ -262,49 +263,52 @@ class ISteamRemoteStorage
virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0;
virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0;
virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0;
CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0;
// Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0,
// cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh.
// A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is.
CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0;
CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
// enumerate the files that the current user published with this app
CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0;
CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t )
STEAM_CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0;
CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0;
CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
CALL_RESULT( RemoteStorageUpdateUserPublishedItemVoteResult_t )
STEAM_CALL_RESULT( RemoteStorageUpdateUserPublishedItemVoteResult_t )
virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0;
CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0;
CALL_RESULT( RemoteStoragePublishFileProgress_t )
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0;
CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t )
STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t )
virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0;
CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0;
// this method enumerates the public view of workshop files
CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0;
CALL_RESULT( RemoteStorageDownloadUGCResult_t )
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0;
};
#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION014"
// Global interface accessor
inline ISteamRemoteStorage *SteamRemoteStorage();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamRemoteStorage *, SteamRemoteStorage, STEAMREMOTESTORAGE_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -312,7 +316,7 @@ class ISteamRemoteStorage
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
@ -450,7 +454,7 @@ struct RemoteStorageEnumerateUserSubscribedFilesResult_t
#elif defined(VALVE_CALLBACK_PACK_LARGE)
VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 + 4 );
#else
#warning You must first include isteamclient.h
#warning You must first include steam_api_common.h
#endif
//-----------------------------------------------------------------------------

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
const uint32 k_nScreenshotMaxTaggedUsers = 32;
const uint32 k_nScreenshotMaxTaggedPublishedFiles = 32;
@ -81,13 +81,17 @@ public:
#define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION003"
// Global interface accessor
inline ISteamScreenshots *SteamScreenshots();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamScreenshots *, SteamScreenshots, STEAMSCREENSHOTS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
// Purpose: Screenshot successfully written or otherwise added to the library

View File

@ -10,7 +10,8 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
#include "isteamremotestorage.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -18,7 +19,7 @@
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -205,23 +206,26 @@ public:
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
// Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL ) = 0;
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
// Send the query to Steam
CALL_RESULT( SteamUGCQueryCompleted_t )
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
// Retrieve an individual result after receiving the callback for querying UGC
virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0;
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0;
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0;
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0;
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0;
virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0;
virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint64 *pStatValue ) = 0;
virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType ) = 0;
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType ) = 0;
virtual uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index ) = 0;
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
// Release the request to free up memory, after retrieving results
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
@ -253,7 +257,7 @@ public:
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
// Steam Workshop Creator API
CALL_RESULT( CreateItemResult_t )
STEAM_CALL_RESULT( CreateItemResult_t )
virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet
virtual UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()
@ -266,6 +270,7 @@ public:
virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) = 0; // change the tags of an UGC item
virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder
virtual bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) = 0; // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size
virtual bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload ) = 0; // use legacy upload for a single small file. The parameter to SetItemContent() should either be a directory with one file or the full path to the file. The file must also be less than 10MB in size.
virtual bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
virtual bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue ) = 0; // add new key-value tags for the item. Note that there can be multiple values for a tag.
virtual bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
@ -274,22 +279,22 @@ public:
virtual bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
CALL_RESULT( SubmitItemUpdateResult_t )
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate()
virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0;
// Steam Workshop Consumer API
CALL_RESULT( SetUserItemVoteResult_t )
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0;
CALL_RESULT( GetUserItemVoteResult_t )
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0;
CALL_RESULT( UserFavoriteItemsListChanged_t )
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
CALL_RESULT( UserFavoriteItemsListChanged_t )
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
@ -299,7 +304,7 @@ public:
// get info about currently installed content on disc for items that have k_EItemStateInstalled set
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
@ -317,35 +322,43 @@ public:
virtual void SuspendDownloads( bool bSuspend ) = 0;
// usage tracking
CALL_RESULT( StartPlaytimeTrackingResult_t )
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
virtual SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
CALL_RESULT( StopPlaytimeTrackingResult_t )
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
virtual SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
CALL_RESULT( StopPlaytimeTrackingResult_t )
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
virtual SteamAPICall_t StopPlaytimeTrackingForAllItems() = 0;
// parent-child relationship or dependency management
CALL_RESULT( AddUGCDependencyResult_t )
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
virtual SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
CALL_RESULT( RemoveUGCDependencyResult_t )
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
virtual SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
// add/remove app dependence/requirements (usually DLC)
CALL_RESULT( AddAppDependencyResult_t )
STEAM_CALL_RESULT( AddAppDependencyResult_t )
virtual SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
CALL_RESULT( RemoveAppDependencyResult_t )
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
virtual SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
// request app dependencies. note that whatever callback you register for GetAppDependenciesResult_t may be called multiple times
// until all app dependencies have been returned
CALL_RESULT( GetAppDependenciesResult_t )
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
virtual SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) = 0;
// delete the item without prompting the user
CALL_RESULT( DeleteItemResult_t )
STEAM_CALL_RESULT( DeleteItemResult_t )
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
};
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION010"
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION012"
// Global interface accessor
inline ISteamUGC *SteamUGC();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUGC *, SteamUGC, STEAMUGC_INTERFACE_VERSION );
// Global accessor for the gameserver client
inline ISteamUGC *SteamGameServerUGC();
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamUGC *, SteamGameServerUGC, STEAMUGC_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Purpose: Callback for querying UGC
@ -358,6 +371,7 @@ struct SteamUGCQueryCompleted_t
uint32 m_unNumResultsReturned;
uint32 m_unTotalMatchingResults;
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
char m_rgchNextCursor[k_cchPublishedFileURLMax]; // If a paging cursor was used, then this will be the next cursor to get the next result set.
};

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
// structure that contains client callback data
// see callbacks documentation for more details
@ -19,7 +19,7 @@
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct CallbackMsg_t
{
@ -165,7 +165,7 @@ public:
// Requests a ticket encrypted with an app specific shared key
// pDataToInclude, cbDataToInclude will be encrypted into the ticket
// ( This is asynchronous, you must wait for the ticket to be completed by the server )
CALL_RESULT( EncryptedAppTicketResponse_t )
STEAM_CALL_RESULT( EncryptedAppTicketResponse_t )
virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0;
// retrieve a finished ticket
@ -189,7 +189,7 @@ public:
// or else immediately navigate to the result URL using a hidden browser window.
// NOTE 2: The resulting authorization cookie has an expiration time of one day,
// so it would be a good idea to request and visit a new auth URL every 12 hours.
CALL_RESULT( StoreAuthURLResponse_t )
STEAM_CALL_RESULT( StoreAuthURLResponse_t )
virtual SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL ) = 0;
// gets whether the users phone number is verified
@ -204,10 +204,15 @@ public:
// gets whether the users phone number is awaiting (re)verification
virtual bool BIsPhoneRequiringVerification() = 0;
STEAM_CALL_RESULT( MarketEligibilityResponse_t )
virtual SteamAPICall_t GetMarketEligibility() = 0;
};
#define STEAMUSER_INTERFACE_VERSION "SteamUser019"
#define STEAMUSER_INTERFACE_VERSION "SteamUser020"
// Global interface accessor
inline ISteamUser *SteamUser();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUser *, SteamUser, STEAMUSER_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -215,7 +220,7 @@ public:
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------
@ -363,6 +368,21 @@ struct StoreAuthURLResponse_t
};
//-----------------------------------------------------------------------------
// Purpose: sent in response to ISteamUser::GetMarketEligibility
//-----------------------------------------------------------------------------
struct MarketEligibilityResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 66 };
bool m_bAllowed;
EMarketNotAllowedReasonFlags m_eNotAllowedReason;
RTime32 m_rtAllowedAtTime;
int m_cdaySteamGuardRequiredDays; // The number of days any user is required to have had Steam Guard before they can use the market
int m_cdayNewDeviceCooldown; // The number of days after initial device authorization a user must wait before using the market on that device
};
#pragma pack( pop )

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
#include "isteamremotestorage.h"
// size limit on stat or achievement name (UTF-8 encoded)
@ -67,7 +67,7 @@ enum ELeaderboardUploadScoreMethod
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
struct LeaderboardEntry_t
@ -89,7 +89,7 @@ class ISteamUserStats
{
public:
// Ask the server to send down this user's data and achievements for this game
CALL_BACK( UserStatsReceived_t )
STEAM_CALL_BACK( UserStatsReceived_t )
virtual bool RequestCurrentStats() = 0;
// Data accessors
@ -149,7 +149,7 @@ public:
// returns a UserStatsReceived_t received when completed
// if the other user has no stats, UserStatsReceived_t.m_eResult will be set to k_EResultFail
// these stats won't be auto-updated; you'll need to call RequestUserStats() again to refresh any data
CALL_RESULT( UserStatsReceived_t )
STEAM_CALL_RESULT( UserStatsReceived_t )
virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0;
// requests stat information for a user, usable after a successful call to RequestUserStats()
@ -166,12 +166,12 @@ public:
// asks the Steam back-end for a leaderboard by name, and will create it if it's not yet
// This call is asynchronous, with the result returned in LeaderboardFindResult_t
CALL_RESULT(LeaderboardFindResult_t)
STEAM_CALL_RESULT(LeaderboardFindResult_t)
virtual SteamAPICall_t FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType ) = 0;
// as above, but won't create the leaderboard if it's not found
// This call is asynchronous, with the result returned in LeaderboardFindResult_t
CALL_RESULT( LeaderboardFindResult_t )
STEAM_CALL_RESULT( LeaderboardFindResult_t )
virtual SteamAPICall_t FindLeaderboard( const char *pchLeaderboardName ) = 0;
// returns the name of a leaderboard
@ -194,15 +194,15 @@ public:
// k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate
// e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after
// k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user
CALL_RESULT( LeaderboardScoresDownloaded_t )
STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
virtual SteamAPICall_t DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd ) = 0;
// as above, but downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers
// if a user doesn't have a leaderboard entry, they won't be included in the result
// a max of 100 users can be downloaded at a time, with only one outstanding call at a time
METHOD_DESC(Downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers)
CALL_RESULT( LeaderboardScoresDownloaded_t )
STEAM_METHOD_DESC(Downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers)
STEAM_CALL_RESULT( LeaderboardScoresDownloaded_t )
virtual SteamAPICall_t DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard,
ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers ) = 0;
STEAM_ARRAY_COUNT_D(cUsers, Array of users to retrieve) CSteamID *prgUsers, int cUsers ) = 0;
// Returns data about a single leaderboard entry
// use a for loop from 0 to LeaderboardScoresDownloaded_t::m_cEntryCount to get all the downloaded entries
@ -224,24 +224,24 @@ public:
// This call is asynchronous, with the result returned in LeaderboardScoreUploaded_t
// Details are extra game-defined information regarding how the user got that score
// pScoreDetails points to an array of int32's, cScoreDetailsCount is the number of int32's in the list
CALL_RESULT( LeaderboardScoreUploaded_t )
STEAM_CALL_RESULT( LeaderboardScoreUploaded_t )
virtual SteamAPICall_t UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount ) = 0;
// Attaches a piece of user generated content the user's entry on a leaderboard.
// hContent is a handle to a piece of user generated content that was shared using ISteamUserRemoteStorage::FileShare().
// This call is asynchronous, with the result returned in LeaderboardUGCSet_t.
CALL_RESULT( LeaderboardUGCSet_t )
STEAM_CALL_RESULT( LeaderboardUGCSet_t )
virtual SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC ) = 0;
// Retrieves the number of players currently playing your game (online + offline)
// This call is asynchronous, with the result returned in NumberOfCurrentPlayers_t
CALL_RESULT( NumberOfCurrentPlayers_t )
STEAM_CALL_RESULT( NumberOfCurrentPlayers_t )
virtual SteamAPICall_t GetNumberOfCurrentPlayers() = 0;
// Requests that Steam fetch data on the percentage of players who have received each achievement
// for the game globally.
// This call is asynchronous, with the result returned in GlobalAchievementPercentagesReady_t.
CALL_RESULT( GlobalAchievementPercentagesReady_t )
STEAM_CALL_RESULT( GlobalAchievementPercentagesReady_t )
virtual SteamAPICall_t RequestGlobalAchievementPercentages() = 0;
// Get the info on the most achieved achievement for the game, returns an iterator index you can use to fetch
@ -261,7 +261,7 @@ public:
// This call is asynchronous, with the results returned in GlobalStatsReceived_t.
// nHistoryDays specifies how many days of day-by-day history to retrieve in addition
// to the overall totals. The limit is 60.
CALL_RESULT( GlobalStatsReceived_t )
STEAM_CALL_RESULT( GlobalStatsReceived_t )
virtual SteamAPICall_t RequestGlobalStats( int nHistoryDays ) = 0;
// Gets the lifetime totals for an aggregated stat
@ -272,8 +272,8 @@ public:
// So when called, pData[0] will be today, pData[1] will be yesterday, and pData[2] will be two days ago,
// etc. cubData is the size in bytes of the pubData buffer. Returns the number of
// elements actually set.
virtual int32 GetGlobalStatHistory( const char *pchStatName, ARRAY_COUNT(cubData) int64 *pData, uint32 cubData ) = 0;
virtual int32 GetGlobalStatHistory( const char *pchStatName, ARRAY_COUNT(cubData) double *pData, uint32 cubData ) = 0;
virtual int32 GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) int64 *pData, uint32 cubData ) = 0;
virtual int32 GetGlobalStatHistory( const char *pchStatName, STEAM_ARRAY_COUNT(cubData) double *pData, uint32 cubData ) = 0;
#ifdef _PS3
// Call to kick off installation of the PS3 trophies. This call is asynchronous, and the results will be returned in a PS3TrophiesInstalled_t
@ -298,13 +298,17 @@ public:
#define STEAMUSERSTATS_INTERFACE_VERSION "STEAMUSERSTATS_INTERFACE_VERSION011"
// Global interface accessor
inline ISteamUserStats *SteamUserStats();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamUserStats *, SteamUserStats, STEAMUSERSTATS_INTERFACE_VERSION );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
// Steam API call failure results
@ -133,7 +133,7 @@ public:
// k_ECheckFileSignatureFileNotFound - The file does not exist on disk.
// k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match.
// k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid.
CALL_RESULT( CheckFileSignature_t )
STEAM_CALL_RESULT( CheckFileSignature_t )
virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0;
// Activates the Big Picture text input dialog which only supports gamepad input
@ -173,6 +173,13 @@ public:
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils009"
// Global interface accessor
inline ISteamUtils *SteamUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamUtils, SteamInternal_FindOrCreateUserInterface( 0, STEAMUTILS_INTERFACE_VERSION ) );
// Global accessor for the gameserver client
inline ISteamUtils *SteamGameServerUtils();
STEAM_DEFINE_INTERFACE_ACCESSOR( ISteamUtils *, SteamGameServerUtils, SteamInternal_FindOrCreateGameServerInterface( 0, STEAMUTILS_INTERFACE_VERSION ) );
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -180,7 +187,7 @@ public:
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
//-----------------------------------------------------------------------------

View File

@ -10,7 +10,7 @@
#pragma once
#endif
#include "isteamclient.h"
#include "steam_api_common.h"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
@ -18,7 +18,7 @@
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
#endif
@ -38,31 +38,35 @@ public:
virtual bool IsBroadcasting( int *pnNumViewers ) = 0;
// Get the OPF Details for 360 Video Playback
CALL_BACK( GetOPFSettingsResult_t )
STEAM_CALL_BACK( GetOPFSettingsResult_t )
virtual void GetOPFSettings( AppId_t unVideoAppID ) = 0;
virtual bool GetOPFStringForApp( AppId_t unVideoAppID, char *pchBuffer, int32 *pnBufferSize ) = 0;
};
#define STEAMVIDEO_INTERFACE_VERSION "STEAMVIDEO_INTERFACE_V002"
DEFINE_CALLBACK( BroadcastUploadStart_t, k_iClientVideoCallbacks + 4 )
END_DEFINE_CALLBACK_0()
// Global interface accessor
inline ISteamVideo *SteamVideo();
STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamVideo *, SteamVideo, STEAMVIDEO_INTERFACE_VERSION );
DEFINE_CALLBACK( BroadcastUploadStop_t, k_iClientVideoCallbacks + 5 )
CALLBACK_MEMBER( 0, EBroadcastUploadResult, m_eResult )
END_DEFINE_CALLBACK_1()
STEAM_CALLBACK_BEGIN( BroadcastUploadStart_t, k_iClientVideoCallbacks + 4 )
STEAM_CALLBACK_END(0)
DEFINE_CALLBACK( GetVideoURLResult_t, k_iClientVideoCallbacks + 11 )
CALLBACK_MEMBER( 0, EResult, m_eResult )
CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
CALLBACK_MEMBER( 2, char, m_rgchURL[256] )
END_DEFINE_CALLBACK_3()
STEAM_CALLBACK_BEGIN( BroadcastUploadStop_t, k_iClientVideoCallbacks + 5 )
STEAM_CALLBACK_MEMBER( 0, EBroadcastUploadResult, m_eResult )
STEAM_CALLBACK_END(1)
STEAM_CALLBACK_BEGIN( GetVideoURLResult_t, k_iClientVideoCallbacks + 11 )
STEAM_CALLBACK_MEMBER( 0, EResult, m_eResult )
STEAM_CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
STEAM_CALLBACK_MEMBER( 2, char, m_rgchURL[256] )
STEAM_CALLBACK_END(3)
DEFINE_CALLBACK( GetOPFSettingsResult_t, k_iClientVideoCallbacks + 24 )
CALLBACK_MEMBER( 0, EResult, m_eResult )
CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
END_DEFINE_CALLBACK_2()
STEAM_CALLBACK_BEGIN( GetOPFSettingsResult_t, k_iClientVideoCallbacks + 24 )
STEAM_CALLBACK_MEMBER( 0, EResult, m_eResult )
STEAM_CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
STEAM_CALLBACK_END(2)
#pragma pack( pop )

View File

@ -1,6 +1,13 @@
//====== Copyright 1996-2008, Valve Corporation, All rights reserved. =======
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose:
// This header includes *all* of the interfaces and callback structures
// in the Steamworks SDK, and some high level functions to control the SDK
// (init, shutdown, etc) that you probably only need in one or two files.
//
// To save your compile times, we recommend that you not include this file
// in header files. Instead, include the specific headers for the interfaces
// and callback structures you need. The one file you might consider including
// in your precompiled header (e.g. stdafx.h) is steam_api_common.h
//
//=============================================================================
@ -10,6 +17,10 @@
#pragma once
#endif
// Basic stuff
#include "steam_api_common.h"
// All of the interfaces
#include "isteamclient.h"
#include "isteamuser.h"
#include "isteamfriends.h"
@ -30,31 +41,9 @@
#include "isteaminventory.h"
#include "isteamvideo.h"
#include "isteamparentalsettings.h"
#include "isteaminput.h"
// Steam API export macro
#if defined( _WIN32 ) && !defined( _X360 )
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __declspec( dllexport )
#elif defined( STEAM_API_NODLL )
#define S_API extern "C"
#else
#define S_API extern "C" __declspec( dllimport )
#endif // STEAM_API_EXPORTS
#elif defined( GNUC )
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __attribute__ ((visibility("default")))
#else
#define S_API extern "C"
#endif // STEAM_API_EXPORTS
#else // !WIN32
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C"
#else
#define S_API extern "C"
#endif // STEAM_API_EXPORTS
#endif
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Steam API setup & shutdown
//
@ -93,263 +82,6 @@ S_API void S_CALLTYPE SteamAPI_ReleaseCurrentThreadMemory();
S_API void S_CALLTYPE SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID );
S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg );
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Global accessors for Steamworks C++ APIs. See individual isteam*.h files for details.
// You should not cache the results of these accessors or pass the result pointers across
// modules! Different modules may be compiled against different SDK header versions, and
// the interface pointers could therefore be different across modules. Every line of code
// which calls into a Steamworks API should retrieve the interface from a global accessor.
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
#if !defined( STEAM_API_EXPORTS )
inline ISteamClient *SteamClient();
inline ISteamUser *SteamUser();
inline ISteamFriends *SteamFriends();
inline ISteamUtils *SteamUtils();
inline ISteamMatchmaking *SteamMatchmaking();
inline ISteamUserStats *SteamUserStats();
inline ISteamApps *SteamApps();
inline ISteamNetworking *SteamNetworking();
inline ISteamMatchmakingServers *SteamMatchmakingServers();
inline ISteamRemoteStorage *SteamRemoteStorage();
inline ISteamScreenshots *SteamScreenshots();
inline ISteamHTTP *SteamHTTP();
inline ISteamController *SteamController();
inline ISteamUGC *SteamUGC();
inline ISteamAppList *SteamAppList();
inline ISteamMusic *SteamMusic();
inline ISteamMusicRemote *SteamMusicRemote();
inline ISteamHTMLSurface *SteamHTMLSurface();
inline ISteamInventory *SteamInventory();
inline ISteamVideo *SteamVideo();
inline ISteamParentalSettings *SteamParentalSettings();
#endif // VERSION_SAFE_STEAM_API_INTERFACES
// CSteamAPIContext encapsulates the Steamworks API global accessors into
// a single object. This is DEPRECATED and only remains for compatibility.
class CSteamAPIContext
{
public:
// DEPRECATED - there is no benefit to using this over the global accessors
CSteamAPIContext() { Clear(); }
void Clear();
bool Init();
ISteamClient* SteamClient() const { return m_pSteamClient; }
ISteamUser* SteamUser() const { return m_pSteamUser; }
ISteamFriends* SteamFriends() const { return m_pSteamFriends; }
ISteamUtils* SteamUtils() const { return m_pSteamUtils; }
ISteamMatchmaking* SteamMatchmaking() const { return m_pSteamMatchmaking; }
ISteamUserStats* SteamUserStats() const { return m_pSteamUserStats; }
ISteamApps* SteamApps() const { return m_pSteamApps; }
ISteamMatchmakingServers* SteamMatchmakingServers() const { return m_pSteamMatchmakingServers; }
ISteamNetworking* SteamNetworking() const { return m_pSteamNetworking; }
ISteamRemoteStorage* SteamRemoteStorage() const { return m_pSteamRemoteStorage; }
ISteamScreenshots* SteamScreenshots() const { return m_pSteamScreenshots; }
ISteamHTTP* SteamHTTP() const { return m_pSteamHTTP; }
ISteamController* SteamController() const { return m_pController; }
ISteamUGC* SteamUGC() const { return m_pSteamUGC; }
ISteamAppList* SteamAppList() const { return m_pSteamAppList; }
ISteamMusic* SteamMusic() const { return m_pSteamMusic; }
ISteamMusicRemote* SteamMusicRemote() const { return m_pSteamMusicRemote; }
ISteamHTMLSurface* SteamHTMLSurface() const { return m_pSteamHTMLSurface; }
ISteamInventory* SteamInventory() const { return m_pSteamInventory; }
ISteamVideo* SteamVideo() const { return m_pSteamVideo; }
ISteamParentalSettings* SteamParentalSettings() const { return m_pSteamParentalSettings; }
// DEPRECATED - there is no benefit to using this over the global accessors
private:
ISteamClient *m_pSteamClient;
ISteamUser *m_pSteamUser;
ISteamFriends *m_pSteamFriends;
ISteamUtils *m_pSteamUtils;
ISteamMatchmaking *m_pSteamMatchmaking;
ISteamUserStats *m_pSteamUserStats;
ISteamApps *m_pSteamApps;
ISteamMatchmakingServers *m_pSteamMatchmakingServers;
ISteamNetworking *m_pSteamNetworking;
ISteamRemoteStorage *m_pSteamRemoteStorage;
ISteamScreenshots *m_pSteamScreenshots;
ISteamHTTP *m_pSteamHTTP;
ISteamController *m_pController;
ISteamUGC *m_pSteamUGC;
ISteamAppList *m_pSteamAppList;
ISteamMusic *m_pSteamMusic;
ISteamMusicRemote *m_pSteamMusicRemote;
ISteamHTMLSurface *m_pSteamHTMLSurface;
ISteamInventory *m_pSteamInventory;
ISteamVideo *m_pSteamVideo;
ISteamParentalSettings *m_pSteamParentalSettings;
};
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steam callback and call-result helpers
//
// The following macros and classes are used to register your application for
// callbacks and call-results, which are delivered in a predictable manner.
//
// STEAM_CALLBACK macros are meant for use inside of a C++ class definition.
// They map a Steam notification callback directly to a class member function
// which is automatically prototyped as "void func( callback_type *pParam )".
//
// CCallResult is used with specific Steam APIs that return "result handles".
// The handle can be passed to a CCallResult object's Set function, along with
// an object pointer and member-function pointer. The member function will
// be executed once the results of the Steam API call are available.
//
// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK
// macros if you require finer control over registration and unregistration.
//
// Callbacks and call-results are queued automatically and are only
// delivered/executed when your application calls SteamAPI_RunCallbacks().
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// SteamAPI_RunCallbacks is safe to call from multiple threads simultaneously,
// but if you choose to do this, callback code could be executed on any thread.
// One alternative is to call SteamAPI_RunCallbacks from the main thread only,
// and call SteamAPI_ReleaseCurrentThreadMemory regularly on other threads.
S_API void S_CALLTYPE SteamAPI_RunCallbacks();
// Declares a callback member function plus a helper member variable which
// registers the callback on object creation and unregisters on destruction.
// The optional fourth 'var' param exists only for backwards-compatibility
// and can be ignored.
#define STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
// Declares a callback function and a named CCallbackManual variable which
// has Register and Unregister functions instead of automatic registration.
#define STEAM_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \
CCallbackManual< thisclass, callback_type > var; void func( callback_type *pParam )
// Internal functions used by the utility CCallback objects to receive callbacks
S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback );
S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback );
// Internal functions used by the utility CCallResult objects to receive async call results
S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
//-----------------------------------------------------------------------------
// Purpose: base for callbacks and call results - internal implementation detail
//-----------------------------------------------------------------------------
class CCallbackBase
{
public:
CCallbackBase() { m_nCallbackFlags = 0; m_iCallback = 0; }
// don't add a virtual destructor because we export this binary interface across dll's
virtual void Run( void *pvParam ) = 0;
virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) = 0;
int GetICallback() { return m_iCallback; }
virtual int GetCallbackSizeBytes() = 0;
protected:
enum { k_ECallbackFlagsRegistered = 0x01, k_ECallbackFlagsGameServer = 0x02 };
uint8 m_nCallbackFlags;
int m_iCallback;
friend class CCallbackMgr;
private:
CCallbackBase( const CCallbackBase& );
CCallbackBase& operator=( const CCallbackBase& );
};
//-----------------------------------------------------------------------------
// Purpose: templated base for callbacks - internal implementation detail
//-----------------------------------------------------------------------------
template< int sizeof_P >
class CCallbackImpl : protected CCallbackBase
{
public:
~CCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) SteamAPI_UnregisterCallback( this ); }
void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; }
protected:
virtual void Run( void *pvParam ) = 0;
virtual void Run( void *pvParam, bool /*bIOFailure*/, SteamAPICall_t /*hSteamAPICall*/ ) { Run( pvParam ); }
virtual int GetCallbackSizeBytes() { return sizeof_P; }
};
//-----------------------------------------------------------------------------
// Purpose: maps a steam async call result to a class member function
// template params: T = local class, P = parameter struct
//-----------------------------------------------------------------------------
template< class T, class P >
class CCallResult : private CCallbackBase
{
public:
typedef void (T::*func_t)( P*, bool );
CCallResult();
~CCallResult();
void Set( SteamAPICall_t hAPICall, T *p, func_t func );
bool IsActive() const;
void Cancel();
void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; }
private:
virtual void Run( void *pvParam );
virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
virtual int GetCallbackSizeBytes() { return sizeof( P ); }
SteamAPICall_t m_hAPICall;
T *m_pObj;
func_t m_Func;
};
//-----------------------------------------------------------------------------
// Purpose: maps a steam callback to a class member function
// template params: T = local class, P = parameter struct,
// bGameserver = listen for gameserver callbacks instead of client callbacks
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameserver = false >
class CCallback : public CCallbackImpl< sizeof( P ) >
{
public:
typedef void (T::*func_t)(P*);
// NOTE: If you can't provide the correct parameters at construction time, you should
// use the CCallbackManual callback object (STEAM_CALLBACK_MANUAL macro) instead.
CCallback( T *pObj, func_t func );
void Register( T *pObj, func_t func );
void Unregister();
protected:
virtual void Run( void *pvParam );
T *m_pObj;
func_t m_Func;
};
//-----------------------------------------------------------------------------
// Purpose: subclass of CCallback which allows default-construction in
// an unregistered state; you must call Register manually
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameServer = false >
class CCallbackManual : public CCallback< T, P, bGameServer >
{
public:
CCallbackManual() : CCallback< T, P, bGameServer >( NULL, NULL ) {}
// Inherits public Register and Unregister functions from base class
};
#ifdef _WIN32
// disable this warning; this pattern need for steam callback registration
#pragma warning( disable: 4355 ) // 'this' : used in base member initializer list
#endif
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steamclient.dll private wrapper functions
//
@ -373,9 +105,6 @@ S_API HSteamUser Steam_GetHSteamUserCurrent();
// DEPRECATED - implementation is Windows only, and the path returned is a UTF-8 string which must be converted to UTF-16 for use with Win32 APIs
S_API const char *SteamAPI_GetSteamInstallPath();
// returns the pipe we are communicating to Steam with
S_API HSteamPipe SteamAPI_GetHSteamPipe();
// sets whether or not Steam_RunCallbacks() should do a try {} catch (...) {} around calls to issuing callbacks
S_API void SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks );
@ -389,6 +118,126 @@ S_API HSteamUser GetHSteamUser();
S_API bool S_CALLTYPE SteamAPI_InitSafe();
#endif
#include "steam_api_internal.h"
#if defined(USE_BREAKPAD_HANDLER) || defined(STEAM_API_EXPORTS)
// this should be called before the game initialized the steam APIs
// pchDate should be of the format "Mmm dd yyyy" (such as from the __ DATE __ macro )
// pchTime should be of the format "hh:mm:ss" (such as from the __ TIME __ macro )
// bFullMemoryDumps (Win32 only) -- writes out a uuid-full.dmp in the client/dumps folder
// pvContext-- can be NULL, will be the void * context passed into m_pfnPreMinidumpCallback
// PFNPreMinidumpCallback m_pfnPreMinidumpCallback -- optional callback which occurs just before a .dmp file is written during a crash. Applications can hook this to allow adding additional information into the .dmp comment stream.
S_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback );
S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID );
#endif
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
//
// CSteamAPIContext
//
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
#ifndef STEAM_API_EXPORTS
// Deprecated! Use the global accessors directly
inline bool CSteamAPIContext::Init()
{
m_pSteamClient = ::SteamClient();
if ( !m_pSteamClient )
return false;
m_pSteamUser = ::SteamUser();
if ( !m_pSteamUser )
return false;
m_pSteamFriends = ::SteamFriends();
if ( !m_pSteamFriends )
return false;
m_pSteamUtils = ::SteamUtils();
if ( !m_pSteamUtils )
return false;
m_pSteamMatchmaking = ::SteamMatchmaking();
if ( !m_pSteamMatchmaking )
return false;
m_pSteamGameSearch = ::SteamGameSearch();
if ( !m_pSteamGameSearch )
return false;
m_pSteamMatchmakingServers = ::SteamMatchmakingServers();
if ( !m_pSteamMatchmakingServers )
return false;
m_pSteamUserStats = ::SteamUserStats();
if ( !m_pSteamUserStats )
return false;
m_pSteamApps = ::SteamApps();
if ( !m_pSteamApps )
return false;
m_pSteamNetworking = ::SteamNetworking();
if ( !m_pSteamNetworking )
return false;
m_pSteamRemoteStorage = ::SteamRemoteStorage();
if ( !m_pSteamRemoteStorage )
return false;
m_pSteamScreenshots = ::SteamScreenshots();
if ( !m_pSteamScreenshots )
return false;
m_pSteamHTTP = ::SteamHTTP();
if ( !m_pSteamHTTP )
return false;
m_pController = ::SteamController();
if ( !m_pController )
return false;
m_pSteamUGC = ::SteamUGC();
if ( !m_pSteamUGC )
return false;
m_pSteamAppList = ::SteamAppList();
if ( !m_pSteamAppList )
return false;
m_pSteamMusic = ::SteamMusic();
if ( !m_pSteamMusic )
return false;
m_pSteamMusicRemote = ::SteamMusicRemote();
if ( !m_pSteamMusicRemote )
return false;
#ifndef ANDROID // Not yet supported on Android
m_pSteamHTMLSurface = ::SteamHTMLSurface();
if ( !m_pSteamHTMLSurface )
return false;
#endif
m_pSteamInventory = ::SteamInventory();
if ( !m_pSteamInventory )
return false;
m_pSteamVideo = ::SteamVideo();
if ( !m_pSteamVideo )
return false;
m_pSteamParentalSettings = ::SteamParentalSettings();
if ( !m_pSteamParentalSettings )
return false;
m_pSteamInput = ::SteamInput();
if ( !m_pSteamInput )
return false;
return true;
}
#endif
#endif // STEAM_API_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,231 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Steamworks SDK minimal include
//
// Defines the minimal set of things we need to use any single interface
// or register for any callback.
//
//=============================================================================
#ifndef STEAM_API_COMMON_H
#define STEAM_API_COMMON_H
#ifdef _WIN32
#pragma once
#endif
#include "steamtypes.h"
#include "steamclientpublic.h"
// S_API defines the linkage and calling conventions for steam_api.dll exports
#if defined( _WIN32 ) && !defined( _X360 )
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __declspec( dllexport )
#elif defined( STEAM_API_NODLL )
#define S_API extern "C"
#else
#define S_API extern "C" __declspec( dllimport )
#endif // STEAM_API_EXPORTS
#elif defined( GNUC )
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C" __attribute__ ((visibility("default")))
#else
#define S_API extern "C"
#endif // STEAM_API_EXPORTS
#else // !WIN32
#if defined( STEAM_API_EXPORTS )
#define S_API extern "C"
#else
#define S_API extern "C"
#endif // STEAM_API_EXPORTS
#endif
#if ( defined(STEAM_API_EXPORTS) || defined(STEAM_API_NODLL) ) && !defined(API_GEN)
#define STEAM_PRIVATE_API( ... ) __VA_ARGS__
#elif defined(STEAM_API_EXPORTS) && defined(API_GEN)
#define STEAM_PRIVATE_API( ... )
#else
#define STEAM_PRIVATE_API( ... ) protected: __VA_ARGS__ public:
#endif
// handle to a communication pipe to the Steam client
typedef int32 HSteamPipe;
// handle to single instance of a steam user
typedef int32 HSteamUser;
// function prototype
#if defined( POSIX )
#define __cdecl
#endif
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
extern "C" typedef uint32 ( *SteamAPI_CheckCallbackRegistered_t )( int iCallbackNum );
#if defined( __SNC__ )
#pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor
#endif
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steam callback and call-result helpers
//
// The following macros and classes are used to register your application for
// callbacks and call-results, which are delivered in a predictable manner.
//
// STEAM_CALLBACK macros are meant for use inside of a C++ class definition.
// They map a Steam notification callback directly to a class member function
// which is automatically prototyped as "void func( callback_type *pParam )".
//
// CCallResult is used with specific Steam APIs that return "result handles".
// The handle can be passed to a CCallResult object's Set function, along with
// an object pointer and member-function pointer. The member function will
// be executed once the results of the Steam API call are available.
//
// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK
// macros if you require finer control over registration and unregistration.
//
// Callbacks and call-results are queued automatically and are only
// delivered/executed when your application calls SteamAPI_RunCallbacks().
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Dispatch all queued Steamworks callbacks.
//
// This is safe to call from multiple threads simultaneously,
// but if you choose to do this, callback code could be executed on any thread.
// One alternative is to call SteamAPI_RunCallbacks from the main thread only,
// and call SteamAPI_ReleaseCurrentThreadMemory regularly on other threads.
S_API void S_CALLTYPE SteamAPI_RunCallbacks();
// Declares a callback member function plus a helper member variable which
// registers the callback on object creation and unregisters on destruction.
// The optional fourth 'var' param exists only for backwards-compatibility
// and can be ignored.
#define STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
// Declares a callback function and a named CCallbackManual variable which
// has Register and Unregister functions instead of automatic registration.
#define STEAM_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \
CCallbackManual< thisclass, callback_type > var; void func( callback_type *pParam )
// Dispatch callbacks relevant to the gameserver client and interfaces.
// To register for these, you need to use STEAM_GAMESERVER_CALLBACK.
// (Or call SetGameserverFlag on your CCallbackBase object.)
S_API void S_CALLTYPE SteamGameServer_RunCallbacks();
// Same as STEAM_CALLBACK, but for callbacks on the gameserver interface.
// These will be dispatched during SteamGameServer_RunCallbacks
#define STEAM_GAMESERVER_CALLBACK( thisclass, func, /*callback_type, [deprecated] var*/... ) \
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, GS, 3 ), ( this->SetGameserverFlag();, thisclass, func, __VA_ARGS__ ) )
#define STEAM_GAMESERVER_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \
CCallbackManual< thisclass, callback_type, true > var; void func( callback_type *pParam )
//-----------------------------------------------------------------------------
// Purpose: base for callbacks and call results - internal implementation detail
//-----------------------------------------------------------------------------
class CCallbackBase
{
public:
CCallbackBase() { m_nCallbackFlags = 0; m_iCallback = 0; }
// don't add a virtual destructor because we export this binary interface across dll's
virtual void Run( void *pvParam ) = 0;
virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) = 0;
int GetICallback() { return m_iCallback; }
virtual int GetCallbackSizeBytes() = 0;
protected:
enum { k_ECallbackFlagsRegistered = 0x01, k_ECallbackFlagsGameServer = 0x02 };
uint8 m_nCallbackFlags;
int m_iCallback;
friend class CCallbackMgr;
private:
CCallbackBase( const CCallbackBase& );
CCallbackBase& operator=( const CCallbackBase& );
};
//-----------------------------------------------------------------------------
// Purpose: templated base for callbacks - internal implementation detail
//-----------------------------------------------------------------------------
template< int sizeof_P >
class CCallbackImpl : protected CCallbackBase
{
public:
virtual ~CCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) SteamAPI_UnregisterCallback( this ); }
void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; }
protected:
virtual void Run( void *pvParam ) = 0;
virtual void Run( void *pvParam, bool /*bIOFailure*/, SteamAPICall_t /*hSteamAPICall*/ ) { Run( pvParam ); }
virtual int GetCallbackSizeBytes() { return sizeof_P; }
};
//-----------------------------------------------------------------------------
// Purpose: maps a steam async call result to a class member function
// template params: T = local class, P = parameter struct
//-----------------------------------------------------------------------------
template< class T, class P >
class CCallResult : private CCallbackBase
{
public:
typedef void (T::*func_t)( P*, bool );
CCallResult();
~CCallResult();
void Set( SteamAPICall_t hAPICall, T *p, func_t func );
bool IsActive() const;
void Cancel();
void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; }
private:
virtual void Run( void *pvParam );
virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
virtual int GetCallbackSizeBytes() { return sizeof( P ); }
SteamAPICall_t m_hAPICall;
T *m_pObj;
func_t m_Func;
};
//-----------------------------------------------------------------------------
// Purpose: maps a steam callback to a class member function
// template params: T = local class, P = parameter struct,
// bGameserver = listen for gameserver callbacks instead of client callbacks
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameserver = false >
class CCallback : public CCallbackImpl< sizeof( P ) >
{
public:
typedef void (T::*func_t)(P*);
// NOTE: If you can't provide the correct parameters at construction time, you should
// use the CCallbackManual callback object (STEAM_CALLBACK_MANUAL macro) instead.
CCallback( T *pObj, func_t func );
void Register( T *pObj, func_t func );
void Unregister();
protected:
virtual void Run( void *pvParam );
T *m_pObj;
func_t m_Func;
};
//-----------------------------------------------------------------------------
// Purpose: subclass of CCallback which allows default-construction in
// an unregistered state; you must call Register manually
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameServer = false >
class CCallbackManual : public CCallback< T, P, bGameServer >
{
public:
CCallbackManual() : CCallback< T, P, bGameServer >( nullptr, nullptr ) {}
// Inherits public Register and Unregister functions from base class
};
// Internal implementation details for all of the above
#include "steam_api_internal.h"
#endif // STEAM_API_COMMON_H

View File

@ -42,6 +42,7 @@ typedef uint32 AccountID_t;
typedef uint32 PartnerId_t;
typedef uint64 ManifestId_t;
typedef uint64 SiteId_t;
typedef uint64 PartyBeaconID_t;
typedef uint32 HAuthTicket;
typedef void * BREAKPAD_HANDLE;
typedef char compile_time_assert_type[1];
@ -62,6 +63,10 @@ typedef uint32 SNetListenSocket_t;
typedef uint32 ScreenshotHandle;
typedef uint32 HTTPRequestHandle;
typedef uint32 HTTPCookieContainerHandle;
typedef uint64 InputHandle_t;
typedef uint64 InputActionSetHandle_t;
typedef uint64 InputDigitalActionHandle_t;
typedef uint64 InputAnalogActionHandle_t;
typedef uint64 ControllerHandle_t;
typedef uint64 ControllerActionSetHandle_t;
typedef uint64 ControllerDigitalActionHandle_t;
@ -86,6 +91,8 @@ int const_k_iClientUserCallbacks = 900;
int const_k_iSteamAppsCallbacks = 1000;
int const_k_iSteamUserStatsCallbacks = 1100;
int const_k_iSteamNetworkingCallbacks = 1200;
int const_k_iSteamNetworkingSocketsCallbacks = 1220;
int const_k_iSteamNetworkingMessagesCallbacks = 1250;
int const_k_iClientRemoteStorageCallbacks = 1300;
int const_k_iClientDepotBuilderCallbacks = 1400;
int const_k_iSteamGameServerItemsCallbacks = 1500;
@ -125,9 +132,12 @@ int const_k_iClientBluetoothManagerCallbacks = 4800;
int const_k_iClientSharedConnectionCallbacks = 4900;
int const_k_ISteamParentalSettingsCallbacks = 5000;
int const_k_iClientShaderCallbacks = 5100;
int const_k_iSteamGameSearchCallbacks = 5200;
int const_k_iSteamPartiesCallbacks = 5300;
int const_k_iClientPartiesCallbacks = 5400;
int const_k_cchPersonaNameMax = 128;
int const_k_cwchPersonaNameMax = 32;
int const_k_cchMaxRichPresenceKeys = 20;
int const_k_cchMaxRichPresenceKeys = 30;
int const_k_cchMaxRichPresenceKeyLength = 64;
int const_k_cchMaxRichPresenceValueLength = 256;
int const_k_cchStatNameMax = 128;
@ -162,6 +172,7 @@ S_API class ISteamApps * SteamAPI_ISteamClient_GetISteamApps(intptr_t instancePt
S_API class ISteamNetworking * SteamAPI_ISteamClient_GetISteamNetworking(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamRemoteStorage * SteamAPI_ISteamClient_GetISteamRemoteStorage(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamScreenshots * SteamAPI_ISteamClient_GetISteamScreenshots(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamGameSearch * SteamAPI_ISteamClient_GetISteamGameSearch(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API uint32 SteamAPI_ISteamClient_GetIPCCallCount(intptr_t instancePtr);
S_API void SteamAPI_ISteamClient_SetWarningMessageHook(intptr_t instancePtr, SteamAPIWarningMessageHook_t pFunction);
S_API bool SteamAPI_ISteamClient_BShutdownIfAllPipesClosed(intptr_t instancePtr);
@ -175,6 +186,8 @@ S_API class ISteamHTMLSurface * SteamAPI_ISteamClient_GetISteamHTMLSurface(intpt
S_API class ISteamInventory * SteamAPI_ISteamClient_GetISteamInventory(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamVideo * SteamAPI_ISteamClient_GetISteamVideo(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamParentalSettings * SteamAPI_ISteamClient_GetISteamParentalSettings(intptr_t instancePtr, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamInput * SteamAPI_ISteamClient_GetISteamInput(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API class ISteamParties * SteamAPI_ISteamClient_GetISteamParties(intptr_t instancePtr, HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char * pchVersion);
S_API HSteamUser SteamAPI_ISteamUser_GetHSteamUser(intptr_t instancePtr);
S_API bool SteamAPI_ISteamUser_BLoggedOn(intptr_t instancePtr);
S_API uint64 SteamAPI_ISteamUser_GetSteamID(intptr_t instancePtr);
@ -204,6 +217,7 @@ S_API bool SteamAPI_ISteamUser_BIsPhoneVerified(intptr_t instancePtr);
S_API bool SteamAPI_ISteamUser_BIsTwoFactorEnabled(intptr_t instancePtr);
S_API bool SteamAPI_ISteamUser_BIsPhoneIdentifying(intptr_t instancePtr);
S_API bool SteamAPI_ISteamUser_BIsPhoneRequiringVerification(intptr_t instancePtr);
S_API SteamAPICall_t SteamAPI_ISteamUser_GetMarketEligibility(intptr_t instancePtr);
S_API const char * SteamAPI_ISteamFriends_GetPersonaName(intptr_t instancePtr);
S_API SteamAPICall_t SteamAPI_ISteamFriends_SetPersonaName(intptr_t instancePtr, const char * pchPersonaName);
S_API EPersonaState SteamAPI_ISteamFriends_GetPersonaState(intptr_t instancePtr);
@ -234,7 +248,7 @@ S_API bool SteamAPI_ISteamFriends_IsUserInSource(intptr_t instancePtr, class CSt
S_API void SteamAPI_ISteamFriends_SetInGameVoiceSpeaking(intptr_t instancePtr, class CSteamID steamIDUser, bool bSpeaking);
S_API void SteamAPI_ISteamFriends_ActivateGameOverlay(intptr_t instancePtr, const char * pchDialog);
S_API void SteamAPI_ISteamFriends_ActivateGameOverlayToUser(intptr_t instancePtr, const char * pchDialog, class CSteamID steamID);
S_API void SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(intptr_t instancePtr, const char * pchURL);
S_API void SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(intptr_t instancePtr, const char * pchURL, EActivateGameOverlayToWebPageMode eMode);
S_API void SteamAPI_ISteamFriends_ActivateGameOverlayToStore(intptr_t instancePtr, AppId_t nAppID, EOverlayToStoreFlag eFlag);
S_API void SteamAPI_ISteamFriends_SetPlayedWith(intptr_t instancePtr, class CSteamID steamIDUserPlayedWith);
S_API void SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog(intptr_t instancePtr, class CSteamID steamIDLobby);
@ -276,6 +290,7 @@ S_API SteamAPICall_t SteamAPI_ISteamFriends_IsFollowing(intptr_t instancePtr, cl
S_API SteamAPICall_t SteamAPI_ISteamFriends_EnumerateFollowingList(intptr_t instancePtr, uint32 unStartIndex);
S_API bool SteamAPI_ISteamFriends_IsClanPublic(intptr_t instancePtr, class CSteamID steamIDClan);
S_API bool SteamAPI_ISteamFriends_IsClanOfficialGameGroup(intptr_t instancePtr, class CSteamID steamIDClan);
S_API int SteamAPI_ISteamFriends_GetNumChatsWithUnreadPriorityMessages(intptr_t instancePtr);
S_API uint32 SteamAPI_ISteamUtils_GetSecondsSinceAppActive(intptr_t instancePtr);
S_API uint32 SteamAPI_ISteamUtils_GetSecondsSinceComputerActive(intptr_t instancePtr);
S_API EUniverse SteamAPI_ISteamUtils_GetConnectedUniverse(intptr_t instancePtr);
@ -371,6 +386,32 @@ S_API HServerQuery SteamAPI_ISteamMatchmakingServers_PingServer(intptr_t instanc
S_API HServerQuery SteamAPI_ISteamMatchmakingServers_PlayerDetails(intptr_t instancePtr, uint32 unIP, uint16 usPort, class ISteamMatchmakingPlayersResponse * pRequestServersResponse);
S_API HServerQuery SteamAPI_ISteamMatchmakingServers_ServerRules(intptr_t instancePtr, uint32 unIP, uint16 usPort, class ISteamMatchmakingRulesResponse * pRequestServersResponse);
S_API void SteamAPI_ISteamMatchmakingServers_CancelServerQuery(intptr_t instancePtr, HServerQuery hServerQuery);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_AddGameSearchParams(intptr_t instancePtr, const char * pchKeyToFind, const char * pchValuesToFind);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_SearchForGameWithLobby(intptr_t instancePtr, class CSteamID steamIDLobby, int nPlayerMin, int nPlayerMax);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_SearchForGameSolo(intptr_t instancePtr, int nPlayerMin, int nPlayerMax);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_AcceptGame(intptr_t instancePtr);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_DeclineGame(intptr_t instancePtr);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_RetrieveConnectionDetails(intptr_t instancePtr, class CSteamID steamIDHost, char * pchConnectionDetails, int cubConnectionDetails);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_EndGameSearch(intptr_t instancePtr);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_SetGameHostParams(intptr_t instancePtr, const char * pchKey, const char * pchValue);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_SetConnectionDetails(intptr_t instancePtr, const char * pchConnectionDetails, int cubConnectionDetails);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_RequestPlayersForGame(intptr_t instancePtr, int nPlayerMin, int nPlayerMax, int nMaxTeamSize);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_HostConfirmGameStart(intptr_t instancePtr, uint64 ullUniqueGameID);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_CancelRequestPlayersForGame(intptr_t instancePtr);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_SubmitPlayerResult(intptr_t instancePtr, uint64 ullUniqueGameID, class CSteamID steamIDPlayer, EPlayerResult_t EPlayerResult);
S_API EGameSearchErrorCode_t SteamAPI_ISteamGameSearch_EndGame(intptr_t instancePtr, uint64 ullUniqueGameID);
S_API uint32 SteamAPI_ISteamParties_GetNumActiveBeacons(intptr_t instancePtr);
S_API PartyBeaconID_t SteamAPI_ISteamParties_GetBeaconByIndex(intptr_t instancePtr, uint32 unIndex);
S_API bool SteamAPI_ISteamParties_GetBeaconDetails(intptr_t instancePtr, PartyBeaconID_t ulBeaconID, class CSteamID * pSteamIDBeaconOwner, struct SteamPartyBeaconLocation_t * pLocation, char * pchMetadata, int cchMetadata);
S_API SteamAPICall_t SteamAPI_ISteamParties_JoinParty(intptr_t instancePtr, PartyBeaconID_t ulBeaconID);
S_API bool SteamAPI_ISteamParties_GetNumAvailableBeaconLocations(intptr_t instancePtr, uint32 * puNumLocations);
S_API bool SteamAPI_ISteamParties_GetAvailableBeaconLocations(intptr_t instancePtr, struct SteamPartyBeaconLocation_t * pLocationList, uint32 uMaxNumLocations);
S_API SteamAPICall_t SteamAPI_ISteamParties_CreateBeacon(intptr_t instancePtr, uint32 unOpenSlots, struct SteamPartyBeaconLocation_t * pBeaconLocation, const char * pchConnectString, const char * pchMetadata);
S_API void SteamAPI_ISteamParties_OnReservationCompleted(intptr_t instancePtr, PartyBeaconID_t ulBeacon, class CSteamID steamIDUser);
S_API void SteamAPI_ISteamParties_CancelReservation(intptr_t instancePtr, PartyBeaconID_t ulBeacon, class CSteamID steamIDUser);
S_API SteamAPICall_t SteamAPI_ISteamParties_ChangeNumOpenSlots(intptr_t instancePtr, PartyBeaconID_t ulBeacon, uint32 unOpenSlots);
S_API bool SteamAPI_ISteamParties_DestroyBeacon(intptr_t instancePtr, PartyBeaconID_t ulBeacon);
S_API bool SteamAPI_ISteamParties_GetBeaconLocationData(intptr_t instancePtr, struct SteamPartyBeaconLocation_t BeaconLocation, ESteamPartyBeaconLocationData eData, char * pchDataStringOut, int cchDataStringOut);
S_API bool SteamAPI_ISteamRemoteStorage_FileWrite(intptr_t instancePtr, const char * pchFile, const void * pvData, int32 cubData);
S_API int32 SteamAPI_ISteamRemoteStorage_FileRead(intptr_t instancePtr, const char * pchFile, void * pvData, int32 cubDataToRead);
S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileWriteAsync(intptr_t instancePtr, const char * pchFile, const void * pvData, uint32 cubData);
@ -495,6 +536,8 @@ S_API bool SteamAPI_ISteamApps_GetDlcDownloadProgress(intptr_t instancePtr, AppI
S_API int SteamAPI_ISteamApps_GetAppBuildId(intptr_t instancePtr);
S_API void SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys(intptr_t instancePtr);
S_API SteamAPICall_t SteamAPI_ISteamApps_GetFileDetails(intptr_t instancePtr, const char * pszFileName);
S_API int SteamAPI_ISteamApps_GetLaunchCommandLine(intptr_t instancePtr, char * pszCommandLine, int cubCommandLine);
S_API bool SteamAPI_ISteamApps_BIsSubscribedFromFamilySharing(intptr_t instancePtr);
S_API bool SteamAPI_ISteamNetworking_SendP2PPacket(intptr_t instancePtr, class CSteamID steamIDRemote, const void * pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel);
S_API bool SteamAPI_ISteamNetworking_IsP2PPacketAvailable(intptr_t instancePtr, uint32 * pcubMsgSize, int nChannel);
S_API bool SteamAPI_ISteamNetworking_ReadP2PPacket(intptr_t instancePtr, void * pubDest, uint32 cubDest, uint32 * pcubMsgSize, class CSteamID * psteamIDRemote, int nChannel);
@ -592,11 +635,43 @@ S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestUserAgentInfo(intptr_t instancePtr,
S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(intptr_t instancePtr, HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate);
S_API bool SteamAPI_ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(intptr_t instancePtr, HTTPRequestHandle hRequest, uint32 unMilliseconds);
S_API bool SteamAPI_ISteamHTTP_GetHTTPRequestWasTimedOut(intptr_t instancePtr, HTTPRequestHandle hRequest, bool * pbWasTimedOut);
S_API bool SteamAPI_ISteamInput_Init(intptr_t instancePtr);
S_API bool SteamAPI_ISteamInput_Shutdown(intptr_t instancePtr);
S_API void SteamAPI_ISteamInput_RunFrame(intptr_t instancePtr);
S_API int SteamAPI_ISteamInput_GetConnectedControllers(intptr_t instancePtr, InputHandle_t * handlesOut);
S_API InputActionSetHandle_t SteamAPI_ISteamInput_GetActionSetHandle(intptr_t instancePtr, const char * pszActionSetName);
S_API void SteamAPI_ISteamInput_ActivateActionSet(intptr_t instancePtr, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle);
S_API InputActionSetHandle_t SteamAPI_ISteamInput_GetCurrentActionSet(intptr_t instancePtr, InputHandle_t inputHandle);
S_API void SteamAPI_ISteamInput_ActivateActionSetLayer(intptr_t instancePtr, InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle);
S_API void SteamAPI_ISteamInput_DeactivateActionSetLayer(intptr_t instancePtr, InputHandle_t inputHandle, InputActionSetHandle_t actionSetLayerHandle);
S_API void SteamAPI_ISteamInput_DeactivateAllActionSetLayers(intptr_t instancePtr, InputHandle_t inputHandle);
S_API int SteamAPI_ISteamInput_GetActiveActionSetLayers(intptr_t instancePtr, InputHandle_t inputHandle, InputActionSetHandle_t * handlesOut);
S_API InputDigitalActionHandle_t SteamAPI_ISteamInput_GetDigitalActionHandle(intptr_t instancePtr, const char * pszActionName);
S_API struct InputDigitalActionData_t SteamAPI_ISteamInput_GetDigitalActionData(intptr_t instancePtr, InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle);
S_API int SteamAPI_ISteamInput_GetDigitalActionOrigins(intptr_t instancePtr, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputDigitalActionHandle_t digitalActionHandle, EInputActionOrigin * originsOut);
S_API InputAnalogActionHandle_t SteamAPI_ISteamInput_GetAnalogActionHandle(intptr_t instancePtr, const char * pszActionName);
S_API struct InputAnalogActionData_t SteamAPI_ISteamInput_GetAnalogActionData(intptr_t instancePtr, InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle);
S_API int SteamAPI_ISteamInput_GetAnalogActionOrigins(intptr_t instancePtr, InputHandle_t inputHandle, InputActionSetHandle_t actionSetHandle, InputAnalogActionHandle_t analogActionHandle, EInputActionOrigin * originsOut);
S_API const char * SteamAPI_ISteamInput_GetGlyphForActionOrigin(intptr_t instancePtr, EInputActionOrigin eOrigin);
S_API const char * SteamAPI_ISteamInput_GetStringForActionOrigin(intptr_t instancePtr, EInputActionOrigin eOrigin);
S_API void SteamAPI_ISteamInput_StopAnalogActionMomentum(intptr_t instancePtr, InputHandle_t inputHandle, InputAnalogActionHandle_t eAction);
S_API struct InputMotionData_t SteamAPI_ISteamInput_GetMotionData(intptr_t instancePtr, InputHandle_t inputHandle);
S_API void SteamAPI_ISteamInput_TriggerVibration(intptr_t instancePtr, InputHandle_t inputHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed);
S_API void SteamAPI_ISteamInput_SetLEDColor(intptr_t instancePtr, InputHandle_t inputHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags);
S_API void SteamAPI_ISteamInput_TriggerHapticPulse(intptr_t instancePtr, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec);
S_API void SteamAPI_ISteamInput_TriggerRepeatedHapticPulse(intptr_t instancePtr, InputHandle_t inputHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags);
S_API bool SteamAPI_ISteamInput_ShowBindingPanel(intptr_t instancePtr, InputHandle_t inputHandle);
S_API ESteamInputType SteamAPI_ISteamInput_GetInputTypeForHandle(intptr_t instancePtr, InputHandle_t inputHandle);
S_API InputHandle_t SteamAPI_ISteamInput_GetControllerForGamepadIndex(intptr_t instancePtr, int nIndex);
S_API int SteamAPI_ISteamInput_GetGamepadIndexForController(intptr_t instancePtr, InputHandle_t ulinputHandle);
S_API const char * SteamAPI_ISteamInput_GetStringForXboxOrigin(intptr_t instancePtr, EXboxOrigin eOrigin);
S_API const char * SteamAPI_ISteamInput_GetGlyphForXboxOrigin(intptr_t instancePtr, EXboxOrigin eOrigin);
S_API EInputActionOrigin SteamAPI_ISteamInput_GetActionOriginFromXboxOrigin(intptr_t instancePtr, InputHandle_t inputHandle, EXboxOrigin eOrigin);
S_API EInputActionOrigin SteamAPI_ISteamInput_TranslateActionOrigin(intptr_t instancePtr, ESteamInputType eDestinationInputType, EInputActionOrigin eSourceOrigin);
S_API bool SteamAPI_ISteamController_Init(intptr_t instancePtr);
S_API bool SteamAPI_ISteamController_Shutdown(intptr_t instancePtr);
S_API void SteamAPI_ISteamController_RunFrame(intptr_t instancePtr);
S_API int SteamAPI_ISteamController_GetConnectedControllers(intptr_t instancePtr, ControllerHandle_t * handlesOut);
S_API bool SteamAPI_ISteamController_ShowBindingPanel(intptr_t instancePtr, ControllerHandle_t controllerHandle);
S_API ControllerActionSetHandle_t SteamAPI_ISteamController_GetActionSetHandle(intptr_t instancePtr, const char * pszActionSetName);
S_API void SteamAPI_ISteamController_ActivateActionSet(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle);
S_API ControllerActionSetHandle_t SteamAPI_ISteamController_GetCurrentActionSet(intptr_t instancePtr, ControllerHandle_t controllerHandle);
@ -605,26 +680,30 @@ S_API void SteamAPI_ISteamController_DeactivateActionSetLayer(intptr_t instanceP
S_API void SteamAPI_ISteamController_DeactivateAllActionSetLayers(intptr_t instancePtr, ControllerHandle_t controllerHandle);
S_API int SteamAPI_ISteamController_GetActiveActionSetLayers(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t * handlesOut);
S_API ControllerDigitalActionHandle_t SteamAPI_ISteamController_GetDigitalActionHandle(intptr_t instancePtr, const char * pszActionName);
S_API struct ControllerDigitalActionData_t SteamAPI_ISteamController_GetDigitalActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle);
S_API struct InputDigitalActionData_t SteamAPI_ISteamController_GetDigitalActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle);
S_API int SteamAPI_ISteamController_GetDigitalActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin * originsOut);
S_API ControllerAnalogActionHandle_t SteamAPI_ISteamController_GetAnalogActionHandle(intptr_t instancePtr, const char * pszActionName);
S_API struct ControllerAnalogActionData_t SteamAPI_ISteamController_GetAnalogActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle);
S_API struct InputAnalogActionData_t SteamAPI_ISteamController_GetAnalogActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle);
S_API int SteamAPI_ISteamController_GetAnalogActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin * originsOut);
S_API const char * SteamAPI_ISteamController_GetGlyphForActionOrigin(intptr_t instancePtr, EControllerActionOrigin eOrigin);
S_API const char * SteamAPI_ISteamController_GetStringForActionOrigin(intptr_t instancePtr, EControllerActionOrigin eOrigin);
S_API void SteamAPI_ISteamController_StopAnalogActionMomentum(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction);
S_API struct InputMotionData_t SteamAPI_ISteamController_GetMotionData(intptr_t instancePtr, ControllerHandle_t controllerHandle);
S_API void SteamAPI_ISteamController_TriggerHapticPulse(intptr_t instancePtr, ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec);
S_API void SteamAPI_ISteamController_TriggerRepeatedHapticPulse(intptr_t instancePtr, ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec, unsigned short usOffMicroSec, unsigned short unRepeat, unsigned int nFlags);
S_API void SteamAPI_ISteamController_TriggerVibration(intptr_t instancePtr, ControllerHandle_t controllerHandle, unsigned short usLeftSpeed, unsigned short usRightSpeed);
S_API void SteamAPI_ISteamController_SetLEDColor(intptr_t instancePtr, ControllerHandle_t controllerHandle, uint8 nColorR, uint8 nColorG, uint8 nColorB, unsigned int nFlags);
S_API int SteamAPI_ISteamController_GetGamepadIndexForController(intptr_t instancePtr, ControllerHandle_t ulControllerHandle);
S_API ControllerHandle_t SteamAPI_ISteamController_GetControllerForGamepadIndex(intptr_t instancePtr, int nIndex);
S_API struct ControllerMotionData_t SteamAPI_ISteamController_GetMotionData(intptr_t instancePtr, ControllerHandle_t controllerHandle);
S_API bool SteamAPI_ISteamController_ShowDigitalActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle, float flScale, float flXPosition, float flYPosition);
S_API bool SteamAPI_ISteamController_ShowAnalogActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle, float flScale, float flXPosition, float flYPosition);
S_API const char * SteamAPI_ISteamController_GetStringForActionOrigin(intptr_t instancePtr, EControllerActionOrigin eOrigin);
S_API const char * SteamAPI_ISteamController_GetGlyphForActionOrigin(intptr_t instancePtr, EControllerActionOrigin eOrigin);
S_API bool SteamAPI_ISteamController_ShowBindingPanel(intptr_t instancePtr, ControllerHandle_t controllerHandle);
S_API ESteamInputType SteamAPI_ISteamController_GetInputTypeForHandle(intptr_t instancePtr, ControllerHandle_t controllerHandle);
S_API ControllerHandle_t SteamAPI_ISteamController_GetControllerForGamepadIndex(intptr_t instancePtr, int nIndex);
S_API int SteamAPI_ISteamController_GetGamepadIndexForController(intptr_t instancePtr, ControllerHandle_t ulControllerHandle);
S_API const char * SteamAPI_ISteamController_GetStringForXboxOrigin(intptr_t instancePtr, EXboxOrigin eOrigin);
S_API const char * SteamAPI_ISteamController_GetGlyphForXboxOrigin(intptr_t instancePtr, EXboxOrigin eOrigin);
S_API EControllerActionOrigin SteamAPI_ISteamController_GetActionOriginFromXboxOrigin(intptr_t instancePtr, ControllerHandle_t controllerHandle, EXboxOrigin eOrigin);
S_API EControllerActionOrigin SteamAPI_ISteamController_TranslateActionOrigin(intptr_t instancePtr, ESteamInputType eDestinationInputType, EControllerActionOrigin eSourceOrigin);
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(intptr_t instancePtr, AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage);
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequest(intptr_t instancePtr, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage);
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequest0(intptr_t instancePtr, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char * pchCursor);
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(intptr_t instancePtr, PublishedFileId_t * pvecPublishedFileID, uint32 unNumPublishedFileIDs);
S_API SteamAPICall_t SteamAPI_ISteamUGC_SendQueryUGCRequest(intptr_t instancePtr, UGCQueryHandle_t handle);
S_API bool SteamAPI_ISteamUGC_GetQueryUGCResult(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, struct SteamUGCDetails_t * pDetails);
@ -665,6 +744,7 @@ S_API bool SteamAPI_ISteamUGC_SetItemVisibility(intptr_t instancePtr, UGCUpdateH
S_API bool SteamAPI_ISteamUGC_SetItemTags(intptr_t instancePtr, UGCUpdateHandle_t updateHandle, const struct SteamParamStringArray_t * pTags);
S_API bool SteamAPI_ISteamUGC_SetItemContent(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pszContentFolder);
S_API bool SteamAPI_ISteamUGC_SetItemPreview(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pszPreviewFile);
S_API bool SteamAPI_ISteamUGC_SetAllowLegacyUpload(intptr_t instancePtr, UGCUpdateHandle_t handle, bool bAllowLegacyUpload);
S_API bool SteamAPI_ISteamUGC_RemoveItemKeyValueTags(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchKey);
S_API bool SteamAPI_ISteamUGC_AddItemKeyValueTag(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchKey, const char * pchValue);
S_API bool SteamAPI_ISteamUGC_AddItemPreviewFile(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pszPreviewFile, EItemPreviewType type);
@ -720,7 +800,7 @@ S_API void SteamAPI_ISteamHTMLSurface_MouseDown(intptr_t instancePtr, HHTMLBrows
S_API void SteamAPI_ISteamHTMLSurface_MouseDoubleClick(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, ISteamHTMLSurface::EHTMLMouseButton eMouseButton);
S_API void SteamAPI_ISteamHTMLSurface_MouseMove(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, int x, int y);
S_API void SteamAPI_ISteamHTMLSurface_MouseWheel(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, int32 nDelta);
S_API void SteamAPI_ISteamHTMLSurface_KeyDown(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, ISteamHTMLSurface::EHTMLKeyModifiers eHTMLKeyModifiers);
S_API void SteamAPI_ISteamHTMLSurface_KeyDown(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, ISteamHTMLSurface::EHTMLKeyModifiers eHTMLKeyModifiers, bool bIsSystemKey);
S_API void SteamAPI_ISteamHTMLSurface_KeyUp(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, ISteamHTMLSurface::EHTMLKeyModifiers eHTMLKeyModifiers);
S_API void SteamAPI_ISteamHTMLSurface_KeyChar(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, ISteamHTMLSurface::EHTMLKeyModifiers eHTMLKeyModifiers);
S_API void SteamAPI_ISteamHTMLSurface_SetHorizontalScroll(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll);
@ -736,6 +816,7 @@ S_API void SteamAPI_ISteamHTMLSurface_SetCookie(intptr_t instancePtr, const char
S_API void SteamAPI_ISteamHTMLSurface_SetPageScaleFactor(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY);
S_API void SteamAPI_ISteamHTMLSurface_SetBackgroundMode(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, bool bBackgroundMode);
S_API void SteamAPI_ISteamHTMLSurface_SetDPIScalingFactor(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, float flDPIScaling);
S_API void SteamAPI_ISteamHTMLSurface_OpenDeveloperTools(intptr_t instancePtr, HHTMLBrowser unBrowserHandle);
S_API void SteamAPI_ISteamHTMLSurface_AllowStartRequest(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, bool bAllowed);
S_API void SteamAPI_ISteamHTMLSurface_JSDialogResponse(intptr_t instancePtr, HHTMLBrowser unBrowserHandle, bool bResult);
S_API EResult SteamAPI_ISteamInventory_GetResultStatus(intptr_t instancePtr, SteamInventoryResult_t resultHandle);
@ -766,8 +847,8 @@ S_API bool SteamAPI_ISteamInventory_GetEligiblePromoItemDefinitionIDs(intptr_t i
S_API SteamAPICall_t SteamAPI_ISteamInventory_StartPurchase(intptr_t instancePtr, const SteamItemDef_t * pArrayItemDefs, const uint32 * punArrayQuantity, uint32 unArrayLength);
S_API SteamAPICall_t SteamAPI_ISteamInventory_RequestPrices(intptr_t instancePtr);
S_API uint32 SteamAPI_ISteamInventory_GetNumItemsWithPrices(intptr_t instancePtr);
S_API bool SteamAPI_ISteamInventory_GetItemsWithPrices(intptr_t instancePtr, SteamItemDef_t * pArrayItemDefs, uint64 * pPrices, uint32 unArrayLength);
S_API bool SteamAPI_ISteamInventory_GetItemPrice(intptr_t instancePtr, SteamItemDef_t iDefinition, uint64 * pPrice);
S_API bool SteamAPI_ISteamInventory_GetItemsWithPrices(intptr_t instancePtr, SteamItemDef_t * pArrayItemDefs, uint64 * pCurrentPrices, uint64 * pBasePrices, uint32 unArrayLength);
S_API bool SteamAPI_ISteamInventory_GetItemPrice(intptr_t instancePtr, SteamItemDef_t iDefinition, uint64 * pCurrentPrice, uint64 * pBasePrice);
S_API SteamInventoryUpdateHandle_t SteamAPI_ISteamInventory_StartUpdateProperties(intptr_t instancePtr);
S_API bool SteamAPI_ISteamInventory_RemoveProperty(intptr_t instancePtr, SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char * pchPropertyName);
S_API bool SteamAPI_ISteamInventory_SetProperty(intptr_t instancePtr, SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, const char * pchPropertyName, const char * pchPropertyValue);

View File

@ -1,188 +1,40 @@
//====== Copyright 1996-2015, Valve Corporation, All rights reserved. =======
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose: Internal private Steamworks API declarations and definitions
// Internal implementation details of the steamworks SDK.
//
// You should be able to figure out how to use the SDK by reading
// steam_api_common.h, and should not need to understand anything in here.
//
//=============================================================================
#ifndef STEAM_API_INTERNAL_H
#define STEAM_API_INTERNAL_H
S_API HSteamUser SteamAPI_GetHSteamUser();
S_API void * S_CALLTYPE SteamInternal_ContextInit( void *pContextInitData );
S_API void * S_CALLTYPE SteamInternal_CreateInterface( const char *ver );
#if !defined( STEAM_API_EXPORTS )
inline void S_CALLTYPE SteamInternal_OnContextInit( void* p )
{
((CSteamAPIContext*)p)->Clear();
if ( SteamAPI_GetHSteamPipe() )
((CSteamAPIContext*)p)->Init();
}
inline CSteamAPIContext& SteamInternal_ModuleContext()
{
// SteamInternal_ContextInit takes a base pointer for the equivalent of
// struct { void (*pFn)(void* pCtx); uintp counter; CSteamAPIContext ctx; }
// Do not change layout of 2 + sizeof... or add non-pointer aligned data!
// NOTE: declaring "static CSteamAPIConext" creates a large function
// which queries the initialization status of the object. We know that
// it is pointer-aligned and fully memset with zeros, so just alias a
// static buffer of the appropriate size and call it a CSteamAPIContext.
static void* s_CallbackCounterAndContext[ 2 + sizeof(CSteamAPIContext)/sizeof(void*) ] = { (void*)&SteamInternal_OnContextInit, 0 };
return *(CSteamAPIContext*)SteamInternal_ContextInit( s_CallbackCounterAndContext );
}
inline ISteamClient *SteamClient() { return SteamInternal_ModuleContext().SteamClient(); }
inline ISteamUser *SteamUser() { return SteamInternal_ModuleContext().SteamUser(); }
inline ISteamFriends *SteamFriends() { return SteamInternal_ModuleContext().SteamFriends(); }
inline ISteamUtils *SteamUtils() { return SteamInternal_ModuleContext().SteamUtils(); }
inline ISteamMatchmaking *SteamMatchmaking() { return SteamInternal_ModuleContext().SteamMatchmaking(); }
inline ISteamUserStats *SteamUserStats() { return SteamInternal_ModuleContext().SteamUserStats(); }
inline ISteamApps *SteamApps() { return SteamInternal_ModuleContext().SteamApps(); }
inline ISteamMatchmakingServers *SteamMatchmakingServers() { return SteamInternal_ModuleContext().SteamMatchmakingServers(); }
inline ISteamNetworking *SteamNetworking() { return SteamInternal_ModuleContext().SteamNetworking(); }
inline ISteamRemoteStorage *SteamRemoteStorage() { return SteamInternal_ModuleContext().SteamRemoteStorage(); }
inline ISteamScreenshots *SteamScreenshots() { return SteamInternal_ModuleContext().SteamScreenshots(); }
inline ISteamHTTP *SteamHTTP() { return SteamInternal_ModuleContext().SteamHTTP(); }
inline ISteamController *SteamController() { return SteamInternal_ModuleContext().SteamController(); }
inline ISteamUGC *SteamUGC() { return SteamInternal_ModuleContext().SteamUGC(); }
inline ISteamAppList *SteamAppList() { return SteamInternal_ModuleContext().SteamAppList(); }
inline ISteamMusic *SteamMusic() { return SteamInternal_ModuleContext().SteamMusic(); }
inline ISteamMusicRemote *SteamMusicRemote() { return SteamInternal_ModuleContext().SteamMusicRemote(); }
inline ISteamHTMLSurface *SteamHTMLSurface() { return SteamInternal_ModuleContext().SteamHTMLSurface(); }
inline ISteamInventory *SteamInventory() { return SteamInternal_ModuleContext().SteamInventory(); }
inline ISteamVideo *SteamVideo() { return SteamInternal_ModuleContext().SteamVideo(); }
inline ISteamParentalSettings *SteamParentalSettings() { return SteamInternal_ModuleContext().SteamParentalSettings(); }
#endif // !defined( STEAM_API_EXPORTS )
inline void CSteamAPIContext::Clear()
{
m_pSteamClient = NULL;
m_pSteamUser = NULL;
m_pSteamFriends = NULL;
m_pSteamUtils = NULL;
m_pSteamMatchmaking = NULL;
m_pSteamUserStats = NULL;
m_pSteamApps = NULL;
m_pSteamMatchmakingServers = NULL;
m_pSteamNetworking = NULL;
m_pSteamRemoteStorage = NULL;
m_pSteamHTTP = NULL;
m_pSteamScreenshots = NULL;
m_pSteamMusic = NULL;
m_pController = NULL;
m_pSteamUGC = NULL;
m_pSteamAppList = NULL;
m_pSteamMusic = NULL;
m_pSteamMusicRemote = NULL;
m_pSteamHTMLSurface = NULL;
m_pSteamInventory = NULL;
m_pSteamVideo = NULL;
m_pSteamParentalSettings = NULL;
}
// This function must be declared inline in the header so the module using steam_api.dll gets the version names they want.
inline bool CSteamAPIContext::Init()
{
HSteamUser hSteamUser = SteamAPI_GetHSteamUser();
HSteamPipe hSteamPipe = SteamAPI_GetHSteamPipe();
if ( !hSteamPipe )
return false;
m_pSteamClient = (ISteamClient*) SteamInternal_CreateInterface( STEAMCLIENT_INTERFACE_VERSION );
if ( !m_pSteamClient )
return false;
m_pSteamUser = m_pSteamClient->GetISteamUser( hSteamUser, hSteamPipe, STEAMUSER_INTERFACE_VERSION );
if ( !m_pSteamUser )
return false;
m_pSteamFriends = m_pSteamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION );
if ( !m_pSteamFriends )
return false;
m_pSteamUtils = m_pSteamClient->GetISteamUtils( hSteamPipe, STEAMUTILS_INTERFACE_VERSION );
if ( !m_pSteamUtils )
return false;
m_pSteamMatchmaking = m_pSteamClient->GetISteamMatchmaking( hSteamUser, hSteamPipe, STEAMMATCHMAKING_INTERFACE_VERSION );
if ( !m_pSteamMatchmaking )
return false;
m_pSteamMatchmakingServers = m_pSteamClient->GetISteamMatchmakingServers( hSteamUser, hSteamPipe, STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION );
if ( !m_pSteamMatchmakingServers )
return false;
m_pSteamUserStats = m_pSteamClient->GetISteamUserStats( hSteamUser, hSteamPipe, STEAMUSERSTATS_INTERFACE_VERSION );
if ( !m_pSteamUserStats )
return false;
m_pSteamApps = m_pSteamClient->GetISteamApps( hSteamUser, hSteamPipe, STEAMAPPS_INTERFACE_VERSION );
if ( !m_pSteamApps )
return false;
m_pSteamNetworking = m_pSteamClient->GetISteamNetworking( hSteamUser, hSteamPipe, STEAMNETWORKING_INTERFACE_VERSION );
if ( !m_pSteamNetworking )
return false;
m_pSteamRemoteStorage = m_pSteamClient->GetISteamRemoteStorage( hSteamUser, hSteamPipe, STEAMREMOTESTORAGE_INTERFACE_VERSION );
if ( !m_pSteamRemoteStorage )
return false;
m_pSteamScreenshots = m_pSteamClient->GetISteamScreenshots( hSteamUser, hSteamPipe, STEAMSCREENSHOTS_INTERFACE_VERSION );
if ( !m_pSteamScreenshots )
return false;
m_pSteamHTTP = m_pSteamClient->GetISteamHTTP( hSteamUser, hSteamPipe, STEAMHTTP_INTERFACE_VERSION );
if ( !m_pSteamHTTP )
return false;
m_pController = m_pSteamClient->GetISteamController( hSteamUser, hSteamPipe, STEAMCONTROLLER_INTERFACE_VERSION );
if ( !m_pController )
return false;
m_pSteamUGC = m_pSteamClient->GetISteamUGC( hSteamUser, hSteamPipe, STEAMUGC_INTERFACE_VERSION );
if ( !m_pSteamUGC )
return false;
m_pSteamAppList = m_pSteamClient->GetISteamAppList( hSteamUser, hSteamPipe, STEAMAPPLIST_INTERFACE_VERSION );
if ( !m_pSteamAppList )
return false;
m_pSteamMusic = m_pSteamClient->GetISteamMusic( hSteamUser, hSteamPipe, STEAMMUSIC_INTERFACE_VERSION );
if ( !m_pSteamMusic )
return false;
m_pSteamMusicRemote = m_pSteamClient->GetISteamMusicRemote( hSteamUser, hSteamPipe, STEAMMUSICREMOTE_INTERFACE_VERSION );
if ( !m_pSteamMusicRemote )
return false;
m_pSteamHTMLSurface = m_pSteamClient->GetISteamHTMLSurface( hSteamUser, hSteamPipe, STEAMHTMLSURFACE_INTERFACE_VERSION );
if ( !m_pSteamHTMLSurface )
return false;
m_pSteamInventory = m_pSteamClient->GetISteamInventory( hSteamUser, hSteamPipe, STEAMINVENTORY_INTERFACE_VERSION );
if ( !m_pSteamInventory )
return false;
m_pSteamVideo = m_pSteamClient->GetISteamVideo( hSteamUser, hSteamPipe, STEAMVIDEO_INTERFACE_VERSION );
if ( !m_pSteamVideo )
return false;
m_pSteamParentalSettings = m_pSteamClient->GetISteamParentalSettings( hSteamUser, hSteamPipe, STEAMPARENTALSETTINGS_INTERFACE_VERSION );
if ( !m_pSteamParentalSettings )
return false;
return true;
}
//-----------------------------------------------------------------------------
// The following macros are implementation details, not intended for public use
//-----------------------------------------------------------------------------
#ifdef STEAM_CALLBACK_BEGIN
#error "This file should only be included from steam_api_common.h"
#endif
#include <string.h>
// Internal functions used by the utility CCallback objects to receive callbacks
S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback );
S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback );
// Internal functions used by the utility CCallResult objects to receive async call results
S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall );
S_API HSteamPipe S_CALLTYPE SteamAPI_GetHSteamPipe();
S_API HSteamUser S_CALLTYPE SteamAPI_GetHSteamUser();
S_API HSteamPipe S_CALLTYPE SteamGameServer_GetHSteamPipe();
S_API HSteamUser S_CALLTYPE SteamGameServer_GetHSteamUser();
S_API void *S_CALLTYPE SteamInternal_ContextInit( void *pContextInitData );
S_API void *S_CALLTYPE SteamInternal_CreateInterface( const char *ver );
S_API void *S_CALLTYPE SteamInternal_FindOrCreateUserInterface( HSteamUser hSteamUser, const char *pszVersion );
S_API void *S_CALLTYPE SteamInternal_FindOrCreateGameServerInterface( HSteamUser hSteamUser, const char *pszVersion );
// disable this warning; this pattern need for steam callback registration
#ifdef _MSVC_VER
#pragma warning( push )
#pragma warning( disable: 4355 ) // 'this' : used in base member initializer list
#endif
#define _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param )
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED
#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y
@ -198,18 +50,15 @@ inline bool CSteamAPIContext::Init()
} m_steamcallback_ ## func ; void func( param *pParam )
#define _STEAM_CALLBACK_4( _, thisclass, func, param, var ) \
CCallback< thisclass, param > var; void func( param *pParam )
#define _STEAM_CALLBACK_GS( _, thisclass, func, param, var ) \
CCallback< thisclass, param, true > var; void func( param *pParam )
//-----------------------------------------------------------------------------
// Purpose: maps a steam async call result to a class member function
// template params: T = local class, P = parameter struct
//-----------------------------------------------------------------------------
template< class T, class P >
inline CCallResult<T, P>::CCallResult()
{
m_hAPICall = k_uAPICallInvalid;
m_pObj = NULL;
m_Func = NULL;
m_pObj = nullptr;
m_Func = nullptr;
m_iCallback = P::k_iCallback;
}
@ -241,7 +90,6 @@ inline void CCallResult<T, P>::Cancel()
SteamAPI_UnregisterCallResult( this, m_hAPICall );
m_hAPICall = k_uAPICallInvalid;
}
}
template< class T, class P >
@ -267,15 +115,9 @@ inline void CCallResult<T, P>::Run( void *pvParam, bool bIOFailure, SteamAPICall
}
}
//-----------------------------------------------------------------------------
// Purpose: maps a steam callback to a class member function
// template params: T = local class, P = parameter struct,
// bGameserver = listen for gameserver callbacks instead of client callbacks
//-----------------------------------------------------------------------------
template< class T, class P, bool bGameserver >
inline CCallback< T, P, bGameserver >::CCallback( T *pObj, func_t func )
: m_pObj( NULL ), m_Func( NULL )
: m_pObj( nullptr ), m_Func( nullptr )
{
if ( bGameserver )
{
@ -312,17 +154,232 @@ inline void CCallback< T, P, bGameserver >::Run( void *pvParam )
(m_pObj->*m_Func)((P *)pvParam);
}
//-----------------------------------------------------------------------------
// Macros to define steam callback structures. Used internally for debugging
//-----------------------------------------------------------------------------
#if defined(USE_BREAKPAD_HANDLER) || defined(STEAM_API_EXPORTS)
// this should be called before the game initialized the steam APIs
// pchDate should be of the format "Mmm dd yyyy" (such as from the __ DATE __ macro )
// pchTime should be of the format "hh:mm:ss" (such as from the __ TIME __ macro )
// bFullMemoryDumps (Win32 only) -- writes out a uuid-full.dmp in the client/dumps folder
// pvContext-- can be NULL, will be the void * context passed into m_pfnPreMinidumpCallback
// PFNPreMinidumpCallback m_pfnPreMinidumpCallback -- optional callback which occurs just before a .dmp file is written during a crash. Applications can hook this to allow adding additional information into the .dmp comment stream.
S_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback );
S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID );
#ifdef STEAM_CALLBACK_INSPECTION_ENABLED
#include "../../clientdll/steam_api_callback_inspection.h"
#else
#define STEAM_CALLBACK_BEGIN( callbackname, callbackid ) struct callbackname { enum { k_iCallback = callbackid };
#define STEAM_CALLBACK_MEMBER( varidx, vartype, varname ) vartype varname ;
#define STEAM_CALLBACK_MEMBER_ARRAY( varidx, vartype, varname, varcount ) vartype varname [ varcount ];
#define STEAM_CALLBACK_END(nArgs) };
#endif
// Forward declare all of the Steam interfaces. (Do we really need to do this?)
class ISteamClient;
class ISteamUser;
class ISteamGameServer;
class ISteamFriends;
class ISteamUtils;
class ISteamMatchmaking;
class ISteamContentServer;
class ISteamMatchmakingServers;
class ISteamUserStats;
class ISteamApps;
class ISteamNetworking;
class ISteamRemoteStorage;
class ISteamScreenshots;
class ISteamMusic;
class ISteamMusicRemote;
class ISteamGameServerStats;
class ISteamPS3OverlayRender;
class ISteamHTTP;
class ISteamController;
class ISteamUGC;
class ISteamAppList;
class ISteamHTMLSurface;
class ISteamInventory;
class ISteamVideo;
class ISteamParentalSettings;
class ISteamGameSearch;
class ISteamInput;
class ISteamParties;
//-----------------------------------------------------------------------------
// Purpose: Base values for callback identifiers, each callback must
// have a unique ID.
//-----------------------------------------------------------------------------
enum { k_iSteamUserCallbacks = 100 };
enum { k_iSteamGameServerCallbacks = 200 };
enum { k_iSteamFriendsCallbacks = 300 };
enum { k_iSteamBillingCallbacks = 400 };
enum { k_iSteamMatchmakingCallbacks = 500 };
enum { k_iSteamContentServerCallbacks = 600 };
enum { k_iSteamUtilsCallbacks = 700 };
enum { k_iClientFriendsCallbacks = 800 };
enum { k_iClientUserCallbacks = 900 };
enum { k_iSteamAppsCallbacks = 1000 };
enum { k_iSteamUserStatsCallbacks = 1100 };
enum { k_iSteamNetworkingCallbacks = 1200 };
enum { k_iSteamNetworkingSocketsCallbacks = 1220 };
enum { k_iSteamNetworkingMessagesCallbacks = 1250 };
enum { k_iClientRemoteStorageCallbacks = 1300 };
enum { k_iClientDepotBuilderCallbacks = 1400 };
enum { k_iSteamGameServerItemsCallbacks = 1500 };
enum { k_iClientUtilsCallbacks = 1600 };
enum { k_iSteamGameCoordinatorCallbacks = 1700 };
enum { k_iSteamGameServerStatsCallbacks = 1800 };
enum { k_iSteam2AsyncCallbacks = 1900 };
enum { k_iSteamGameStatsCallbacks = 2000 };
enum { k_iClientHTTPCallbacks = 2100 };
enum { k_iClientScreenshotsCallbacks = 2200 };
enum { k_iSteamScreenshotsCallbacks = 2300 };
enum { k_iClientAudioCallbacks = 2400 };
enum { k_iClientUnifiedMessagesCallbacks = 2500 };
enum { k_iSteamStreamLauncherCallbacks = 2600 };
enum { k_iClientControllerCallbacks = 2700 };
enum { k_iSteamControllerCallbacks = 2800 };
enum { k_iClientParentalSettingsCallbacks = 2900 };
enum { k_iClientDeviceAuthCallbacks = 3000 };
enum { k_iClientNetworkDeviceManagerCallbacks = 3100 };
enum { k_iClientMusicCallbacks = 3200 };
enum { k_iClientRemoteClientManagerCallbacks = 3300 };
enum { k_iClientUGCCallbacks = 3400 };
enum { k_iSteamStreamClientCallbacks = 3500 };
enum { k_IClientProductBuilderCallbacks = 3600 };
enum { k_iClientShortcutsCallbacks = 3700 };
enum { k_iClientRemoteControlManagerCallbacks = 3800 };
enum { k_iSteamAppListCallbacks = 3900 };
enum { k_iSteamMusicCallbacks = 4000 };
enum { k_iSteamMusicRemoteCallbacks = 4100 };
enum { k_iClientVRCallbacks = 4200 };
enum { k_iClientGameNotificationCallbacks = 4300 };
enum { k_iSteamGameNotificationCallbacks = 4400 };
enum { k_iSteamHTMLSurfaceCallbacks = 4500 };
enum { k_iClientVideoCallbacks = 4600 };
enum { k_iClientInventoryCallbacks = 4700 };
enum { k_iClientBluetoothManagerCallbacks = 4800 };
enum { k_iClientSharedConnectionCallbacks = 4900 };
enum { k_ISteamParentalSettingsCallbacks = 5000 };
enum { k_iClientShaderCallbacks = 5100 };
enum { k_iSteamGameSearchCallbacks = 5200 };
enum { k_iSteamPartiesCallbacks = 5300 };
enum { k_iClientPartiesCallbacks = 5400 };
// Macro used to define a type-safe accessor that will always return the version
// of the interface of the *header file* you are compiling with! We also bounce
// through a safety function that checks for interfaces being created or destroyed.
#ifndef STEAM_API_EXPORTS
// SteamInternal_ContextInit takes a base pointer for the equivalent of
// struct { void (*pFn)(void* pCtx); uintp counter; CSteamAPIContext ctx; }
// Do not change layout of 2 + sizeof... or add non-pointer aligned data!
// NOTE: declaring "static CSteamAPIConext" creates a large function
// which queries the initialization status of the object. We know that
// it is pointer-aligned and fully memset with zeros, so just alias a
// static buffer of the appropriate size and call it a CSteamAPIContext.
#define STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, expr ) \
inline void S_CALLTYPE SteamInternal_Init_ ## name( type *p ) { *p = (type)( expr ); } \
inline type name() { \
static void* s_CallbackCounterAndContext[ 3 ] = { (void*)&SteamInternal_Init_ ## name, 0, 0 }; \
return *(type*)SteamInternal_ContextInit( s_CallbackCounterAndContext ); \
}
#else
// Stub when we're compiling steam_api.dll itself. These are inline
// functions defined when the header is included. not functions exported
// by the lib!
#define STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, expr )
#endif
#define STEAM_DEFINE_USER_INTERFACE_ACCESSOR( type, name, version ) \
STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, SteamInternal_FindOrCreateUserInterface( SteamAPI_GetHSteamUser(), version ) )
#define STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( type, name, version ) \
STEAM_DEFINE_INTERFACE_ACCESSOR( type, name, SteamInternal_FindOrCreateGameServerInterface( SteamGameServer_GetHSteamUser(), version ) )
#ifdef _MSVC_VER
#pragma warning( pop )
#endif
// CSteamAPIContext encapsulates the Steamworks API global accessors into
// a single object.
//
// DEPRECATED: Used the global interface accessors instead!
//
// This will be removed in a future iteration of the SDK
class CSteamAPIContext
{
public:
CSteamAPIContext() { Clear(); }
inline void Clear() { memset( this, 0, sizeof(*this) ); }
inline bool Init(); // NOTE: This is defined in steam_api.h, to avoid this file having to include everything
ISteamClient* SteamClient() const { return m_pSteamClient; }
ISteamUser* SteamUser() const { return m_pSteamUser; }
ISteamFriends* SteamFriends() const { return m_pSteamFriends; }
ISteamUtils* SteamUtils() const { return m_pSteamUtils; }
ISteamMatchmaking* SteamMatchmaking() const { return m_pSteamMatchmaking; }
ISteamGameSearch* SteamGameSearch() const { return m_pSteamGameSearch; }
ISteamUserStats* SteamUserStats() const { return m_pSteamUserStats; }
ISteamApps* SteamApps() const { return m_pSteamApps; }
ISteamMatchmakingServers* SteamMatchmakingServers() const { return m_pSteamMatchmakingServers; }
ISteamNetworking* SteamNetworking() const { return m_pSteamNetworking; }
ISteamRemoteStorage* SteamRemoteStorage() const { return m_pSteamRemoteStorage; }
ISteamScreenshots* SteamScreenshots() const { return m_pSteamScreenshots; }
ISteamHTTP* SteamHTTP() const { return m_pSteamHTTP; }
ISteamController* SteamController() const { return m_pController; }
ISteamUGC* SteamUGC() const { return m_pSteamUGC; }
ISteamAppList* SteamAppList() const { return m_pSteamAppList; }
ISteamMusic* SteamMusic() const { return m_pSteamMusic; }
ISteamMusicRemote* SteamMusicRemote() const { return m_pSteamMusicRemote; }
ISteamHTMLSurface* SteamHTMLSurface() const { return m_pSteamHTMLSurface; }
ISteamInventory* SteamInventory() const { return m_pSteamInventory; }
ISteamVideo* SteamVideo() const { return m_pSteamVideo; }
ISteamParentalSettings* SteamParentalSettings() const { return m_pSteamParentalSettings; }
ISteamInput* SteamInput() const { return m_pSteamInput; }
private:
ISteamClient *m_pSteamClient;
ISteamUser *m_pSteamUser;
ISteamFriends *m_pSteamFriends;
ISteamUtils *m_pSteamUtils;
ISteamMatchmaking *m_pSteamMatchmaking;
ISteamGameSearch *m_pSteamGameSearch;
ISteamUserStats *m_pSteamUserStats;
ISteamApps *m_pSteamApps;
ISteamMatchmakingServers *m_pSteamMatchmakingServers;
ISteamNetworking *m_pSteamNetworking;
ISteamRemoteStorage *m_pSteamRemoteStorage;
ISteamScreenshots *m_pSteamScreenshots;
ISteamHTTP *m_pSteamHTTP;
ISteamController *m_pController;
ISteamUGC *m_pSteamUGC;
ISteamAppList *m_pSteamAppList;
ISteamMusic *m_pSteamMusic;
ISteamMusicRemote *m_pSteamMusicRemote;
ISteamHTMLSurface *m_pSteamHTMLSurface;
ISteamInventory *m_pSteamInventory;
ISteamVideo *m_pSteamVideo;
ISteamParentalSettings *m_pSteamParentalSettings;
ISteamInput *m_pSteamInput;
};
class CSteamGameServerAPIContext
{
public:
CSteamGameServerAPIContext() { Clear(); }
inline void Clear() { memset( this, 0, sizeof(*this) ); }
inline bool Init(); // NOTE: This is defined in steam_gameserver.h, to avoid this file having to include everything
ISteamClient *SteamClient() const { return m_pSteamClient; }
ISteamGameServer *SteamGameServer() const { return m_pSteamGameServer; }
ISteamUtils *SteamGameServerUtils() const { return m_pSteamGameServerUtils; }
ISteamNetworking *SteamGameServerNetworking() const { return m_pSteamGameServerNetworking; }
ISteamGameServerStats *SteamGameServerStats() const { return m_pSteamGameServerStats; }
ISteamHTTP *SteamHTTP() const { return m_pSteamHTTP; }
ISteamInventory *SteamInventory() const { return m_pSteamInventory; }
ISteamUGC *SteamUGC() const { return m_pSteamUGC; }
ISteamApps *SteamApps() const { return m_pSteamApps; }
private:
ISteamClient *m_pSteamClient;
ISteamGameServer *m_pSteamGameServer;
ISteamUtils *m_pSteamGameServerUtils;
ISteamNetworking *m_pSteamGameServerNetworking;
ISteamGameServerStats *m_pSteamGameServerStats;
ISteamHTTP *m_pSteamHTTP;
ISteamInventory *m_pSteamInventory;
ISteamUGC *m_pSteamUGC;
ISteamApps *m_pSteamApps;
};
#endif // STEAM_API_INTERNAL_H

File diff suppressed because it is too large Load Diff

View File

@ -22,12 +22,17 @@ enum EServerMode
eServerModeAuthenticationAndSecure = 3, // Authenticate users, list on the server list and VAC protect clients
};
// Initialize ISteamGameServer interface object, and set server properties which may not be changed.
// Initialize SteamGameServer client and interface objects, and set server properties which may not be changed.
//
// After calling this function, you should set any additional server parameters, and then
// call ISteamGameServer::LogOnAnonymous() or ISteamGameServer::LogOn()
//
// - usSteamPort is the local port used to communicate with the steam servers.
// NOTE: unless you are using ver old Steam client binaries, this parameter is ignored, and
// you should pass 0. Gameservers now always use WebSockets to talk to Steam.
// This protocol is TCP-based and thus always uses an ephemeral local port.
// Older steam client binaries used UDP to talk to Steam, and this argument was useful.
// A future version of the SDK will remove this argument.
// - usGamePort is the port that clients will connect to for gameplay.
// - usQueryPort is the port that will manage server browser related duties and info
// pings from clients. If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE for usQueryPort, then it
@ -35,11 +40,10 @@ enum EServerMode
// UDP packets for the master server updater. See references to GameSocketShare in isteamgameserver.h.
// - The version string is usually in the form x.x.x.x, and is used by the master server to detect when the
// server is out of date. (Only servers with the latest version will be listed.)
inline bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString );
// Shutdown SteamGameSeverXxx interfaces, log out, and free resources.
S_API void SteamGameServer_Shutdown();
S_API void SteamGameServer_RunCallbacks();
// Most Steam API functions allocate some amount of thread-local memory for
// parameter storage. Calling SteamGameServer_ReleaseCurrentThreadMemory()
@ -51,56 +55,6 @@ inline void SteamGameServer_ReleaseCurrentThreadMemory();
S_API bool SteamGameServer_BSecure();
S_API uint64 SteamGameServer_GetSteamID();
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// Global accessors for game server C++ APIs. See individual isteam*.h files for details.
// You should not cache the results of these accessors or pass the result pointers across
// modules! Different modules may be compiled against different SDK header versions, and
// the interface pointers could therefore be different across modules. Every line of code
// which calls into a Steamworks API should retrieve the interface from a global accessor.
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
#if !defined( STEAM_API_EXPORTS )
inline ISteamClient *SteamGameServerClient();
inline ISteamGameServer *SteamGameServer();
inline ISteamUtils *SteamGameServerUtils();
inline ISteamNetworking *SteamGameServerNetworking();
inline ISteamGameServerStats *SteamGameServerStats();
inline ISteamHTTP *SteamGameServerHTTP();
inline ISteamInventory *SteamGameServerInventory();
inline ISteamUGC *SteamGameServerUGC();
inline ISteamApps *SteamGameServerApps();
#endif
class CSteamGameServerAPIContext
{
public:
CSteamGameServerAPIContext() { Clear(); }
inline void Clear();
inline bool Init();
ISteamClient *SteamClient() const { return m_pSteamClient; }
ISteamGameServer *SteamGameServer() const { return m_pSteamGameServer; }
ISteamUtils *SteamGameServerUtils() const { return m_pSteamGameServerUtils; }
ISteamNetworking *SteamGameServerNetworking() const { return m_pSteamGameServerNetworking; }
ISteamGameServerStats *SteamGameServerStats() const { return m_pSteamGameServerStats; }
ISteamHTTP *SteamHTTP() const { return m_pSteamHTTP; }
ISteamInventory *SteamInventory() const { return m_pSteamInventory; }
ISteamUGC *SteamUGC() const { return m_pSteamUGC; }
ISteamApps *SteamApps() const { return m_pSteamApps; }
private:
ISteamClient *m_pSteamClient;
ISteamGameServer *m_pSteamGameServer;
ISteamUtils *m_pSteamGameServerUtils;
ISteamNetworking *m_pSteamGameServerNetworking;
ISteamGameServerStats *m_pSteamGameServerStats;
ISteamHTTP *m_pSteamHTTP;
ISteamInventory *m_pSteamInventory;
ISteamUGC *m_pSteamUGC;
ISteamApps *m_pSteamApps;
};
// Older SDKs exported this global pointer, but it is no longer supported.
// You should use SteamGameServerClient() or CSteamGameServerAPIContext to
// safely access the ISteamClient APIs from your game server application.
@ -110,122 +64,37 @@ private:
// is no longer supported. Use SteamGameServer_Init instead.
//S_API void S_CALLTYPE SteamGameServer_InitSafe();
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// These macros are similar to the STEAM_CALLBACK_* macros in steam_api.h, but only trigger for gameserver callbacks
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
#define STEAM_GAMESERVER_CALLBACK( thisclass, func, /*callback_type, [deprecated] var*/... ) \
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, GS, 3 ), ( this->SetGameserverFlag();, thisclass, func, __VA_ARGS__ ) )
#define STEAM_GAMESERVER_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \
CCallbackManual< thisclass, callback_type, true > var; void func( callback_type *pParam )
#define _STEAM_CALLBACK_GS( _, thisclass, func, param, var ) \
CCallback< thisclass, param, true > var; void func( param *pParam )
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// steamclient.dll private wrapper functions
//=============================================================================
//
// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
S_API HSteamPipe S_CALLTYPE SteamGameServer_GetHSteamPipe();
S_API HSteamUser S_CALLTYPE SteamGameServer_GetHSteamUser();
S_API bool S_CALLTYPE SteamInternal_GameServer_Init( uint32 unIP, uint16 usPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString );
#if !defined( STEAM_API_EXPORTS )
inline void S_CALLTYPE SteamGameServerInternal_OnContextInit( void* p )
{
((CSteamGameServerAPIContext*)p)->Clear();
if ( SteamGameServer_GetHSteamPipe() )
((CSteamGameServerAPIContext*)p)->Init();
}
inline CSteamGameServerAPIContext& SteamGameServerInternal_ModuleContext()
{
// SteamInternal_ContextInit takes a base pointer for the equivalent of
// struct { void (*pFn)(void* pCtx); uintp counter; CSteamAPIContext ctx; }
// Do not change layout of 2 + sizeof... or add non-pointer aligned data!
// NOTE: declaring "static CSteamAPIConext" creates a large function
// which queries the initialization status of the object. We know that
// it is pointer-aligned and fully memset with zeros, so just alias a
// static buffer of the appropriate size and call it a CSteamAPIContext.
static void* s_CallbackCounterAndContext[2 + sizeof( CSteamGameServerAPIContext ) / sizeof( void* )] = { (void*)&SteamGameServerInternal_OnContextInit, 0 };
return *(CSteamGameServerAPIContext*)SteamInternal_ContextInit( s_CallbackCounterAndContext );
}
inline ISteamClient *SteamGameServerClient() { return SteamGameServerInternal_ModuleContext().SteamClient(); }
inline ISteamGameServer *SteamGameServer() { return SteamGameServerInternal_ModuleContext().SteamGameServer(); }
inline ISteamUtils *SteamGameServerUtils() { return SteamGameServerInternal_ModuleContext().SteamGameServerUtils(); }
inline ISteamNetworking *SteamGameServerNetworking() { return SteamGameServerInternal_ModuleContext().SteamGameServerNetworking(); }
inline ISteamGameServerStats *SteamGameServerStats() { return SteamGameServerInternal_ModuleContext().SteamGameServerStats(); }
inline ISteamHTTP *SteamGameServerHTTP() { return SteamGameServerInternal_ModuleContext().SteamHTTP(); }
inline ISteamInventory *SteamGameServerInventory() { return SteamGameServerInternal_ModuleContext().SteamInventory(); }
inline ISteamUGC *SteamGameServerUGC() { return SteamGameServerInternal_ModuleContext().SteamUGC(); }
inline ISteamApps *SteamGameServerApps() { return SteamGameServerInternal_ModuleContext().SteamApps(); }
#endif // !defined( STEAM_API_EXPORTS )
inline void CSteamGameServerAPIContext::Clear()
{
m_pSteamClient = NULL;
m_pSteamGameServer = NULL;
m_pSteamGameServerUtils = NULL;
m_pSteamGameServerNetworking = NULL;
m_pSteamGameServerStats = NULL;
m_pSteamHTTP = NULL;
m_pSteamInventory = NULL;
m_pSteamUGC = NULL;
m_pSteamApps = NULL;
}
// Internal implementation details below
//
//=============================================================================
#ifndef STEAM_API_EXPORTS
// This function must be declared inline in the header so the module using steam_api.dll gets the version names they want.
inline bool CSteamGameServerAPIContext::Init()
{
HSteamUser hSteamUser = SteamGameServer_GetHSteamUser();
HSteamPipe hSteamPipe = SteamGameServer_GetHSteamPipe();
if ( !hSteamPipe )
return false;
m_pSteamClient = (ISteamClient*) SteamInternal_CreateInterface( STEAMCLIENT_INTERFACE_VERSION );
m_pSteamClient = ::SteamGameServerClient();
if ( !m_pSteamClient )
return false;
m_pSteamGameServer = m_pSteamClient->GetISteamGameServer( hSteamUser, hSteamPipe, STEAMGAMESERVER_INTERFACE_VERSION );
if ( !m_pSteamGameServer )
return false;
m_pSteamGameServerUtils = m_pSteamClient->GetISteamUtils( hSteamPipe, STEAMUTILS_INTERFACE_VERSION );
if ( !m_pSteamGameServerUtils )
return false;
m_pSteamGameServerNetworking = m_pSteamClient->GetISteamNetworking( hSteamUser, hSteamPipe, STEAMNETWORKING_INTERFACE_VERSION );
if ( !m_pSteamGameServerNetworking )
return false;
m_pSteamGameServerStats = m_pSteamClient->GetISteamGameServerStats( hSteamUser, hSteamPipe, STEAMGAMESERVERSTATS_INTERFACE_VERSION );
if ( !m_pSteamGameServerStats )
return false;
m_pSteamHTTP = m_pSteamClient->GetISteamHTTP( hSteamUser, hSteamPipe, STEAMHTTP_INTERFACE_VERSION );
if ( !m_pSteamHTTP )
return false;
m_pSteamInventory = m_pSteamClient->GetISteamInventory( hSteamUser, hSteamPipe, STEAMINVENTORY_INTERFACE_VERSION );
if ( !m_pSteamInventory )
return false;
m_pSteamUGC = m_pSteamClient->GetISteamUGC( hSteamUser, hSteamPipe, STEAMUGC_INTERFACE_VERSION );
if ( !m_pSteamUGC )
return false;
m_pSteamApps = m_pSteamClient->GetISteamApps( hSteamUser, hSteamPipe, STEAMAPPS_INTERFACE_VERSION );
if ( !m_pSteamApps )
m_pSteamGameServer = ::SteamGameServer();
m_pSteamGameServerUtils = ::SteamGameServerUtils();
m_pSteamGameServerNetworking = ::SteamGameServerNetworking();
m_pSteamGameServerStats = ::SteamGameServerStats();
m_pSteamHTTP = ::SteamGameServerHTTP();
m_pSteamInventory = ::SteamGameServerInventory();
m_pSteamUGC = ::SteamGameServerUGC();
m_pSteamApps = ::SteamGameServerApps();
if ( !m_pSteamGameServer || !m_pSteamGameServerUtils || !m_pSteamGameServerNetworking || !m_pSteamGameServerStats
|| !m_pSteamHTTP || !m_pSteamInventory || !m_pSteamUGC || !m_pSteamApps )
return false;
return true;
}
#endif
S_API bool S_CALLTYPE SteamInternal_GameServer_Init( uint32 unIP, uint16 usPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString );
inline bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString )
{
if ( !SteamInternal_GameServer_Init( unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString ) )
@ -233,8 +102,6 @@ inline bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGame
return true;
}
inline void SteamGameServer_ReleaseCurrentThreadMemory()
{
SteamAPI_ReleaseCurrentThreadMemory();

View File

@ -137,6 +137,7 @@ enum EResult
k_EResultWGNetworkSendExceeded = 110, // the WG couldn't send a response because we exceeded max network send size
k_EResultAccountNotFriends = 111, // the user is not mutually friends
k_EResultLimitedUserAccount = 112, // the user is limited
k_EResultCantRemoveItem = 113, // item can't be removed
};
// Error codes for use with the voice functions
@ -448,6 +449,16 @@ enum EBroadcastUploadResult
k_EBroadcastUploadResultMissingAudio = 11, // client failed to send audio data
k_EBroadcastUploadResultTooFarBehind = 12, // clients was too slow uploading
k_EBroadcastUploadResultTranscodeBehind = 13, // server failed to keep up with transcode
k_EBroadcastUploadResultNotAllowedToPlay = 14, // Broadcast does not have permissions to play game
k_EBroadcastUploadResultBusy = 15, // RTMP host to busy to take new broadcast stream, choose another
k_EBroadcastUploadResultBanned = 16, // Account banned from community broadcast
k_EBroadcastUploadResultAlreadyActive = 17, // We already already have an stream running.
k_EBroadcastUploadResultForcedOff = 18, // We explicitly shutting down a broadcast
k_EBroadcastUploadResultAudioBehind = 19, // Audio stream was too far behind video
k_EBroadcastUploadResultShutdown = 20, // Broadcast Server was shut down
k_EBroadcastUploadResultDisconnect = 21, // broadcast uploader TCP disconnected
k_EBroadcastUploadResultVideoInitFailed = 22, // invalid video settings
k_EBroadcastUploadResultAudioInitFailed = 23, // invalid audio settings
};
@ -503,6 +514,7 @@ enum EVRHMDType
k_eEVRHMDType_HTC_Dev = 1, // original HTC dev kits
k_eEVRHMDType_HTC_VivePre = 2, // htc vive pre
k_eEVRHMDType_HTC_Vive = 3, // htc vive consumer release
k_eEVRHMDType_HTC_VivePro = 4, // htc vive pro release
k_eEVRHMDType_HTC_Unknown = 20, // unknown htc hmd
@ -530,6 +542,12 @@ enum EVRHMDType
k_eEVRHMDType_Unannounced_Unknown = 100, // Unannounced unknown HMD
k_eEVRHMDType_Unannounced_WindowsMR = 101, // Unannounced Windows MR headset
k_eEVRHMDType_vridge = 110, // VRIDGE tool
k_eEVRHMDType_Huawei_Unknown = 120, // Huawei unknown HMD
k_eEVRHMDType_Huawei_VR2 = 121, // Huawei VR2 3DOF headset
k_eEVRHMDType_Huawei_EndOfRange = 129, // end of Huawei HMD range
};
@ -551,15 +569,84 @@ static inline bool BIsWindowsMRHeadset( EVRHMDType eType )
}
//-----------------------------------------------------------------------------
// Purpose: true if this is from a Hauwei HMD
//-----------------------------------------------------------------------------
static inline bool BIsHuaweiHeadset( EVRHMDType eType )
{
return eType >= k_eEVRHMDType_Huawei_Unknown && eType <= k_eEVRHMDType_Huawei_EndOfRange;
}
//-----------------------------------------------------------------------------
// Purpose: true if this is from an Vive HMD
//-----------------------------------------------------------------------------
static inline bool BIsViveHMD( EVRHMDType eType )
{
return eType == k_eEVRHMDType_HTC_Dev || eType == k_eEVRHMDType_HTC_VivePre || eType == k_eEVRHMDType_HTC_Vive || eType == k_eEVRHMDType_HTC_Unknown;
return eType == k_eEVRHMDType_HTC_Dev || eType == k_eEVRHMDType_HTC_VivePre || eType == k_eEVRHMDType_HTC_Vive || eType == k_eEVRHMDType_HTC_Unknown || eType == k_eEVRHMDType_HTC_VivePro;
}
//-----------------------------------------------------------------------------
// Purpose: Reasons a user may not use the Community Market.
// Used in MarketEligibilityResponse_t.
//-----------------------------------------------------------------------------
enum EMarketNotAllowedReasonFlags
{
k_EMarketNotAllowedReason_None = 0,
// A back-end call failed or something that might work again on retry
k_EMarketNotAllowedReason_TemporaryFailure = (1 << 0),
// Disabled account
k_EMarketNotAllowedReason_AccountDisabled = (1 << 1),
// Locked account
k_EMarketNotAllowedReason_AccountLockedDown = (1 << 2),
// Limited account (no purchases)
k_EMarketNotAllowedReason_AccountLimited = (1 << 3),
// The account is banned from trading items
k_EMarketNotAllowedReason_TradeBanned = (1 << 4),
// Wallet funds aren't tradable because the user has had no purchase
// activity in the last year or has had no purchases prior to last month
k_EMarketNotAllowedReason_AccountNotTrusted = (1 << 5),
// The user doesn't have Steam Guard enabled
k_EMarketNotAllowedReason_SteamGuardNotEnabled = (1 << 6),
// The user has Steam Guard, but it hasn't been enabled for the required
// number of days
k_EMarketNotAllowedReason_SteamGuardOnlyRecentlyEnabled = (1 << 7),
// The user has recently forgotten their password and reset it
k_EMarketNotAllowedReason_RecentPasswordReset = (1 << 8),
// The user has recently funded his or her wallet with a new payment method
k_EMarketNotAllowedReason_NewPaymentMethod = (1 << 9),
// An invalid cookie was sent by the user
k_EMarketNotAllowedReason_InvalidCookie = (1 << 10),
// The user has Steam Guard, but is using a new computer or web browser
k_EMarketNotAllowedReason_UsingNewDevice = (1 << 11),
// The user has recently refunded a store purchase by his or herself
k_EMarketNotAllowedReason_RecentSelfRefund = (1 << 12),
// The user has recently funded his or her wallet with a new payment method that cannot be verified
k_EMarketNotAllowedReason_NewPaymentMethodCannotBeVerified = (1 << 13),
// Not only is the account not trusted, but they have no recent purchases at all
k_EMarketNotAllowedReason_NoRecentPurchases = (1 << 14),
// User accepted a wallet gift that was recently purchased
k_EMarketNotAllowedReason_AcceptedWalletGift = (1 << 15),
};
#pragma pack( push, 1 )
#define CSTEAMID_DEFINED
@ -1197,9 +1284,6 @@ public:
return m_gameID.m_nAppID == k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000;
default:
#if defined(Assert)
Assert(false);
#endif
return false;
}
@ -1267,4 +1351,67 @@ typedef void (*PFNPreMinidumpCallback)(void *context);
typedef void *BREAKPAD_HANDLE;
#define BREAKPAD_INVALID_HANDLE (BREAKPAD_HANDLE)0
enum EGameSearchErrorCode_t
{
k_EGameSearchErrorCode_OK = 1,
k_EGameSearchErrorCode_Failed_Search_Already_In_Progress = 2,
k_EGameSearchErrorCode_Failed_No_Search_In_Progress = 3,
k_EGameSearchErrorCode_Failed_Not_Lobby_Leader = 4, // if not the lobby leader can not call SearchForGameWithLobby
k_EGameSearchErrorCode_Failed_No_Host_Available = 5, // no host is available that matches those search params
k_EGameSearchErrorCode_Failed_Search_Params_Invalid = 6, // search params are invalid
k_EGameSearchErrorCode_Failed_Offline = 7, // offline, could not communicate with server
k_EGameSearchErrorCode_Failed_NotAuthorized = 8, // either the user or the application does not have priveledges to do this
k_EGameSearchErrorCode_Failed_Unknown_Error = 9, // unknown error
};
enum EPlayerResult_t
{
k_EPlayerResultFailedToConnect = 1, // failed to connect after confirming
k_EPlayerResultAbandoned = 2, // quit game without completing it
k_EPlayerResultKicked = 3, // kicked by other players/moderator/server rules
k_EPlayerResultIncomplete = 4, // player stayed to end but game did not conclude successfully ( nofault to player )
k_EPlayerResultCompleted = 5, // player completed game
};
// Define compile time assert macros to let us validate the structure sizes.
#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1];
#if defined(__linux__) || defined(__APPLE__)
// The 32-bit version of gcc has the alignment requirement for uint64 and double set to
// 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned.
// The 64-bit version of gcc has the alignment requirement for these types set to
// 8 meaning that unless we use #pragma pack(4) our structures will get bigger.
// The 64-bit structure packing has to match the 32-bit structure packing for each platform.
#define VALVE_CALLBACK_PACK_SMALL
#else
#define VALVE_CALLBACK_PACK_LARGE
#endif
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error ???
#endif
typedef struct ValvePackingSentinel_t
{
uint32 m_u32;
uint64 m_u64;
uint16 m_u16;
double m_d;
} ValvePackingSentinel_t;
#pragma pack( pop )
#if defined(VALVE_CALLBACK_PACK_SMALL)
VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 24 )
#elif defined(VALVE_CALLBACK_PACK_LARGE)
VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 32 )
#else
#error ???
#endif
#endif // STEAMCLIENTPUBLIC_H

View File

@ -0,0 +1,69 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Backend functions to generate authorization tickets for steam datagram
//
//=============================================================================
#ifndef STEAMDATAGRAM_TICKETGEN_H
#define STEAMDATAGRAM_TICKETGEN_H
#ifdef _WIN32
#pragma once
#endif
// Import some common stuff that is useful by both the client
// and the backend ticket-generating authority.
#include "steamdatagram_tickets.h"
#if defined( STEAMDATAGRAM_TICKETGEN_FOREXPORT )
#define STEAMDATAGRAM_TICKET_INTERFACE DLL_EXPORT
#elif defined( STEAMNETWORKINGSOCKETS_STATIC_LINK )
#define STEAMDATAGRAM_TICKET_INTERFACE extern "C"
#else
#define STEAMDATAGRAM_TICKET_INTERFACE DLL_IMPORT
#endif
struct SteamDatagramSignedTicketBlob
{
int m_sz;
uint8 m_blob[ k_cbSteamDatagramMaxSerializedTicket ];
};
/// Initialize ticket generation with an Ed25519 private key.
/// See: https://ed25519.cr.yp.to/
///
/// Input buffer will be securely wiped.
///
/// You can generate an Ed25519 key using OpenSSH: ssh-keygen -t ed25519
/// Or with our cert tool: steamnetworkingsockets_certtool gen_keypair
///
/// The private key should be a PEM-like block of text
/// ("-----BEGIN OPENSSH PRIVATE KEY-----").
/// Private keys encrypted with a password are not supported.
///
/// In order for signatures using this key to be accepted by the relay network,
/// you need to send your public key to Valve. This key should be on a single line
/// of text that begins with "ssh-ed25519". (The format used in the .ssh/authorized_keys
/// file.)
STEAMDATAGRAM_TICKET_INTERFACE bool SteamDatagram_InitTicketGenerator_Ed25519( void *pvPrivateKey, size_t cbPrivateKey );
/// Serialize the specified auth ticket and attach a signature.
/// Returns false if you did something stupid like forgot to load a key.
/// Will also fail if your ticket is too big. (Probably because you
/// added too many extra fields.)
///
/// The resulting blob should be sent to the client, who will put it in
/// their ticket cache using ISteamNetworkingSockets::ReceivedRelayAuthTicket
STEAMDATAGRAM_TICKET_INTERFACE bool SteamDatagram_SerializeAndSignTicket( const SteamDatagramRelayAuthTicket &ticket, SteamDatagramSignedTicketBlob &outBlob, SteamNetworkingErrMsg &errMsg );
//
// Some ping-related tools that don't have anything to do with tickets.
// But it's something that a backend might find useful, so we're putting it in this library for now.
//
/// Parse location string. Returns true on success
STEAMDATAGRAM_TICKET_INTERFACE bool SteamDatagram_ParsePingLocation( const char *pszString, SteamNetworkPingLocation_t &outLocation );
/// Estimate ping time between two locations.
STEAMDATAGRAM_TICKET_INTERFACE int SteamDatagram_EstimatePingBetweenTwoLocations( const SteamNetworkPingLocation_t &location1, const SteamNetworkPingLocation_t &location2 );
#endif // STEAMDATAGRAM_TICKETGEN_H

View File

@ -0,0 +1,247 @@
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Types and utilities for handling steam datagram tickets. These are
// useful for both the client and the backend ticket generating authority.
//
//=============================================================================
#ifndef STEAMDATAGRAM_TICKETS_H
#define STEAMDATAGRAM_TICKETS_H
#ifdef _WIN32
#pragma once
#endif
#ifndef assert
#include <assert.h>
#endif
#include <string.h>
#include "steamnetworkingtypes.h"
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error "Must define VALVE_CALLBACK_PACK_SMALL or VALVE_CALLBACK_PACK_LARGE"
#endif
/// Max length of serialized auth ticket. This is important so that we
/// can ensure that we always fit into a single UDP datagram (along with
/// other certs and signatures) and keep the implementation simple.
const size_t k_cbSteamDatagramMaxSerializedTicket = 512;
/// Network-routable identifier for a service. This is an intentionally
/// opaque byte blob. The relays know how to use this to forward it on
/// to the intended destination, but otherwise clients really should not
/// need to know what's inside. (Indeed, we don't really want them to
/// know, as it could reveal information useful to an attacker.)
#ifndef IS_STEAMDATAGRAMROUTER
struct SteamDatagramHostedAddress
{
// Size of data blob.
int m_cbSize;
// Opaque data
char m_data[ 128 ];
// Reset to empty state
void Clear() { memset( this, 0, sizeof(*this) ); }
// Parse the data center out of the blob.
SteamNetworkingPOPID GetPopID() const { return CalculateSteamNetworkingPOPIDFromString( m_data ); }
/// Set a dummy routing blob with a hardcoded IP:port. You should only use
/// this in a dev environment, since the address is in plaintext!
/// In production this information should come from the server,
/// using ISteamNetworkingSockets::GetHostedDedicatedServerAddress
void SetDevAddress( uint32 nIP, uint16 nPort, SteamNetworkingPOPID popid = 0 )
{
GetSteamNetworkingLocationPOPStringFromID( popid, m_data );
m_cbSize = 4;
m_data[m_cbSize++] = 1;
m_data[m_cbSize++] = 1;
m_data[m_cbSize++] = char(nPort);
m_data[m_cbSize++] = char(nPort>>8);
m_data[m_cbSize++] = char(nIP);
m_data[m_cbSize++] = char(nIP>>8);
m_data[m_cbSize++] = char(nIP>>16);
m_data[m_cbSize++] = char(nIP>>24);
}
/// Convert to/from std::string (or anything that acts like it).
/// Useful for interfacing with google protobuf. It's a template
/// mainly so that we don't have to include <string> in the header.
/// Note: by "string", we don't mean that it's text. Ut's a binary
/// blob, and it might have zeros in it. (std::string can handle that.)
template <typename T> bool SetFromStdString( const T &str )
{
if ( str.length() >= sizeof(m_data) )
{
m_cbSize = 0;
return false;
}
m_cbSize = (int)str.length();
memcpy( m_data, str.c_str(), m_cbSize );
return true;
}
template <typename T> void GetAsStdString( T *str ) const
{
str->assign( m_data, m_cbSize );
}
};
#endif
/// Ticket used to gain access to the relay network.
struct SteamDatagramRelayAuthTicket
{
SteamDatagramRelayAuthTicket() { Clear(); }
/// Reset all fields
void Clear() { memset( this, 0, sizeof(*this) ); m_nRestrictToVirtualPort = -1; }
/// Identity of the gameserver we want to talk to. This is required.
SteamNetworkingIdentity m_identityGameserver;
/// Identity of the person who was authorized. This is required.
SteamNetworkingIdentity m_identityAuthorizedClient;
/// SteamID is authorized to send from a particular public IP. If this
/// is 0, then the sender is not restricted to a particular IP.
///
/// Recommend to leave this set to zero.
uint32 m_unPublicIP;
/// Time when the ticket expires. Recommended: take the current
/// time and add 6 hours, or maybe a bit longer if your gameplay
/// sessions are longer.
///
/// NOTE: relays may reject tickets with expiry times excessively
/// far in the future, so contact us if you wish to use an expiry
/// longer than, say, 24 hours.
RTime32 m_rtimeTicketExpiry;
/// Routing information where the gameserver is listening for
/// relayed traffic. You should fill this in when generating
/// a ticket.
///
/// When generating tickets on your backend:
/// - In production: The gameserver knows the proper routing
/// information, so you need to call
/// ISteamNetworkingSockets::GetHostedDedicatedServerAddress
/// and send the info to your backend.
/// - In development, you will need to provide public IP
/// of the server using SteamDatagramServiceNetID::SetDevAddress.
/// Relays need to be able to send UDP
/// packets to this server. Since it's very likely that
/// your server is behind a firewall/NAT, make sure that
/// the address is the one that the outside world can use.
/// The traffic from the relays will be "unsolicited", so
/// stateful firewalls won't work -- you will probably have
/// to set up an explicit port forward.
/// On the client:
/// - this field will always be blank.
SteamDatagramHostedAddress m_routing;
/// App ID this is for. This is required, and should be the
/// App ID the client is running. (Even if your gameserver
/// uses a different App ID.)
uint32 m_nAppID;
/// Restrict this ticket to be used for a particular virtual port?
/// Set to -1 to allow any virtual port.
///
/// This is useful as a security measure, and also so the client will
/// use the right ticket (which might have extra fields that are useful
/// for proper analytics), if the client happens to have more than one
/// appropriate ticket.
///
/// Note: if a client has more that one acceptable ticket, they will
/// always use the one expiring the latest.
int m_nRestrictToVirtualPort;
//
// Extra fields.
//
// These are collected for backend analytics. For example, you might
// send a MatchID so that all of the records for a particular match can
// be located. Or send a game mode field so that you can compare
// the network characteristics of different game modes.
//
// (At the time of this writing we don't have a way to expose the data
// we collect to partners, but we hope to in the future so that you can
// get visibility into network conditions.)
//
struct ExtraField
{
enum EType
{
k_EType_String,
k_EType_Int, // For most small integral values. Uses google protobuf sint64, so it's small on the wire. WARNING: In some places this value may be transmitted in JSON, in which case precision may be lost in backend analytics. Don't use this for an "identifier", use it for a scalar quantity.
k_EType_Fixed64, // 64 arbitrary bits. This value is treated as an "identifier". In places where JSON format is used, it will be serialized as a string. No aggregation / analytics can be performed on this value.
};
int /* EType */ m_eType;
char m_szName[28];
union {
char m_szStringValue[128];
int64 m_nIntValue;
uint64 m_nFixed64Value;
};
};
enum { k_nMaxExtraFields = 16 };
int m_nExtraFields;
ExtraField m_vecExtraFields[ k_nMaxExtraFields ];
/// Helper to add an extra field in a single call
void AddExtraField_Int( const char *pszName, int64 val )
{
ExtraField *p = AddExtraField( pszName, ExtraField::k_EType_Int );
if ( p )
p->m_nIntValue = val;
}
void AddExtraField_Fixed64( const char *pszName, uint64 val )
{
ExtraField *p = AddExtraField( pszName, ExtraField::k_EType_Fixed64 );
if ( p )
p->m_nFixed64Value = val;
}
void AddExtraField_String( const char *pszName, const char *val )
{
ExtraField *p = AddExtraField( pszName, ExtraField::k_EType_String );
if ( p )
{
size_t l = strlen( val );
if ( l > sizeof(p->m_szStringValue)-1 )
l = sizeof(p->m_szStringValue)-1;
memcpy( p->m_szStringValue, val, l );
p->m_szStringValue[l] = '\0';
}
}
private:
ExtraField *AddExtraField( const char *pszName, ExtraField::EType eType )
{
if ( m_nExtraFields >= k_nMaxExtraFields )
{
assert( false );
return nullptr;
}
ExtraField *p = &m_vecExtraFields[ m_nExtraFields++ ];
p->m_eType = eType;
size_t l = strlen( pszName );
if ( l > sizeof(p->m_szName)-1 )
l = sizeof(p->m_szName)-1;
memcpy( p->m_szName, pszName, l );
p->m_szName[l] = '\0';
return p;
}
};
#pragma pack(pop)
#endif // STEAMDATAGRAM_TICKETS_H

File diff suppressed because it is too large Load Diff

View File

@ -85,25 +85,25 @@ typedef unsigned int uintp;
#endif // else _WIN32
#ifdef API_GEN
# define CLANG_ATTR(ATTR) __attribute__((annotate( ATTR )))
# define STEAM_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR )))
#else
# define CLANG_ATTR(ATTR)
# define STEAM_CLANG_ATTR(ATTR)
#endif
#define METHOD_DESC(DESC) CLANG_ATTR( "desc:" #DESC ";" )
#define IGNOREATTR() CLANG_ATTR( "ignore" )
#define OUT_STRUCT() CLANG_ATTR( "out_struct: ;" )
#define OUT_STRING() CLANG_ATTR( "out_string: ;" )
#define OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" )
#define OUT_ARRAY_COUNT(COUNTER, DESC) CLANG_ATTR( "out_array_count:" #COUNTER ";desc:" #DESC )
#define ARRAY_COUNT(COUNTER) CLANG_ATTR( "array_count:" #COUNTER ";" )
#define ARRAY_COUNT_D(COUNTER, DESC) CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC )
#define BUFFER_COUNT(COUNTER) CLANG_ATTR( "buffer_count:" #COUNTER ";" )
#define OUT_BUFFER_COUNT(COUNTER) CLANG_ATTR( "out_buffer_count:" #COUNTER ";" )
#define OUT_STRING_COUNT(COUNTER) CLANG_ATTR( "out_string_count:" #COUNTER ";" )
#define DESC(DESC) CLANG_ATTR("desc:" #DESC ";")
#define CALL_RESULT(RESULT_TYPE) CLANG_ATTR("callresult:" #RESULT_TYPE ";")
#define CALL_BACK(RESULT_TYPE) CLANG_ATTR("callback:" #RESULT_TYPE ";")
#define STEAM_METHOD_DESC(DESC) STEAM_CLANG_ATTR( "desc:" #DESC ";" )
#define STEAM_IGNOREATTR() STEAM_CLANG_ATTR( "ignore" )
#define STEAM_OUT_STRUCT() STEAM_CLANG_ATTR( "out_struct: ;" )
#define STEAM_OUT_STRING() STEAM_CLANG_ATTR( "out_string: ;" )
#define STEAM_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) STEAM_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" )
#define STEAM_OUT_ARRAY_COUNT(COUNTER, DESC) STEAM_CLANG_ATTR( "out_array_count:" #COUNTER ";desc:" #DESC )
#define STEAM_ARRAY_COUNT(COUNTER) STEAM_CLANG_ATTR( "array_count:" #COUNTER ";" )
#define STEAM_ARRAY_COUNT_D(COUNTER, DESC) STEAM_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC )
#define STEAM_BUFFER_COUNT(COUNTER) STEAM_CLANG_ATTR( "buffer_count:" #COUNTER ";" )
#define STEAM_OUT_BUFFER_COUNT(COUNTER) STEAM_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" )
#define STEAM_OUT_STRING_COUNT(COUNTER) STEAM_CLANG_ATTR( "out_string_count:" #COUNTER ";" )
#define STEAM_DESC(DESC) STEAM_CLANG_ATTR("desc:" #DESC ";")
#define STEAM_CALL_RESULT(RESULT_TYPE) STEAM_CLANG_ATTR("callresult:" #RESULT_TYPE ";")
#define STEAM_CALL_BACK(RESULT_TYPE) STEAM_CLANG_ATTR("callback:" #RESULT_TYPE ";")
const int k_cubSaltSize = 8;
typedef uint8 Salt_t[ k_cubSaltSize ];
@ -180,5 +180,8 @@ const ManifestId_t k_uManifestIdInvalid = 0;
typedef uint64 SiteId_t;
const SiteId_t k_ulSiteIdInvalid = 0;
// Party Beacon ID
typedef uint64 PartyBeaconID_t;
const PartyBeaconID_t k_ulPartyBeaconIdInvalid = 0;
#endif // STEAMTYPES_H